1 mike 1.2 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
13 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
14 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 //
21 //==============================================================================
22 mike 1.2 //
23 // Author: Chip Vincent (cvincent@us.ibm.com)
24 //
25 // Modified By:
26 //
27 //%/////////////////////////////////////////////////////////////////////////////
28
29 #include "OperationContext.h"
30
31 PEGASUS_NAMESPACE_BEGIN
32
|
37 chip 1.3 OperationContext::~OperationContext(void)
38 {
39 }
40
41 void OperationContext::clear(void)
42 {
43 _containers.clear();
44 }
45
46 const OperationContext::Container OperationContext::get(const Uint32 key) const
47 {
48 for(Uint32 i = 0, n = _containers.size(); i < n; i++)
49 {
50 if(key == _containers[i].getKey())
51 {
52 return(_containers[i]);
53 }
54 }
55
56 throw Exception("object not found");
57 }
58 chip 1.3
59 void OperationContext::set(const OperationContext::Container & container)
60 {
61 for(Uint32 i = 0, n = _containers.size(); i < n; i++)
62 {
63 if(container.getKey() == _containers[i].getKey())
64 {
65 // delete previous container
66 _containers.remove(i);
67
68 // append current container
69 _containers.append(container);
70
71 return;
72 }
73 }
74
75 throw Exception("object not found");
76 }
77
78 void OperationContext::insert(const OperationContext::Container & container)
79 chip 1.3 {
80 for(Uint32 i = 0, n = _containers.size(); i < n; i++)
81 {
82 if(container.getKey() == _containers[i].getKey())
83 {
84 throw Exception("object already exists.");
85 }
86 }
87
88 _containers.append(container);
89 }
90
91 void OperationContext::remove(const Uint32 key)
92 {
93 for(Uint32 i = 0, n = _containers.size(); i < n; i++)
94 {
95 if(key == _containers[i].getKey())
96 {
97 _containers.remove(i);
98
99 return;
100 chip 1.3 }
101 }
102
103 throw Exception("object not found");
104 }
105
106 OperationContext::Container::Container(const Uint32 key) : _key(key)
107 {
108 }
109
110 OperationContext::Container::~Container(void)
111 {
112 }
113
114 IdentityContainer::IdentityContainer(const String & userName)
115 : OperationContext::Container(CONTEXT_IDENTITY), _userName(userName)
116 {
117 }
118
119 IdentityContainer::~IdentityContainer(void)
120 {
|