use of org.omg.CORBA.IRObject in project ACS by ACS-Community.
the class BACIIntrospector method IDtoClassName.
/**
* Insert the method's description here.
* Creation date: (13.11.2000 0:59:30)
* @return java.lang.String
* @param ID java.lang.String
*/
public String IDtoClassName(String ID) {
if (ID == null)
throw new NullPointerException("ID");
String retVal = (String) IDLtoJavaMapping.get(ID);
if (retVal != null)
return retVal;
else {
int index1 = 0;
int index2 = 0;
index1 = ID.indexOf(':');
index2 = ID.lastIndexOf(':');
if (index1 == index2)
throw new IntrospectionInconsistentException("IDL ID '" + ID + "' is not well-formed because it contains only one ':' character");
String partial = ID.substring(index1 + 1, index2);
index1 = partial.lastIndexOf('/');
index2 = partial.indexOf('/');
if (index1 == -1 || index2 == -1)
throw new IntrospectionInconsistentException("IDL ID '" + ID + "' is not well-formed because it does not contain module separators '/'.");
if (index1 == index2)
return addIDLPackagePrefix(partial.replace('/', '.'));
String lookup = "IDL:" + partial.substring(0, index1) + ":1.0";
if (index1 != index2) {
// reverse order of pragma prefix
final String delimiter = ".";
StringTokenizer stringTokenizer = new StringTokenizer(partial.substring(0, index2), delimiter);
String reversedPragma = stringTokenizer.nextToken();
while (stringTokenizer.hasMoreTokens()) reversedPragma = stringTokenizer.nextToken() + delimiter + reversedPragma;
partial = reversedPragma + partial.substring(index2);
}
ra.getNotifier().reportDebug("BACIIntrospector::IDtoClassName", "Analysing IDL to Java mapping of type '" + ID + "'. Querying IR for parent container '" + lookup + "'.");
IRObject ctd = ra.lookupId(lookup);
if (ctd == null)
throw new IntrospectionInconsistentException("Repository does not contain container '" + lookup + "' of child '" + ID + "'.");
if (ctd.def_kind() == DefinitionKind.dk_Module)
retVal = addIDLPackagePrefix(partial.replace('/', '.'));
else
retVal = addIDLPackagePrefix(partial.substring(0, index1).replace('/', '.') + "Package." + partial.substring(index1 + 1));
IDLtoJavaMapping.put(ID, retVal);
return retVal;
}
}
Aggregations