コード例 #1
0
/** Constructor. */
ShutdownService::ShutdownService(CIMServer* cimserver)
{
    _cimserver = cimserver;

    //
    // get client identify
    //
    _id = peg_credential_types::MODULE;


    //
    // get module controller
    //
    _controller = &(ModuleController::get_client_handle(_id, &_client_handle));
    if((_client_handle == NULL))
    {
        throw UninitializedObjectException();
    }
}
コード例 #2
0
void CIMPropertyList::set(const Array<CIMName>& propertyNames)
{
    // ATTN: the following code is inefficient and problematic. besides
    // adding overhead to check for null property names, it has the
    // disadvantage of returning an error if only 1 of n properties are null
    // without informing the caller of which one. this is mainly a problem
    // with this object's interface. it should be more like CIMQualifierList,
    // which has a add() method that would validate one at a time.

    // ensure names are not null
    for(Uint32 i = 0, n = propertyNames.size(); i < n; i++)
    {
        if(propertyNames[i].isNull())
        {
            throw UninitializedObjectException();
        }
    }

    _rep->propertyNames = propertyNames;
    _rep->isNull = false;
}
コード例 #3
0
CIMQualifierList& CIMQualifierList::add(const CIMQualifier& qualifier)
{
    if (qualifier.isUninitialized())
        throw UninitializedObjectException();

    if (find(qualifier.getName()) != PEG_NOT_FOUND)
    {
        MessageLoaderParms parms("Common.CIMQualifierList.QUALIFIER",
            "qualifier \"$0\"",
            qualifier.getName().getString());
        throw AlreadyExistsException(parms);
    }

    _qualifiers.append(qualifier);

    // Update key index:
    if (_keyIndex == PEGASUS_ORDEREDSET_INDEX_UNKNOWN &&
            qualifier._rep->_name == _KEY)
        _keyIndex = _qualifiers.size()-1;

    return *this;
}
コード例 #4
0
ファイル: CIMPropertyRep.cpp プロジェクト: brunolauze/pegasus
void CIMPropertyRep::setName(const CIMName& name)
{
    // ensure name is not null
    if (name.isNull())
    {
        throw UninitializedObjectException();
    }

    if (_ownerCount != 0 && _name != name)
    {
        MessageLoaderParms parms(
            "Common.CIMPropertyRep.CONTAINED_PROPERTY_NAMECHANGEDEXCEPTION",
            "Attempted to change the name of a property"
                " already in a container.");
        throw Exception(parms);
    }

    _name = name;

    // Set the CIM name tag.
    _nameTag = generateCIMNameTag(_name);
}
コード例 #5
0
Uint32 slp_service_agent::test_registration(const char *url, 
					    const char *attrs, 
					    const char *type, 
 					    const char *scopes)
{

   if(_initialized.value() == 0 )
      throw UninitializedObjectException();

   //cout << "test_registration. type= " << type << endl;
   if(type ==  0)
      return 1;
   
   if(url == 0)
      return 2;
   
   if(attrs == 0)
      return 3;
   
   if(scopes == 0)
      return 4;
   
   char* _type = strdup(type);
   char* _url = strdup(url);
   char* _attrs = strdup(attrs);
   char* _scopes = strdup(scopes);

   Uint32 ccode = _test_reg(_type, _url, _attrs, _scopes);

   //cout << "rtn from _tst_reg: " << ccode << endl;
   
   free(_type);
   free(_url);
   free(_attrs);
   free(_scopes);
   return ccode;
}
コード例 #6
0
CIMPropertyRep::CIMPropertyRep(
    const CIMName& name,
    const CIMValue& value,
    Uint32 arraySize,
    const CIMName& referenceClassName,
    const CIMName& classOrigin,
    Boolean propagated)
    :
    _name(name), _value(value), _arraySize(arraySize),
    _referenceClassName(referenceClassName), _classOrigin(classOrigin),
    _propagated(propagated)
{
    // ensure name is not null
    if(name.isNull())
    {
        throw UninitializedObjectException();
    }

    if((arraySize != 0) && (!value.isArray() || value.getArraySize() != arraySize))
    {
        throw TypeMismatchException();
    }

    // if referenceClassName exists, must be CIMType REFERENCE.
    if (!referenceClassName.isNull())
    {
        if (_value.getType() != CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }

    // Can a property be of reference type with a null referenceClassName?
    // The DMTF says yes if it is a property of an instance; no if it is a
    // property of a class.  We'll allow it here, but check in the CIMClass
    // addProperty() method.
}
コード例 #7
0
CIMParameterRep::CIMParameterRep(
    const CIMName& name,
    CIMType type,
    Boolean isArray,
    Uint32 arraySize,
    const CIMName& referenceClassName)
    : _name(name), _type(type),
    _isArray(isArray), _arraySize(arraySize),
    _referenceClassName(referenceClassName)
{
    // ensure name is not null
    if(name.isNull())
    {
        throw UninitializedObjectException();
    }

    if((_arraySize != 0) && !_isArray)
    {
        throw TypeMismatchException();
    }

    if (!referenceClassName.isNull())
    {
        if (_type != CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }
    else
    {
        if (_type == CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }
}
コード例 #8
0
Sint32 JMPILocalProviderManager::_provider_ctrl(CTRL code, void *parm, void *ret)
{
    static Uint32 quantum;
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "_provider_ctrl");

    Sint32 ccode = 0;
    CTRL_STRINGS *parms = reinterpret_cast<CTRL_STRINGS *>(parm);

    switch(code)
    {

    case GET_PROVIDER:
        {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                             Tracer::LEVEL2,
                             "_provider_ctrl::GET_PROVIDER");

            String providerName = *(parms->providerName);
            String moduleFileName = *(parms->fileName);
            String interfaceName = *(parms->interfaceName);

            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: GET_PROVIDER "
                <<providerName
                <<PEGASUS_STD(endl));

            JMPIProvider::OpProviderHolder* ph =
               reinterpret_cast< JMPIProvider::OpProviderHolder* >( ret );
            JMPIProviderModule *newModule = NULL;
            JMPIProviderModule *module = NULL;
            JMPIProvider *newProvider = NULL;
            JMPIProvider *provider = NULL;
            ProviderVector base;

            try
            {
               {
                  AutoMutex lock (_providerTableMutex);

                  if (true == _providers.lookup(providerName, provider))
                  {
                      PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                       Tracer::LEVEL4,
                                       "Found JMPIProvider "
                                       + providerName
                                       + " in JMPIProvider Manager Cache");
                      DDD(PEGASUS_STD(cout)
                          <<"--- JMPILocalProviderManager::_provider_ctrl: Found "
                          <<providerName
                          <<" in JMPIProvider Manager Cache"
                          <<PEGASUS_STD(endl));
                      DDD(PEGASUS_STD(cout)
                          <<"--- JMPILocalProviderManager::_provider_ctrl:"
                            " setting provider to "
                          <<PEGASUS_STD(hex)
                          <<(int)provider
                          <<PEGASUS_STD(dec)
                          <<PEGASUS_STD(endl));

                      ph->SetProvider(provider);

//////////////////////ph->GetProvider().update_idle_timer();
                      break;
                  }

                  PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                   Tracer::LEVEL4,
                                   "Creating JMPIProvider " + providerName );
                  DDD(PEGASUS_STD(cout)
                      <<"--- JMPILocalProviderManager::_provider_ctrl: Creating "
                      <<providerName
                      <<PEGASUS_STD(endl));

                  if (false == _modules.lookup(moduleFileName, module))
                  {
                      PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                       Tracer::LEVEL4,
                                       "Creating JMPIProvider Module "
                                       + moduleFileName );
                      DDD(PEGASUS_STD(cout)
                          <<"--- JMPILocalProviderManager::_provider_ctrl: "
                            "Creating module "
                            <<moduleFileName
                            <<PEGASUS_STD(endl));

                      newModule = new JMPIProviderModule(moduleFileName,
                                                         interfaceName);

                      if (0 == newModule)
                      {
                          PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                           Tracer::LEVEL4,
                                           "new JMPIProviderModule is NULL!");
                          DDD(PEGASUS_STD(cout)
                              <<"--- JMPILocalProviderManager::_provider_ctrl:"
                                " new JMPIProviderModule is NULL!"
                                <<PEGASUS_STD(endl));

                          throw NullPointer();
                      }

                      module = newModule;

                      _modules.insert(moduleFileName, module);
                  }
                  else
                  {
                      PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                       Tracer::LEVEL4,
                                       "Using Cached JMPIProvider Module "
                                       + moduleFileName);
                      DDD(PEGASUS_STD(cout)
                          <<"--- JMPILocalProviderManager::_provider_ctrl: "
                          "Using cached "
                          <<moduleFileName
                          <<PEGASUS_STD(endl));
                  }
               }

               PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                Tracer::LEVEL4,
                                "Loading/Linking JMPIProvider Module "
                                + moduleFileName );
               DDD(PEGASUS_STD(cout)
                   <<"--- JMPILocalProviderManager::_provider_ctrl:"
                     " Loading/Linking module "
                     <<moduleFileName
                     <<PEGASUS_STD(endl));

               try
               {
                   base = module->load(moduleFileName);
               }
               catch(...)
               {
                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                    Tracer::LEVEL4,
                                    "Exception caught Loading/Linking"
                                    " JMPIProvider Module "
                                    + moduleFileName );
                   DDD(PEGASUS_STD(cout)
                       <<"--- JMPILocalProviderManager::_provider_ctrl: "
                       "Exception caught Loading/Linking module "
                       <<moduleFileName
                       <<PEGASUS_STD(endl));

                   throw;
               }

               // create provider module
               newProvider = new JMPIProvider(providerName, module, &base);
               if (0 == newProvider)
               {
                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                    Tracer::LEVEL4,
                                    "new JMPIProvider is NULL!");
                   DDD(PEGASUS_STD(cout)
                       <<"--- JMPILocalProviderManager::_provider_ctrl: "
                         "new JMPIProvider is NULL!"
                       <<PEGASUS_STD(endl));

                   throw NullPointer();
               }

               provider = newProvider;

               if (0 == (provider->_cimom_handle = new CIMOMHandle()))
               {
                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                    Tracer::LEVEL4,
                                    "_cimom_handle is NULL!");
                   DDD(PEGASUS_STD(cout)
                       <<"--- JMPILocalProviderManager::_provider_ctrl:"
                         " _cimom_handle is NULL!"
                         <<PEGASUS_STD(endl));

                   throw NullPointer();
               }

               provider->_quantum = 0;

               {
                  AutoMutex lock(provider->_statusMutex);

                  PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                   Tracer::LEVEL2,
                                   "Loading JMPIProvider "
                                   +  provider->_name);
                  DDD(PEGASUS_STD(cout)
                      <<"--- JMPILocalProviderManager::_provider_ctrl:"
                        " Loading "
                        <<provider->_name
                        <<PEGASUS_STD(endl));
                  try
                  {
                      provider->initialize(*(provider->_cimom_handle));
                  }
                  catch(...)
                  {
                      PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                       Tracer::LEVEL4,
                                       "Exception caught calling initialize!");
                      DDD(PEGASUS_STD(cout)
                          <<"--- JMPILocalProviderManager::_provider_ctrl:"
                            " Exception caught calling initialize!"
                            <<PEGASUS_STD(endl));

                      throw UninitializedObjectException();
                  }
               }
            }
            catch (...)
            {
               if (newModule)
               {
                  _modules.remove(moduleFileName);
               }

               delete newModule;

               if (newProvider)
               {
                  delete newProvider->_cimom_handle;
               }

               delete newProvider;

               throw;
            }


//          provider->update_idle_timer();

            _providers.insert(providerName, provider);

            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl:"
                  "setting provider to "
                  <<PEGASUS_STD(hex)
                  <<(int)provider
                  <<PEGASUS_STD(dec)
                  <<PEGASUS_STD(endl));

            ph->SetProvider( provider );
            break;
        }

    case UNLOAD_PROVIDER:
        {
            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: "
                  "UNLOAD_PROVIDER"
                  <<PEGASUS_STD(endl));
            break;
        }

    case LOOKUP_PROVIDER:
        {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                             Tracer::LEVEL2,
                             "_provider_ctrl::LOOKUP_PROVIDER");
            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: "
                "LOOKUP_PROVIDER "
                <<*(parms->providerName)
                <<PEGASUS_STD(endl));

            AutoMutex lock (_providerTableMutex);

            if (true == _providers.lookup(*(parms->providerName),
                                   *(reinterpret_cast<JMPIProvider * *>(ret))))
            {
                PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                 Tracer::LEVEL4,
                                 "Found JMPIProvider in cache: "
                                 + *(parms->providerName));

////////////////(*(reinterpret_cast<JMPIProvider * *>(ret)))->update_idle_timer();
            }
            else
            {
                PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                                 Tracer::LEVEL4,
                                 "Could not find  JMPIProvider in cache: "
                                 + *(parms->providerName));
                ccode = -1;
            }

            break;
        }

    case LOOKUP_MODULE:
        {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                             Tracer::LEVEL2,
                             "_provider_ctrl::LOOKUP_MODULE");
            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: "
                  "LOOKUP_MODULE "
                <<*(parms->fileName)
                <<PEGASUS_STD(endl));

            AutoMutex lock (_providerTableMutex);

            if (false  == _modules.lookup(*(parms->fileName),
                *(reinterpret_cast<JMPIProviderModule * *>(ret))))
            {
                PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
                    "Could not find  JMPIProvider Module in cache: " +
                    *(parms->fileName));
                ccode = -1;
            }

            break;
        }

    case INSERT_PROVIDER:
        {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                             Tracer::LEVEL2,
                             "_provider_ctrl::INSERT_PROVIDER");
            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: "
                  "INSERT_PROVIDER "
                <<*(parms->providerName)
                <<PEGASUS_STD(endl));

            AutoMutex lock (_providerTableMutex);

            if (false  == _providers.insert(*(parms->providerName),
                                    *reinterpret_cast<JMPIProvider * *>(parm)))
                ccode = -1;
            break;
        }

    case INSERT_MODULE:
        {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                             Tracer::LEVEL2,
                             "_provider_ctrl::INSERT_MODULE");
            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: "
                  "INSERT_MODULE "
                <<*(parms->fileName)
                <<PEGASUS_STD(endl));

            AutoMutex lock (_providerTableMutex);

            if(false  == _modules.insert(*(parms->fileName),
                              *reinterpret_cast<JMPIProviderModule * *>(parm)))
                ccode = -1;
            break;
        }

    case REMOVE_PROVIDER:
        {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                             Tracer::LEVEL2,
                             "_provider_ctrl::REMOVE_PROVIDER");
            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: "
                  "REMOVE_PROVIDER "
                <<*(parms->providerName)
                <<PEGASUS_STD(endl));

            AutoMutex lock (_providerTableMutex);

            if (false == _providers.remove(*(parms->providerName)))
                ccode = -1;
            break;
        }

    case REMOVE_MODULE:
        {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER,
                             Tracer::LEVEL2,
                             "_provider_ctrl::REMOVE_MODULE");
            DDD(PEGASUS_STD(cout)
                <<"--- JMPILocalProviderManager::_provider_ctrl: REMOVE_MODULE "
                <<*(parms->fileName)
                <<PEGASUS_STD(endl));

            AutoMutex lock (_providerTableMutex);

            if (false == _modules.remove(*(parms->fileName)))
                ccode = -1;
            break;
        }

    case UNLOAD_ALL_PROVIDERS:
        {
           DDD(PEGASUS_STD(cout)
               <<"--- JMPILocalProviderManager::_provider_ctrl: "
                 "UNLOAD_ALL_PROVIDERS"
               <<PEGASUS_STD(endl));

           JMPIjvm::destroyJVM();
           break;
        }

    case UNLOAD_IDLE_PROVIDERS:
         {
           DDD(PEGASUS_STD(cout)
               <<"--- JMPILocalProviderManager::_provider_ctrl: "
                 "UNLOAD_IDLE_PROVIDERS"
               <<PEGASUS_STD(endl));
           break;
        }

    case UNLOAD_IDLE_MODULES:
        {
           DDD(PEGASUS_STD(cout)
               <<"--- JMPILocalProviderManager::_provider_ctrl: "
                 "UNLOAD_IDLE_MODULES"
               <<PEGASUS_STD(endl));
           break;
        }

    default:
        {
           DDD(PEGASUS_STD(cout)
               <<"--- JMPILocalProviderManager::_provider_ctrl: unknown! "
               <<code
               <<PEGASUS_STD(endl));
           ccode = -1;
           break;
        }
    }
    PEG_METHOD_EXIT();
    return(ccode);
}
コード例 #9
0
void CIMConstQualifierDecl::_checkRep() const
{
    if (!_rep)
        throw UninitializedObjectException();
}
コード例 #10
0
ファイル: CIMInstance.cpp プロジェクト: ncultra/Pegasus-2.5
void CIMConstInstance::_checkRep() const
{
    if (!_rep)
        throw UninitializedObjectException();
}