com.linar.jintegra
Class Dispatch

java.lang.Object
  extended by com.linar.jintegra.Dispatch
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Dispatch
extends java.lang.Object
implements java.io.Externalizable

The Dispatch class represents a reference to a COM object via a COM interface. It is used via a class which derives from this class, which is used to access COM objects via a specific COM interface.

This class can be used to access COM objects both via the COM IDispatch standard interface, and via custom COM interfaces.

This class is not exposed directly to end-users of J-Integra®. It is meant to be used internally by the J-Integra® runtime, and by parties that have been authorized to access the J-Integra® runtime directly.

See Also:
Serialized Form

Field Summary
static int DISPATCH_METHOD
          Used in invoke, Indicates that it is a method that is being invoked
static int DISPATCH_PROPERTYGET
          Used in invoke, Indicates that a property is being got
static int DISPATCH_PROPERTYPUT
          Used in invoke, Indicates that a property is being set
static int DISPATCH_PROPERTYPUTREF
          Used in invoke, Indicates that a property is being set by reference (an object reference)
 
Constructor Summary
protected Dispatch()
          Used in proxies generated by 'java2com'
  Dispatch(java.lang.Object other)
           
  Dispatch(java.lang.Object other, java.lang.String iidStr)
          Access an existing COM object reference via the specified COM interface.
  Dispatch(java.lang.String clsidStr, java.lang.String host)
          Create an instance of a COM class.
  Dispatch(java.lang.String clsidStr, java.lang.String iidStr, java.lang.String host, AuthInfo authInfo)
          Create an instance of a COM class.
protected Dispatch(java.lang.String clsidStr, java.lang.String iidStr, java.lang.String hostname, boolean deferred)
           
 
Method Summary
 void addListener(java.lang.String iidStr, java.lang.Object theListener, java.lang.Object theSource)
          Adds a Java object to be a listener for a specific kind of event generated by the COM object.
static java.lang.Object bindUsingMoniker(java.lang.String moniker)
           
 void convertToNative()
           
 long cookieForListener(java.lang.Object theListener)
          Returns the COM cookie associated with a specific listener.
protected  void createDispatch(java.lang.String clsidStr, java.lang.String iidStr, java.lang.String host, AuthInfo authInfo)
           
static java.lang.String createObjrefMonikerDisplayName(java.lang.Object forObject)
           
 boolean equals(java.lang.Object other)
           
static java.lang.Object getActiveObject(java.lang.String clsid)
           
static java.lang.Object getActiveObject(java.lang.String clsid, java.lang.String iid)
           
 java.lang.Object getDefaultProperty()
           
protected  int getDispatchIdOfName(java.lang.String name)
          Gets the IDispatch memid of a method or property
static int getLastErrorCode()
           
static java.lang.Object getMtsObjectContext()
           
 com.linar.jintegra.StdObjRef getObjRef()
           
 java.lang.Object getPropertyByName(java.lang.String name)
          getPropertyByName.
 java.lang.Object getPropertyByName(java.lang.String name, java.lang.Object rhs)
           
 int hashCode()
           
protected  com.linar.jintegra.Variant invoke(java.lang.String methodName, int dispId, long kind, com.linar.jintegra.Variant[] parameters)
          Invoke a method or set/get a property on the COM object.
 java.lang.Object invokeMethodByName(java.lang.String name, java.lang.Object[] parameters)
           
 java.lang.Object invokeMethodByName(java.lang.String name, java.lang.Object[] parameters, boolean[] byRefMask)
           
 java.lang.Object invokeMethodByName(java.lang.String name, com.linar.jintegra.Variant[] parameters)
           
 java.lang.Object invokePropertyGetByName(java.lang.String name, com.linar.jintegra.Variant[] parameters)
           
 void invokePropertyPutByName(java.lang.String name, com.linar.jintegra.Variant[] parameters)
           
 void invokePropertyPutByRefByName(java.lang.String name, com.linar.jintegra.Variant[] parameters)
           
static boolean isNativeMode()
           
static boolean isObjRef(java.lang.Object other)
           
 void queryInterface()
           
 void readExternal(java.io.ObjectInput in)
           
 void removeListener(java.lang.String iidStr, java.lang.Object theListener)
          Removes a Java object as a listener to events generated by a COM object.
static void setNativeMode()
           
 void setPropertyByName(java.lang.String name, java.lang.Object value)
           
 java.lang.String toString()
           
 void vtblInvoke(java.lang.String methodName, int opNum, java.lang.Object[] paramValues)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DISPATCH_METHOD

public static final int DISPATCH_METHOD
Used in invoke, Indicates that it is a method that is being invoked

See Also:
Constant Field Values

DISPATCH_PROPERTYGET

public static final int DISPATCH_PROPERTYGET
Used in invoke, Indicates that a property is being got

See Also:
Constant Field Values

DISPATCH_PROPERTYPUT

public static final int DISPATCH_PROPERTYPUT
Used in invoke, Indicates that a property is being set

See Also:
Constant Field Values

DISPATCH_PROPERTYPUTREF

public static final int DISPATCH_PROPERTYPUTREF
Used in invoke, Indicates that a property is being set by reference (an object reference)

See Also:
Constant Field Values
Constructor Detail

Dispatch

protected Dispatch()
Used in proxies generated by 'java2com'


Dispatch

protected Dispatch(java.lang.String clsidStr,
                   java.lang.String iidStr,
                   java.lang.String hostname,
                   boolean deferred)
            throws java.net.UnknownHostException,
                   java.io.IOException
Throws:
java.net.UnknownHostException
java.io.IOException

Dispatch

public Dispatch(java.lang.String clsidStr,
                java.lang.String host)
         throws java.net.UnknownHostException,
                java.io.IOException
Create an instance of a COM class. Sends a DCOM RemoteActivation request.

Parameters:
clsidStr - the UUID of the COM class of the object to be instanciated.
host - the host on which the COM object is to be instanciated. Specify "localhost" for the current machine.
Throws:
java.net.UnknownHostException
java.io.IOException

Dispatch

public Dispatch(java.lang.String clsidStr,
                java.lang.String iidStr,
                java.lang.String host,
                AuthInfo authInfo)
         throws java.net.UnknownHostException,
                java.io.IOException
Create an instance of a COM class. Sends a DCOM RemoteActivation request.

Parameters:
clsidStr - the UUID of the COM class of the object to be instanciated.
iidStr - the UUID of the COM interface through which the new object is to be accessed.
host - the host on which the COM object is to be instanciated. Specify "localhost" for the current machine.
authInfo - authentication information to be used to create and access the object. Pass null to use the default authentication.
Throws:
java.net.UnknownHostException
java.io.IOException

Dispatch

public Dispatch(java.lang.Object other)
         throws java.io.IOException
Throws:
java.io.IOException

Dispatch

public Dispatch(java.lang.Object other,
                java.lang.String iidStr)
         throws java.io.IOException
Access an existing COM object reference via the specified COM interface. Use this constructor if you have an existing reference to a COM object, and you wish to access it via a specific COM interface.

Parameters:
other - a reference to a COM object.
iidStr - the UUID of the COM interface through which the object is to be accessed.
Throws:
java.lang.IllegalArgumentException - if the object is not a reference to a COM object.
java.io.IOException
Method Detail

getObjRef

public com.linar.jintegra.StdObjRef getObjRef()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setNativeMode

public static void setNativeMode()

isNativeMode

public static boolean isNativeMode()

createDispatch

protected void createDispatch(java.lang.String clsidStr,
                              java.lang.String iidStr,
                              java.lang.String host,
                              AuthInfo authInfo)
                       throws java.net.UnknownHostException,
                              java.io.IOException
Throws:
java.net.UnknownHostException
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

isObjRef

public static boolean isObjRef(java.lang.Object other)

queryInterface

public void queryInterface()
                    throws AutomationException,
                           java.io.IOException
Throws:
AutomationException
java.io.IOException

getDefaultProperty

public java.lang.Object getDefaultProperty()
                                    throws java.lang.NoSuchFieldException,
                                           java.io.IOException,
                                           AutomationException
Throws:
java.lang.NoSuchFieldException
java.io.IOException
AutomationException

invoke

protected com.linar.jintegra.Variant invoke(java.lang.String methodName,
                                            int dispId,
                                            long kind,
                                            com.linar.jintegra.Variant[] parameters)
                                     throws AutomationException,
                                            java.io.IOException
Invoke a method or set/get a property on the COM object. Use this method when you wish to invoke method on the COM object using IDispatch (not using custom marshalling).

Invokes the method or gets/set a property identified by the dispId parameter. Whether it is a method or a property is specified using the kind parameter.

Parameters:
methodName - the name of the method to be invoked. Purely used for logging purposes, the method to be invoked is determined by the opNum parameter.
dispId - the ID of the method or property.
kind - one of DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, or DISPATCH_PROPERTYPUTREF.
parameters - the parameters to the method, or the value to be set
Returns:
the return value, or null if none.
Throws:
AutomationException
java.io.IOException

addListener

public void addListener(java.lang.String iidStr,
                        java.lang.Object theListener,
                        java.lang.Object theSource)
                 throws java.io.IOException
Adds a Java object to be a listener for a specific kind of event generated by the COM object. when you wish to invoke method on the COM object using IDispatch (not using custom marshalling).

Parameters:
iidStr - the ID of the outgoing interface, implemented by the listener
theListener - the object to be informed of the events
theSource - the proxy class that represents the COM class that is the source of the events
Throws:
java.io.IOException

cookieForListener

public long cookieForListener(java.lang.Object theListener)
Returns the COM cookie associated with a specific listener. This method is not publicly documented, and was implemented at the request of SnapTrack Inc.

Parameters:
theListener - the listener whose cookie should be returned
Returns:
the cookie or 0 if the listener has no cookie

removeListener

public void removeListener(java.lang.String iidStr,
                           java.lang.Object theListener)
                    throws java.io.IOException
Removes a Java object as a listener to events generated by a COM object. when you wish to invoke method on the COM object using IDispatch (not using custom marshalling).

Parameters:
iidStr - the ID of the outgoing interface, implemented by the listener
theListener - the object that no longer wishes to be informed of the events
Throws:
java.io.IOException

getDispatchIdOfName

protected int getDispatchIdOfName(java.lang.String name)
                           throws java.lang.NoSuchFieldException,
                                  AutomationException,
                                  java.io.IOException
Gets the IDispatch memid of a method or property

Parameters:
name - the name of the method or property
Returns:
the corresponding memid
Throws:
java.lang.NoSuchFieldException - if the method or field does not exist
AutomationException
java.io.IOException

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

createObjrefMonikerDisplayName

public static java.lang.String createObjrefMonikerDisplayName(java.lang.Object forObject)
                                                       throws java.io.IOException
Throws:
java.io.IOException

convertToNative

public void convertToNative()
                     throws java.io.IOException
Throws:
java.io.IOException

getActiveObject

public static java.lang.Object getActiveObject(java.lang.String clsid)
                                        throws java.io.IOException
Throws:
java.io.IOException

getActiveObject

public static java.lang.Object getActiveObject(java.lang.String clsid,
                                               java.lang.String iid)
                                        throws java.io.IOException
Throws:
java.io.IOException

bindUsingMoniker

public static java.lang.Object bindUsingMoniker(java.lang.String moniker)
                                         throws java.io.IOException
Throws:
java.io.IOException

getLastErrorCode

public static int getLastErrorCode()

vtblInvoke

public void vtblInvoke(java.lang.String methodName,
                       int opNum,
                       java.lang.Object[] paramValues)
                throws java.io.IOException,
                       AutomationException
Throws:
java.io.IOException
AutomationException

getMtsObjectContext

public static java.lang.Object getMtsObjectContext()

getPropertyByName

public java.lang.Object getPropertyByName(java.lang.String name)
                                   throws java.lang.NoSuchFieldException,
                                          java.io.IOException,
                                          AutomationException
getPropertyByName. Get the value of a property dynamically at run-time, based on its name

Parameters:
name - The name of the property to get.
Returns:
return value. The value of the property.
Throws:
java.lang.NoSuchFieldException - If the property does not exit.
java.io.IOException - If there are communications problems.
AutomationException - If the remote server throws an exception.

getPropertyByName

public java.lang.Object getPropertyByName(java.lang.String name,
                                          java.lang.Object rhs)
                                   throws java.lang.NoSuchFieldException,
                                          java.io.IOException,
                                          AutomationException
Throws:
java.lang.NoSuchFieldException
java.io.IOException
AutomationException

setPropertyByName

public void setPropertyByName(java.lang.String name,
                              java.lang.Object value)
                       throws java.lang.NoSuchMethodException,
                              java.io.IOException,
                              AutomationException
Throws:
java.lang.NoSuchMethodException
java.io.IOException
AutomationException

invokeMethodByName

public java.lang.Object invokeMethodByName(java.lang.String name,
                                           java.lang.Object[] parameters)
                                    throws java.lang.NoSuchMethodException,
                                           java.io.IOException,
                                           AutomationException
Throws:
java.lang.NoSuchMethodException
java.io.IOException
AutomationException

invokeMethodByName

public java.lang.Object invokeMethodByName(java.lang.String name,
                                           com.linar.jintegra.Variant[] parameters)
                                    throws java.lang.NoSuchMethodException,
                                           java.io.IOException,
                                           AutomationException
Throws:
java.lang.NoSuchMethodException
java.io.IOException
AutomationException

invokePropertyGetByName

public java.lang.Object invokePropertyGetByName(java.lang.String name,
                                                com.linar.jintegra.Variant[] parameters)
                                         throws java.lang.NoSuchMethodException,
                                                java.io.IOException,
                                                AutomationException
Throws:
java.lang.NoSuchMethodException
java.io.IOException
AutomationException

invokePropertyPutByName

public void invokePropertyPutByName(java.lang.String name,
                                    com.linar.jintegra.Variant[] parameters)
                             throws java.lang.NoSuchMethodException,
                                    java.io.IOException,
                                    AutomationException
Throws:
java.lang.NoSuchMethodException
java.io.IOException
AutomationException

invokePropertyPutByRefByName

public void invokePropertyPutByRefByName(java.lang.String name,
                                         com.linar.jintegra.Variant[] parameters)
                                  throws java.lang.NoSuchMethodException,
                                         java.io.IOException,
                                         AutomationException
Throws:
java.lang.NoSuchMethodException
java.io.IOException
AutomationException

invokeMethodByName

public java.lang.Object invokeMethodByName(java.lang.String name,
                                           java.lang.Object[] parameters,
                                           boolean[] byRefMask)
                                    throws java.lang.NoSuchMethodException,
                                           java.io.IOException,
                                           AutomationException
Throws:
java.lang.NoSuchMethodException
java.io.IOException
AutomationException