public class NativeComObject extends ComObject implements Deletable, java.io.Externalizable
ComOleHelper
to access and/or manage it.Modifier and Type | Class and Description |
---|---|
private static class |
NativeComObject.WorkArea
Holds context-local data specific to native COM objects, on server-side.
|
Modifier and Type | Field and Description |
---|---|
private long |
comId
The ID used to identify this COM object on the native side.
|
private ComOleOps |
comOps
Save the reference to the
ComOleOps proxy which delegates the calls to the
client-side. |
private boolean |
deleted
Flag which marks this COM object as deleted/released.
|
private java.lang.String |
name
The COM automation name.
|
private static ContextLocal<NativeComObject.WorkArea> |
work
Stores context-local state variables.
|
Modifier | Constructor and Description |
---|---|
|
NativeComObject()
Default c'tor, for deserialization purposes only.
|
|
NativeComObject(long comId)
Constructor which can be used by the native (or client-side) to create an instance marked
with the
comId , which will be mapped via the NativeComObject.WorkArea.registry on
server-side. |
private |
NativeComObject(java.lang.String name,
long comId)
Create a new instance with the specified details.
|
Modifier and Type | Method and Description |
---|---|
BaseDataType |
call(java.lang.String methodName,
java.lang.Object... params)
Calls a COM-method without parameters on the COM-object stored in this com-handle.
|
comhandle |
chainCall(java.lang.String methodName,
java.lang.Object... params)
Calls a COM-method without parameters on the COM-object stored in this com-handle.
|
private static comhandle |
createComHandle(NativeComObject nco)
Create a new
comhandle by re-using the existing native COM object or create a new
one. |
void |
delete()
Perform actual delete of an resource.
|
(package private) static ComObject |
getAutomation(java.lang.String comObjectType,
boolean topLevel,
boolean noCreate)
Obtain a reference to an automation.
|
long |
getComId()
Get the
comId . |
java.lang.String |
getName()
Get the COM automation
name . |
BaseDataType |
getProperty(java.lang.String prop)
Obtain a property value from the COM object stored in this handle.
|
java.lang.Long |
id()
Get this resource's ID, if is already set.
|
void |
id(long id)
This is a no-op, as the native COM objects get their IDs from the native side.
|
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
void |
release()
Perform actual delete of all resources.
|
boolean |
setProperty(java.lang.String prop,
java.lang.Object newVal,
java.lang.Object... indices)
Sets a COM property for the COM object stored by the handle.
|
boolean |
valid()
Reports if this object is valid for use.
|
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
checkParameters, destroy, getParentControlFrame, marshal, marshal, setParentControlFrame, unknown, unmarshal, unmarshal
private static final ContextLocal<NativeComObject.WorkArea> work
private boolean deleted
private long comId
private java.lang.String name
public NativeComObject()
public NativeComObject(long comId)
comId
, which will be mapped via the NativeComObject.WorkArea.registry
on
server-side.comId
- The ID used to identify this COM object on the native side.private NativeComObject(java.lang.String name, long comId)
name
- The COM automation name.comId
- The ID used to identify this COM object on the native side.static ComObject getAutomation(java.lang.String comObjectType, boolean topLevel, boolean noCreate)
comObjectType
- The name of the automation.topLevel
- Only return top-level. If the requested comObjectType
is not a top-level,
return null
.noCreate
- Must exist. Do not allow creation of new instances. Only used with topLevel
requests.ComObject
requested, or null
if such automation does not exist
or it does not satisfy the parameter constraints.private static comhandle createComHandle(NativeComObject nco)
comhandle
by re-using the existing native COM object or create a new
one.nco
- The NativeComObject
with the COM details.public long getComId()
comId
.public java.lang.Long id()
id
in interface WrappedResource
id
in class ComObject
null
if not set.public void id(long id)
id
in interface WrappedResource
id
in class ComObject
id
- Ignored.public java.lang.String getName()
name
.public boolean valid()
valid
in interface WrappedResource
true
if we are valid (can be used).public void release()
public void delete()
public BaseDataType getProperty(java.lang.String prop)
getProperty
in class ComObject
prop
- The legacy name of the property. Case insensitive. If no property is found then a
warning is displayed and method returns unknown
value.unknown
on exceptions.public boolean setProperty(java.lang.String prop, java.lang.Object newVal, java.lang.Object... indices)
setProperty
in class ComObject
prop
- The legacy property name. Case insensitive. If no property is found then a warning
is displayed and method returns without altering the stored object.newVal
- The new value for the property. It must be of a compatible type with the property.indices
- A variable number of indices used to access this property's element.true
if the property was set.public BaseDataType call(java.lang.String methodName, java.lang.Object... params)
call
in class ComObject
methodName
- The method name. Case insensitive. If the COM-object does not declare such method
an error message is displayed and this method returns unknown
value.params
- The list of actual parameters. Their types must be compatible with the parameters
of called method.public comhandle chainCall(java.lang.String methodName, java.lang.Object... params)
chainCall
in class ComObject
methodName
- The method name. Case insensitive. If the COM-object does not declare such method
an error message is displayed and this method returns unknown
value.params
- The list of actual parameters. Their types must be compatible with the parameters
of called method.comhandle
, so it can be used in a
chained call or property access.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
comId
is used on
network transfer. The receiving side must know to create a new instance based on this ID.writeExternal
in interface java.io.Externalizable
out
- The output destination to which fields will be saved.java.io.IOException
- In case of I/O errors.public void readExternal(java.io.ObjectInput in) throws java.io.IOException
comId
is used on
network transfer. The receiving side must know to create a new instance based on this ID.readExternal
in interface java.io.Externalizable
in
- The input source from which fields will be restored.java.io.IOException
- In case of I/O errors.