클래스 이름
TADDM 공통 데이터 모델 클래스 오브젝트 이름은 자세한 이름 또는 축약형 이름으로 참조할 수 있습니다. 대부분의 오브젝트 이름은 축약형 이름으로 참조할 수 있습니다.
컴퓨터 시스템의 경우, 축약형 이름은 ComputerSystem이고 자세한 이름은 com.collation.platform.model.topology.sys.ComputerSystem입니다.
축약형 이름을 사용하지 않는 경우는 중복되는 경우입니다. 예를 들어, SSLSettings의 인스턴스가 두 개이므로 SSLSettings는
자세한 이름으로 참조해야 합니다.
com.collation.platform.model.topology.app.lotus.SSLSettingscom.collation.platform.model.topology.app.SSLSettings.
다음 코드 샘플은 공통 데이터 모델의 클래스에 대한 축약형 이름과
자세한 이름을 모두 표시합니다. 이 명령을 실행하면 결과 끝
부분에 자세한 이름으로 참조해야 하는 중복된 클래스 이름
목록이 표시됩니다.
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) { }
}
}
}
}