Mercurial > pub > Impl
diff lib/IMPL/Config/ActivationContext.pm @ 407:c6e90e02dd17 ref20150831
renamed Lib->lib
author | cin |
---|---|
date | Fri, 04 Sep 2015 19:40:23 +0300 |
parents | |
children | 3d24b10dd0d5 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/IMPL/Config/ActivationContext.pm Fri Sep 04 19:40:23 2015 +0300 @@ -0,0 +1,68 @@ +package IMPL::Config::ActivationContext; + +use IMPL::Const qw(:prop); +use IMPL::Exception(); +use IMPL::declare { + require => { + PropertyBag => 'IMPL::Config::ServicesBag' + }, + base => { + 'IMPL::Object' => '@_' + }, + props => { + _services => PROP_RW, + _cache => PROP_RW, + _stack => PROP_RW + } +}; + +sub GetService { + my ($this,$serviceId) = @_; + + $this->_services-> +} + +sub EnterScope { + my ($this, $name, $localize) = @_; + + my $info = { name => $name }; + + if ($localize) { + $info->{services} = $this->_services; + + $this->_services(PropertyBag->new($this->_services)); + } + + $this->_stack->Push($info); +} + +sub LeaveScope { + my ($this) = @_; + + my $info = $this->_stack->Pop() + or die IMPL::InvalidOperationException(); + + if ($info->{services}) + $this->_services($info->{services}); +} + +1; +__END__ + +=pod + +=head1 NAME + +C<IMPL::Config::ActivationContext> - an activation context for the service + +=head1 SYNOPSIS + +For the internal use only + +=head1 MEMBERS + +=head2 METHODS + +=head3 GetService($serviceId) + +=cut \ No newline at end of file