(file) Return to CIMOMHandleQueryContext.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Provider

  1 karl  1.3 //%2006////////////////////////////////////////////////////////////////////////
  2 chuck 1.1 //
  3 karl  1.2 // 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 chuck 1.1 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.2 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8           // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9           // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.3 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec Corporation; The Open Group.
 13 chuck 1.1 //
 14           // Permission is hereby granted, free of charge, to any person obtaining a copy
 15           // 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           // 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           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22           // 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           // 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           // 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           // Authors: David Rosckes (rosckes@us.ibm.com)
 33           //          Bert Rivero (hurivero@us.ibm.com)
 34 chuck 1.1 //          Chuck Carmack (carmack@us.ibm.com)
 35           //          Brian Lucier (lucier@us.ibm.com)
 36           //
 37           // Modified By: 
 38           //
 39           //%/////////////////////////////////////////////////////////////////////////////
 40           
 41           #include "CIMOMHandleQueryContext.h"
 42           
 43           PEGASUS_NAMESPACE_BEGIN
 44           
 45           CIMOMHandleQueryContext::CIMOMHandleQueryContext(const CIMNamespaceName& inNS, CIMOMHandle& handle)
 46             :QueryContext(inNS),
 47              _CH(handle)
 48           {
 49           }
 50           
 51           CIMOMHandleQueryContext::CIMOMHandleQueryContext(const CIMOMHandleQueryContext& handle)
 52             :QueryContext(handle),
 53              _CH(handle._CH)
 54           {
 55 chuck 1.1 }
 56           
 57           CIMOMHandleQueryContext::~CIMOMHandleQueryContext()
 58           {
 59           }
 60           
 61           CIMOMHandleQueryContext& CIMOMHandleQueryContext::operator=(const CIMOMHandleQueryContext& rhs)
 62           {
 63             if (this == &rhs)
 64               return *this;
 65           
 66             QueryContext::operator=(rhs);
 67           
 68             _CH = rhs._CH;
 69           
 70             return *this;
 71           }
 72           
 73           CIMClass CIMOMHandleQueryContext::getClass(const CIMName& inClassName)const
 74           {
 75             /* Hardcoded defaults */
 76 chuck 1.1   Boolean localOnly = false;
 77             Boolean includeQualifiers = true;
 78             Boolean includeClassOrigin = false;
 79             CIMOMHandle tmp = _CH;
 80           
 81             // ATTN - constructing OperationContext from scratch may be a problem
 82             // once security is added to that object
 83             CIMClass _class = tmp.getClass(OperationContext(),
 84           				 getNamespace(),
 85           				 inClassName,
 86           				 localOnly,
 87           				 includeQualifiers,
 88           				 includeClassOrigin,
 89           				 CIMPropertyList());
 90             return _class;
 91           }
 92           
 93           Array<CIMName> CIMOMHandleQueryContext::enumerateClassNames(const CIMName& inClassName)const
 94           {
 95             CIMOMHandle tmp = _CH;
 96             // ATTN - constructing OperationContext from scratch may be a problem
 97 chuck 1.1   // once security is added to that object
 98             return tmp.enumerateClassNames(OperationContext(),
 99           				  getNamespace(),
100           				  inClassName,
101           				  true);          // deepInheritance
102           }
103           
104           Boolean CIMOMHandleQueryContext::isSubClass(const CIMName& baseClass,
105                                                       const CIMName& derivedClass)const
106           {
107             if (baseClass == derivedClass)
108             {
109               return false;
110             }
111           
112             Array<CIMName> subClasses = enumerateClassNames(baseClass);
113             for (Uint32 i = 0; i < subClasses.size(); i++)
114             {
115               if (subClasses[i] == derivedClass)
116               {
117                 return true;
118 chuck 1.1     }   
119             }
120             
121             return false;  
122           }
123           
124           QueryContext::ClassRelation CIMOMHandleQueryContext::getClassRelation(const CIMName& anchorClass,
125                                                                                 const CIMName& relatedClass)const
126           {
127             if (anchorClass == relatedClass)
128             {
129               return SAMECLASS;
130             }
131           
132             if (isSubClass(anchorClass, relatedClass))
133             {
134               return SUBCLASS;
135             }
136           
137             if (isSubClass(relatedClass, anchorClass))
138             {
139 chuck 1.1     return SUPERCLASS;
140             }
141           
142             return NOTRELATED;  
143           }
144           
145           QueryContext* CIMOMHandleQueryContext::clone()
146           {
147             return new CIMOMHandleQueryContext(*this);
148           }
149           
150           PEGASUS_NAMESPACE_END
151           

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2