Ice::ObjectAdapter

Overview

local interface ObjectAdapter

The object adapter, which is responsible for receiving requests from endpoints, and for mapping between servants, identities, and proxies.

Operation Index

activate

Activate all endpoints that belong to this object adapter.

add

Add a servant to this object adapter's Active Servant Map.

addFacet

Like add, but with a facet.

addFacetWithUUID

Like addWithUUID, but with a facet.

addRouter

Add a router to this object adapter.

addServantLocator

Add a Servant Locator to this object adapter.

addWithUUID

Add a servant to this object adapter's Active Servant Map, using an automatically generated UUID as its identity.

createDirectProxy

Create a "direct proxy" that matches this object adapter and the given identity.

createProxy

Create a proxy that matches this object adapter and the given identity.

createReverseProxy

Create a "reverse proxy" that matches this object adapter and the given identity.

deactivate

Deactivate all endpoints that belong to this object adapter.

find

Look up a servant in this object adapter's Active Servant Map by the identity of the Ice object it implements.

findAllFacets

Find all facets with the given identity in the Active Servant Map.

findByProxy

Look up a servant in this object adapter's Active Servant Map, given a proxy.

findFacet

Like find, but with a facet.

findServantLocator

Find a Servant Locator installed with this object adapter.

getCommunicator

Get the communicator this object adapter belongs to.

getName

Get the name of this object adapter.

hold

Temporarily hold receiving and dispatching requests.

remove

Remove a servant (that is, the default facet) from the object adapter's Active Servant Map.

removeAllFacets

Remove all facets with the given identity from the Active Servant Map (that is, completely remove the Ice object, including it's default facet).

removeFacet

Like remove, but with a facet.

setLocator

Set an Ice locator for this object adapter.

waitForDeactivate

Wait until the object adapter has deactivated.

waitForHold

Wait until the object adapter holds requests.

activate

void activate();

Activate all endpoints that belong to this object adapter. After activation, the object adapter can dispatch requests received through its endpoints.

See Also

hold, deactivate

add

Object* add(Object servant,
    Identity id);

Add a servant to this object adapter's Active Servant Map. Note that one servant can implement several Ice objects by registering the servant with multiple identities. Adding a servant with an identity that is in the map already throws AlreadyRegisteredException.

Parameters

servant

The servant to add.

id

The identity of the Ice object that is implemented by the servant.

Return Value

A proxy that matches the given identity and this object adapter.

addFacet

Object* addFacet(Object servant,
    Identity id,
    string facet);

Like add, but with a facet. Calling add(servant, * id) is equivalent to calling addFacet with an empty facet.

Parameters

servant

The servant to add.

id

The identity of the Ice object that is implemented by the servant.

facet

The facet. An empty facet means the default facet.

Return Value

A proxy that matches the given identity, facet, and this object adapter.

addFacetWithUUID

Object* addFacetWithUUID(Object servant,
    string facet);

Like addWithUUID, but with a facet. Calling addWithUUID(servant) is equivalent to calling addFacetWithUUID with an empty facet.

Parameters

servant

The servant to add.

facet

The facet. An empty facet means the default facet.

Return Value

A proxy that matches the generated UUID identity, facet, and this object adapter.

addRouter

void addRouter(Router* rtr);

Add a router to this object adapter. By doing so, this object adapter can receive callbacks from this router over connections that are established from this process to the router. This avoids the need for the router to establish a separate connection back to this object adapter.

Note

You can add a particular router to only a single object adapter. Adding the same router to more than one object adapter results in undefined behavior. However, it is possible to add different routers to different object adapters.

Parameters

rtr

The router to add to this object adapter.

addServantLocator

void addServantLocator(ServantLocator locator,
    string category);

Add a Servant Locator to this object adapter. Adding a servant locator for a category for which a servant locator is already registered throws AlreadyRegisteredException. To dispatch operation calls on servants, the object adapter tries to find a servant for a given Ice object identity and facet in the following order:

  1. The object adapter tries to find a servant for the identity and facet in the Active Servant Map.

  2. If no servant has been found in the Active Servant Map, the object adapter tries to find a locator for the category component of the identity. If a locator is found, the object adapter tries to find a servant using this locator.

  3. If no servant has been found by any of the preceding steps, the object adapter tries to find a locator for an empty category, regardless of the category contained in the identity. If a locator is found, the object adapter tries to find a servant using this locator.

  4. If no servant has been found with any of the preceding steps, the object adapter gives up and the caller receives ObjectNotExistException or FacetNotExistException.

Note

Only one locator for the empty category can be installed.

Parameters

locator

The locator to add.

category

The category for which the Servant Locator can locate servants, or an empty string if the Servant Locator does not belong to any specific category.

addWithUUID

Object* addWithUUID(Object servant);

Add a servant to this object adapter's Active Servant Map, using an automatically generated UUID as its identity. Note that the generated UUID identity can be accessed using the proxy's ice_getIdentity operation.

Parameters

servant

The servant to add.

Return Value

A proxy that matches the generated UUID identity and this object adapter.

createDirectProxy

Object* createDirectProxy(Identity id);

Create a "direct proxy" that matches this object adapter and the given identity. A direct proxy always contains the current adapter endpoints.

Note

This operation is intended to be used by locator implementations. Regular user code should not attempt to use this operation.

Parameters

id

The identity for which a proxy is to be created.

Return Value

A proxy that matches the given identity and this object adapter.

See Also

Identity

createProxy

Object* createProxy(Identity id);

Create a proxy that matches this object adapter and the given identity.

Parameters

id

The identity for which a proxy is to be created.

Return Value

A proxy that matches the given identity and this object adapter.

See Also

Identity

createReverseProxy

Object* createReverseProxy(Identity id);

Create a "reverse proxy" that matches this object adapter and the given identity. A reverse proxy uses the incoming connections that have been established from a client to this object adapter.

Note

This operation is intended to be used by special services, such as Router implementations. Regular user code should not attempt to use this operation.

Parameters

id

The identity for which a proxy is to be created.

Return Value

A "reverse proxy" that matches the given identity and uses the incoming connections of this object adapter.

See Also

Identity

deactivate

void deactivate();

Deactivate all endpoints that belong to this object adapter. After deactivation, the object adapter stops receiving requests through its endpoints. Object adapters that have been deactivated must not be reactivated again, i.e., the deactivation is permanent and activate or hold must not be called after calling deactivate; attempting to do so results in an ObjectAdapterDeactivatedException being thrown. Calls to deactivate on an already deactivated object adapter are ignored.

Note

After deactivate returns, no new requests are processed by the object adapter. However, requests that have been started before deactivate was called might still be active. You can use waitForDeactivate to wait for the completion of all requests for this object adapter.

find

Object find(Identity id);

Look up a servant in this object adapter's Active Servant Map by the identity of the Ice object it implements.

Note

This operation only tries to lookup a servant in the Active Servant Map. It does not attempt to find a servant by using any installed ServantLocator.

Parameters

id

The identity of the Ice object for which the servant should be returned.

Return Value

The servant that implements the Ice object with the given identity, or null if no such servant has been found.

findAllFacets

FacetMap findAllFacets(Identity id);

Find all facets with the given identity in the Active Servant Map.

Parameters

id

The identity of the Ice object for which the facets should be returned.

Return Value

A collection containing all the facet names and servants which have been found, or an empty map if there is no facet for the given identity.

See Also

find, findFacet

findByProxy

Object findByProxy(Object* proxy);

Look up a servant in this object adapter's Active Servant Map, given a proxy.

Note

This operation only tries to lookup a servant in the Active Servant Map. It does not attempt to find a servant via any installed ServantLocators.

Parameters

proxy

The proxy for which the servant should be returned.

Return Value

The servant that matches the proxy, or null if no such servant has been found.

See Also

find, findFacet

findFacet

Object findFacet(Identity id,
    string facet);

Like find, but with a facet. Calling find(id) is equivalent to calling findFacet with an empty facet.

Parameters

id

The identity of the Ice object for which the servant should be returned.

facet

The facet. An empty facet means the default facet.

Return Value

The servant that implements the Ice object with the given identity and facet, or null if no such servant has been found.

findServantLocator

ServantLocator findServantLocator(string category);

Find a Servant Locator installed with this object adapter.

Parameters

category

The category for which the Servant Locator can locate servants, or an empty string if the Servant Locator does not belong to any specific category.

Return Value

The Servant Locator, or null if no Servant Locator was found for the given category.

getCommunicator

Communicator getCommunicator();

Get the communicator this object adapter belongs to.

Return Value

This object adapter's communicator.

See Also

Communicator

getName

string getName();

Get the name of this object adapter.

Return Value

This object adapter's name.

hold

void hold();

Temporarily hold receiving and dispatching requests. The object adapter can be reactivated with the activate operation.

Note

Holding is not immediate, i.e., after hold returns, the object adapter might still be active for some time. You can use waitForHold to wait until holding is complete.

remove

Object remove(Identity id);

Remove a servant (that is, the default facet) from the object adapter's Active Servant Map.

Parameters

id

The identity of the Ice object that is implemented by the servant. If the servant implements multiple Ice objects, remove has to be called for all those Ice objects. Removing an identity that is not in the map throws NotRegisteredException.

Return Value

The removed servant.

removeAllFacets

FacetMap removeAllFacets(Identity id);

Remove all facets with the given identity from the Active Servant Map (that is, completely remove the Ice object, including it's default facet). Removing an identity that is not in the map throws NotRegisteredException.

Parameters

id

The identity of the Ice object to be removed.

Return Value

A collection containing all the facet names and servants of the removed Ice object.

removeFacet

Object removeFacet(Identity id,
    string facet);

Like remove, but with a facet. Calling remove(id) is equivalent to calling removeFacet with an empty facet.

Parameters

id

The identity of the Ice object that is implemented by the servant.

facet

The facet. An empty facet means the default facet.

Return Value

The removed servant.

setLocator

void setLocator(Locator* loc);

Set an Ice locator for this object adapter. By doing so, the object adapter will register itself with the locator registry when it is activated for the first time. Furthermore, the proxies created by this object adapter will contain the adapter name instead of its endpoints.

Parameters

loc

The locator used by this object adapter.

waitForDeactivate

void waitForDeactivate();

Wait until the object adapter has deactivated. Calling deactivate initiates object adapter deactivation, and waitForDeactivate only returns when deactivation has been completed.

waitForHold

void waitForHold();

Wait until the object adapter holds requests. Calling hold initiates holding of requests, and waitForHold only returns when holding of requests has been completed.