org.jinterop.dcom.core
Class JILocalCoClass

java.lang.Object
  extended by org.jinterop.dcom.core.JILocalCoClass
All Implemented Interfaces:
java.io.Serializable

public final class JILocalCoClass
extends java.lang.Object
implements java.io.Serializable

Represents a Java COCLASS.

Please refer to MSInternetExplorer, Test_ITestServer2_Impl, SampleTestServer and MSShell examples for more details on how to use this class.

Since:
2.0 (formerly JIJavaCoClass)
See Also:
Serialized Form

Constructor Summary
JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition, java.lang.Class clazz)
          Creates a local class instance.
JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition, java.lang.Class clazz, boolean useInterfaceDefinitionIID)
          Refer JILocalCoClass(JILocalInterfaceDefinition, Class).
JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition, java.lang.Object instance)
          Creates a local class instance.
JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition, java.lang.Object instance, boolean useInterfaceDefinitionIID)
          Creates a local class instance.
 
Method Summary
 void addInterfaceDefinition(JILocalInterfaceDefinition interfaceDefinition, java.lang.Class clazz)
          Add another interface definition and it's class.
 void addInterfaceDefinition(JILocalInterfaceDefinition interfaceDefinition, java.lang.Object instance)
          Add another interface definition and it's supporting object instance.
 boolean equals(java.lang.Object target)
           
 java.lang.String getCoClassIID()
          Returns the interface identifier of this COCLASS.
 JILocalInterfaceDefinition getInterfaceDefinition()
          Returns the primary interfaceDefinition.
 JILocalInterfaceDefinition getInterfaceDefinition(java.lang.String IID)
          Returns the interface definition based on the IID of the interface.
 java.lang.Class getServerClass()
          Returns the actual class representing the interface definition.
 java.lang.Object getServerInstance()
          Returns the instance representing the interface definition.
 int hashCode()
           
 boolean isCoClassUnderRealIID()
           Returns true if the primary interface definition represents a real IID .
 void setSupportedEventInterfaces(java.util.List listOfIIDs)
          Sets the interface identifiers (IIDs) of the event interfaces this class would support.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JILocalCoClass

public JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition,
                      java.lang.Class clazz)
Creates a local class instance. The framework will try to create a instance of the clazz using Class.newInstance. Make sure that clazz has a visible null constructor.

Parameters:
interfaceDefinition - implementing structurally the definition of the COM callback interface.
clazz - class to instantiate for serving requests from COM client. Must implement the interfaceDefinition fully.
Throws:
java.lang.IllegalArgumentException - if interfaceDefinition or clazz are null.

JILocalCoClass

public JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition,
                      java.lang.Class clazz,
                      boolean useInterfaceDefinitionIID)
Refer JILocalCoClass(JILocalInterfaceDefinition, Class).

Parameters:
interfaceDefinition - implementing structurally the definition of the COM callback interface.
clazz - class to instantiate for serving requests from COM client. Must implement the interfaceDefinition fully.
useInterfaceDefinitionIID - true if the IID of interfaceDefinitionIUnknown* is required. For all JIObjectFactory.attachEventHandler(IJIComObject, String, IJIComObject) operations this should be set to false since the IConnectionPoint::Advise method takes in a IUnknown* reference.
Throws:
java.lang.IllegalArgumentException - if interfaceDefinition or clazz are null.

JILocalCoClass

public JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition,
                      java.lang.Object instance)
Creates a local class instance.

Parameters:
interfaceDefinition - implementing structurally the definition of the COM callback interface.
instance - instance for serving requests from COM client. Must implement the interfaceDefinition fully.
Throws:
java.lang.IllegalArgumentException - if interfaceDefinition or instance are null.

JILocalCoClass

public JILocalCoClass(JILocalInterfaceDefinition interfaceDefinition,
                      java.lang.Object instance,
                      boolean useInterfaceDefinitionIID)
Creates a local class instance.

Parameters:
interfaceDefinition - implementing structurally the definition of the COM callback interface.
instance - instance for serving requests from COM client. Must implement the interfaceDefinition fully.
useInterfaceDefinitionIID - true if the IID of interfaceDefinitionIUnknown* is required. For all JIObjectFactory.attachEventHandler(IJIComObject, String, IJIComObject) operations this should be set to false since the IConnectionPoint::Advise method takes in a IUnknown* reference.
Throws:
java.lang.IllegalArgumentException - if interfaceDefinition or instance are null.
Method Detail

setSupportedEventInterfaces

public void setSupportedEventInterfaces(java.util.List listOfIIDs)
Sets the interface identifiers (IIDs) of the event interfaces this class would support. This in case the same clazz or instance is implementing more than one IID.

Parameters:
listOfIIDs -
See Also:
JILocalCoClass(JILocalInterfaceDefinition, Class), JILocalCoClass(JILocalInterfaceDefinition, Object)

addInterfaceDefinition

public void addInterfaceDefinition(JILocalInterfaceDefinition interfaceDefinition,
                                   java.lang.Object instance)
Add another interface definition and it's supporting object instance.

Parameters:
interfaceDefinition - implementing structurally the definition of the COM callback interface.
instance - instance for serving requests from COM client. Must implement the interfaceDefinition fully.
Throws:
java.lang.IllegalArgumentException - if interfaceDefinition or instance are null.

addInterfaceDefinition

public void addInterfaceDefinition(JILocalInterfaceDefinition interfaceDefinition,
                                   java.lang.Class clazz)
Add another interface definition and it's class. Make sure that this class has a default constructor, so that instantiation using reflection can take place.

Parameters:
interfaceDefinition - implementing structurally the definition of the COM callback interface.
clazz - instance for serving requests from COM client. Must implement the interfaceDefinition fully.
Throws:
java.lang.IllegalArgumentException - if interfaceDefinition or clazz are null.

getServerInstance

public java.lang.Object getServerInstance()
Returns the instance representing the interface definition.

Returns:
See Also:
JILocalCoClass(JILocalInterfaceDefinition, Object)

getServerClass

public java.lang.Class getServerClass()
Returns the actual class representing the interface definition.

Returns:
See Also:
JILocalCoClass(JILocalInterfaceDefinition, Class)

getCoClassIID

public java.lang.String getCoClassIID()
Returns the interface identifier of this COCLASS.

Returns:
See Also:
JILocalCoClass(JILocalInterfaceDefinition, Class), JILocalCoClass(JILocalInterfaceDefinition, Object), JILocalInterfaceDefinition.getInterfaceIdentifier()

getInterfaceDefinition

public JILocalInterfaceDefinition getInterfaceDefinition()
Returns the primary interfaceDefinition.

Returns:
See Also:
JILocalCoClass(JILocalInterfaceDefinition, Class), JILocalCoClass(JILocalInterfaceDefinition, Object)

equals

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

hashCode

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

getInterfaceDefinition

public JILocalInterfaceDefinition getInterfaceDefinition(java.lang.String IID)
Returns the interface definition based on the IID of the interface.

Returns:
null if no interface definition matching the IID has been found.

isCoClassUnderRealIID

public boolean isCoClassUnderRealIID()

Returns true if the primary interface definition represents a real IID .

Returns: