use of org.wildfly.iiop.openjdk.rmi.ExceptionAnalysis 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.ExceptionAnalysis in project wildfly by wildfly.
the class InterfaceRepository method addOperations.
/**
* Add a set of operations to a container (interface or value class).
*/
private void addOperations(LocalContainer container, ContainerAnalysis ca) throws RMIIIOPViolationException, IRConstructionException {
OperationAnalysis[] ops = ca.getOperations();
for (int i = 0; i < ops.length; ++i) {
OperationDefImpl oDef;
String oName = ops[i].getIDLName();
String oid = ca.getMemberRepositoryId(oName);
Class cls = ops[i].getReturnType();
TypeCode typeCode = getTypeCode(cls);
ParameterAnalysis[] ps = ops[i].getParameters();
ParameterDescription[] params = new ParameterDescription[ps.length];
for (int j = 0; j < ps.length; ++j) {
params[j] = new ParameterDescription(ps[j].getIDLName(), getTypeCode(ps[j].getCls()), // filled in later
null, ParameterMode.PARAM_IN);
}
ExceptionAnalysis[] exc = ops[i].getMappedExceptions();
ExceptionDef[] exceptions = new ExceptionDef[exc.length];
for (int j = 0; j < exc.length; ++j) {
ExceptionDefImpl e = addException(exc[j]);
exceptions[j] = ExceptionDefHelper.narrow(e.getReference());
}
oDef = new OperationDefImpl(oid, oName, "1.0", container, typeCode, params, exceptions, impl);
container.add(oName, oDef);
}
}
Aggregations