3 |
# $Id$ |
# $Id$ |
4 |
# |
# |
5 |
# $Log$ |
# $Log$ |
6 |
|
# Revision 1.30 2003/03/27 15:31:14 joko |
7 |
|
# fixes to modules regarding new namespace(s) below Data::Mungle::* |
8 |
|
# |
9 |
|
# Revision 1.29 2003/02/21 01:47:18 joko |
10 |
|
# purged old code |
11 |
|
# minor cosmetics |
12 |
|
# |
13 |
|
# Revision 1.28 2003/02/20 20:20:26 joko |
14 |
|
# tried to get auto-disconnect working again - failed with that |
15 |
|
# |
16 |
|
# Revision 1.27 2003/01/31 06:30:59 joko |
17 |
|
# + enabled 'sendQuery' |
18 |
|
# |
19 |
# Revision 1.26 2003/01/30 22:29:47 joko |
# Revision 1.26 2003/01/30 22:29:47 joko |
20 |
# + fixed module usage (removed dependency on 'libp.pm') |
# + fixed module usage (removed dependency on 'libp.pm') |
21 |
# |
# |
51 |
# + fix: encapsulated object-loading inside an 'eval' |
# + fix: encapsulated object-loading inside an 'eval' |
52 |
# |
# |
53 |
# Revision 1.15 2002/12/05 13:55:21 joko |
# Revision 1.15 2002/12/05 13:55:21 joko |
54 |
# + now utilizing 'object2hash' instead of 'var_deref' |
# + now utilizing 'expand' instead of 'var_deref' |
55 |
# + played around with having fresh-objects - no progress.... |
# + played around with having fresh-objects - no progress.... |
56 |
# |
# |
57 |
# Revision 1.14 2002/12/05 09:40:30 jonen |
# Revision 1.14 2002/12/05 09:40:30 jonen |
124 |
use base ("Data::Storage::Handler"); |
use base ("Data::Storage::Handler"); |
125 |
use base ("Data::Storage::Handler::Abstract"); |
use base ("Data::Storage::Handler::Abstract"); |
126 |
|
|
127 |
use Tangram; |
|
128 |
use Data::Dumper; |
use Data::Dumper; |
129 |
|
use Tangram; |
130 |
|
|
131 |
use DesignPattern::Object; |
use DesignPattern::Object; |
132 |
use Data::Storage::Result::Tangram; |
use Data::Storage::Result::Tangram; |
133 |
use Data::Compare::Struct qw( isEmpty ); |
use Data::Mungle::Compare::Struct qw( isEmpty ); |
134 |
use Data::Transform::Deep qw( object2hash ); |
use Data::Mungle::Transform::Deep qw( expand ); |
|
use Data::Transform::Encode qw( var2utf8 ); |
|
135 |
|
|
136 |
# get logger instance |
# get logger instance |
137 |
my $logger = Log::Dispatch::Config->instance; |
my $logger = Log::Dispatch::Config->instance; |
440 |
my @results; |
my @results; |
441 |
$logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $nodename . "' )" ); |
$logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $nodename . "' )" ); |
442 |
|
|
443 |
#print Dumper($filters); |
#print Dumper($filters); |
444 |
|
|
445 |
my @tfilters; |
my @tfilters; |
446 |
|
|
479 |
# HACK: build eval-string (sorry) to get filtered list - please give advice here |
# HACK: build eval-string (sorry) to get filtered list - please give advice here |
480 |
my $evalstring = 'return $self->{_COREHANDLE}->select($remote, ' . $tfilter . ');'; |
my $evalstring = 'return $self->{_COREHANDLE}->select($remote, ' . $tfilter . ');'; |
481 |
|
|
482 |
|
#print "eval: $evalstring", "\n"; |
483 |
|
|
484 |
# get filtered list/set |
# get filtered list/set |
485 |
@results = eval($evalstring); |
@results = eval($evalstring); |
486 |
die $@ if $@; |
die $@ if $@; |
540 |
#return $self->createSet( $self->{COREHANDLE}->load('300090018') ); |
#return $self->createSet( $self->{COREHANDLE}->load('300090018') ); |
541 |
} |
} |
542 |
|
|
543 |
die("This should not be reached for now - redirect to \$self->getListFiltered() here!"); |
my $list = $self->getListFiltered($query->{node}, $query->{criterias}); |
544 |
|
#return $self->createSet($object); |
545 |
|
#return $self->createSet($list); |
546 |
|
return $self->createSet(@$list); |
547 |
|
|
548 |
|
#die("This should not be reached for now - redirect to \$self->getListFiltered() here!"); |
549 |
|
|
|
# TODO: do a common tangram query here |
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
|
# try a generic tangram query here |
554 |
|
# TODO: try to place an oql on top of that (search.cpan.org!) |
555 |
my @crits; |
my @crits; |
556 |
foreach (@{$query->{criterias}}) { |
foreach (@{$query->{criterias}}) { |
557 |
my $op = ''; |
my $op = ''; |
647 |
# build options (a callback to unload autovivified objects) for 'expand' |
# build options (a callback to unload autovivified objects) for 'expand' |
648 |
# TODO: use $logger to write to debug here! |
# TODO: use $logger to write to debug here! |
649 |
my $cb; # = sub {}; |
my $cb; # = sub {}; |
650 |
|
|
651 |
|
# deactivated way to get rid of used instances, if requested |
652 |
=pod |
=pod |
653 |
if ($options->{destroy}) { |
if ($options->{destroy}) { |
654 |
$options->{cb}->{destroy} = sub { |
$options->{cb}->{destroy} = sub { |
655 |
print "================ DESTROY", "\n"; |
print "================ DESTROY", "\n"; |
656 |
my $object = shift; |
my $object = shift; |
657 |
#print Dumper($object); |
#print Dumper($object); |
658 |
$self->{_COREHANDLE}->unload($object); |
$self->{_COREHANDLE}->unload($object); |
659 |
#undef($object); |
#undef($object); |
660 |
}; |
}; |
661 |
} |
} |
662 |
=cut |
=cut |
663 |
|
|
664 |
my $hash = object2hash($obj, $options); |
my $hash = expand($obj, $options); |
665 |
#$options->{cb}->{destroy}->($obj); |
|
666 |
#$self->{_COREHANDLE}->unload($obj); |
# old (unsuccessful) attempts to get rid of used instances, if requested |
667 |
|
|
668 |
# convert values in hash to utf8 to be ready for (e.g.) encapsulation in XML |
# V1: |
669 |
# now done in object2hash |
#$options->{cb}->{destroy}->($obj); |
670 |
#var2utf8($hash) if ($options->{utf8}); |
#$self->{_COREHANDLE}->unload($obj); |
671 |
|
|
672 |
# old (wrong) attempts to get rid of used instances, if requested |
# V2: |
673 |
#$obj->clear_refs; |
#$obj->clear_refs; |
674 |
#$self->{COREHANDLE}->unload($obj) if($options->{destroy}); |
#$self->{COREHANDLE}->unload($obj) if($options->{destroy}); |
675 |
#$obj->DESTROY; |
#$obj->DESTROY; |
699 |
return $storage->testAvailability(); |
return $storage->testAvailability(); |
700 |
} |
} |
701 |
|
|
702 |
|
sub disconnect2 { |
703 |
|
my $self = shift; |
704 |
|
my $storage = $self->_getSubLayerHandle(); |
705 |
|
print "DISC!", "\n"; |
706 |
|
|
707 |
|
my $storage_ll = $storage->{_COREHANDLE}; |
708 |
|
$storage_ll->disconnect(); |
709 |
|
|
710 |
|
print Dumper($storage); |
711 |
|
exit; |
712 |
|
|
713 |
|
#$self->{_COREHANDLE} |
714 |
|
#$storage->disconnect(); |
715 |
|
$self->{dataStorageLayer}->disconnect(); |
716 |
|
} |
717 |
|
|
718 |
1; |
1; |
719 |
__END__ |
__END__ |