annotate lib/IMPL/Config/ActivationContext.pm @ 415:3d24b10dd0d5 ref20150831

working on IMPL::Config::Container
author cin
date Tue, 20 Oct 2015 07:32:55 +0300
parents c6e90e02dd17
children cc2cf8c0edc2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Config::ActivationContext;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use IMPL::Const qw(:prop);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4 use IMPL::Exception();
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 use IMPL::declare {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6 require => {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7 PropertyBag => 'IMPL::Config::ServicesBag'
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8 },
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 base => {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 'IMPL::Object' => '@_'
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 },
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12 props => {
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
13 container => PROP_RW,
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 _services => PROP_RW,
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
15 _cache => PROP_RW,
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
16 _stack => PROP_RW
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
20 sub CTOR {
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
21 my ( $this, $container ) = @_;
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
22
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
23 $this->container($container)
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
24 or die IMPL::InvalidArgumentException('container');
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27 sub EnterScope {
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
28 my ( $this, $name, $services ) = @_;
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
29
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
30 my $info = { name => $name };
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
31
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
32 if ($services) {
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
33 $info->{services} = $this->_services;
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
34
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
35 $this->_services( $services );
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
36 }
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
37
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
38 $this->_stack->Push($info);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
39 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
40
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
41 sub LeaveScope {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
42 my ($this) = @_;
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
43
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
44 my $info = $this->_stack->Pop()
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
45 or die IMPL::InvalidOperationException();
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
46
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
47 if ( $info->{services} ) $this->_services( $info->{services} );
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
48 }
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
49
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
50 sub Resolve {
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
51 my ($this, $role, %opts) = @_;
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
52 }
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
53
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
54 sub Clone {
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
55 my ($this) = @_;
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
56 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
57
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
58 1;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
59 __END__
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
60
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
61 =pod
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
62
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
63 =head1 NAME
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
64
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
65 C<IMPL::Config::ActivationContext> - an activation context for the service
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
66
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
67 =head1 SYNOPSIS
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
68
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
69 For the internal use only
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
70
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
71 =head1 MEMBERS
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
72
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
73 =head2 METHODS
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
74
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
75 =head3 GetService($serviceId)
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
76
415
3d24b10dd0d5 working on IMPL::Config::Container
cin
parents: 407
diff changeset
77 =cut