Search in sources :

Example 1 with DataElement

use of si.ijs.acs.objectexplorer.engine.DataElement in project ACS by ACS-Community.

the class BACIIntrospector method getDef.

private DataElement getDef(TypeCode tc) {
    int value = tc.kind().value();
    switch(value) {
        case TCKind._tk_struct:
            try {
                if (structs.search(tc.id()) != -1)
                    return null;
                structs.push(tc.id());
                DataElement ret = getStructDef(tc);
                structs.pop();
                return ret;
            } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
                e.printStackTrace();
                return null;
            }
        case TCKind._tk_enum:
            return getEnumDef(tc);
        case TCKind._tk_alias:
        case TCKind._tk_sequence:
        case TCKind._tk_array:
            try {
                return getDef(tc.content_type());
            } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
                e.printStackTrace();
                return null;
            }
        default:
            //System.out.println("Definition not supported: "+value);
            return null;
    }
}
Also used : DataElement(si.ijs.acs.objectexplorer.engine.DataElement)

Example 2 with DataElement

use of si.ijs.acs.objectexplorer.engine.DataElement in project ACS by ACS-Community.

the class ReporterBean method toString.

/**
 */
public static String toString(RemoteCall call, boolean expand) {
    StringBuffer result = new StringBuffer(500);
    result.append('[');
    result.append(call.getSN());
    result.append("] : ");
    //result.append(System.currentTimeMillis());
    result.append(IsoDateFormat.formatCurrentDate());
    result.append(" |--------------------------------------------------------\n");
    result.append(call.getIntrospectable().getName());
    String name = null;
    if (call.getAttribute() == null) {
        if (call.getOperation() != null)
            name = call.getOperation().getName();
        else
            throw (new NullPointerException("RemoteCall -- both Operation and Attribute are null"));
    } else
        name = call.getAttribute().toString();
    // do the conversion
    Converter converter;
    if (call.isAttributeAccess())
        converter = ObjectExplorer.getConverter(call.getAttribute().getIntrospectable());
    else
        converter = ObjectExplorer.getConverter(call.getOperation().getIntrospectable());
    Object returnValue = call.getSyncReturnValue();
    Object[] auxs = call.getAuxReturnValues();
    if (converter != null && converter.acceptConvert(name))
        returnValue = converter.convert(name, auxs, returnValue);
    result.append('.');
    result.append(name);
    result.append('\n');
    result.append(" --> Return value: ");
    if ((call.getOperation() != null) && (call.getOperation().getReturnType().getType() == Void.TYPE))
        result.append("void");
    else {
        if (returnValue == null)
            result.append(DataFormatter.unpackReturnValue(returnValue, "      ", 0, expand));
        else if (returnValue.getClass().isArray())
            result.append(DataElementFormatter.unpackArray(returnValue, "      ", 0, expand));
        else if (returnValue instanceof DataElement)
            result.append(((DataElement) returnValue).toString("      ", 0, expand));
        else
            result.append(DataFormatter.unpackReturnValue(returnValue, "      ", 0, expand));
    }
    result.append('\n');
    if (auxs != null) {
        for (int i = 0; i < auxs.length; i++) if (auxs[i] != null) {
            if (auxs[i].getClass().isArray())
                result.append(" --> Auxiliary return value '" + call.getOperation().getParameterNames()[i] + "' = " + DataElementFormatter.unpackArray(auxs[i], "      ", 0, expand));
            else if (auxs[i] instanceof DataElement)
                result.append(" --> Auxiliary return value '" + call.getOperation().getParameterNames()[i] + "' = " + ((DataElement) auxs[i]).toString("      ", 0, expand) + "\n");
            else
                result.append(" --> Auxiliary return value '" + call.getOperation().getParameterNames()[i] + "' = " + DataFormatter.unpackReturnValue(auxs[i], "      ", 0, expand) + "\n");
        }
        result.append('\n');
    }
    if (call.getThrowable() != null) {
        result.append(" --> Exception: " + call.getThrowable() + "\n");
        if (call.getThrowable() instanceof DataElement)
            result.append(((DataElement) call.getThrowable()).toString("/      ", 0, expand));
        else
            result.append(DataFormatter.unpackReturnValue(call.getThrowable(), "/      ", 0, expand));
    }
    if (call.isTimeout()) {
        result.append(" --> Timeout raised by the engine while waiting for response.\n");
    }
    return result.toString();
}
Also used : DataElement(si.ijs.acs.objectexplorer.engine.DataElement) Converter(si.ijs.acs.objectexplorer.engine.Converter)

Aggregations

DataElement (si.ijs.acs.objectexplorer.engine.DataElement)2 Converter (si.ijs.acs.objectexplorer.engine.Converter)1