Top Description Methods
com.sun.star.uno

public Interface IEnvironment

Known Direct Implementers
com.sun.star.lib.uno.environments.java.java_environment, com.sun.star.lib.uno.environments.remote.remote_environment
Annotations
@Deprecated

Deprecated

As of UDK 3.2, this interface is deprecated, without offering a replacement.

The interface implemented by UNO environments.

With this interface, objects can be registered at and revoked from an environment.

See Also
com.sun.star.uno.IBridge, com.sun.star.uno.IQueryInterface, com.sun.star.uno.UnoRuntime

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the context of this environment
getContext
()

Gets the context of this environment.

public String

Returns:

the name of this environment
getName
()

Gets the name of this environment.

public Object

Returns:

the registered object, or null if none is found
getRegisteredInterface
(String
the OID of the object to retrieve; must be non-null
oid
,
Type
the UNO interface type of the object to retrieve. This argument must be non-null, and must denote a UNO interface type.
type
)

Retrieves a registered object, specified by OID and UNO interface type.

public String

Returns:

the OID of the object; will never be null
getRegisteredObjectIdentifier
(Object
a registered object; must be non-null
object
)

Retrieves the OID for a registered object.

public void
list()

Lists the registered objects to System.out.

public Object

Returns:

the registered object (may differ from the object passed in); will never be null
registerInterface
(Object
the object to register; must be non-null
object
,
String[]
in-out parameter containing the OID of object. 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).
oid
,
Type
the UNO interface type to register. This argument must be non-null, and must denote a UNO interface type. The given object should implement this type.
type
)

Registers one UNO interface facet of an object.

public void
revokeInterface(String
the OID of the object to revoke; must be non-null
oid
,
Type
the UNO interface type of the object to revoke. This argument must be non-null, and must denote a UNO interface type.
type
)

Explicitly revokes a UNO interface facet.

Method Detail

getContextback to summary
public Object getContext()

Gets the context of this environment.

Returns:Object

the context of this environment

getNameback to summary
public String getName()

Gets the name of this environment.

Returns:String

the name of this environment

getRegisteredInterfaceback to summary
public Object getRegisteredInterface(String oid, Type type)

Retrieves a registered object, specified by OID and UNO interface type.

Parameters
oid:String

the OID of the object to retrieve; must be non-null

type:Type

the UNO interface type of the object to retrieve. This argument must be non-null, and must denote a UNO interface type.

Returns:Object

the registered object, or null if none is found

getRegisteredObjectIdentifierback to summary
public String getRegisteredObjectIdentifier(Object object)

Retrieves the OID for a registered object.

Parameters
object:Object

a registered object; must be non-null

Returns:String

the OID of the object; will never be null

listback to summary
public void list()

Lists the registered objects to System.out.

This is for debug purposes.

registerInterfaceback to summary
public Object registerInterface(Object object, String[] oid, Type type)

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 call registerInterface for the same combination of oid and type at the same time; the race condition is solved by letting one of the calls register its argument object, ignoring the argument object of the other call, and letting both calls return the same object.

The registered object is held only weakly by the environment. After a call to registerInterface, a call to getRegisteredInterface only succeeds as long as the registered object is still strongly reachable, and the registered object has not been explicitly revoked by calling revokeInterface.

Parameters
object:Object

the object to register; must be non-null

oid:String[]

in-out parameter containing the OID of object. 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:Type

the UNO interface type to register. This argument must be non-null, and must denote a UNO interface type. The given object should implement this type.

Returns:Object

the registered object (may differ from the object passed in); will never be null

revokeInterfaceback to summary
public void revokeInterface(String oid, Type type)

Explicitly revokes a UNO interface facet.

Calls to registerInterface and revokeInterface must be paired. A facet is only removed from the environment when it has been revoked as often as it has been registered. This may change in the future, so that a facet would be removed upon the first call to revokeInterface (and calls to revokeInterface would no longer be necessary if the calling code does not want to control the temporal extent of the registration).

It is not an error if the specified facet is not registered at this environment (either because no corresponding object has ever been registered, or it has been explicitly revoked, or it is no longer strongly reachable). In such a case, this method simply does nothing.

Parameters
oid:String

the OID of the object to revoke; must be non-null

type:Type

the UNO interface type of the object to revoke. This argument must be non-null, and must denote a UNO interface type.