(file) Return to ProviderRegistrar.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / Attic

Diff for /pegasus/src/Pegasus/ProviderManager2/Attic/ProviderRegistrar.cpp between version 1.3 and 1.7.2.1

version 1.3, 2003/10/11 15:25:42 version 1.7.2.1, 2004/02/19 01:01:54
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2003////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
   // IBM Corp.; EMC Corporation, The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 23 
Line 25 
 // //
 // Author: Chip Vincent (cvincent@us.ibm.com) // Author: Chip Vincent (cvincent@us.ibm.com)
 // //
 // Modified By:  // Modified By: Adrian Schuur (schuur@de-ibm.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 32 
Line 34 
 #include <Pegasus/Common/Constants.h> #include <Pegasus/Common/Constants.h>
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
 #include <Pegasus/Common/Pair.h> #include <Pegasus/Common/Pair.h>
   #include <Pegasus/Common/Tracer.h>
   #include <Pegasus/Common/Logger.h>
   #include <Pegasus/Common/MessageLoader.h> //l10n
  
 #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
   #include <Pegasus/ProviderManager2/ProviderType.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 64 
Line 70 
         // get the PG_ProviderCapabilities instances for the specified namespace:class_name. use the matching         // get the PG_ProviderCapabilities instances for the specified namespace:class_name. use the matching
         // instance to gather the PG_Provider instance name (logical name).         // instance to gather the PG_Provider instance name (logical name).
  
         Array<CIMInstance> cimInstances = _prm->enumerateInstances(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderCapabilities"));          Array<CIMObjectPath> cimInstanceNames = _prm->enumerateInstanceNames(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderCapabilities"));
  
         for(Uint32 i = 0, n = cimInstances.size(); i < n; i++)          for(Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++)
         {         {
             CIMInstance cimInstance = cimInstances[i];              CIMInstance cimInstance = _prm->getInstance(cimInstanceNames[i]);
  
             // check ClassName property value             // check ClassName property value
             if(String::equalNoCase(cimObjectPath.getClassName().getString(), _getPropertyValue(cimInstance, "ClassName").toString()))             if(String::equalNoCase(cimObjectPath.getClassName().getString(), _getPropertyValue(cimInstance, "ClassName").toString()))
Line 88 
Line 94 
             }             }
         }         }
     }     }
     catch(Exception & e)  
     {  
         // log error  
         String message = e.getMessage();  
     }  
     catch(...)     catch(...)
     {     {
     }     }
Line 108 
Line 109 
         // get the PG_Provider instances associated with the specified namespace:class_name. use the matching         // get the PG_Provider instances associated with the specified namespace:class_name. use the matching
         // instance to gather the PG_ProviderModule instance name.         // instance to gather the PG_ProviderModule instance name.
  
         Array<CIMInstance> cimInstances = _prm->enumerateInstances(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_Provider"));          Array<CIMObjectPath> cimInstanceNames = _prm->enumerateInstanceNames(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_Provider"));
  
         for(Uint32 i = 0, n = cimInstances.size(); i < n; i++)          for(Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++)
         {         {
             CIMInstance cimInstance = cimInstances[i];              CIMInstance cimInstance = _prm->getInstance(cimInstanceNames[i]);
  
             if(String::equalNoCase(providerName, _getPropertyValue(cimInstance, "Name").toString()))             if(String::equalNoCase(providerName, _getPropertyValue(cimInstance, "Name").toString()))
             {             {
Line 122 
Line 123 
             }             }
         }         }
     }     }
     catch(Exception & e)  
     {  
         // log error  
         String message = e.getMessage();  
     }  
     catch(...)     catch(...)
     {     {
     }     }
Line 145 
Line 141 
         // get the PG_ProviderModule instances associated with the specified namespace:class_name. use the matching         // get the PG_ProviderModule instances associated with the specified namespace:class_name. use the matching
         // instance to gather the module status and location (physical name).         // instance to gather the module status and location (physical name).
  
         Array<CIMInstance> cimInstances = _prm->enumerateInstances(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderModule"));          Array<CIMObjectPath> cimInstanceNames = _prm->enumerateInstanceNames(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderModule"));
  
         for(Uint32 i = 0, n = cimInstances.size(); i < n; i++)          for(Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++)
         {         {
             CIMInstance cimInstance = cimInstances[i];              CIMInstance cimInstance = _prm->getInstance(cimInstanceNames[i]);
  
             if(String::equalNoCase(moduleName, _getPropertyValue(cimInstance, "Name").toString()))             if(String::equalNoCase(moduleName, _getPropertyValue(cimInstance, "Name").toString()))
             {             {
Line 165 
Line 161 
             }             }
         }         }
     }     }
     catch(Exception & e)  
     {  
         // log error  
         String message = e.getMessage();  
     }  
     catch(...)     catch(...)
     {     {
     }     }
Line 180 
Line 171 
         throw Exception("Could not determine PG_ProviderModule.InterfaceType or PG_ProviderModule.Location or module is disabled.");         throw Exception("Could not determine PG_ProviderModule.InterfaceType or PG_ProviderModule.Location or module is disabled.");
     }     }
  
       // DEBUG
       CString s1 = interfaceType.getCString();
       const char * p1 = s1;
   
       CString s2 = moduleLocation.getCString();
       const char * p2 = s2;
   
     ProviderName temp(     ProviderName temp(
         cimObjectPath.toString(),         cimObjectPath.toString(),
         providerName,         providerName,
Line 198 
Line 196 
 { {
 } }
  
   static const Uint16 _MODULE_STOPPING = 9;
   static const Uint16 _MODULE_STOPPED  = 10;
   
   static void checkBlocked(CIMInstance &pm)
   {
       PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "checkBlocked");
   
       Array<Uint16> operationalStatus;
   
       Uint32 pos = pm.findProperty(CIMName ("OperationalStatus"));
       if(pos == PEG_NOT_FOUND) {
           PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
               "OperationalStatus not found.");
           PEG_METHOD_EXIT();
           //l10n
           //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "provider lookup failed.");
           throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
                                                   "ProviderManager.ProviderManagerService.PROVIDER_LOOKUP_FAILED",
                                                   "provider lookup failed."));
       }
   
       pm.getProperty(pos).getValue().get(operationalStatus);
       for(Uint32 i = 0; i < operationalStatus.size(); i++) {
           if(operationalStatus[i] == _MODULE_STOPPED ||
              operationalStatus[i] == _MODULE_STOPPING) {
               PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
                   "Provider blocked.");
               PEG_METHOD_EXIT();
                           //l10n
               //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, "provider blocked.");
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, MessageLoaderParms(
                                   "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
                                   "provider blocked."));
           }
       }
   }
   
 // need at least the object and the one capability. // need at least the object and the one capability.
 // for example, // for example,
 //  "//localhost/root/cimv2:CIM_ComputerSystem", INSTANCE //  "//localhost/root/cimv2:CIM_ComputerSystem", INSTANCE
Line 207 
Line 242 
  
 // the method will return the logical and physical provider names associated with the object and capability. // the method will return the logical and physical provider names associated with the object and capability.
  
 ProviderName ProviderRegistrar::findProvider(const ProviderName & providerName)  ProviderName ProviderRegistrar::findProvider(const ProviderName & providerName, Boolean test)
 { {
     CIMObjectPath objectName = providerName.getObjectName();     CIMObjectPath objectName = providerName.getObjectName();
     Uint32 flags = providerName.getCapabilitiesMask();     Uint32 flags = providerName.getCapabilitiesMask();
Line 218 
Line 253 
         throw Exception("Invalid argument.");         throw Exception("Invalid argument.");
     }     }
  
     ProviderName temp = _lookupProvider(objectName);      CIMInstance provider;
       CIMInstance providerModule;
       ProviderName temp;
   
      switch (flags) {
          case 2: //ProviderType::INSTANCE
             if (_prm->lookupInstanceProvider(objectName.getNameSpace(),objectName.getClassName(),
                   provider,providerModule,0)) {
                 if (test) checkBlocked(providerModule);
                 return ProviderName(providerName.getObjectName(),
                       provider.getProperty(provider.findProperty
                          ("Name")).getValue ().toString (),
                       providerModule.getProperty(providerModule.findProperty
                          ("Location")).getValue().toString(),
                       providerModule.getProperty(providerModule.findProperty
                          ("InterfaceType")).getValue().toString(),
                       ProviderType::INSTANCE);
             }
             break;
          case 5: //ProviderType::ASSOCIATION
             if (_prm->lookupInstanceProvider(objectName.getNameSpace(),objectName.getClassName(),
                   provider,providerModule,1)) {
                 if (test) checkBlocked(providerModule);
                 return ProviderName(providerName.getObjectName(),
                       provider.getProperty(provider.findProperty
                          ("Name")).getValue ().toString (),
                       providerModule.getProperty(providerModule.findProperty
                          ("Location")).getValue().toString(),
                       providerModule.getProperty(providerModule.findProperty
                          ("InterfaceType")).getValue().toString(),
                       ProviderType::ASSOCIATION);
             }
             break;
          default:
             temp = _lookupProvider(objectName);
       }
  
     return(temp);     return(temp);
 } }
Line 239 
Line 309 
     return(false);     return(false);
 } }
  
 // resolve a partial internal name into a fully qualified (as much as possible) internal  
 // provider name. for example, given a namespace and class name (embedded in the object  
 // name component), this method will determine the physical provider name, the logical  
 // provider name, and the provider capabilities for the specific object name  
 //  
 // given X, this method will provide O.  
 //  
 // physical_name    logical_name    object_name     capabilities  
 // =============================================================  
 //      X  
 //      O                X  
 //      O                O              X                O  
 //  
   
 void SetProviderRegistrationManager(ProviderRegistrationManager * p) void SetProviderRegistrationManager(ProviderRegistrationManager * p)
 { {
     _prm = p;     _prm = p;


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.7.2.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2