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

  1 martin 1.4 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.5 //
  3 martin 1.4 // Licensed to The Open Group (TOG) under one or more contributor license
  4            // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5            // this work for additional information regarding copyright ownership.
  6            // Each contributor licenses this file to you under the OpenPegasus Open
  7            // Source License; you may not use this file except in compliance with the
  8            // License.
  9 martin 1.5 //
 10 martin 1.4 // Permission is hereby granted, free of charge, to any person obtaining a
 11            // copy of this software and associated documentation files (the "Software"),
 12            // to deal in the Software without restriction, including without limitation
 13            // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14            // and/or sell copies of the Software, and to permit persons to whom the
 15            // Software is furnished to do so, subject to the following conditions:
 16 martin 1.5 //
 17 martin 1.4 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.5 //
 20 martin 1.4 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.5 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.4 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23            // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24            // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25            // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26            // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.5 //
 28 martin 1.4 //////////////////////////////////////////////////////////////////////////
 29 kumpf  1.2 //
 30            //%////////////////////////////////////////////////////////////////////////////
 31            
 32            #include <Pegasus/Common/Config.h>
 33            #include <Pegasus/WsmServer/WsmSelectorSet.h>
 34 rohini.deshpande 1.6 #include <Pegasus/WsmServer/WsmConstants.h>
 35 kumpf            1.2 #include "WsmEndpointReference.h"
 36                      
 37                      PEGASUS_NAMESPACE_BEGIN
 38                      
 39                      WsmEndpointReference::WsmEndpointReference()
 40                      {
 41                          selectorSet = new WsmSelectorSet;
 42                      }
 43                      
 44                      WsmEndpointReference::~WsmEndpointReference()
 45                      {
 46                          delete selectorSet;
 47                      }
 48                      
 49                      WsmEndpointReference::WsmEndpointReference(const WsmEndpointReference& epr)
 50                          : address(epr.address),
 51                            resourceUri(epr.resourceUri)
 52                      {
 53                          if (epr.selectorSet)
 54                          {
 55                              selectorSet = new WsmSelectorSet;
 56 kumpf            1.2         selectorSet->selectors = epr.selectorSet->selectors;
 57                          }
 58                          else
 59                          {
 60                              selectorSet = 0;
 61                          }
 62                      }
 63                      
 64 kumpf            1.3 const String& WsmEndpointReference::getNamespace() const
 65                      {
 66                          if (selectorSet)
 67                          {
 68                              for (Uint32 i = 0; i < selectorSet->selectors.size(); i++)
 69                              {
 70                                  if (selectorSet->selectors[i].type == WsmSelector::VALUE &&
 71                                      selectorSet->selectors[i].name == "__cimnamespace")
 72                                  {
 73                                      return selectorSet->selectors[i].value;
 74                                  }
 75                              }
 76                          }
 77                      
 78                          return String::EMPTY;
 79                      }
 80                      
 81 rohini.deshpande 1.6 void WsmEndpointReference::setNamespace(const String& Namespace)
 82                      {
 83                          if (selectorSet)
 84                          {
 85                              for (Uint32 i = 0; i < selectorSet->selectors.size(); i++)
 86                              {
 87                                  if (selectorSet->selectors[i].type == WsmSelector::VALUE &&
 88                                      selectorSet->selectors[i].name == PEGASUS_WS_CIMNAMESPACE)
 89                                  {
 90                                      selectorSet->selectors[i].value = Namespace;
 91                                  }
 92                              }
 93                          }
 94                      }
 95                      
 96 kumpf            1.2 WsmEndpointReference& WsmEndpointReference::operator=(
 97                          const WsmEndpointReference& epr)
 98                      {
 99                          if (this != &epr)
100                          {
101                              address = epr.address;
102                              resourceUri = epr.resourceUri;
103                      
104                              delete selectorSet;
105                              if (epr.selectorSet)
106                              {
107                                  selectorSet = new WsmSelectorSet;
108                                  selectorSet->selectors = epr.selectorSet->selectors;
109                              }
110                              else
111                              {
112                                  selectorSet = 0;
113                              }
114                          }
115                      
116                          return *this;
117 kumpf            1.2 }
118                      
119 kumpf            1.3 Boolean operator==(
120                          const WsmEndpointReference& epr1,
121                          const WsmEndpointReference& epr2)
122                      {
123                          if (epr1.address != epr2.address ||
124                              epr1.resourceUri != epr2.resourceUri ||
125                              (epr1.selectorSet && !epr2.selectorSet) ||
126                              (!epr1.selectorSet && epr2.selectorSet))
127                          {
128                              return false;
129                          }
130                      
131                          if (epr1.selectorSet && epr2.selectorSet)
132                          {
133                              return *epr1.selectorSet == *epr2.selectorSet;
134                          }
135                      
136                          return true;
137                      }
138                      
139                      Boolean operator!=(
140 kumpf            1.3     const WsmEndpointReference& epr1,
141                          const WsmEndpointReference& epr2)
142                      {
143                          return !(epr1 == epr2);
144                      }
145                      
146 kumpf            1.2 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2