com.moesol.bindings.platform_sdk.component_services
Class ComObject

java.lang.Object
  extended by com.moesol.bindings.platform_sdk.component_services.ComObject
All Implemented Interfaces:
IUnknown
Direct Known Subclasses:
ComClassFactory, ComClassFactory.InternalUnknown, ComControl, ComDebugFrame.TestObject, ComDispatchSink

public class ComObject
extends Object
implements IUnknown

Implement COM object servers in Java. Extend this class to create a COM object server in java. See Reverse COM for more details.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.moesol.bindings.platform_sdk.component_services.IUnknown
IUnknown.Disp, IUnknown.Jni
 
Field Summary
protected  com.moesol.bindings.platform_sdk.component_services.ComIUnknown m_iunknown_support
          This field helps avoid most name conflicts and supports aggregation.
 
Fields inherited from interface com.moesol.bindings.platform_sdk.component_services.IUnknown
IID, TYPELIB
 
Constructor Summary
protected ComObject()
          Initializes the COM interface map based on refelection.
protected ComObject(boolean reflect_com_map)
          If reflect_com_map is true then initializes the COM interface based on reflection.
 
Method Summary
 void FinalConstruct()
          Override if you need to create aggregate objects.
protected  void FinalRelease()
          Override if you want to know when all external COM interfaces have been freed.
 int Invoke(int dispIdMember, GUID riid, long lcid, int flags, Object[] dispParams, Object[] varResult, long[] argErr)
          Called when a native client uses IDispatch::Invoke.
 IUnknown QueryInterface(Class iface_class)
          Provides an implementation of IUnknown.QueryInterface The current implementation may return a java forward COM wrapper to a reverse COM wrapper.
 int QueryInterface(InterfaceBuilder interfaceBuilder)
          Called when native code calls IUnknown::QueryInterface on this ComObject.
 void QueryInterface(Object[] out_iface)
          Provides an implementation of IUnknown.QueryInterface.
 int Release()
          Calls the native COM interfaces IUnknown::Release method and make this equivalent to NULL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_iunknown_support

protected com.moesol.bindings.platform_sdk.component_services.ComIUnknown m_iunknown_support
This field helps avoid most name conflicts and supports aggregation.

Constructor Detail

ComObject

protected ComObject()
Initializes the COM interface map based on refelection. Each interface that this class implements that has IUnknown as a super class is included. For more control over the COM interface map used by the default implementation of QueryInterface see #ComObjectRoot(boolean).


ComObject

protected ComObject(boolean reflect_com_map)
If reflect_com_map is true then initializes the COM interface based on reflection. Otherwise, the COM interface map is empty and must be filled in by the subclass.

Parameters:
reflect_com_map -
Method Detail

QueryInterface

public void QueryInterface(Object[] out_iface)
Provides an implementation of IUnknown.QueryInterface. The current implementation may return a java forward COM wrapper to a reverse COM wrapper. However, the forward COM wrapper might also be a forward COM wrapper to an aggregated native COM server so we cannot always bypass the extra wrappers.

Specified by:
QueryInterface in interface IUnknown
Parameters:
out_iface - See IUnknown.QueryInterface(Object[])

QueryInterface

public IUnknown QueryInterface(Class iface_class)
Provides an implementation of IUnknown.QueryInterface The current implementation may return a java forward COM wrapper to a reverse COM wrapper. However, the forward COM wrapper might also be a forward COM wrapper to an aggregated native COM server so we cannot always bypass the extra wrappers.

Specified by:
QueryInterface in interface IUnknown
Parameters:
iface_class - See IUnknown.QueryInterface(Class)
Returns:
Result of QueryInterface.

Release

public int Release()
Description copied from interface: IUnknown
Calls the native COM interfaces IUnknown::Release method and make this equivalent to NULL. Calling COM methods after this call will throw a COMException. If this object referered to a valid native COM interface before the call, this method causes the COM unreleased count to be reduced by one when the interface is released.

Specified by:
Release in interface IUnknown
Returns:
an integer which may represent the remaining numbers of references on the COM object. See IUknown for more details.

FinalConstruct

public void FinalConstruct()
Override if you need to create aggregate objects. Creating them from the constructor is too soon to have the outer IUnknown available to pass to your inner objects. If you create your ComObject with java new then you will need to call this method. See FinalRelease() for discussion about method name clashes.


FinalRelease

protected void FinalRelease()
Override if you want to know when all external COM interfaces have been freed. Release any aggregate objects you have created here. Name may class with method name in COM interface, but this is the same method used by ATL. Also, tlb2java supports renaming methods, so that feature could be used should there be a conflict.


QueryInterface

public int QueryInterface(InterfaceBuilder interfaceBuilder)
Called when native code calls IUnknown::QueryInterface on this ComObject. You can override for debugging purposes, but if you do not call this implementation from your subclass (super.QueryInterface) or correctly initialize interfaceBuilder QueryInterface will fail with E_NOINTERFACE.

Parameters:
interfaceBuilder - [in] IID, [out] native interface
Returns:
HRESULT, typically S_OK or E_NOINTERFACE.

Invoke

public int Invoke(int dispIdMember,
                  GUID riid,
                  long lcid,
                  int flags,
                  Object[] dispParams,
                  Object[] varResult,
                  long[] argErr)
Called when a native client uses IDispatch::Invoke. The default implementation tries to route the call to the correct interface/method. You can override this method if you want to dispatch calls based on their dispIdMember.

Parameters:
dispIdMember -
riid -
lcid -
flags -
dispParams -
varResult -
Returns:
HRESULT


Copyright © 2004 Moebius Solutions, Inc. All Rights Reserved.