Class names
The TADDM Common Data Model class object names can be referenced by either their long name or their short name. Most object names can be referenced by their short name.
For a computer system, the short name is ComputerSystem and the long name is com.collation.platform.model.topology.sys.ComputerSystem.
The exception to the usage of short names is in the case of duplicates.
For example, SSLSettings must be referenced by its long name because
there are 2 instances of SSLSettings:
- com.collation.platform.model.topology.app.lotus.SSLSettings
- com.collation.platform.model.topology.app.SSLSettings.
The following code sample displays all the short and long names
for classes in the Common Data Model. Once you run this command, the
duplicate class names which must be referenced by their long name
are listed at the end of the results.
DisplayClassNames sample
import com.collation.proxy.api.client.*;
import com.collation.proxy.api.util.*;
import com.ibm.cdb.api.ApiFactory;
import java.util.*;
class DisplayClassNames {
public static void main(String[] args) {
CMDBApi api = null;
try {
System.out.println("--- Displaying Model Object Names ----" );
ApiConnection conn = ApiFactory.getInstance().
getApiConnection("localhost", -1, null, false);
ApiSession sess1 = ApiFactory.getInstance().getSession(conn,
"administrator",
"collation", ApiSession.DEFAULT_VERSION);
api = sess1.createCMDBApi();
String[] classNameArray = api.getClassNames();
ArrayList shortNames = new ArrayList(classNameArray.length);
ArrayList dups = new ArrayList(10);
for (int i = 0; i < classNameArray.length; i++) {
// print the short and long class names
System.out.println ("\nShort Name = " + classNameArray[i]);
System.out.println ("Long Name = " + classNameArray[i+1]);
// See if short name is a dup
if (shortNames.contains(classNameArray[i])) {
dups.add(classNameArray[i]);
} else {
shortNames.add(classNameArray[i]);
}
i++;
}
System.out.println("\nThe following classes must be specified using
the long name: ");
System.out.println(dups);
sess1.close();
} catch(Exception ex) {
ex.printStackTrace();
} finally {
if (api != null) {
try {
api.close();
} catch (Exception e) { }
}
}
}
}