Search in sources :

Example 1 with ParameterDescription

use of org.omg.CORBA.ParameterDescription in project ACS by ACS-Community.

the class BACIIntrospector method getOperations.

/**
 * Insert the method's description here.
 * Creation date: (2.11.2000 0:44:52)
 */
public BACIOperation[] getOperations(BACIRemote target) {
    if (target == null)
        throw new NullPointerException("target");
    OperationDescription[] operations = target.getIFDesc().operations;
    ArrayList<BACIOperation> tempList = new ArrayList<BACIOperation>();
    for (int i = 0; i < operations.length; i++) {
        ra.getNotifier().reportDebug("BACIIntrospector::getOperations", "Analysing operation '" + operations[i].name + "'.");
        ParameterDescription[] ps = operations[i].parameters;
        String[] names = new String[ps.length];
        //Class[] types = new Class[ps.length];
        DataType[] types = new DataType[ps.length];
        boolean[] mask = new boolean[ps.length];
        int cb = -1;
        boolean unsupportedOperation = false;
        for (int j = 0; j < ps.length; j++) {
            try {
                names[j] = ps[j].name;
                types[j] = new BACIDataType(getClassType(ps[j].type));
                types[j].setElement(getDef(ps[j].type));
                types[j].setArrayType(getArrayType(ps[j].type));
                if (isOfType(ps[j].type, ID_CALLBACK)) {
                    if (cb != -1)
                        throw new IntrospectionInconsistentException("Operation '" + operations[i].name + "' declares more than one callback parameter.");
                    cb = j;
                    if (cb == ps.length - 1 && ra.isStrict())
                        throw new IntrospectionInconsistentException("A callback parameter for operation '" + operations[i].name + "' must be followed by a 'CBDescIn' parameter.");
                }
                if (ps[j].mode == ParameterMode.PARAM_OUT || cb == j) {
                    mask[j] = false;
                } else
                    mask[j] = true;
                if (cb != -1 && j == cb + 1) {
                    try {
                        if (ID_CBDESCIN.equals(ps[j].type.id())) {
                            mask[j] = false;
                        } else if (ra.isStrict())
                            throw new IntrospectionInconsistentException("A callback parameter for opration '" + operations[i].name + "' must be followed by a 'CBDescIn' parameter.");
                    } catch (Exception bk) {
                        throw new RemoteException("Exception while analyzing typecode (getting typecode name raises exception). Exception: " + bk);
                    }
                }
            } catch (Exception e) {
                ra.getNotifier().reportDebug("BACIIntrospector::getOperations", "Failed to analyse parameter '" + ps[j].name + "' for operation '" + operations[i].name + "'. Removing it from operation list... Exception:" + e);
                e.printStackTrace();
                unsupportedOperation = true;
                break;
            }
        }
        if (!unsupportedOperation)
            tempList.add(new BACIOperation(ra, operations[i], target, names, types, mask, !(cb == -1), false));
    }
    BACIOperation[] retVal = new BACIOperation[tempList.size()];
    tempList.toArray(retVal);
    return retVal;
}
Also used : ArrayList(java.util.ArrayList) IntrospectionInconsistentException(si.ijs.acs.objectexplorer.engine.IntrospectionInconsistentException) OperationDescription(org.omg.CORBA.OperationDescription) IntrospectionInconsistentException(si.ijs.acs.objectexplorer.engine.IntrospectionInconsistentException) RemoteException(si.ijs.acs.objectexplorer.engine.RemoteException) DataException(si.ijs.acs.objectexplorer.engine.DataException) DataType(si.ijs.acs.objectexplorer.engine.DataType) RemoteException(si.ijs.acs.objectexplorer.engine.RemoteException) ParameterDescription(org.omg.CORBA.ParameterDescription)

Example 2 with ParameterDescription

use of org.omg.CORBA.ParameterDescription 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

ParameterDescription (org.omg.CORBA.ParameterDescription)2 ArrayList (java.util.ArrayList)1 ExceptionDef (org.omg.CORBA.ExceptionDef)1 OperationDescription (org.omg.CORBA.OperationDescription)1 TypeCode (org.omg.CORBA.TypeCode)1 ExceptionAnalysis (org.wildfly.iiop.openjdk.rmi.ExceptionAnalysis)1 OperationAnalysis (org.wildfly.iiop.openjdk.rmi.OperationAnalysis)1 ParameterAnalysis (org.wildfly.iiop.openjdk.rmi.ParameterAnalysis)1 DataException (si.ijs.acs.objectexplorer.engine.DataException)1 DataType (si.ijs.acs.objectexplorer.engine.DataType)1 IntrospectionInconsistentException (si.ijs.acs.objectexplorer.engine.IntrospectionInconsistentException)1 RemoteException (si.ijs.acs.objectexplorer.engine.RemoteException)1