org.jinterop.dcom.core
Interface IJIComObject

All Superinterfaces:
IJIUnknown
All Known Subinterfaces:
IJIDispatch

public interface IJIComObject
extends IJIUnknown

Represents a COM Object. All interfaces (representing COM objects) for e.g. IJIDispatch, IJITypeInfo must extend from this interface.

Sample usage:-
JISession session = JISession.createSession("DOMAIN","USERNAME","PASSWORD");
JIComServer comserver = new JIComServer(JIProgId.valueOf(session,"Word.Application"),address,session);

IJIComObject comObject = comserver.createInstance();

Also ,
IJIComObject handle = (IJIComObject)comObject.queryInterface("620012E2-69E3-4DC0-B553-AE252524D2F6");

Since:
1.0

Field Summary
 
Fields inherited from interface org.jinterop.dcom.core.IJIUnknown
IID
 
Method Summary
 java.lang.Object[] call(JICallObject obj)
          Executes a method call on the actual COM object represented by this interface.
 java.lang.Object[] call(JICallObject obj, int timeout)
          Executes a method call on the actual COM object represented by this interface.
 JISession getAssociatedSession()
          Session associated with this object.
 int getInstanceLevelSocketTimeout()
          Returns the timeout set at the instance level.
 java.lang.String getInterfaceIdentifier()
          Returns the IID of this object
 JIInterfacePointer getInterfacePointer()
          Returns self Interface pointer
 java.lang.String getIpid()
          Unique 128 bit uuid representing the interface on the COM server.
 IJIUnreferenced getUnreferencedHandler(JISession session)
          Returns the IJIUnreferenced handler associated with this comObject, null if none is.
 boolean isDispatchSupported()
          Returns true if IJIDispatch is supported by this interface.
 void registerUnreferencedHandler(JISession session, IJIUnreferenced unreferenced)
          Adds a IJIUnreferenced handler , the handler will be invoked when this comObject goes out of reference and is removed from the session by the library.
 java.lang.Object[] removeConnectionInfo(java.lang.String identifier)
          Returns and Removes the connection info from the internal map.
 void setInstanceLevelSocketTimeout(int timeout)
          Sets a timeout for all socket level operations , overrides the global socket timeout at the JISession level.
 void unregisterUnreferencedHandler(JISession session)
          Removes the IJIUnreferenced handler associated with this comObject.
 
Methods inherited from interface org.jinterop.dcom.core.IJIUnknown
addRef, queryInterface, release
 

Method Detail

getIpid

java.lang.String getIpid()
Unique 128 bit uuid representing the interface on the COM server.

Returns:

call

java.lang.Object[] call(JICallObject obj)
                        throws JIException

Executes 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 JICallObject.

JICallObject obj = new JICallObject(handle.getIpid());
obj.reInit();
obj.setOpnum(94); //This needs to be obtained via IDL, Other wise use IJIDispatch if COM IDispatch //interface is supported by the underlying COM Object.
obj.addInParamAsPointer(new JIPointer(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 = handle.call(obj);

The above example demonstrates a call where no results are expected. When you expect something to be returned back , set up the Out Params also in the JICallObject (see corresponding JICallObject javadoc for more details).
The timeout used here , by default is the instance level timeout. If not instance level timeout has been specified(or is 0) then the global timeout in JISession will be used.

Parameters:
obj - Data Object carrying all information neccessary to make the call.
Returns:
Object[] representing the results in the order set in JICallObject.
Throws:
JIException

call

java.lang.Object[] call(JICallObject obj,
                        int timeout)
                        throws JIException

Executes 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 JICallObject.

JICallObject obj = new JICallObject(handle.getIpid());
obj.reInit();
obj.setOpnum(94); //This needs to be obtained via IDL, Other wise use IJIDispatch if COM IDispatch //interface is supported by the underlying COM Object.
obj.addInParamAsPointer(new JIPointer(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 = handle.call(obj);

The above example demonstrates a call where no results are expected. When you expect something to be returned back , set up the Out Params also in the JICallObject (see corresponding JICallObject javadoc for more details).

Parameters:
obj - Data Object carrying all information necessary to make the call.
timeout - timeout for this call in millisecs, overrides the instance level timeout. Passing 0 here will use the global socket timeout (not the class level timeout) .
Returns:
Object[] representing the results in the order set in JICallObject.
Throws:
JIException

setInstanceLevelSocketTimeout

void setInstanceLevelSocketTimeout(int timeout)
Sets a timeout for all socket level operations , overrides the global socket timeout at the JISession level. To unset a previous timeout, pass 0 as a parameter.

Parameters:
timeout -

getInstanceLevelSocketTimeout

int getInstanceLevelSocketTimeout()
Returns the timeout set at the instance level.

Returns:

getInterfacePointer

JIInterfacePointer getInterfacePointer()
Returns self Interface pointer


getAssociatedSession

JISession getAssociatedSession()
Session associated with this object.

Returns:
JISession

getInterfaceIdentifier

java.lang.String getInterfaceIdentifier()
Returns the IID of this object

Returns:
String representation of 128 bit uuid.

isDispatchSupported

boolean isDispatchSupported()
Returns true if IJIDispatch is supported by this interface.

Returns:

removeConnectionInfo

java.lang.Object[] removeConnectionInfo(java.lang.String identifier)
Returns and Removes the connection info from the internal map.

Parameters:
identifier -
Returns:

registerUnreferencedHandler

void registerUnreferencedHandler(JISession session,
                                 IJIUnreferenced unreferenced)
Adds a IJIUnreferenced handler , the handler will be invoked when this comObject goes out of reference and is removed from the session by the library.

Parameters:
session -
unreferenced -

getUnreferencedHandler

IJIUnreferenced getUnreferencedHandler(JISession session)
Returns the IJIUnreferenced handler associated with this comObject, null if none is.

Parameters:
session -
Returns:

unregisterUnreferencedHandler

void unregisterUnreferencedHandler(JISession session)
Removes the IJIUnreferenced handler associated with this comObject.

Parameters:
session -