Class java_environment
- java.lang.Object
-
- com.sun.star.lib.uno.environments.java.java_environment
-
- All Implemented Interfaces:
IEnvironment
public final class java_environment extends java.lang.Object implements IEnvironment
The java_environment is the environment where objects and interfaces are registered, which are mapped out of java or into java.The java_environment implements the
IEnvironment
interface defined in the uno runtime.- Since:
- UDK1.0
- See Also:
UnoRuntime
,IEnvironment
-
-
Constructor Summary
Constructors Constructor Description java_environment(java.lang.Object context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.Object
getContext()
Gets the context of this environment.java.lang.String
getName()
Gets the name of this environment.java.lang.Object
getRegisteredInterface(java.lang.String oid, Type type)
Retrieves an interface identified by its object id and type from this environment.java.lang.String
getRegisteredObjectIdentifier(java.lang.Object object)
Retrieves the object identifier for a registered interface from this environment.void
list()
Lists the registered objects toSystem.out
.java.lang.Object
registerInterface(java.lang.Object object, java.lang.String[] oid, Type type)
Registers one UNO interface facet of an object.void
revokeAllProxies()
Revokes all registered proxy interfaces.void
revokeInterface(java.lang.String oid, Type type)
You have to revoke ANY interface that has been registered via this method.
-
-
-
Method Detail
-
getContext
public java.lang.Object getContext()
Description copied from interface:IEnvironment
Gets the context of this environment.- Specified by:
getContext
in interfaceIEnvironment
- Returns:
- the context of this environment
- See Also:
IEnvironment.getContext()
-
getName
public java.lang.String getName()
Description copied from interface:IEnvironment
Gets the name of this environment.- Specified by:
getName
in interfaceIEnvironment
- Returns:
- the name of this environment
- See Also:
IEnvironment.getName()
-
registerInterface
public java.lang.Object registerInterface(java.lang.Object object, java.lang.String[] oid, Type type)
Description copied from interface:IEnvironment
Registers one UNO interface facet of an object.Such an object will typically be one of three things:
- A local Java object, to be mapped out of this environment via a given bridge.
- A proxy object, mapped into this environment via some bridge B1, and now to be mapped out of this environment via a given bridge B2.
- A proxy object, created as a remote object is mapped into this environment via a given bridge.
The object actually registered may differ from the specified
object
that is passed as an argument. This enables an environment to work in a multi-threaded scenario, where two threads can callregisterInterface
for the same combination ofoid
andtype
at the same time; the race condition is solved by letting one of the calls register its argumentobject
, ignoring the argumentobject
of the other call, and letting both calls return the sameobject
.The registered object is held only weakly by the environment. After a call to
registerInterface
, a call togetRegisteredInterface
only succeeds as long as the registered object is still strongly reachable, and the registered object has not been explicitly revoked by callingrevokeInterface
.- Specified by:
registerInterface
in interfaceIEnvironment
- Parameters:
object
- the object to register; must be non-nulloid
- in-out parameter containing the OID ofobject
. This must be a non-null reference to an array of length at least one; the zeroth element is used to pass the argument in and out. If the zeroth element is null on input, the OID will be computed and passed out (that is, the zeroth element will never be null upon normal return).type
- the UNO interface type to register. This argument must be non-null, and must denote a UNO interface type. The givenobject
should implement thistype
.- Returns:
- the registered object (may differ from the
object
passed in); will never be null - See Also:
IEnvironment.registerInterface(java.lang.Object, java.lang.String[], com.sun.star.uno.Type)
-
revokeInterface
public void revokeInterface(java.lang.String oid, Type type)
You have to revoke ANY interface that has been registered via this method.- Specified by:
revokeInterface
in interfaceIEnvironment
- Parameters:
oid
- object id of interface to be revoked.type
- the type description of the interface.- See Also:
IEnvironment.revokeInterface(java.lang.String, com.sun.star.uno.Type)
-
getRegisteredInterface
public java.lang.Object getRegisteredInterface(java.lang.String oid, Type type)
Retrieves an interface identified by its object id and type from this environment.- Specified by:
getRegisteredInterface
in interfaceIEnvironment
- Parameters:
oid
- object id of interface to be retrieved.type
- the type description of the interface to be retrieved.- Returns:
- the registered object, or null if none is found
- See Also:
IEnvironment.getRegisteredInterface(java.lang.String, com.sun.star.uno.Type)
-
getRegisteredObjectIdentifier
public java.lang.String getRegisteredObjectIdentifier(java.lang.Object object)
Retrieves the object identifier for a registered interface from this environment.- Specified by:
getRegisteredObjectIdentifier
in interfaceIEnvironment
- Parameters:
object
- a registered interface.- Returns:
- the OID of the
object
; will never be null - See Also:
IEnvironment.getRegisteredObjectIdentifier(java.lang.Object)
-
list
public void list()
Description copied from interface:IEnvironment
Lists the registered objects toSystem.out
.This is for debug purposes.
- Specified by:
list
in interfaceIEnvironment
- See Also:
IEnvironment.list()
-
revokeAllProxies
public void revokeAllProxies()
Revokes all registered proxy interfaces.This method should be part of
IEnvironment
. It is called fromcom.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.dispose
.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-