Interface ObjectAdapter
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Activate all endpoints that belong to this object adapter.Add a servant to this object adapter's Active Servant Map.void
addDefaultServant
(Object servant, String category) Add a default servant to handle requests for a specific category.Likeadd(com.zeroc.Ice.Object, com.zeroc.Ice.Identity)
, but with a facet.addFacetWithUUID
(Object servant, String facet) LikeaddWithUUID(com.zeroc.Ice.Object)
, but with a facet.void
addServantLocator
(ServantLocator locator, String category) Add a Servant Locator to this object adapter.addWithUUID
(Object servant) Add a servant to this object adapter's Active Servant Map, using an automatically generated UUID as its identity.Create a direct proxy for the object with the given identity.Create an indirect proxy for the object with the given identity.createProxy
(Identity id) Create a proxy for the object with the given identity.void
Deactivate all endpoints that belong to this object adapter.void
destroy()
Destroys the object adapter and cleans up all resources held by the object adapter.Look up a servant in this object adapter's Active Servant Map by the identity of the Ice object it implements.Find all facets with the given identity in the Active Servant Map.findByProxy
(ObjectPrx proxy) Look up a servant in this object adapter's Active Servant Map, given a proxy.findDefaultServant
(String category) Find the default servant for a specific category.Likefind(com.zeroc.Ice.Identity)
, but with a facet.findServantLocator
(String category) Find a Servant Locator installed with this object adapter.Get the communicator this object adapter belongs to.Endpoint[]
Get the set of endpoints configured with this object adapter.Get the Ice locator used by this object adapter.getName()
Get the name of this object adapter.Endpoint[]
Get the set of endpoints that proxies created by this object adapter will contain.void
hold()
Temporarily hold receiving and dispatching requests.boolean
Check whether object adapter has been deactivated.void
Refresh the set of published endpoints.Remove a servant (that is, the default facet) from the object adapter's Active Servant Map.Remove all facets with the given identity from the Active Servant Map.removeDefaultServant
(String category) Remove the default servant for a specific category.removeFacet
(Identity id, String facet) Likeremove(com.zeroc.Ice.Identity)
, but with a facet.removeServantLocator
(String category) Remove a Servant Locator from this object adapter.void
setLocator
(LocatorPrx loc) Set an Ice locator for this object adapter.void
setPublishedEndpoints
(Endpoint[] newEndpoints) Set of the endpoints that proxies created by this object adapter will contain.void
Wait until the object adapter has deactivated.void
Wait until the object adapter holds requests.
-
Method Details
-
getName
String getName()Get the name of this object adapter.- Returns:
- This object adapter's name.
-
getCommunicator
Communicator getCommunicator()Get the communicator this object adapter belongs to.- Returns:
- This object adapter's communicator.
- See Also:
-
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
void hold()Temporarily hold receiving and dispatching requests. The object adapter can be reactivated with theactivate()
operation.Holding is not immediate, i.e., after
hold()
returns, the object adapter might still be active for some time. You can usewaitForHold()
to wait until holding is complete.- See Also:
-
waitForHold
void waitForHold()Wait until the object adapter holds requests. Callinghold()
initiates holding of requests, andwaitForHold()
only returns when holding of requests has been completed. -
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, and cannot be used otherwise. Attempts to use a deactivated object adapter raiseObjectAdapterDeactivatedException
however, attempts todeactivate()
an already deactivated object adapter are ignored and do nothing. Once deactivated, it is possible to destroy the adapter to clean up resources and then create and activate a new adapter with the same name.After
deactivate()
returns, no new requests are processed by the object adapter. However, requests that have been started beforedeactivate()
was called might still be active. You can usewaitForDeactivate()
to wait for the completion of all requests for this object adapter. -
waitForDeactivate
void waitForDeactivate()Wait until the object adapter has deactivated. Callingdeactivate()
initiates object adapter deactivation, andwaitForDeactivate()
only returns when deactivation has been completed. -
isDeactivated
boolean isDeactivated()Check whether object adapter has been deactivated.- Returns:
- Whether adapter has been deactivated.
- See Also:
-
destroy
void destroy()Destroys the object adapter and cleans up all resources held by the object adapter. If the object adapter has not yet been deactivated, destroy implicitly initiates the deactivation and waits for it to finish. Subsequent calls to destroy are ignored. Once destroy has returned, it is possible to create another object adapter with the same name. -
add
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 throwsAlreadyRegisteredException
.- Parameters:
servant
- The servant to add.id
- The identity of the Ice object that is implemented by the servant.- Returns:
- A proxy that matches the given identity and this object adapter.
- See Also:
-
addFacet
Likeadd(com.zeroc.Ice.Object, com.zeroc.Ice.Identity)
, but with a facet. Callingadd(servant, id)
is equivalent to callingaddFacet(com.zeroc.Ice.Object, com.zeroc.Ice.Identity, java.lang.String)
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.- Returns:
- A proxy that matches the given identity, facet, and this object adapter.
- See Also:
-
addWithUUID
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'sice_getIdentity
operation.- Parameters:
servant
- The servant to add.- Returns:
- A proxy that matches the generated UUID identity and this object adapter.
- See Also:
-
addFacetWithUUID
LikeaddWithUUID(com.zeroc.Ice.Object)
, but with a facet. CallingaddWithUUID(servant)
is equivalent to callingaddFacetWithUUID(com.zeroc.Ice.Object, java.lang.String)
with an empty facet.- Parameters:
servant
- The servant to add.facet
- The facet. An empty facet means the default facet.- Returns:
- A proxy that matches the generated UUID identity, facet, and this object adapter.
- See Also:
-
addDefaultServant
Add a default servant to handle requests for a specific category. Adding a default servant for a category for which a default servant is already registered throwsAlreadyRegisteredException
. 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:- The object adapter tries to find a servant for the identity and facet in the Active Servant Map.
- If no servant has been found in the Active Servant Map, the object adapter tries to find a default servant for the category component of the identity.
- If no servant has been found by any of the preceding steps, the object adapter tries to find a default servant for an empty category, regardless of the category contained in the identity.
- If no servant has been found by any of the preceding steps,
the object adapter gives up and the caller receives
ObjectNotExistException
orFacetNotExistException
.
- Parameters:
servant
- The default servant.category
- The category for which the default servant is registered. An empty category means it will handle all categories.- See Also:
-
remove
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(com.zeroc.Ice.Identity)
has to be called for all those Ice objects. Removing an identity that is not in the map throwsNotRegisteredException
.- Returns:
- The removed servant.
- See Also:
-
removeFacet
Likeremove(com.zeroc.Ice.Identity)
, but with a facet. Callingremove(id)
is equivalent to callingremoveFacet(com.zeroc.Ice.Identity, java.lang.String)
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.- Returns:
- The removed servant.
- See Also:
-
removeAllFacets
Remove all facets with the given identity from the Active Servant Map. The operation completely removes the Ice object, including its default facet. Removing an identity that is not in the map throwsNotRegisteredException
.- Parameters:
id
- The identity of the Ice object to be removed.- Returns:
- A collection containing all the facet names and servants of the removed Ice object.
- See Also:
-
removeDefaultServant
Remove the default servant for a specific category. Attempting to remove a default servant for a category that is not registered throwsNotRegisteredException
.- Parameters:
category
- The category of the default servant to remove.- Returns:
- The default servant.
- See Also:
-
find
Look up a servant in this object adapter's Active Servant Map by the identity of the Ice object it implements.This operation only tries to look up 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.- Returns:
- The servant that implements the Ice object with the given identity, or null if no such servant has been found.
- See Also:
-
findFacet
Likefind(com.zeroc.Ice.Identity)
, but with a facet. Callingfind(id)
is equivalent to callingfindFacet(com.zeroc.Ice.Identity, java.lang.String)
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.- Returns:
- The servant that implements the Ice object with the given identity and facet, or null if no such servant has been found.
- See Also:
-
findAllFacets
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.- Returns:
- A collection containing all the facet names and servants that have been found, or an empty map if there is no facet for the given identity.
- See Also:
-
findByProxy
Look up a servant in this object adapter's Active Servant Map, given a proxy.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:
proxy
- The proxy for which the servant should be returned.- Returns:
- The servant that matches the proxy, or null if no such servant has been found.
- See Also:
-
addServantLocator
Add a Servant Locator to this object adapter. Adding a servant locator for a category for which a servant locator is already registered throwsAlreadyRegisteredException
. 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:- The object adapter tries to find a servant for the identity and facet in the Active Servant Map.
- If no servant has been found in the Active Servant Map, the object adapter tries to find a servant locator for the category component of the identity. If a locator is found, the object adapter tries to find a servant using this locator.
- 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.
- If no servant has been found by any of the preceding steps,
the object adapter gives up and the caller receives
ObjectNotExistException
orFacetNotExistException
.
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.- See Also:
-
removeServantLocator
Remove a Servant Locator from 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.- Returns:
- The Servant Locator, or throws
NotRegisteredException
if no Servant Locator was found for the given category. - See Also:
-
findServantLocator
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.- Returns:
- The Servant Locator, or null if no Servant Locator was found for the given category.
- See Also:
-
findDefaultServant
Find the default servant for a specific category.- Parameters:
category
- The category of the default servant to find.- Returns:
- The default servant or null if no default servant was registered for the category.
- See Also:
-
createProxy
Create a proxy for the object with the given identity. If this object adapter is configured with an adapter id, the return value is an indirect proxy that refers to the adapter id. If a replica group id is also defined, the return value is an indirect proxy that refers to the replica group id. Otherwise, if no adapter id is defined, the return value is a direct proxy containing this object adapter's published endpoints.- Parameters:
id
- The object's identity.- Returns:
- A proxy for the object with the given identity.
- See Also:
-
createDirectProxy
Create a direct proxy for the object with the given identity. The returned proxy contains this object adapter's published endpoints.- Parameters:
id
- The object's identity.- Returns:
- A proxy for the object with the given identity.
- See Also:
-
createIndirectProxy
Create an indirect proxy for the object with the given identity. If this object adapter is configured with an adapter id, the return value refers to the adapter id. Otherwise, the return value contains only the object identity.- Parameters:
id
- The object's identity.- Returns:
- A proxy for the object with the given identity.
- See Also:
-
setLocator
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 identifier instead of its endpoints. The adapter identifier must be configured using the AdapterId property.- Parameters:
loc
- The locator used by this object adapter.- See Also:
-
getLocator
LocatorPrx getLocator()Get the Ice locator used by this object adapter.- Returns:
- The locator used by this object adapter, or null if no locator is used by this object adapter.
- See Also:
-
getEndpoints
Endpoint[] getEndpoints()Get the set of endpoints configured with this object adapter.- Returns:
- The set of endpoints.
- See Also:
-
refreshPublishedEndpoints
void refreshPublishedEndpoints()Refresh the set of published endpoints. The run time re-reads the PublishedEndpoints property if it is set and re-reads the list of local interfaces if the adapter is configured to listen on all endpoints. This operation is useful to refresh the endpoint information that is published in the proxies that are created by an object adapter if the network interfaces used by a host changes. -
getPublishedEndpoints
Endpoint[] getPublishedEndpoints()Get the set of endpoints that proxies created by this object adapter will contain.- Returns:
- The set of published endpoints.
- See Also:
-
setPublishedEndpoints
Set of the endpoints that proxies created by this object adapter will contain.- Parameters:
newEndpoints
- The new set of endpoints that the object adapter will embed in proxies.- See Also:
-