Package org.sblim.wbem.cim

Examples of org.sblim.wbem.cim.CIMDataType


      CIMNameSpace clientNameSpace = _cimClient.getNameSpace();
      cimObjectPath.setNameSpace(clientNameSpace.getNameSpace());
      cimObjectPath.setHost(clientNameSpace.getHost());
      System.out.println("cimObjectPath : "+cimObjectPath.toString());
     
      CIMDataType strType = new CIMDataType(CIMDataType.STRING);
    CIMValue policyNameCimValue = new CIMValue (policyName,strType);
     
      cimObjectPath.addKey("PolicyRuleName", policyNameCimValue);
      if(_cimClient.getInstance(cimObjectPath, true, true, true, null) != null)
      {
View Full Code Here


    CIMObjectPath cimObjectPath = new CIMObjectPath("CIM_SPLPolicyRule");
      CIMNameSpace clientNameSpace = _cimClient.getNameSpace();
      cimObjectPath.setNameSpace(clientNameSpace.getNameSpace());
      cimObjectPath.setHost(clientNameSpace.getHost());
     
      CIMDataType strType = new CIMDataType(CIMDataType.STRING);
    CIMValue policyNameCimValue = new CIMValue (policyName,strType);
   
      cimObjectPath.addKey("PolicyRuleName", policyNameCimValue);
        
    _cimClient.deleteInstance(cimObjectPath);
View Full Code Here

  public void modifyPolicy(String policyPath, String policyName) throws CIMException
  {
    String policyString = _readPolicyString(policyPath,policyName);
    boolean localOnly = true;
    Vector kvp = new Vector ();
    CIMDataType strType = new CIMDataType(CIMDataType.STRING);
    CIMValue policyStringCimValue = new CIMValue (policyString,strType);
   
        kvp.addElement (new CIMProperty ("PolicyRuleName", new CIMValue (policyName,strType)));
       
        CIMObjectPath cop = new CIMObjectPath ("CIM_SPLPolicyRule", kvp);
View Full Code Here

  public String listPolicy(String policyName) throws CIMException
  {
    boolean localOnly = true;
    CIMObjectPath cop=new CIMObjectPath("CIM_SPLPolicyRule","root/cimv2");
   
    CIMDataType strType = new CIMDataType(CIMDataType.STRING);
    CIMValue policyNameCimValue = new CIMValue (policyName,strType);
   
    cop.addKey("PolicyRuleName", policyNameCimValue);
    
    CIMInstance cimInstance = _cimClient.getInstance(cop, localOnly);
View Full Code Here

    System.out.println("createPolicy** : "+policyPath+" "+policyName) ;
    String policyString = _readPolicyString(policyPath,policyName);
    
     Vector kvp = new Vector ();
    
     CIMDataType strType = new CIMDataType(CIMDataType.STRING);
     CIMValue policyNameCimValue = new CIMValue (policyName,strType);
    
     CIMValue policyStringCimValue = new CIMValue(policyString,strType);

         kvp.addElement (new CIMProperty ("PolicyRuleName", policyNameCimValue));
View Full Code Here

          Short sht=new Short(Short.parseShort((arrayIt.next()).toString()));
          UnsignedInt8 uint8= new UnsignedInt8(sht.shortValue());
          uintArray.add(uint8);
        }
        Object actualValue=(UnsignedInt8[])uintArray.toArray();
        CIMDataType uint8ArrType = new CIMDataType(CIMDataType.UINT8_ARRAY);
        cimval=new CIMValue(actualValue, uint8ArrType);   
       
      }
      break;
      case CIMDataType.UINT16_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List uintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Integer integ=new Integer(Integer.parseInt((arrayIt.next()).toString()));
          UnsignedInt16 uint16= new UnsignedInt16(integ.intValue());
          uintArray.add(uint16);
        }
        Object actualValue=(UnsignedInt16[])uintArray.toArray();
        CIMDataType uint16ArrType = new CIMDataType(CIMDataType.UINT16_ARRAY);
        cimval=new CIMValue(actualValue,uint16ArrType);                   
      }
      break;
      case CIMDataType.UINT32_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List uintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Long lng=new Long(Long.parseLong((arrayIt.next()).toString()));
          UnsignedInt32 uint32= new UnsignedInt32(lng.longValue());
          uintArray.add(uint32);
        }
        Object actualValue=(UnsignedInt32[])uintArray.toArray();
        CIMDataType uint32ArrType = new CIMDataType(CIMDataType.UINT32_ARRAY);
        cimval=new CIMValue(actualValue,uint32ArrType);                   
      }
      break;
      case CIMDataType.UINT64_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List uintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Long lng=new Long(Long.parseLong((arrayIt.next()).toString()));
          BigInteger big=BigInteger.valueOf(lng.longValue());
          UnsignedInt64 uint64= new UnsignedInt64(big.abs());
          uintArray.add(uint64);
        }
        Object actualValue=(UnsignedInt64[])uintArray.toArray();
        CIMDataType uint64ArrType = new CIMDataType(CIMDataType.UINT64_ARRAY);
        cimval=new CIMValue(actualValue,uint64ArrType);                   
      }
      break;
      case CIMDataType.SINT8_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Byte bt=new Byte(Byte.parseByte((arrayIt.next()).toString()));
          sintArray.add(bt);
        }
        Object actualValue=(Byte[])sintArray.toArray();
        CIMDataType sint8ArrType = new CIMDataType(CIMDataType.SINT8_ARRAY);
        cimval=new CIMValue(actualValue,sint8ArrType);                   
      }
      break;

      case CIMDataType.SINT16_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Short bt=new Short(Short.parseShort((arrayIt.next()).toString()));
          sintArray.add(bt);
        }
        Object actualValue=(Short[])sintArray.toArray();
        CIMDataType sint16ArrType = new CIMDataType(CIMDataType.SINT16_ARRAY);
        cimval=new CIMValue(actualValue,sint16ArrType);                   
      }
      break;
      case CIMDataType.SINT32_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Integer bt=new Integer(Integer.parseInt((arrayIt.next()).toString()));
          sintArray.add(bt);
        }
        Object actualValue=(Integer[])sintArray.toArray();
        CIMDataType sint32ArrType = new CIMDataType(CIMDataType.SINT32_ARRAY);
        cimval=new CIMValue(actualValue,sint32ArrType);                   
      }
      break;

      case CIMDataType.SINT64_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext()){
          Long bt=new Long(Long.parseLong((arrayIt.next()).toString()));
          sintArray.add(bt);
        }
        Object actualValue=(Long[])sintArray.toArray();
        CIMDataType sint64ArrType = new CIMDataType(CIMDataType.SINT64_ARRAY);
        cimval=new CIMValue(actualValue,sint64ArrType);                   
      }
      break;

      case CIMDataType.REAL32_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Float bt=new Float(Float.parseFloat((arrayIt.next()).toString()));
          sintArray.add(bt);
        }
        Object actualValue=(Float[])sintArray.toArray();
        CIMDataType real32ArrType = new CIMDataType(CIMDataType.REAL32_ARRAY);
        cimval=new CIMValue(actualValue,real32ArrType);                   
      }
      break;

      case CIMDataType.REAL64_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Double bt=new Double(Double.parseDouble((arrayIt.next()).toString()));
          sintArray.add(bt);
        }
        Object actualValue=(Double[])sintArray.toArray();
        CIMDataType real64ArrType = new CIMDataType(CIMDataType.REAL64_ARRAY);
        cimval=new CIMValue(actualValue,real64ArrType);                   
      }
      break;

      case CIMDataType.BOOLEAN_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Boolean bt=Boolean.valueOf((arrayIt.next()).toString());
          sintArray.add(bt);
        }
        Object actualValue=(Boolean[])sintArray.toArray();
        CIMDataType boolArrType = new CIMDataType(CIMDataType.BOOLEAN_ARRAY);
        cimval=new CIMValue(actualValue,boolArrType);                   
      }
      break;
      case CIMDataType.CHAR16_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Character bt=new Character(((arrayIt.next()).toString()).charAt(0));
          sintArray.add(bt);
        }
        Object actualValue=(Character[])sintArray.toArray();
        CIMDataType char16ArrType = new CIMDataType(CIMDataType.CHAR16_ARRAY);
        cimval=new CIMValue(actualValue,char16ArrType);                   
      }
      break;

      case CIMDataType.STRING_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List sintArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          String bt=(arrayIt.next()).toString();
          sintArray.add(bt);
        }
        Object actualValue=(String[])sintArray.toArray();
        CIMDataType stringArrType = new CIMDataType(CIMDataType.STRING_ARRAY);
        cimval=new CIMValue(actualValue,stringArrType);                   
      }
      break;

      case CIMDataType.DATETIME_ARRAY:
      {
        if(!(CIMKeyValue instanceof List))
        {
          logger.severe(Thread.currentThread().getName()+" "+"expected a List");
          throw new SPLException("expected a List");
        }
        List intArray=(List)CIMKeyValue;
        Iterator arrayIt=intArray.iterator();
        List cimDateTimeArray=new ArrayList();
        while(arrayIt.hasNext())
        {
          Object ob=arrayIt.next();
          if(!(ob instanceof Calendar)){
            throw new SPLException("Value should be of type Calendar");
          }
          Calendar cal=(Calendar)ob;
          CIMDateTime calCIM=new CIMSimpleDateTime(cal);
          cimDateTimeArray.add(calCIM);
        }
        Object actualValue=(CIMDateTime[])cimDateTimeArray.toArray();
        CIMDataType calArrType = new CIMDataType(CIMDataType.DATETIME_ARRAY);
        cimval=new CIMValue(actualValue,calArrType);                   
      }
      break;
   
      case CIMDataType.UINT8:
      {
        Short sht=new Short(Short.parseShort(CIMKeyValue.toString()));
        UnsignedInt8 uint8= new UnsignedInt8(sht.shortValue());
        CIMDataType uint8Type = new CIMDataType(CIMDataType.UINT8);
        cimval=new CIMValue(uint8,uint8Type);
      }
      break;
      case CIMDataType.UINT16:
      {
        Integer integ=new Integer(Integer.parseInt(CIMKeyValue.toString()));
        UnsignedInt16 uint16= new UnsignedInt16(integ.intValue());
        CIMDataType uint16Type = new CIMDataType(CIMDataType.UINT16);
        cimval=new CIMValue(uint16,uint16Type);
      }
      break;
      case CIMDataType.UINT32:
      {
        Long lng=new Long(Long.parseLong(CIMKeyValue.toString()));
        UnsignedInt32 uint32= new UnsignedInt32(lng.longValue());
        CIMDataType uint32Type = new CIMDataType(CIMDataType.UINT32);
        cimval=new CIMValue(uint32,uint32Type);
      }
      break;
      case CIMDataType.UINT64:
      {
        Long shrt=new Long(Long.parseLong(CIMKeyValue.toString()));
        BigInteger big=BigInteger.valueOf(shrt.longValue());
        UnsignedInt64 uint64= new UnsignedInt64(big.abs());
        CIMDataType uint64Type = new CIMDataType(CIMDataType.UINT64);
        cimval=new CIMValue(uint64,uint64Type);
      }
      break;
      case CIMDataType.SINT8:
      {
        Byte byt=new Byte(Byte.parseByte(CIMKeyValue.toString()));
        CIMDataType sint8Type = new CIMDataType(CIMDataType.SINT8);
        cimval=new CIMValue(byt,sint8Type);
      }
      break;
      case CIMDataType.SINT16:
      {
        Short sht=new Short(Short.parseShort(CIMKeyValue.toString()));
        CIMDataType sint16Type = new CIMDataType(CIMDataType.SINT16);
        cimval=new CIMValue(sht,sint16Type);
      }
      break;
      case CIMDataType.SINT32:
      {
        Integer integ=new Integer(Integer.parseInt(CIMKeyValue.toString()));
        CIMDataType sint32Type = new CIMDataType(CIMDataType.SINT32);
        cimval=new CIMValue(integ,sint32Type);
      }
      break;
      case CIMDataType.SINT64:
      {
        Long lng=new Long(Long.parseLong(CIMKeyValue.toString()));
        CIMDataType sint64Type = new CIMDataType(CIMDataType.SINT64);
        cimval=new CIMValue(lng,sint64Type);
      }
      break;
      case CIMDataType.REAL32:
      {
        Float flt=new Float(Float.parseFloat(CIMKeyValue.toString()));
        CIMDataType real32Type = new CIMDataType(CIMDataType.REAL32);
        cimval=new CIMValue(flt,real32Type);
      }
      break;
      case CIMDataType.REAL64:
      {
        Double dbl=new Double(Double.parseDouble(CIMKeyValue.toString()));
        CIMDataType real64Type = new CIMDataType(CIMDataType.REAL64);
        cimval=new CIMValue(dbl,real64Type);
      }
      break;
      case CIMDataType.CHAR16:
      {
        Character cha=new Character((CIMKeyValue.toString()).charAt(0));
        CIMDataType char16Type = new CIMDataType(CIMDataType.CHAR16);
        cimval=new CIMValue(cha,char16Type);
      }
      break;
      case CIMDataType.BOOLEAN:
      {
        Boolean booln=Boolean.valueOf(CIMKeyValue.toString());
        CIMDataType boolType = new CIMDataType(CIMDataType.BOOLEAN);
        cimval=new CIMValue(booln,boolType);
      }
      break;
      case CIMDataType.STRING:
      {
        String str=CIMKeyValue.toString();
        CIMDataType stringType = new CIMDataType(CIMDataType.STRING);
        cimval=new CIMValue(str,stringType);
      }
      break;
      case CIMDataType.DATETIME:
      {
        if(!(CIMKeyValue instanceof Calendar)){
          throw new SPLException("Value should be of type Calendar");
        }
        Calendar cal=(Calendar)CIMKeyValue;
        CIMDateTime calCIM=new CIMSimpleDateTime(cal);
        CIMDataType calType = new CIMDataType(CIMDataType.DATETIME);
        cimval=new CIMValue(calCIM,calType);
      }
      break;
      default:
        throw new SPLException("invalid type " + type);
View Full Code Here

TOP

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

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.