Declaration
public class JIDLObject implements JIDLObjectI, java.io.Serializable
java.lang.Object
|
+--com.idl.javaidl.JIDLObject
All Implemented Interfaces:
JIDLObjectI, java.io.Serializable
Description
This class wraps an IDL object.
In many of the methods of this class, one or more flags are required to be specified for parameters being passed to or from the bridge. These flags follow the following guidelines:
For all types of parameters (subclasses of JIDLNumber, JIDLString, JIDLObjectI and JIDLArray), a flag should be set that determines whether the parameter is in-only (const) or in-out (we expect it to be changed by IDL). The constants that determine this are either JIDLConst.PARMFLAG_CONST or JIDLConst.PARMFLAG_IN_OUT.
For parameters that are arrays, a flag should be set that tells the bridge whether the array is to be convolved when passed to IDL. If the PARM_IN_OUT flag is set, this flag will also tell the bridge whether to convolve the array when it is copied back to Java. The constants that determine this are either JIDLConst.PARMFLAG_CONVMAJORITY or JIDLConst.PARMFLAG_NO_CONVMAJORITY.
For example, if the parameter in question is an array that is to be modified by IDL (in-out) and needs to be convolved when passed to and from IDL, set its argpal array member as follows:
argpal[2] = JIDLConst.PARMFLAG_IN_OUT | JIDLConst.PARMFLAG_CONV MAJORITY
Member Summary
Methods
void
abort()
Requests that the IDL process containing the underlying IDL object abort its current activity.
void
addIDLNotifyListener(JIDLNotifyListener listener)
Adds the specified IDL notify listener to receive IDL notification events on this object.
void
addIDLOutputListener(JIDLOutputListener listener)
Adds the specified IDL output listener to receive IDL output events on this object.
java.lang.Object
callFunction(java.lang.String sMethodName, int iPalFlag)
Call IDL function that accepts zero parameters.
java.lang.Object
callFunction(java.lang.String sMethodName, int argc, java.lang.Object argv, int[] argpal, int iPalFlag)
Call IDL function.
void
callProcedure(java.lang.String sMethodName)
Call IDL procedure that accepts zero parameters.
void
callProcedure(java.lang.String sMethodName, int argc, java.lang.Object argv, int[] argpal)
Call IDL procedure.
void
createObject()
Create the wrapped object by calling IDL’s ::INIT method.
void
createObject(int argc, java.lang.Object argv, int[] argpal)
Create the wrapped object by calling IDL’s ::INIT method.
void
createObject(int argc, java.lang.Object argv, int[] argpal, com.idl.javaidl.JIDLProcessInitializer initializer)
Create the wrapped object by calling IDL’s ::INIT method.
void
createObject(com.idl.javaidl.JIDLProcessInit ializer initializer)
Create the wrapped object by calling IDL’s ::INIT method.
void
destroyObject()
Destroys the underlying IDL object associated with the wrapper.
void
executeString(java.lang.String sCmd)
Execute the given command string in IDL.
java.lang.String
getClassName()
Get the class name of the object.
long
getCookie()
Internal use.
java.lang.String
getIDLObjectClassName()
Retrieves the IDL object class name of the underlying IDL object.
java.lang.String
getIDLObjectVariableName()
When the underlying IDL object was created in the IDL process, it was assigned a variable name.
java.lang.Object
getIDLVariable(java.lang.String sVar)
Given a variable name, return the IDL variable.
java.lang.String
getObjVariableName()
Get the IDL Variable name of the given object
java.lang.String
getProcessName()
Returns the name of the process that contains the underlying IDL object.
java.lang.Object
getProperty(java.lang.String sProperty, int iPalFlag)
Call IDL getProperty method to get named property.
void
initListeners()
Initialize listeners.
boolean
isObjCreated()
Determine if object has been created successfully.
boolean
isObjectCreated()
Determine if object has been created successfully.
boolean
isObjectDisplayable()
void
removeIDLNotifyListener(JIDLNotifyListener listener)
Removes the specified IDL notify listener so it no longer receives IDL notifications.
void
removeIDLOutputListener(JIDLOutputListener listener)
Removes the specified IDL output listener on this object.
void
setIDLVariable(java.lang.String sVar, java.lang.Object obj)
Set/Create an IDL variable of the given name and value.
void
setProcessName(java.lang.String process)
Set the process name that the object will be created in.
void
setProperty(java.lang.String sProperty, java.lang.Object obj, int iPalFlag)
Call IDL setProperty method to set named property.
java.lang.String
toString()
Returns a string representation of the object.
Inherited Member Summary
Methods inherited from class Object
equals(Object), getClass(), hashCode(), notify(), notifyAll(), wait(long, int), wait(long, int), wait(long, int)
Methods
abort()
public void abort()
Requests that the IDL process containing the underlying IDL object abort its current activity.
This is only a request and IDL may take a long time before it actually stops.
The client can only Abort the current IDL activity if that wrapper object is the current “owner” of the underlying IDL.
Specified By:
abort in interface JIDLObjectI
Throws:
JIDLException - If IDL encounters an error.
See Also:
JIDLAbortedException
addIDLNotifyListener(JIDLNotifyListener)
public void addIDLNotifyListener(com.idl.javaidl.JIDLNotifyListener listener)
Adds the specified IDL notify listener to receive IDL notification events on this object.
Note: Registering/unregistering for events should happen in the initListeners method or AFTER the createObject method.
Specified By:
addIDLNotifyListener in interface JIDLObjectI
Parameters:
listener - the listener
addIDLOutputListener(JIDLOutputListener)
public void addIDLOutputListener(com.idl.javaidl.JIDLOutputListener listener)
Adds the specified IDL output listener to receive IDL output events on this object.
Note: Registering/unregistering for events should happen in the initListeners method or AFTER the createObject method.
Specified By:
addIDLOutputListener in interface JIDLObjectI
Parameters:
listener - the listener
callFunction(String, int)
public java.lang.Object callFunction(java.lang.StringsMethodName, int iPalFlag)
Call IDL function that accepts zero parameters.
Parameters:
sMethodName - the function name
iPalFlag - a flag determining whether a returned array if convolved or not. If the returned value is not an array, this value is zero. See class description for more information.
Returns:
an Object of type JIDLNumber, JIDLString, JIDLObject or JIDLArray. The caller must know the type of the Object being returned and cast it to its proper type. May also return null.
Throws:
JIDLException - If IDL encounters an error.
See Also:
JIDLObjectI.callFunction(String, int, Object[], int[], int)
callFunction(String, int, Object[], int[], int)
public java.lang.Object callFunction(java.lang.String sMethodName, int argc, java.lang.Object[] argv, int[] argpal, int iPalFlag)
Call IDL function.
The argpal parameter is an array of flags created by OR-ing constants from class JIDLConst. Each array element corresponds to the equivalent parameter in argv.
Specified By:
callFunction in interface JIDLObjectI
Parameters:
sMethodName - the procedure name
argc - the number of parameters
argv - array of Objects to be passed to IDL. This array should be of length argc and should contain objects of type JIDLNumber, JIDLObject, JIDLString or JIDLObject.
argpal - array of flags denoting whether each argv parameter passed to be bridge is 1) in-out vs constant; or 2) a convolved or non-convolved array This array should be of length argc.
iPalFlag - a flag determining whether a returned array if convolved or not. If the returned value is not an array, this value is zero.
Returns:
an Object of type JIDLNumber, JIDLString, JIDLObjectI or JIDLArray. The caller must know the type of the Object being returned and cast it to its proper type.
Throws:
JIDLException - If IDL encounters an error.
See Also:
JIDLNumber, JIDLObject, JIDLString, JIDLArray, JIDLConst.PARMFLAG_CONST, JIDLConst.PARMFLAG_IN_OUT, JIDLConst.PARMFLAG_CONVMAJORITY, JIDLConst.PARMFLAG_NO_CONVMAJORITY
callProcedure(String)
public void callProcedure(java.lang.String sMethodName)
Call IDL procedure that accepts zero parameters.
Parameters:
sMethodName - the procedure name
Throws:
JIDLException - If IDL encounters an error.
See Also:
callProcedure(String, int, Object[], int[])
callProcedure(String, int, Object[], int[])
public void callProcedure(java.lang.String sMethodName, int argc, java.lang.Object[] argv, int[] argpal)
Call IDL procedure.
The argpal parameter is an array of flags created by OR-ing constants from class JIDLConst. Each array element corresponds to the equivalent parameter in argv.
Specified By:
callProcedure in interface JIDLObjectI
Parameters:
sMethodName - the procedure name
argc - the number of parameters
argv - array of Objects to be passed to IDL. This array should be of length argc and should contain objects of type JIDLNumber, JIDLObject, JIDLString or JIDLObject.
argpal - array of flags denoting whether each argv parameter passed to be bridge is 1) in-out vs constant; or 2) a convolved or non-convolved array This array should be of length argc.
Throws:
JIDLException - If IDL encounters an error.
See Also:
JIDLNumber, JIDLObject, JIDLString, JIDLArray, JIDLConst.PARMFLAG_CONST, JIDLConst.PARMFLAG_IN_OUT, JIDLConst.PARMFLAG_CONVMAJORITY, JIDLConst.PARMFLAG_NO_CONVMAJORITY
createObject()
public void createObject()
Create the wrapped object by calling IDL’s ::INIT method.
Used for ::INIT methods that take zero parameters. Assumes a default JIDLProcessInitializer.
Throws:
JIDLException - If IDL encounters an error.
See Also:
createObject(int, Object[], int[])
createObject(int, Object[], int[])
public void createObject(int argc, java.lang.Object[] argv, int[] argpal)
Create the wrapped object by calling IDL’s ::INIT method.
The argc, argv, argpal parameters are used to supply parameters to the underlying IDL object’s ::Init method.
If the ::Init method does not have any parameters, the caller sets argc, argv, argpal to 0, null, null, respectively. createObject does the following:
• Calls ::Init method in the IDL object
• Calls the superclass initListeners method to initialize any event handlers. The initListeners method has default behavior, which is different for graphical and non-graphical objects. If the default behavior is not desired, a sub-class to modify the listener initialization may override the initListeners method.
Specified By:
createObject in interface JIDLObjectI
Parameters:
argc - the number of parameters to be passed to INIT
argv - array of Objects to be passed to IDL. This array should be of length argc and should contain objects of type JIDLNumber, JIDLObject, JIDLString or JIDLArray.
argpal - array of flags denoting whether each argv parameter that is of type array should be convolved or not. For parameters that are not arrays, the value within the array will always be 0.
Throws:
JIDLException - If IDL encounters an error.
createObject(int, Object[], int[], JIDLProcessInitializer)
public void createObject(int argc, java.lang.Object[] argv, int[] argpal, com.idl.javaidl.JIDLProcessInitializer initializer)
Create the wrapped object by calling IDL’s ::INIT method.
The argc, argv, argpal parameters are used to supply parameters to the underlying IDL object’s ::Init method The initializer parameter is used to supply IDL process initialization values.
If the ::Init method does not have any parameters, the caller sets argc, argv, argpal to 0, null, null, respectively. createObject does the following:
• Calls ::Init method in the IDL object
• Calls the superclass initListeners method to initialize any event handlers. The initListeners method has default behavior, which is different for graphical and non-graphical objects. If the default behavior is not desired, a sub-class to modify the listener initialization may override the initListeners method.
Specified By:
createObject in interface JIDLObjectI
Parameters:
argc - the number of parameters to be passed to INIT
argv - array of Objects to be passed to IDL. This array should be of length argc and should contain objects of type JIDLNumber, JIDLObject, JIDLString or JIDLArray.
argpal - array of flags denoting whether each argv parameter that is of type array should be convolved or not. For parameters that are not arrays, the value within the array will always be 0.
initializer - a JIDLProcessInitializer object that specifies IDL process initialization parameters such as the licensing mode to be used..
Throws:
JIDLException - If IDL encounters an error.
createObject(JIDLProcessInitializer)
public void createObject(com.idl.javaidl.JIDLProcessInitializer initializer)
Create the wrapped object by calling IDL’s ::INIT method. Used for ::INIT methods that take zero parameters.
The initializer parameter is used to supply IDL process initialization values.
Parameters:
initializer - a JIDLProcessInitializer object that specifies IDL process initialization parameters such as the licensing mode to be used..
Throws:
JIDLException - If IDL encounters an error.
destroyObject()
public void destroyObject()
Destroys the underlying IDL object associated with the wrapper.
If the object being destroyed is the last object within an OPS process, the OPS process is also destroyed.
Note: This does not destroy the actual wrapper object. Because the wrapper object is a Java object, it follows all the Java reference counting/garbage collection schemes. Once all references to the wrapper object are released from Java code and once the Java Virtual Machine calls the garbage collector, the wrapper object may be deleted from memory.
Specified By:
destroyObject in interface JIDLObjectI
executeString(String)
public void executeString(java.lang.String sCmd)
Execute the given command string in IDL.
Specified By:
executeString in interface JIDLObjectI
Parameters:
sCmd - the single-line command to execute in IDL.
Throws:
JIDLException - If IDL encounters an error.
getClassName()
public java.lang.String getClassName()
Deprecated.
Replaced by getIDLObjectClassName() Get the class name of the object.
Returns:
class name (“” if object not created yet)
getCookie()
public long getCookie()
Internal use.
Specified By:
getCookie in interface JIDLObjectI
getIDLObjectClassName()
public java.lang.String getIDLObjectClassName()
Retrieves the IDL object class name of the underlying IDL object.
Specified By:
getIDLObjectClassName in interface JIDLObjectI
Returns:
the IDL object class name
getIDLObjectVariableName()
public java.lang.String getIDLObjectVariableName()
When the underlying IDL object was created in the IDL process, it was assigned a variable name. This method retrieves that name.
Specified By:
getIDLObjectVariableName in interface JIDLObjectI
Returns:
the variable name
getIDLVariable(String)
public java.lang.Object getIDLVariable(java.lang.String sVar)
Given a variable name, return the IDL variable.
Note: In the case of arrays, the array will ALWAYS be convolved when passed between Java and IDL.
Specified By:
getIDLVariable in interface JIDLObjectI
Parameters:
sVar - The IDL variable name
Returns:
an Object of type JIDLNumber, JIDLString, JIDLObject or JIDLArray. The caller must know the type of the Object being returned and cast it to its proper type. May also return null.
Throws:
JIDLException - If IDL encounters an error.
getObjVariableName()
public java.lang.String getObjVariableName()
Deprecated.
Replaced by getIDLObjectVariableName()
Get the IDL Variable name of the given object
Returns:
a String representing the IDL Variable name
getProcessName()
public java.lang.String getProcessName()
Returns the name of the process that contains the underlying IDL object. For an in- process object, returns an empty string.
Specified By:
getProcessName in interface JIDLObjectI
Returns:
process name. Empty string if the process is in-process.
getProperty(String, int)
public java.lang.Object getProperty(java.lang.StringsProperty, int iPalFlag)
Call IDL getProperty method to get named property.
Specified By:
getProperty in interface JIDLObjectI
Parameters:
sProperty - the property name
iPalFlag - a flag determining whether a returned array will be convolved or not. If the returned value is not is ignored.
Returns:
an Object of type JIDLNumber, JIDLString, JIDLObject or JIDLArray. The caller must know the type of the Object being returned and cast it to its proper type. May also return null.
Throws:
JIDLException - If IDL encounters an error.
See Also:
JIDLNumber, JIDLObjectI, JIDLString, JIDLArray, JIDLConst.PARMFLAG_CONVMAJORITY, JIDLConst.PARMFLAG_NO_CONVMAJORITY
initListeners()
public void initListeners()
Initialize listeners.
This method is always called by createObject. The JIDLObject listens to no events, but this method may be overridden by sub-classes to initialize a different set of listeners (or none at all).
For example if a sub-class of JIDLObject wished to listen to IDL output events, it would need to implement JIDLOutputListener and register to listen for these events in initListeners, as follows:
public class newObject extends JIDLObject implements JIDLOutputListener
{
public void initListeners()
{
addIDLOutputListener(this)
}
void IDLoutput(JIDLObjectI obj, String s)
{
// do something with the output
}
}
Specified By:
initListeners in interface JIDLObjectI
See Also:
JIDLNotifyListener, JIDLOutputListener
isObjCreated()
public boolean isObjCreated()
Deprecated.
Replaced by isObjectCreated()
Determine if object has been created successfully.
Returns:
true if object created successfully, or falseif object not created or creation was unsuccessful.
isObjectCreated()
public boolean isObjectCreated()
Determine if object has been created successfully.
Specified By:
isObjectCreated in interface JIDLObjectI
Returns:
true if object created successfully, or false if object not created, destroyed, or creation was unsuccessful.
See Also:
createObject()
isObjectDisplayable()
public boolean isObjectDisplayable()
Specified By:
isObjectDisplayable in interface JIDLObjectI
removeIDLNotifyListener(JIDLNotifyListener)
public void removeIDLNotifyListener(com.idl.javaidl.JIDLNotifyListener listener)
Removes the specified IDL notify listener so it no longer receives IDL notifications.
Note: Registering/unregistering for events should happen in the initListeners method or AFTER the createObject method.
Specified By:
removeIDLNotifyListener in interface JIDLObjectI
Parameters:
listener - the listener
removeIDLOutputListener(JIDLOutputListener)
public void removeIDLOutputListener(com.idl.javaidl.JIDLOutputListener listener)
Removes the specified IDL output listener on this object.
Note: Registering/unregistering for events should happen in the initListeners method or AFTER the createObject method.
Specified By:
removeIDLOutputListener in interface JIDLObjectI
Parameters:
listener - the listener
setIDLVariable(String, Object)
public void setIDLVariable(java.lang.String sVar, java.lang.Object obj)
Set/Create an IDL variable of the given name and value.
Note: In the case of arrays, the array will ALWAYS be convolved when passed between Java and IDL.
Specified By:
setIDLVariable in interface JIDLObjectI
Parameters:
sVar - the IDL variable name
obj - object to be passed to IDL. Should be an object of type JIDLNumber, JIDLObject, JIDLString or JIDLArray.
Throws:
JIDLException - If IDL encounters an error.
setProcessName(String)
public void setProcessName(java.lang.String process)
Set the process name that the object will be created in.
The process name may only be set before createObject is called. If called after the object has been created, this method call does nothing.
Specified By:
setProcessName in interface JIDLObjectI
Parameters:
process - Process name. Empty String means create in same process (in-process).
setProperty(String, Object, int)
public void setProperty(java.lang.String sProperty, java.lang.Object obj, int iPalFlag)
Call IDL setProperty method to set named property.
The iPalFlag parameter is a set of flags that are or-ed together. Currently this parameter is only used to specify whether a JIDLArray being passed in to IDL is convolved or not. For arrays argpal should be set to either JIDLConst.PARMFLAG_CONVMAJORITY or JIDLConst.PARMFLAG_NO_CONVMAJORITY.
Specified By:
setProperty in interface JIDLObjectI
Parameters:
sProperty - the property name
obj - object to be passed to IDL. Should be an object of type JIDLNumber, JIDLObject, JIDLString or JIDLObject.
iPalFlag - flag denoting whether the passed in parameter is convolved or not. Note: setProperty does not allow obj to be modified by IDL
Throws:
JIDLException - If IDL encounters an error.
See Also:
JIDLNumber, JIDLObject, JIDLString, JIDLArray, JIDLConst.PARMFLAG_CONVMAJORITY, JIDLConst.PARMFLAG_NO_CONVMAJORITY
toString()
public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class Object