當前位置: 首頁>>代碼示例>>Java>>正文


Java CIMProperty類代碼示例

本文整理匯總了Java中javax.cim.CIMProperty的典型用法代碼示例。如果您正苦於以下問題:Java CIMProperty類的具體用法?Java CIMProperty怎麽用?Java CIMProperty使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CIMProperty類屬於javax.cim包,在下文中一共展示了CIMProperty類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEntryByName

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * Find property by name
 *
 * @param list prop list
 * @param name sought name
 * @return prop or null
 */
public static CIMProperty getEntryByName(CIMPropertyArrayList list, String name) {
    CIMProperty result = null;
    for (CIMProperty cimp : list) {
        if (cimp.getName().equals(name)) {
            result = cimp;
            break;
        }
    }
    return result;
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:18,代碼來源:CimUbluHelper.java

示例2: getKeyByName

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * Get key by name for instance
 *
 * @param cimi instance
 * @param name
 * @return key by name for instance
 */
public static CIMProperty getKeyByName(CIMInstance cimi, String name) {
    CIMProperty result = null;
    CIMPropertyArrayList list = getKeys(cimi);
    for (CIMProperty cimp : list) {
        if (cimp.getName().equals(name)) {
            result = cimp;
            break;
        }
    }
    return result;
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:19,代碼來源:CimUbluHelper.java

示例3: getPropByName

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * Get key by name for instance
 *
 * @param cimi instance
 * @param name
 * @return key by name for instance
 */
public static CIMProperty getPropByName(CIMInstance cimi, String name) {
    CIMProperty result = null;
    CIMPropertyArrayList list = getProps(cimi);
    for (CIMProperty cimp : list) {
        if (cimp.getName().equals(name)) {
            result = cimp;
            break;
        }
    }
    return result;
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:19,代碼來源:CimUbluHelper.java

示例4: getPropByInt

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * Get key by name for instance
 *
 * @param cimi instance
 * @param index
 * @return key by name for instance
 */
public static CIMProperty getPropByInt(CIMInstance cimi, int index) {
    CIMProperty result = null;
    CIMPropertyArrayList list = getProps(cimi);
    for (CIMProperty cimp : list) {
        if (cimp.getName().equals(index)) {
            result = cimp;
            break;
        }
    }
    return result;
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:19,代碼來源:CimUbluHelper.java

示例5: toStringArray

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * Export CIMPropertyArrayList to a string array list
 *
 * @return CIMPropertyArrayList as a string array list
 */
public String[] toStringArray() {
    StringArrayList sal = new StringArrayList();
    for (CIMProperty c : this) {
        sal.add(c.toString());
    }
    return sal.toStringArray();
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:13,代碼來源:Generics.java

示例6: cimProperties

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * Knows how to read CIMProperty objects and put them in a string format
 *
 * @param properties to list out pretty print
 * @param format     to use in pretty print, like "%s='%s',"
 * @return a string representing the properties with the format string repeatedly applied
 */
public String cimProperties(final CIMProperty<?>[] properties, final String format) {
    StringBuffer out = new StringBuffer();
    for (CIMProperty<?> property : properties) {
        String name = property.getName();
        Object value = property.getValue();
        if (value instanceof Object[]) {
            value = listing((Object[]) value);
        }
        out.append(String.format(format, name, (value != null) ? value : ""));
    }
    return out.toString();
}
 
開發者ID:jdgwartney,項目名稱:vsphere-ws,代碼行數:20,代碼來源:CIMReader.java

示例7: testCpuOperationalStatus

import javax.cim.CIMProperty; //導入依賴的package包/類
@Test
public void testCpuOperationalStatus()
    throws Exception
{

    WBEMClient cimClient = null;

    ServiceServerNode node = new ServiceServerNode();
    node.setNodeID( "N3" );
    node.setIbIpAddress( "1.2.3.4" );
    node.setOsUserName( "root" );
    node.setOsPassword( "test123" );

    URL cimomUrl = new URL( "https://" + node.getIbIpAddress() + ":" + 5989 );
    cimClient = WBEMClientFactory.getClient( WBEMClientConstants.PROTOCOL_CIMXML );

    List<CIMInstance> instancesList = new ArrayList<CIMInstance>();

    // Constructing OMC_Processor entry CPU SOCKET 0
    CIMProperty<String> cimProperty =
        new CIMProperty<String>( "ElementName", null, "SOCKET 0", true, true, "OMC_Processor" );
    CIMProperty<UnsignedInteger16> cimProperty1 =
        new CIMProperty<UnsignedInteger16>( "HealthState", null, new UnsignedInteger16( "5" ), true, true,
                                            "OMC_Processor" );
    CIMProperty<UnsignedInteger16> cimProperty2 =
        new CIMProperty<UnsignedInteger16>( "CPUStatus", null, new UnsignedInteger16( "4" ), true, true,
                                            "OMC_Processor" );
    CIMProperty cimPropertyList[] = { cimProperty, cimProperty1, cimProperty2 };

    // Constructing OMC_Processor entry CPU SOCKET 1
    CIMProperty<String> cimPropertyNonOperaional =
        new CIMProperty<String>( "ElementName", null, "SOCKET 1", true, true, "OMC_Processor" );
    CIMProperty<UnsignedInteger16> cimPropertyNonOperaional1 =
        new CIMProperty<UnsignedInteger16>( "HealthState", null, new UnsignedInteger16( "30" ), true, true,
                                            "OMC_Processor" );
    CIMProperty<UnsignedInteger16> cimPropertyNonOperaional2 =
        new CIMProperty<UnsignedInteger16>( "CPUStatus", null, new UnsignedInteger16( "3" ), true, true,
                                            "OMC_Processor" );
    CIMProperty cimPropertyList1[] =
        { cimPropertyNonOperaional, cimPropertyNonOperaional1, cimPropertyNonOperaional2 };

    CIMInstance instance = new CIMInstance( new CIMObjectPath( "/root/cimv2:OMC_Processor" ), cimPropertyList );
    CIMInstance instance1 = new CIMInstance( new CIMObjectPath( "/root/cimv2:OMC_Processor" ), cimPropertyList1 );

    instancesList.add( instance );
    instancesList.add( instance1 );

    List<CPUInfo> cpuInfoList = new ArrayList<CPUInfo>();
    CPUInfo cpu1 = new CPUInfo();
    ComponentIdentifier cpuIdentifier1 = new ComponentIdentifier();
    cpuIdentifier1.setManufacturer( "INTEL" );
    cpuIdentifier1.setProduct( "Intel Xeon Processor" );
    cpu1.setComponentIdentifier( cpuIdentifier1 );
    cpu1.setId( "1" );
    cpu1.setMaxClockFrequency( (long) 2600 );
    cpu1.setTotalCpuCores( 4 );
    cpuInfoList.add( cpu1 );

    CPUInfo cpu2 = new CPUInfo();
    ComponentIdentifier cpuIdentifier2 = new ComponentIdentifier();
    cpuIdentifier2.setManufacturer( "INTEL" );
    cpuIdentifier2.setProduct( "Intel Xeon Processor" );
    cpu1.setComponentIdentifier( cpuIdentifier2 );
    cpu2.setId( "2" );
    cpu2.setMaxClockFrequency( (long) 2600 );
    cpu2.setTotalCpuCores( 4 );
    cpuInfoList.add( cpu2 );

    CpuInfoOperationalStatusHelper cpuInfoOperationalStatusHelper = new CpuInfoOperationalStatusHelper( node );
    cpuInfoOperationalStatusHelper.getProcessorInformation( cimClient, instancesList, cpuInfoList );

    assertEquals( cpuInfoList.get( 0 ).getFruOperationalStatus().toString(),
                  FruOperationalStatus.Operational.toString() );
    assertEquals( cpuInfoList.get( 1 ).getFruOperationalStatus().toString(),
                  FruOperationalStatus.NonOperational.toString() );

    // System.out.println("CPU Operational status: " +cpuInfoList.get(0).getFruOperationalStatus());
    // System.out.println("CPU NonOperational status: " +cpuInfoList.get(1).getFruOperationalStatus());
}
 
開發者ID:vmware,項目名稱:OHMS,代碼行數:80,代碼來源:CpuInfoOperationalStatusHelperTest.java

示例8: newPath

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 *
 * @param url
 * @param pNamespace
 * @param pObjectName
 * @param pKeys
 * @param pXmlSchemaName
 * @return
 */
public static CIMObjectPath newPath(URL url, String pNamespace, String pObjectName, CIMPropertyArrayList pKeys, String pXmlSchemaName) {
    return new CIMObjectPath(url == null ? null : url.getProtocol(),
            url == null ? null : url.getHost(),
            url == null ? null : String.valueOf(url.getPort()),
            pNamespace, pObjectName,
            pKeys == null ? null : pKeys.toArray(new CIMProperty[pKeys.size()]),
            pXmlSchemaName);
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:18,代碼來源:CimUbluHelper.java

示例9: listProperties

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * builds a list of properties as a map based on an instance, instance objects hold local copies
 * of the properties associated with the server-side instance. This may not be the whole set
 * of properties.
 * <p/>
 * NOTE: be sure to use "getInstance(path,true,true,null)" if you want to see <i>all</i> the
 *
 * @param instance the instance to examine (holds a local subset of properties)
 * @return a map of the properties available in the instance
 * @throws WBEMException
 */
public Map<String, Object> listProperties(CIMInstance instance) throws WBEMException {
    final Map<String, Object> results = new java.util.LinkedHashMap<String, Object>();
    for (CIMProperty<?> property : instance.getProperties()) {
        results.put(property.getName(), property.getValue());
    }
    return results;
}
 
開發者ID:jdgwartney,項目名稱:vsphere-ws,代碼行數:19,代碼來源:CIMReader.java

示例10: CIMPropertyArrayList

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * ctor/1
 *
 * @param cIMPropertys array of properties
 */
public CIMPropertyArrayList(CIMProperty[] cIMPropertys) {
    addAll(Arrays.asList(cIMPropertys));
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:9,代碼來源:Generics.java

示例11: instanceProperties

import javax.cim.CIMProperty; //導入依賴的package包/類
/**
 * pretty print the properties of an instance
 *
 * @param instance examine this
 * @return a string pretty print of the instance's properties
 */
public String instanceProperties(CIMInstance instance) {
    final CIMProperty<?>[] properties = instance.getProperties();
    return cimProperties(properties, "%s=\"%s\",");
}
 
開發者ID:jdgwartney,項目名稱:vsphere-ws,代碼行數:11,代碼來源:CIMReader.java


注:本文中的javax.cim.CIMProperty類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。