Search in sources :

Example 1 with ExceptionAnalysis

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);
    }
}
Also used : InterfaceAnalysis(org.wildfly.iiop.openjdk.rmi.InterfaceAnalysis) ValueAnalysis(org.wildfly.iiop.openjdk.rmi.ValueAnalysis) ExceptionAnalysis(org.wildfly.iiop.openjdk.rmi.ExceptionAnalysis)

Example 2 with ExceptionAnalysis

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);
    }
}
Also used : TypeCode(org.omg.CORBA.TypeCode) ExceptionAnalysis(org.wildfly.iiop.openjdk.rmi.ExceptionAnalysis) OperationAnalysis(org.wildfly.iiop.openjdk.rmi.OperationAnalysis) ParameterAnalysis(org.wildfly.iiop.openjdk.rmi.ParameterAnalysis) ExceptionDef(org.omg.CORBA.ExceptionDef) ParameterDescription(org.omg.CORBA.ParameterDescription)

Aggregations

ExceptionAnalysis (org.wildfly.iiop.openjdk.rmi.ExceptionAnalysis)2 ExceptionDef (org.omg.CORBA.ExceptionDef)1 ParameterDescription (org.omg.CORBA.ParameterDescription)1 TypeCode (org.omg.CORBA.TypeCode)1 InterfaceAnalysis (org.wildfly.iiop.openjdk.rmi.InterfaceAnalysis)1 OperationAnalysis (org.wildfly.iiop.openjdk.rmi.OperationAnalysis)1 ParameterAnalysis (org.wildfly.iiop.openjdk.rmi.ParameterAnalysis)1 ValueAnalysis (org.wildfly.iiop.openjdk.rmi.ValueAnalysis)1