本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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());
}
示例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);
}
示例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;
}
示例10: CIMPropertyArrayList
import javax.cim.CIMProperty; //导入依赖的package包/类
/**
* ctor/1
*
* @param cIMPropertys array of properties
*/
public CIMPropertyArrayList(CIMProperty[] cIMPropertys) {
addAll(Arrays.asList(cIMPropertys));
}
示例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\",");
}