Mercurial > pub > Impl
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 406:f23fcb19d3c1 | 407:c6e90e02dd17 |
|---|---|
| 1 package IMPL::Config::ActivationContext; | |
| 2 | |
| 3 use IMPL::Const qw(:prop); | |
| 4 use IMPL::Exception(); | |
| 5 use IMPL::declare { | |
| 6 require => { | |
| 7 PropertyBag => 'IMPL::Config::ServicesBag' | |
| 8 }, | |
| 9 base => { | |
| 10 'IMPL::Object' => '@_' | |
| 11 }, | |
| 12 props => { | |
| 13 _services => PROP_RW, | |
| 14 _cache => PROP_RW, | |
| 15 _stack => PROP_RW | |
| 16 } | |
| 17 }; | |
| 18 | |
| 19 sub GetService { | |
| 20 my ($this,$serviceId) = @_; | |
| 21 | |
| 22 $this->_services-> | |
| 23 } | |
| 24 | |
| 25 sub EnterScope { | |
| 26 my ($this, $name, $localize) = @_; | |
| 27 | |
| 28 my $info = { name => $name }; | |
| 29 | |
| 30 if ($localize) { | |
| 31 $info->{services} = $this->_services; | |
| 32 | |
| 33 $this->_services(PropertyBag->new($this->_services)); | |
| 34 } | |
| 35 | |
| 36 $this->_stack->Push($info); | |
| 37 } | |
| 38 | |
| 39 sub LeaveScope { | |
| 40 my ($this) = @_; | |
| 41 | |
| 42 my $info = $this->_stack->Pop() | |
| 43 or die IMPL::InvalidOperationException(); | |
| 44 | |
| 45 if ($info->{services}) | |
| 46 $this->_services($info->{services}); | |
| 47 } | |
| 48 | |
| 49 1; | |
| 50 __END__ | |
| 51 | |
| 52 =pod | |
| 53 | |
| 54 =head1 NAME | |
| 55 | |
| 56 C<IMPL::Config::ActivationContext> - an activation context for the service | |
| 57 | |
| 58 =head1 SYNOPSIS | |
| 59 | |
| 60 For the internal use only | |
| 61 | |
| 62 =head1 MEMBERS | |
| 63 | |
| 64 =head2 METHODS | |
| 65 | |
| 66 =head3 GetService($serviceId) | |
| 67 | |
| 68 =cut |
