An object adapter is an instance of the local interface ObjectAdapter
. You create an object adapter by calling one of several operations on a communicator:
module Ice { local interface ObjectAdapter { string getName(); Communicator getCommunicator(); // ... } local interface Communicator { ObjectAdapter createObjectAdapter(string name); ObjectAdapter createObjectAdapterWithEndpoints(string name, string endpoints); ObjectAdapter createObjectAdapterWithRouter(string name, Router* rtr); // ... } }
The ObjectAdapter
operations behave as follows:
- The
getName
operation returns the name of the adapter as passed to one of the communicator operationscreateObjectAdapter
,createObjectAdapterWithEndpoints
, orcreateObjectAdapterWithRouter
.
- The
getCommunicator
operation returns the communicator that was used to create the adapter.
Note that there are other operations in the ObjectAdapter
interface; we will explore these throughout the remainder of this discussion.
An application normally needs to configure an object adapter with endpoints or a router. Calling createObjectAdapter
with a non-empty value for name
means the new object adapter will check the communicator's configuration for properties, including:
name.Endpoints
- defines one or more object adapter endpointsname.Router
- specifies the stringified proxy of a router
createObjectAdapter
raises an exception if neither is defined.
The createObjectAdapterWithEndpoints
operation allows you to specify the object adapter's endpoints directly, overriding any setting for name.Endpoints
. Similarly, createObjectAdapterWithRouter
accepts a router proxy and overrides name.Router
.
Passing an empty value for name
to createObjectAdapter
creates a nameless object adapter that can only be used for collocated invocations or callbacks over bidirectional connections.