use of si.ijs.acs.objectexplorer.engine.IntrospectionInconsistentException in project ACS by ACS-Community.
the class BACIRemoteAccess method internalInvokeInvocation.
/**
* Insert the method's description here.
* Creation date: (2.11.2000 18:08:47)
* @return si.ijs.acs.objectexplorer.engine.Invocation
* @param target si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteNode
* @param op si.ijs.acs.objectexplorer.engine.Operation
*/
private Invocation internalInvokeInvocation(//TODO update secondary tree???
BACIRemote target, BACIOperation op, java.lang.Object[] params, RemoteResponseCallback cb) {
int callbackIndex = baciIntrospector.getCallbackLocation(op);
if (callbackIndex == -1)
throw new IntrospectionInconsistentException("Asynchronous operation '" + op + "' must take exactly one callback parameter.");
/* create callback */
CallbackImpl cbImpl = null;
try {
cbImpl = new CallbackImpl(op.getOperationDesc().parameters[callbackIndex].type.id(), cb);
} catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
throw new RemoteException("Error while trying to analyze typecode: " + bk);
}
org.omg.CORBA.Object cbIF = cbImpl._this_object(orb);
notifier.reportDebug("BACIRemoteAccess::internalInvokeInvocation", "Activated callback object for '" + op + "'.");
DataStruct desc = new DataStruct("IDL:alma/ACS/CBDescIn:1.0");
desc.add("normal_timeout", new Long(1000000));
desc.add("negotiable_timeout", new Long(5000000));
desc.add("id_tag", new Integer(0));
params[callbackIndex] = cbIF;
if (callbackIndex == params.length - 1) {
if (!isStrict())
notifier.reportDebug("BACIRemoteAccess::internalInvokeInvocation", "Non-strict BACI invocation signature: callback is not followed by a descriptor.");
else
throw new IntrospectionInconsistentException("Callback cannot be the last argument, because it must be followed by the descriptor.");
} else
params[callbackIndex + 1] = desc;
BACIInvocation invoc = new BACIInvocation(TRANSIENT, op.getName(), null, cb, parent.getTree(), this);
cbImpl.setInvocation(invoc);
invoc.setRemoteCall(internalInvokeTrivial(target, op, params));
synchronized (invocations) {
invocations.add(invoc);
}
notifier.reportDebug("BACIRemoteAccess::internalInvokeInvocation", "Remote call ended, constructed Invocation. Returning...");
return invoc;
}
use of si.ijs.acs.objectexplorer.engine.IntrospectionInconsistentException in project ACS by ACS-Community.
the class BACIRemoteAccess method explodeDomainNode.
/**
* Insert the method's description here.
* Creation date: (1.11.2000 18:08:31)
* @return si.ijs.acs.objectexplorer.engine.BACI.BACITreeDataNode[]
* @param node si.ijs.acs.objectexplorer.engine.BACI.BACITreeDataNode
*/
private synchronized BACITreeDataNode[] explodeDomainNode(BACITreeDataNode n) {
if (n == null)
throw new NullPointerException("node");
if (n.childrenHolder == null)
return new BACITreeDataNode[0];
//TreeMap temp = new TreeMap();
ComponentInfo[] infos = new ComponentInfo[n.childrenHolder.size()];
n.childrenHolder.toArray(infos);
TreeMap tempTypes = new TreeMap();
TreeMap tempDomains = new TreeMap();
for (int i = 0; i < infos.length; i++) {
String cmp = null;
String domain = BACICURLResolver.resolveDomain(infos[i].name);
if (domain.endsWith("/"))
cmp = domain;
else
cmp = domain + "/";
if (n.domainRemainder.equals(cmp)) {
BACITreeDataNode node = (BACITreeDataNode) tempTypes.get(infos[i]);
if (node != null) {
// node.childrenHolder.add(infos[i].cob_curl);
node.childrenHolder.add(infos[i].name);
} else {
try {
node = new BACITreeDataNode(TYPE, BACIIntrospector.fullTypeToType(infos[i].type), BACIIntrospector.fullTypeToType(infos[i].type), parent.getTree(), getIcon(DOMAIN));
} catch (IntrospectionInconsistentException iie) {
notifier.reportError("Invalid IDL type '" + infos[i].type + "'.", iie);
continue;
}
node.childrenHolder = new ArrayList();
// node.childrenHolder.add(infos[i].cob_curl);
node.childrenHolder.add(infos[i].name);
tempTypes.put(infos[i].type, node);
}
} else {
if (domain.startsWith("/"))
domain = domain.substring(1);
if (!domain.endsWith("/"))
domain = domain + "/";
String dpart = domain.substring(n.domainRemainder.length(), domain.indexOf('/'));
BACITreeDataNode node = (BACITreeDataNode) tempDomains.get(dpart);
if (node != null) {
node.childrenHolder.add(infos[i]);
} else {
node = new BACITreeDataNode(DOMAIN, dpart, infos[i], parent.getTree(), getIcon(DOMAIN));
node.childrenHolder = new ArrayList();
node.childrenHolder.add(infos[i]);
node.domainRemainder = n.domainRemainder + dpart + "/";
tempDomains.put(dpart, node);
}
}
}
BACITreeDataNode[] arrayTypes = new BACITreeDataNode[tempTypes.size()];
tempTypes.values().toArray(arrayTypes);
BACITreeDataNode[] arrayDomains = new BACITreeDataNode[tempDomains.size()];
tempDomains.values().toArray(arrayDomains);
BACITreeDataNode[] retVal = new BACITreeDataNode[arrayTypes.length + arrayDomains.length];
System.arraycopy(arrayDomains, 0, retVal, 0, arrayDomains.length);
System.arraycopy(arrayTypes, 0, retVal, arrayDomains.length, arrayTypes.length);
notifier.reportDebug("BACIRemoteAccess::explodeDomainNode", "Processing for node '" + n + "' complete.");
//2010.02.05 panta@naoj
java.util.Arrays.sort(retVal);
return retVal;
}
use of si.ijs.acs.objectexplorer.engine.IntrospectionInconsistentException in project ACS by ACS-Community.
the class BACIIntrospector method getCallbackLocation.
/**
* Insert the method's description here.
* Creation date: (9.11.2000 0:23:33)
* @return java.lang.Object[]
* @param params java.lang.Object[]
* @param cb si.ijs.acs.objectexplorer.engine.RemoteResponseCallback
*/
public int getCallbackLocation(Operation op) {
if (op == null)
throw new NullPointerException("op");
DataType[] args = op.getParameterTypes();
int count = -1;
for (int i = 0; i < args.length; i++) {
if (alma.ACS.Callback.class.isAssignableFrom(args[i].getType())) {
if (count != -1)
throw new IntrospectionInconsistentException("Operation '" + op + "' declares more than one parameter that extends 'Callback'");
count = i;
if (i == args.length - 1 && ra.isStrict())
throw new IntrospectionInconsistentException("Operation '" + op + "' takes callback as its last parameter, but takes no 'CBDescIn' parameter.");
if (ra.isStrict() && !args[i + 1].equals(alma.ACS.CBDescIn.class))
throw new IntrospectionInconsistentException("Operation '" + op + "' does not take a 'CBDescIn' parameter after 'Callback' parameter.");
}
}
return count;
}
use of si.ijs.acs.objectexplorer.engine.IntrospectionInconsistentException 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;
}
Aggregations