use of org.omg.CORBA.AttributeDescription in project ACS by ACS-Community.
the class BACIRemoteAccess method internalParentConnect.
/**
* Insert the method's description here.
* Creation date: (2.11.2000 0:35:23)
* @param baciNode si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteNode
*/
private void internalParentConnect(BACIRemoteNode baciNode, boolean doSync) {
/* we are using the parent to query the object as either an IDL attribute or
Java property accessor design pattern (returns Object type, takes no parameters)
*/
// System.out.println("IPC");
String targetName = null;
TypeCode retType = null;
String id = null;
if (baciNode.getNodeType() == ATTRIBUTE) {
AttributeDescription ad = (AttributeDescription) baciNode.getUserObject();
try {
id = ad.type.id();
} catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
throw new RemoteException("IDL: BadKind thrown on type id lookup for PROPERTY child of the remote node: " + bk);
}
targetName = BACIIntrospector.attributeNameToMethodName(ad.name);
retType = ad.type;
notifier.reportDebug("BACIRemoteAccess::internalParentConnect", "Obtaining IDL attribute reference for '" + ad.name + "'.");
} else if (baciNode.getNodeType() == PROPERTY) {
OperationDescription od = (OperationDescription) baciNode.getUserObject();
try {
id = od.result.id();
} catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
throw new RemoteException("IDL: BadKind thrown on type id lookup for PROPERTY child of the remote node: " + bk);
}
targetName = od.name;
retType = od.result;
notifier.reportDebug("BACIRemoteAccess::internalParentConnect", "Obtaining reference to contained object through property accessor design pattern for '" + od.name + ".");
} else
throw new IntrospectionInconsistentException("Devices can contain objects only as IDL attributes or property accessor design patterns. Failed on '" + baciNode + "'.");
BACIRemoteNode parentNode = (BACIRemoteNode) baciNode.getParent();
if (parentNode.getCORBARef() == null) {
parentNode.connect();
if (parentNode.getCORBARef() == null)
throw new RemoteException("Child node is accessible although the parent node CORBA reference is null. Failed on '" + baciNode + ".");
}
/* begin DII stanza */
Request req = parentNode.getCORBARef()._request(targetName);
req.set_return_type(retType);
notifier.reportDebug("BACIRemoteAccess::internalParentConnect", "Invoking remote call...");
req.invoke();
Any returnValue = req.return_value();
if (returnValue.type().kind() != TCKind.tk_objref)
throw new IntrospectionInconsistentException("Return type of '" + targetName + "' is not of type object reference, expected object reference because of BACI containment specifications.");
baciNode.setCORBARef(returnValue.extract_Object());
//
baciNode.setIFDesc(getIFDesc(id));
//
if (baciNode.getCORBARef() != null)
notifier.reportDebug("BACIRemoteAccess::internalParentConnect", "Connection to contained object OK.");
else
notifier.reportError("Reference returned when resolving contained object '" + targetName + "' is null.");
/* end DII stanza */
}
use of org.omg.CORBA.AttributeDescription in project wildfly by wildfly.
the class AttributeDefImpl method describe.
// ContainedImpl implementation ----------------------------------
public Description describe() {
String defined_in_id = "IR";
if (defined_in instanceof ContainedOperations)
defined_in_id = ((ContainedOperations) defined_in).id();
AttributeDescription d = new AttributeDescription(name, id, defined_in_id, version, typeCode, mode);
Any any = getORB().create_any();
AttributeDescriptionHelper.insert(any, d);
return new Description(DefinitionKind.dk_Attribute, any);
}
use of org.omg.CORBA.AttributeDescription in project wildfly by wildfly.
the class InterfaceDefImpl method describe_interface.
public FullInterfaceDescription describe_interface() {
if (fullInterfaceDescription != null)
return fullInterfaceDescription;
// Has to create the FullInterfaceDescription
// TODO
OperationDescription[] operations = new OperationDescription[0];
AttributeDescription[] attributes = new AttributeDescription[0];
String defined_in_id = "IDL:Global:1.0";
if (defined_in instanceof org.omg.CORBA.ContainedOperations)
defined_in_id = ((org.omg.CORBA.ContainedOperations) defined_in).id();
fullInterfaceDescription = new FullInterfaceDescription(name, id, defined_in_id, version, operations, attributes, base_interfaces, type(), is_abstract);
return fullInterfaceDescription;
}
use of org.omg.CORBA.AttributeDescription in project wildfly by wildfly.
the class ValueDefImpl method describe_value.
public FullValueDescription describe_value() {
if (fullValueDescription != null)
return fullValueDescription;
// Has to create the FullValueDescription
// TODO
OperationDescription[] operations = new OperationDescription[0];
AttributeDescription[] attributes = new AttributeDescription[0];
String defined_in_id = "IDL:Global:1.0";
if (defined_in instanceof org.omg.CORBA.ContainedOperations)
defined_in_id = ((org.omg.CORBA.ContainedOperations) defined_in).id();
fullValueDescription = new FullValueDescription(name, id, is_abstract, is_custom, defined_in_id, version, operations, attributes, getValueMembers(), // TODO
new Initializer[0], supported_interfaces, abstract_base_valuetypes, false, baseValue, typeCode);
return fullValueDescription;
}
use of org.omg.CORBA.AttributeDescription in project ACS by ACS-Community.
the class BACIRemoteAccess method invokeAccessor.
/**
* Insert the method's description here.
* Creation date: (7.11.2000 22:52:30)
* @return si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteCall
* @param att si.ijs.acs.objectexplorer.engine.BACI.BACIAttribute
*/
BACIRemoteCall invokeAccessor(BACIAttribute att) {
if (att == null)
throw new NullPointerException("att");
BACIRemote target = (BACIRemote) att.getIntrospectable();
if (target.getCORBARef() == null)
throw new RemoteException("Cannot invoke attribute accessor '" + att + "' on object '" + target.getName() + "' because it is not connected.");
org.omg.CORBA.Object remote = target.getCORBARef();
AttributeDescription desc = att.getAttributeDesc();
/* begin DII stanza */
Request req = remote._request(BACIIntrospector.attributeNameToMethodName(desc.name));
req.set_return_type(desc.type);
java.lang.Object[] params = new java.lang.Object[0];
int time = 0;
notifier.reportMessage("Invoking accessor '" + target.getName() + "." + att + "()'.");
notifier.reportDebug("BACIRemoteAccess::invokeAccessor", "Sending deferred attribute accessor '" + target.getName() + "." + att + "()'.");
try {
req.send_deferred();
while (!req.poll_response()) {
try {
Thread.sleep(POLL_SLEEP);
time += POLL_SLEEP;
} catch (InterruptedException ie) {
}
if (time > POLL_TIMEOUT) {
notifier.reportError("Timeout (" + POLL_TIMEOUT + " ms) while polling for response from '" + att + "' on '" + target.getName() + "'.");
return new BACIRemoteCall(target, att, params, null, true, null);
}
}
// check exception
checkException(target, req);
notifier.reportDebug("BACIRemoteAccess::invokeAccessor", "Received response for '" + target.getName() + "." + att + "()'.");
// req.get_response();
Any anyRet = req.return_value();
java.lang.Object oRet = null;
if (anyRet != null)
oRet = baciIntrospector.extractAny(anyRet);
notifier.reportDebug("BACIRemoteAccess::invokeAccessor", "Successfully unpacked response for '" + target.getName() + "." + att + "()'.");
return new BACIRemoteCall(target, att, params, oRet, false, null);
} catch (Exception e) {
notifier.reportError("Exception during deferred remote invocation.", e);
return new BACIRemoteCall(target, att, params, null, false, e);
}
/* end DII stanza */
}
Aggregations