public class JIComObjectImplWrapper extends Object implements IJIComObject
| Modifier and Type | Field and Description |
|---|---|
protected IJIComObject |
comObject |
IID| Modifier | Constructor and Description |
|---|---|
protected |
JIComObjectImplWrapper(IJIComObject comObject) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRef()
Increases the reference count on the COM server by 5
(currently hard coded).
|
Object[] |
call(JICallBuilder obj)
Executes a method call on the actual COM object represented by this interface.
|
Object[] |
call(JICallBuilder obj,
int timeout)
Refer
IJIComObject.call(JICallBuilder) for details on this method. |
JISession |
getAssociatedSession()
Returns session associated with this object.
|
int |
getInstanceLevelSocketTimeout()
Returns the socket timeout set at the instance level.
|
String |
getInterfaceIdentifier()
Returns the IID of this object
|
String |
getIpid()
Unique 128 bit uuid representing the interface on the COM server.
|
IJIUnreferenced |
getUnreferencedHandler()
Returns the
IJIUnreferenced handler associated with this object. |
Object[] |
internal_getConnectionInfo(String identifier)
Framework Internal Returns the ConnectionPoint (IJIComObject) and it's Cookie.
|
org.jinterop.dcom.core.JIInterfacePointer |
internal_getInterfacePointer()
Framework Internal
Returns self Interface pointer.
|
Object[] |
internal_removeConnectionInfo(String identifier)
Framework Internal Returns and Removes the connection info from the internal map.
|
String |
internal_setConnectionInfo(IJIComObject connectionPoint,
Integer cookie)
Adds a connection point information and it's cookie to the connectionPointMap internally.
|
void |
internal_setDeffered(boolean deffered)
Framework Internal
|
boolean |
isDispatchSupported()
Returns
true if IDispatch interface is supported
by this object. |
boolean |
isLocalReference()
Returns
true if this COM object represents a local Java reference obtained by
JIObjectFactory.buildObject(JISession, JILocalCoClass). |
IJIComObject |
queryInterface(String iid)
Retrieve interface references based on
iid. |
void |
registerUnreferencedHandler(IJIUnreferenced unreferenced)
Adds a
IJIUnreferenced handler. |
void |
release()
Decreases the reference count on the COM server by 5
(currently hard coded).
|
void |
setInstanceLevelSocketTimeout(int timeout)
Sets a timeout for all socket level operations done on this
object.
|
String |
toString() |
void |
unregisterUnreferencedHandler()
Removes the
IJIUnreferenced handler associated with this object. |
protected final IJIComObject comObject
protected JIComObjectImplWrapper(IJIComObject comObject)
public IJIComObject queryInterface(String iid) throws JIException
IJIComObjectRetrieve interface references based on iid. Make sure to
narrow before casting to the expected type.
For example when expecting an IJIEnumVariant :-
IJIComObject object2 = variant.getObjectAsComObject();
IJIEnumVariant enumVariant = (IJIEnumVariant)JIObjectFactory.narrowObject(object2.queryInterface(IJIEnumVariant.IID));
Throws IllegalStateException if IJIComObject.isLocalReference() returns true.
queryInterface in interface IJIComObjectiid - string representation of the IID.JIExceptionJIObjectFactory.narrowObject(IJIComObject)public void addRef()
throws JIException
IJIComObjectIncreases the reference count on the COM server by 5
(currently hard coded). The developer should refrain from calling this API,
as referencing is maintained internally by the system though he is not
obligated to do so. If the IJIComObject.release() is not called in conjunction
with addRef then the COM Instance will not get garbage collected
at the server.
addRef in interface IJIComObjectJIExceptionpublic void release()
throws JIException
IJIComObject Decreases the reference count on the COM server by 5
(currently hard coded). The developer should refrain from calling this API,
as referencing is maintained internally by the system though he is not
obligated to do so. If the release is not called in conjunction
with IJIComObject.addRef() then the COM Instance will not get garbage collected at
the server.
release in interface IJIComObjectJIExceptionpublic String getIpid()
IJIComObjectIJIUnreferenced handler implementation to this COM Object.
Under NO circumstances should a reference to this COM object be stored any where for only purposes of "unreferenced" handling. This would hinder the way in which objects are garbage collected by the framework and this object would be forever "live".
getIpid in interface IJIComObjectpublic Object[] call(JICallBuilder obj) throws JIException
IJIComObjectExecutes a method call on the actual COM object represented by this interface.
All the data like parameter information, operation number etc. are prepared and
sent via the JICallBuilder.
JICallBuilder obj = new JICallBuilder();
obj.reInit();
obj.setOpnum(0); //methods are sequentially indexed from 0 in the IDL
obj.addInParamAsString(new JIString("j-Interop Rocks",JIFlags.FLAG_REPRESENTATION_STRING_LPCTSTR), JIFlags.FLAG_NULL);
obj.addInParamAsPointer(new JIPointer(new JIString("Pretty simple ;)",JIFlags.FLAG_REPRESENTATION_STRING_LPCTSTR)), JIFlags.FLAG_NULL);
Object[] result = comObject.call(obj);
If return values are expected then set up the Out Params also in the
JICallBuilder.
The call timeout used here , by default is the instance level timeout. If no
instance level timeout has been specified(or is 0) then the global timeout set in
JISession will be used.
call in interface IJIComObjectobj - call builder carrying all information necessary to make the call successfully.JICallBuilder.JIExceptionIJIComObject.setInstanceLevelSocketTimeout(int),
JISession.setGlobalSocketTimeout(int)public org.jinterop.dcom.core.JIInterfacePointer internal_getInterfacePointer()
IJIComObjectinternal_getInterfacePointer in interface IJIComObjectpublic JISession getAssociatedSession()
IJIComObjectgetAssociatedSession in interface IJIComObjectpublic String getInterfaceIdentifier()
getInterfaceIdentifier in interface IJIComObjectpublic boolean isDispatchSupported()
IJIComObjecttrue if IDispatch interface is supported
by this object.isDispatchSupported in interface IJIComObjecttrue if IDispatch is supported, false
otherwise.IJIDispatchpublic String internal_setConnectionInfo(IJIComObject connectionPoint, Integer cookie)
IJIComObjectinternal_setConnectionInfo in interface IJIComObjectpublic Object[] internal_getConnectionInfo(String identifier)
IJIComObjectinternal_getConnectionInfo in interface IJIComObjectpublic Object[] internal_removeConnectionInfo(String identifier)
IJIComObjectinternal_removeConnectionInfo in interface IJIComObjectpublic IJIUnreferenced getUnreferencedHandler()
IJIComObjectIJIUnreferenced handler associated with this object.getUnreferencedHandler in interface IJIComObjectpublic void registerUnreferencedHandler(IJIUnreferenced unreferenced)
IJIComObjectIJIUnreferenced handler. The handler will be invoked when this comObject goes
out of reference and is removed from it's session by the library. Only a single handler can be
added for each object. If a handler for this object already exists , it would be replaced by this
call.registerUnreferencedHandler in interface IJIComObjectunreferenced - handler to get notification when reference count for this object hits 0 and is
garbage collected by the library's runtime.public void unregisterUnreferencedHandler()
IJIComObjectIJIUnreferenced handler associated with this object. No exception will
be thrown if one does not exist for this object.unregisterUnreferencedHandler in interface IJIComObjectpublic Object[] call(JICallBuilder obj, int timeout) throws JIException
IJIComObject Refer IJIComObject.call(JICallBuilder) for details on this method.
call in interface IJIComObjectobj - call builder carrying all information necessary to make the call successfully.timeout - timeout for this call in milliseconds, overrides the instance level
timeout. Passing 0 here will use the global socket timeout.JICallBuilder.JIExceptionJISession.setGlobalSocketTimeout(int)public int getInstanceLevelSocketTimeout()
IJIComObjectIJIComObject.call(JICallBuilder)
, IJIComObject.queryInterface(String) etc.getInstanceLevelSocketTimeout in interface IJIComObjectpublic void setInstanceLevelSocketTimeout(int timeout)
IJIComObjectSets a timeout for all socket level operations done on this
object. Calling this overrides the global socket timeout at the
JISession level. To unset a previous timeout, pass 0 as a
parameter.
setInstanceLevelSocketTimeout in interface IJIComObjecttimeout - timeout for this call in millisecondsJISession.setGlobalSocketTimeout(int)public void internal_setDeffered(boolean deffered)
IJIComObjectinternal_setDeffered in interface IJIComObjectpublic boolean isLocalReference()
IJIComObjecttrue if this COM object represents a local Java reference obtained by
JIObjectFactory.buildObject(JISession, JILocalCoClass).
isLocalReference in interface IJIComObjecttrue if this is a local reference , false otherwise.Copyright © 2017 LSST. All rights reserved.