⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commoninstanceprovider.java

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
      {         // Ensure that the keys are valid         if (!validatePropertyTypePath (cop))         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }         // Ensure that the request object exists         int index = findCOPInPropertyTypesNew (cop);         if (index < 0)         {            throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);         }         return (CIMInstance)instancesPropertyTypes.elementAt (index);      }      else      {         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);      }   }   public void setInstance (OperationContext oc,                            CIMObjectPath    cop,                            CIMInstance      cimInstance,                            boolean          includeQualifiers,                            String[]         propertyList)      throws CIMException   {      if (DEBUG)      {         System.err.println (providerName + "::setInstance: oc                = " + oc);         System.err.println (providerName + "::setInstance: cop               = " + cop);         System.err.println (providerName + "::setInstance: cimInstance       = " + cimInstance);         System.err.println (providerName + "::setInstance: includeQualifiers = " + includeQualifiers);         System.err.println (providerName + "::setInstance: propertyList      = " + propertyList);      }      // Ensure that the namespace is valid      if (!cop.getNameSpace ().equalsIgnoreCase (namespace))      {         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);      }      // Ensure that the class exists in the specified namespace      if (cop.getObjectName ().equalsIgnoreCase (testElementClassname))      {         // Ensure that the property values are valid         testTestElementInstance (cimInstance);         // Ensure that the keys are valid         if (!validateTestElementPath (cop))         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }         // Ensure that the request object exists         int index = findCOPInTestElements (cop);         if (index < 0)         {            throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);         }         if (fEnableModifications)         {            pathsTestElements.removeElementAt (index);            instancesTestElements.removeElementAt (index);            pathsTestElements.addElement (cop);            instancesTestElements.addElement (cimInstance);            pathsTestElements.sort ();            instancesTestElements.sort ();         }         else         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }      }      else if (cop.getObjectName ().equalsIgnoreCase (propertyTypesClassname))      {         // Ensure that the property values are valid         testPropertyTypeInstance (cimInstance);         // Ensure that the keys are valid         if (!validatePropertyTypePath (cop))         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }         // Ensure that the request object exists         int index = findCOPInPropertyTypesNew (cop);         if (index < 0)         {            throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);         }         if (fEnableModifications)         {            pathsPropertyTypes.removeElementAt (index);            instancesPropertyTypes.removeElementAt (index);            pathsPropertyTypes.addElement (cop);            instancesPropertyTypes.addElement (cimInstance);            pathsPropertyTypes.sort ();            instancesPropertyTypes.sort ();         }         else         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }      }      else      {         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);      }   }   public void deleteInstance (OperationContext oc,                               CIMObjectPath    cop)      throws CIMException   {      if (DEBUG)      {         System.err.println (providerName + "::deleteInstance: oc  = " + oc);         System.err.println (providerName + "::deleteInstance: cop = " + cop);      }      // Ensure that the namespace is valid      if (!cop.getNameSpace ().equalsIgnoreCase (namespace))      {         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);      }      // Ensure that the class exists in the specified namespace      if (cop.getObjectName ().equalsIgnoreCase (testElementClassname))      {         // Ensure that the keys are valid         if (!validateTestElementPath (cop))         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }         // Ensure that the request object exists         int index = findCOPInTestElements (cop);         if (index < 0)         {            throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);         }         if (fEnableModifications)         {            pathsTestElements.removeElementAt (index);            instancesTestElements.removeElementAt (index);            pathsTestElements.sort ();            instancesTestElements.sort ();         }         else         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }      }      else if (cop.getObjectName ().equalsIgnoreCase (propertyTypesClassname))      {         // Ensure that the keys are valid         if (!validatePropertyTypePath (cop))         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }         // Ensure that the request object exists         int index = findCOPInPropertyTypesNew (cop);         if (index < 0)         {            throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);         }         if (fEnableModifications)         {            pathsPropertyTypes.removeElementAt (index);            instancesPropertyTypes.removeElementAt (index);            pathsPropertyTypes.sort ();            instancesPropertyTypes.sort ();         }         else         {            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);         }      }      else      {         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);      }   }   public Vector enumerateInstanceNames (OperationContext oc,                                         CIMObjectPath    cop,                                         boolean          deepInheritance,                                         CIMClass         cimClass)      throws CIMException   {      if (DEBUG)      {         System.err.println (providerName + "::enumerateInstanceNames: oc              = " + oc);         System.err.println (providerName + "::enumerateInstanceNames: cop             = " + cop);         System.err.println (providerName + "::enumerateInstanceNames: deepInheritance = " + deepInheritance);         System.err.println (providerName + "::enumerateInstanceNames: cimClass        = " + cimClass);      }      // Ensure that the namespace is valid      if (!cop.getNameSpace ().equalsIgnoreCase (namespace))      {         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);      }      // Ensure that the class exists in the specified namespace      if (cop.getObjectName ().equalsIgnoreCase (testElementClassname))      {         return pathsTestElements;      }      else if (cop.getObjectName ().equalsIgnoreCase (propertyTypesClassname))      {         return pathsPropertyTypes;      }      else      {         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);      }   }   public Vector enumerateInstances (OperationContext oc,                                     CIMObjectPath    cop,                                     CIMClass         cimClass,                                     boolean          deepInheritance,                                     boolean          localOnly,                                     boolean          includeQualifiers,                                     boolean          includeClassOrigin,                                     String           propertyList[])      throws CIMException   {      if (DEBUG)      {         System.err.println (providerName + "::enumerateInstances: oc                 = " + oc);         System.err.println (providerName + "::enumerateInstances: cop                = " + cop);         System.err.println (providerName + "::enumerateInstances: cimClass           = " + cimClass);         System.err.println (providerName + "::enumerateInstances: deepInheritance    = " + deepInheritance);         System.err.println (providerName + "::enumerateInstances: localOnly          = " + localOnly);         System.err.println (providerName + "::enumerateInstances: includeQualifiers  = " + includeQualifiers);         System.err.println (providerName + "::enumerateInstances: includeClassOrigin = " + includeClassOrigin);         System.err.println (providerName + "::enumerateInstances: propertyList       = " + propertyList);      }      // Ensure that the namespace is valid      if (!cop.getNameSpace ().equalsIgnoreCase (namespace))      {         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);      }      // Ensure that the class exists in the specified namespace      if (cop.getObjectName ().equalsIgnoreCase (testElementClassname))      {         return instancesTestElements;      }      else if (cop.getObjectName ().equalsIgnoreCase (propertyTypesClassname))      {         return instancesPropertyTypes;      }      else      {         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);      }   }   public Vector execQuery (OperationContext oc,                            CIMObjectPath    cop,                            String           queryStatement,                            String           queryLanguage,                            CIMClass         cimClass)      throws CIMException   {      if (DEBUG)      {         System.err.println (providerName + "::execQuery: oc              = " + oc);         System.err.println (providerName + "::execQuery: cop             = " + cop);         System.err.println (providerName + "::execQuery: queryStatement  = " + queryStatement);         System.err.println (providerName + "::execQuery: queryLanguage   = " + queryLanguage);         System.err.println (providerName + "::execQuery: cimClass        = " + cimClass);      }      // Ensure that the namespace is valid      if (!cop.getNameSpace ().equalsIgnoreCase (namespace))      {         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);      }      // Ensure that the class exists in the specified namespace      if (cop.getObjectName ().equalsIgnoreCase (testElementClassname))      {         throw new CIMException (CIMException.CIM_ERR_NOT_SUPPORTED);      }      else if (cop.getObjectName ().equalsIgnoreCase (propertyTypesClassname))      {         if (!queryLanguage.equals ("WQL"))         {            throw new CIMException (CIMException.CIM_ERR_NOT_SUPPORTED);         }         SelectExp     q         = new SelectExp (queryStatement);         SelectList    attrs     = q.getSelectList ();         NonJoinExp    from      = (NonJoinExp)q.getFromClause ();         QueryExp      where     = q.getWhereClause ();         Vector        instances = enumerateInstances (oc,                                                       cop,                                                       cimClass,                                                       false,    // deepInheritance,                                                       true,     // localOnly,                                                       true,     // includeQualifiers,                                                       true,     // includeClassOrigin,                                                       null);         Vector        ret       = new Vector ();         if (DEBUG)         {            System.err.println (providerName + "::execQuery: q                 = " + q);            System.err.println (providerName + "::execQuery: attrs             = " + attrs);            System.err.println (providerName + "::execQuery: from              = " + from);            System.err.println (providerName + "::execQuery: where             = " + where);            System.err.println (providerName + "::execQuery: instances.size () = " + instances.size ());         }         // filter the instances         for (int i = 0; i < instances.size (); i++)         {            if (  where == null               || where.apply ((CIMInstance)instances.elementAt (i))               )            {               if (DEBUG)               {                  System.err.println (providerName + "::execQuery: adding instance " + instances.elementAt (i));               }               ret.addElement (attrs.apply ((CIMInstance)instances.elementAt (i)));            }         }         return ret;      }      else      {         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);      }   }   public CIMValue invokeMethod (OperationContext oc,                                 CIMObjectPath    cop,                                 String           methodName,                                 Vector           inArgs,                                 Vector           outArgs)      throws CIMException   {      if (DEBUG)      {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -