Package org.sblim.wbem.cim

Examples of org.sblim.wbem.cim.CIMInstance


    {
    //  CIMObjectPath cimObjectPath= new CIMObjectPath(className,namespc);
    //  CIMObjectPath cop1=(CIMObjectPath)cop;
    //  cimObjectPath.setKeys(cop1.getKeys());
      try{
        CIMInstance ci=_handle.getInstance((CIMObjectPath)cop, true, true, true, null);
        Map instanceProperties=new HashMap();
        //get all properties of the current instance
        Vector properties=ci.getAllProperties();
        for(int i=0;i<properties.size();i++)
        {
          //add property to HashMap as (class.name,value) pair
          CIMProperty cimproperty=(CIMProperty) properties.get(i);
          String qualifiedPropertyName=  cimproperty.getName();
View Full Code Here


    CIMObjectPath cop = new CIMObjectPath("CIM_SPLPolicyRule");
    cop.setNameSpace("root/cimv2");
    Enumeration enm = _cimClient.enumerateInstances(cop, true, true, true, true, null);
    while (enm.hasMoreElements ())
        {
           CIMInstance cimInstance = (CIMInstance)enm.nextElement ();
           CIMProperty cimProperty = cimInstance.getProperty("PolicyString");
           CIMValue policyStringCimValue = cimProperty.getValue();
         String policyString = policyStringCimValue.toString();
        
         CIMProperty cimProperty2 = cimInstance.getProperty("PolicyRuleName");
         CIMValue policyRuleCimValue = cimProperty2.getValue();
       String policyName = policyRuleCimValue.toString();
         System.out.println("----------------------------");
         System.out.println("Policy Name: " + policyName);
         System.out.println("Policy String: " + policyString);
View Full Code Here

        kvp.addElement (new CIMProperty ("PolicyRuleName", new CIMValue (policyName,strType)));
       
        CIMObjectPath cop = new CIMObjectPath ("CIM_SPLPolicyRule", kvp);
        cop.setNameSpace ("root/cimv2");
       
      CIMInstance cimInstance = _cimClient.getInstance(cop, localOnly);

     
      cimInstance.setProperty("PolicyString", policyStringCimValue);
      
     
    _cimClient.setInstance(cop, cimInstance, true, null);
   
   
View Full Code Here

    CIMDataType strType = new CIMDataType(CIMDataType.STRING);
    CIMValue policyNameCimValue = new CIMValue (policyName,strType);
   
    cop.addKey("PolicyRuleName", policyNameCimValue);
    
    CIMInstance cimInstance = _cimClient.getInstance(cop, localOnly);
    
    CIMProperty cimProperty = cimInstance.getProperty("PolicyString");
    CIMValue policyStringCimValue = cimProperty.getValue();
    String policyString = policyStringCimValue.toString();
    System.out.println("Policy String: " + policyString);
        return policyString;
View Full Code Here

         kvp.addElement (new CIMProperty ("PolicyString", policyStringCimValue));

         CIMObjectPath cop = new CIMObjectPath ("CIM_SPLPolicyRule", kvp);
         cop.setNameSpace ("root/cimv2");

         CIMInstance ci = new CIMInstance (cop);
         ci.setObjectPath (cop);
         CIMObjectPath returnpath=_cimClient.createInstance(ci.getObjectPath(), ci);
     System.out.println("returnpath :"+returnpath);
   
   
  }
View Full Code Here


          if(logger.isLoggable(Level.FINE))
            logger.fine(Thread.currentThread().getName()+" Actuator::Modify instance :cop"+cop);

          CIMInstance cimInstance= null;
          try
          {
            cimInstance=handle.getInstance(cop, true, true, true, null);
          }
          catch(CIMException e)
          {
            logger.severe(Thread.currentThread().getName()+" "+
                "instance does not belong to Anchor Class, might be of an extension of Anchor class, " +
                "no action will be taken on it. "+e.getMessage());
            throw new SPLException("instance does not belong to Anchor Class, might be of an " +
                "extension of Anchor class, no action will be taken on it. "+e.getMessage());

          }
          if(cimInstance != null)
          {
            Vector modifiedProperties = new Vector();
           
            Vector instanceProperties = cimInstance.getAllProperties();
            Set propertyNames = properties.keySet();
            Iterator propertyIterator = propertyNames.iterator();
            while(propertyIterator.hasNext())
            {
              String keyName = (String)propertyIterator.next();
              Object keyValue = properties.get(keyName);
              Iterator instancePropertyIterator = instanceProperties.iterator();

              while(instancePropertyIterator.hasNext())
              {
                CIMProperty cimprop=(CIMProperty)instancePropertyIterator.next();
                String name=cimprop.getName();
                int type=cimprop.getType().getType();
              //  boolean isArray=cimprop.isArray();
                CIMValue instValue=cimprop.getValue();
                if(cimprop.getName().equalsIgnoreCase(keyName))
                {
                  Object cimKeyValue = keyValue;
                  if(logger.isLoggable(Level.FINE))
                    logger.fine(Thread.currentThread().getName()+
                        " Instance property:: Name,Type,Value,CIMKeyValue :"+name+" "+type+" "
                          +instValue+" "+ cimKeyValue.getClass());

                  CIMValue cimval = getCIMObjectOfGivenType(type,cimKeyValue);


                  cimprop.setValue(cimval);
                  handle.setProperty(cimInstance.getObjectPath(), keyName, cimval);
                  modifiedProperties.add(cimprop);
                  if(logger.isLoggable(Level.FINE))
                    logger.fine(Thread.currentThread().getName()+" cimprop set to cimValue "+cimval.getValue());
                }
View Full Code Here

TOP

Related Classes of org.sblim.wbem.cim.CIMInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.