1 karl 1.23 //%2006////////////////////////////////////////////////////////////////////////
|
2 bob 1.1 //
|
3 karl 1.20 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.19 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.20 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.21 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.23 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 bob 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.7 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 bob 1.1 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
|
21 kumpf 1.7 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 bob 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 kumpf 1.7 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 bob 1.1 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Author: Bob Blair (bblair@bmc.com)
33 //
|
34 kumpf 1.10 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
35 // (carolann_graves@hp.com)
|
36 gerarda 1.15 // Gerarda Marquez (gmarquez@us.ibm.com)
37 // -- PEP 43 changes
|
38 bob 1.1 //
39 //%/////////////////////////////////////////////////////////////////////////////
40
41 #include "cimmofClient.h"
42 #include <Pegasus/Common/CIMClass.h>
43 #include <Pegasus/Common/CIMQualifierDecl.h>
44 #include <Pegasus/Common/CIMInstance.h>
45
46 PEGASUS_USING_PEGASUS;
47
|
48 kumpf 1.5 static const char __NAMESPACE_NAMESPACE [] = "root";
|
49 kumpf 1.3 static const char NAMESPACE_CLASS [] = "__NameSpace";
50 static const char NAMESPACE_PROPERTY_NAME [] = "Name";
51
|
52 bob 1.1 cimmofClient::cimmofClient() :
|
53 kumpf 1.2 _ot(compilerCommonDefs::USE_REPOSITORY),
54 _client(0)
|
55 bob 1.1 {
56 }
57
58 cimmofClient::~cimmofClient() {
59 }
60
61 void
62 cimmofClient::init(String &location, compilerCommonDefs::operationType ot)
63 {
64 _ot = ot;
65 // ATTN: We will want to make failure to connect a more satisfying
66 // experience by catching the error here and analyzing it. For now,
67 // though, it should be OK to just jump all the way out and let
68 // our caller handle it.
69
70 _client = new CIMClient();
|
71 mateus.baur 1.24 _client->setTimeout(CIMMOFCLIENT_TIMEOUT_DEFAULT);
|
72 humberto 1.17 _client->setRequestDefaultLanguages(); //l10n
|
73 kumpf 1.12 _client->connectLocal();
|
74 bob 1.1 }
75
76 void
|
77 kumpf 1.10 cimmofClient::addClass(const CIMNamespaceName &nameSpace, CIMClass &Class) const
|
78 kumpf 1.8 {
|
79 bob 1.1 _client->createClass(nameSpace, Class);
80 }
81
82 void
|
83 kumpf 1.10 cimmofClient::addQualifier(const CIMNamespaceName &nameSpace,
|
84 bob 1.1 CIMQualifierDecl &qualifier) const
85 {
86 _client->setQualifier(nameSpace, qualifier);
87 }
88
89 void
|
90 kumpf 1.10 cimmofClient::addInstance(const CIMNamespaceName &nameSpace,
|
91 bob 1.1 CIMInstance &instance) const
92 {
93 _client->createInstance(nameSpace, instance);
94 }
95
96 CIMQualifierDecl
|
97 kumpf 1.10 cimmofClient::getQualifierDecl(const CIMNamespaceName &nameSpace,
98 const CIMName &qualifierName) const
|
99 bob 1.1 {
100 return (_client->getQualifier(nameSpace, qualifierName));
101 }
102
103 CIMClass
|
104 kumpf 1.10 cimmofClient::getClass(const CIMNamespaceName &nameSpace,
105 const CIMName &className) const
|
106 bob 1.1 {
|
107 karl 1.18 return (_client->getClass(nameSpace, className, false, true, true));
|
108 gerarda 1.15 }
109
110 void
111 cimmofClient::modifyClass(const CIMNamespaceName &nameSpace, CIMClass &Class) const
112 {
113 _client->modifyClass(nameSpace, Class);
|
114 bob 1.1 }
115
116 void
|
117 kumpf 1.10 cimmofClient::createNameSpace(const CIMNamespaceName &nameSpace) const
|
118 bob 1.1 {
|
119 kumpf 1.6 // The new namespace name will be computed by
120 // concatenating the target Namespace name with the
121 // value of the Name property. By setting the
122 // value of the Name property to String::EMPTY,
123 // the name of the created namespace will be the
124 // target namespace.
|
125 kumpf 1.10 CIMInstance newInstance = CIMName (NAMESPACE_CLASS);
|
126 kumpf 1.3 newInstance.addProperty(
|
127 kumpf 1.10 CIMProperty(CIMName (NAMESPACE_PROPERTY_NAME), String::EMPTY));
|
128 kumpf 1.6 _client->createInstance(nameSpace, newInstance);
|
129 bob 1.1 }
|