use of org.wildfly.iiop.openjdk.rmi.ValueAnalysis in project wildfly by wildfly.
the class InterfaceRepository method addClass.
/**
* Map the class and add its IIOP mapping to the repository.
*/
private void addClass(Class cls) throws RMIIIOPViolationException, IRConstructionException {
if (cls.isPrimitive())
// No need to add primitives.
return;
if (cls.isArray()) {
// Add array mapping
addArray(cls);
} else if (cls.isInterface()) {
if (!RmiIdlUtil.isAbstractValueType(cls)) {
// Analyse the interface
InterfaceAnalysis ia = InterfaceAnalysis.getInterfaceAnalysis(cls);
// Add analyzed interface (which may be abstract)
addInterface(ia);
} else {
// Analyse the value
ValueAnalysis va = ValueAnalysis.getValueAnalysis(cls);
// Add analyzed value
addValue(va);
}
} else if (Exception.class.isAssignableFrom(cls)) {
// Exception type.
// Analyse the exception
ExceptionAnalysis ea = ExceptionAnalysis.getExceptionAnalysis(cls);
// Add analyzed exception
addException(ea);
} else {
// Got to be a value type.
// Analyse the value
ValueAnalysis va = ValueAnalysis.getValueAnalysis(cls);
// Add analyzed value
addValue(va);
}
}
use of org.wildfly.iiop.openjdk.rmi.ValueAnalysis in project wildfly by wildfly.
the class InterfaceRepository method getJavaxRmiCORBAClassDesc.
/**
* Get a reference to the special case mapping for java.lang.Class.
* This is according to "Java(TM) Language to IDL Mapping Specification",
* section 1.3.5.11.
*/
private ValueDefImpl getJavaxRmiCORBAClassDesc() throws IRConstructionException, RMIIIOPViolationException {
if (javaxRmiCORBAClassDesc == null) {
// Just map the right value class
ValueAnalysis va = ValueAnalysis.getValueAnalysis(javax.rmi.CORBA.ClassDesc.class);
ValueDefImpl val = addValue(va);
// Warn if it does not conform to the specification.
if (!"RMI:javax.rmi.CORBA.ClassDesc:B7C4E3FC9EBDC311:CFBF02CF5294176B".equals(val.id()))
IIOPLogger.ROOT_LOGGER.warnClassDescDoesNotConformToSpec();
javaxRmiCORBAClassDesc = val;
}
return javaxRmiCORBAClassDesc;
}
use of org.wildfly.iiop.openjdk.rmi.ValueAnalysis in project wildfly by wildfly.
the class InterfaceRepository method addValue.
/**
* Add a value type.
*/
private ValueDefImpl addValue(ValueAnalysis va) throws RMIIIOPViolationException, IRConstructionException {
ValueDefImpl vDef;
Class cls = va.getCls();
// Lookup: Has it already been added?
vDef = (ValueDefImpl) valueMap.get(cls);
if (vDef != null)
// Yes, just return it.
return vDef;
// Get module to add value to.
ModuleDefImpl m = ensurePackageExists(cls.getPackage().getName());
// Add implemented interfaces
String[] supported_interfaces = addInterfaces(va);
// Add abstract base valuetypes
String[] abstract_base_valuetypes = addAbstractBaseValuetypes(va);
// Add superclass
ValueDefImpl superValue = null;
ValueAnalysis superAnalysis = va.getSuperAnalysis();
if (superAnalysis != null)
superValue = addValue(superAnalysis);
// Create the value
String base = cls.getName();
base = base.substring(base.lastIndexOf('.') + 1);
base = Util.javaToIDLName(base);
TypeCode baseTypeCode;
if (superValue == null)
baseTypeCode = orb.get_primitive_tc(TCKind.tk_null);
else
baseTypeCode = superValue.type();
vDef = new ValueDefImpl(va.getRepositoryId(), base, "1.0", m, va.isAbstractValue(), va.isCustom(), supported_interfaces, abstract_base_valuetypes, baseTypeCode, impl);
addTypeCode(cls, vDef.type());
m.add(base, vDef);
// Remember we mapped this.
valueMap.put(cls, vDef);
// Fill in constants.
addConstants(vDef, va);
// Add value members
ValueMemberAnalysis[] vmas = va.getMembers();
for (int i = 0; i < vmas.length; ++i) {
ValueMemberDefImpl vmDef;
String vmid = va.getMemberRepositoryId(vmas[i].getJavaName());
String vmName = vmas[i].getIDLName();
Class vmCls = vmas[i].getCls();
TypeCode typeCode = getTypeCode(vmCls);
boolean vmPublic = vmas[i].isPublic();
vmDef = new ValueMemberDefImpl(vmid, vmName, "1.0", typeCode, vmPublic, vDef, impl);
vDef.add(vmName, vmDef);
}
// Add attributes
addAttributes(vDef, va);
return vDef;
}
use of org.wildfly.iiop.openjdk.rmi.ValueAnalysis in project wildfly by wildfly.
the class InterfaceRepository method addAbstractBaseValuetypes.
/**
* Add a set of abstract valuetypes to the IR.
*
* @return An array of the IR IDs of the abstract valuetypes.
*/
private String[] addAbstractBaseValuetypes(ContainerAnalysis ca) throws RMIIIOPViolationException, IRConstructionException {
ValueAnalysis[] abstractValuetypes = ca.getAbstractBaseValuetypes();
List abstract_base_valuetypes = new ArrayList();
for (int i = 0; i < abstractValuetypes.length; ++i) {
ValueDefImpl vdi = addValue(abstractValuetypes[i]);
abstract_base_valuetypes.add(vdi.id());
}
String[] strArr = new String[abstract_base_valuetypes.size()];
return (String[]) abstract_base_valuetypes.toArray(strArr);
}
Aggregations