The entry point of the SBLIM CIM Client is the org.sblim.wbem.client.CIMClient class. An instance of this
class encapsulates a client connection to a CIMOM. The API represents the WBEM operations. Other quite important classe are
found in the org.sblim.wbem.cim package that contains the Java representations of all CIM objects.
The following code snippet opens a connection, enumerates all CIM_RegisteredProfile instances and traverses the association
CIM_ElementConformsToProfile.
String cimAgentAddress = "https://127.0.0.1:5989";
String namespace = "root/ibm";
String user = "youruser";
String pw = "yourpawo";
UserPrincipal userPr = new UserPrincipal(user);
PasswordCredential pwCred = new PasswordCredential(pw);
CIMNameSpace ns = new CIMNameSpace(cimAgentAddress,namespace);
CIMClient cimClient = new CIMClient(ns,userPr,pwCred);
try {
CIMObjectPath rpCOP = new CIMObjectPath("CIM_RegisteredProfile");
System.out.println("Looking for children of CIM_RegisteredProfile");
Enumeration rpEnm = cimClient.enumerateInstanceNames(rpCOP);
while (rpEnm.hasMoreElements()) {
CIMObjectPath rp = (CIMObjectPath) rpEnm.nextElement();
System.out.println(" Found: "+rp);
System.out.println(" Traversing CIM_ElementConformsToProfile association...");
Enumeration systemEnum = cimClient.associatorNames(rp,"CIM_ElementConformsToProfile",null,null,null);
while (systemEnum.hasMoreElements()) {
CIMObjectPath system = (CIMObjectPath) systemEnum.nextElement();
System.out.println(" Found: "+system);
}
}
} finally {
cimClient.close();
}