public interface ContainerServices extends ContainerServicesBase
ContainerServices is different from the other services that the container
provides without the component implementation knowing about it.
It can be thought of as a callback handle or a library.
Currently, methods are added to this interface as the functionality becomes available.
At some point we will have to declutter the interface by introducing 2nd-level interfaces
that harbor cohesive functionality. For example, instead of calling
myContainerServices.getComponent(...), the new call will then be something like
myContainerServices.communication().getComponent(...).
created on Oct 24, 2002 12:56:36 PM
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ContainerServices.ComponentListener |
static class |
ContainerServices.ComponentReleaseCallback
Callback that can be optionally given to
releaseComponent(String, ComponentReleaseCallback). |
static class |
ContainerServices.ComponentReleaseCallbackWithLogging
Variant of
ContainerServices.ComponentReleaseCallback which logs all errors. |
| Modifier and Type | Method and Description |
|---|---|
<T extends OffShootOperations> |
activateOffShoot(T offshootImpl,
java.lang.Class<T> idlOpInterface)
Activates an Object as an OffShoot.
|
void |
assignUniqueEntityId(EntityT entity)
Creates a unique id and sets it on the given (binding class) entity object.
|
java.lang.String[] |
findComponents(java.lang.String curlWildcard,
java.lang.String typeWildcard)
Finds components by their instance name (curl) and/or by their type.
|
AlarmSource |
getAlarmSource()
Returns the
AlarmSource owned by this object. |
org.omg.CORBA.Object |
getCollocatedComponent(ComponentQueryDescriptor compSpec,
boolean markAsDefaul,
java.lang.String targetCompUrl)
Dynamic version of
getCollocatedComponent(String, String). |
org.omg.CORBA.Object |
getCollocatedComponent(java.lang.String compUrl,
java.lang.String targetCompUrl)
Gets a component that will run collocated with a given component.
|
org.omg.CORBA.Object |
getComponent(java.lang.String componentUrl)
Gets a component specified by its instance name.
|
ComponentDescriptor |
getComponentDescriptor(java.lang.String componentUrl)
Gets the component descriptor which contains meta data for the component.
|
org.omg.CORBA.Object |
getComponentNonSticky(java.lang.String curl)
Gets a non-sticky reference to a component.
|
ComponentStateManager |
getComponentStateManager()
Delivers the
ComponentStateManager object
through which the component and the container administrate the
state of the component. |
org.omg.CORBA.Object |
getDefaultComponent(java.lang.String componentIDLType)
Gets the default component specified by the component type.
|
org.omg.CORBA.Object |
getDynamicComponent(ComponentQueryDescriptor compSpec,
boolean markAsDefault)
Gets a component whose instance is not registered in the CDB
at deployment time.
|
org.omg.CORBA.Object |
getDynamicComponent(ComponentSpec compSpec,
boolean markAsDefault)
Deprecated.
use
getDynamicComponent(ComponentQueryDescriptor, boolean) instead.
if you need to set not only the standard fields component_name or component_type,
but also the more advanced values component_code or container_name,
please send a request to ACS so that access to these fields be included in the
ComponentQueryDescriptor given to the recommended version of this method. |
org.omg.CORBA.Object |
getReferenceWithCustomClientSideTimeout(org.omg.CORBA.Object originalCorbaRef,
double timeoutSeconds)
Wraps a component reference (or offshoot reference etc) such that the given timeout is applied on
the client side of calls to this (possibly remote) object.
|
<T,F> T |
getTransparentXmlWrapper(java.lang.Class<T> transparentXmlIF,
F objectReference,
java.lang.Class<F> flatXmlIF)
Converts a "flat-XML" remote object (RO) interface
(as obtained from the various
getComponent methods, in the
case of components, or by retrieving offshoots from components,
in the case of offshoots) to a "transparent-XML" RO interface. |
void |
registerComponentListener(ContainerServices.ComponentListener listener)
Allows a client to register a callback object that gets notified when some
component(s) in use by the client (= components the client requested previously)
dies or comes back to life (with
ComponentListener#includeForeignComponents()==false). |
void |
releaseComponent(java.lang.String componentUrl)
Releases the specified component.
|
void |
releaseComponent(java.lang.String componentUrl,
ContainerServices.ComponentReleaseCallback callback)
Releases the reference to the specified component.
|
activateOffShoot, createNotificationChannelPublisher, createNotificationChannelPublisher, createNotificationChannelSubscriber, createNotificationChannelSubscriber, deactivateOffShoot, getAdvancedContainerServices, getCDB, getLogger, getName, getThreadFactoryComponentStateManager getComponentStateManager()
ComponentStateManager object
through which the component and the container administrate the
state of the component.
The component needs to access the ComponentStateManager
if it wishes to change its state.
If it doesn't, only the container will change the state based on
the information it has available.
alma.ACS.ComponentStatesorg.omg.CORBA.Object getComponent(java.lang.String componentUrl)
throws AcsJContainerServicesEx
get_component.
HelloComponent helloComp =
HelloComponentHelper.narrow(containerServices.getComponent("HELLOCOMP1"));.
get_service offered by the manager
is deliberately not represented here. It would currently (Oct.03) offer
access to "LogFactory", "NotifyEventChannelFactory", "ArchivingChannel@ARCHIVING.channels",
"LoggingChannel", "InterfaceRepository", "CDB", "ACSLogSvc";
It seems that if such access is needed, specialized methods should be added
to this interface, like ContainerServicesBase.getCDB().
componentUrl - the ACS CURL of the deployed component instance.AcsJContainerServicesEx - if something goes wrong.org.omg.CORBA.Object getComponentNonSticky(java.lang.String curl)
throws AcsJContainerServicesEx
A non-sticky reference does not bind the Manager to keep alive the Component, and the Client requesting a non-sticky reference is not considered when checking for reference counts. The non-sticky reference should not be released, as that call will fail. The Manager can deactivate Components independently of any non-sticky reference. Since a non-sticky reference is not considered in reference counting, it will also not activate the component if it is not already active. As a consequence, asking for a non-sticky reference to a not-active Component throws an exception. The client represented by id (the handle) must have adequate access rights to access the component.
curl - the component URL (component instance name)AcsJContainerServicesEx - if something goes wrongorg.omg.CORBA.Object getDefaultComponent(java.lang.String componentIDLType)
throws AcsJContainerServicesEx
IDL:alma/PS/PowerSupply:1.0.
A default instance for the given type must have been declared beforehand (either statically in the CDB config files, or dynamically), otherwise an exception is thrown.
To get more information on the returned component, call
getComponentDescriptor(java.lang.String) with the instance name that
you can get from the component using alma.ACS.ACSComponentOperations#name.
Delegates to si.ijs.maci.ManagerOperations#get_default_component.
componentIDLType - AcsJContainerServicesExorg.omg.CORBA.Object getCollocatedComponent(java.lang.String compUrl,
java.lang.String targetCompUrl)
throws AcsJContainerServicesEx
compUrl - the component's name (URL)targetCompUrl - the name (URL) of the target component, in whose container we also want compUrl to run.AcsJContainerServicesEx - If the call failed and no component reference could be obtained.org.omg.CORBA.Object getCollocatedComponent(ComponentQueryDescriptor compSpec, boolean markAsDefaul, java.lang.String targetCompUrl) throws AcsJContainerServicesEx
getCollocatedComponent(String, String).compSpec - the description of the component to be createdmarkAsDefaul - if true, the new component will become the default component for its IDL type.targetCompUrl - targetCompUrl the name (URL) of the target component, in whose container we also want compUrl to run.AcsJContainerServicesEx - If the call failed and no component reference could be obtained.org.omg.CORBA.Object getDynamicComponent(ComponentQueryDescriptor compSpec, boolean markAsDefault) throws AcsJContainerServicesEx
The fields of compSpec can be filled in at various levels of detail,
allowing the manager to blend in missing data from static deployment information.
For a detailed description of the various options,
please refer to the ACS documentation.
To get more information on the returned component, call
getComponentDescriptor(java.lang.String) with the instance name that
you've specified or that you can get from the component in case it was
assigned (see alma.ACS.ACSComponentOperations#name()).
Delegates to si.ijs.maci.ManagerOperations#get_dynamic_component.
compSpec - the description of the component to be createdmarkAsDefault - if true, the new component will become the default component for its IDL type.AcsJContainerServicesExorg.omg.CORBA.Object getDynamicComponent(ComponentSpec compSpec,
boolean markAsDefault)
throws AcsJContainerServicesEx
getDynamicComponent(ComponentQueryDescriptor, boolean) instead.
if you need to set not only the standard fields component_name or component_type,
but also the more advanced values component_code or container_name,
please send a request to ACS so that access to these fields be included in the
ComponentQueryDescriptor given to the recommended version of this method.getDynamicComponent(ComponentQueryDescriptor, boolean)
which exposes a CORBA struct directly.compSpec - the description of the component to be createdmarkAsDefault - if true, the new component will become the default component for its IDL type.AcsJContainerServicesExjava.lang.String[] findComponents(java.lang.String curlWildcard,
java.lang.String typeWildcard)
throws AcsJContainerServicesEx
getComponent
to obtain the reference.curlWildcard - (null is understood as "*")typeWildcard - (null is understood as "*")AcsJContainerServicesExsi.ijs.maci.ManagerOperations#get_component_info(int, int[], java.lang.String, java.lang.String, boolean)ComponentDescriptor getComponentDescriptor(java.lang.String componentUrl) throws AcsJContainerServicesEx
To be used primarily after retrieval of a component with
getDefaultComponent
or getDynamicComponent,
when some data like the instance name is not known.
The idea behind having this method separately is that in many cases,
components are not interested in this information, and are happier to
get back from these methods directly the remote reference to another component,
instead of always dealing with a ComponentDescriptor.
componentUrl - the unique name of a componentContainerException - if componentUrl is unknown
or anything else goes wrongAcsJContainerServicesExsi.ijs.maci.ComponentInfovoid releaseComponent(java.lang.String componentUrl)
_release() on the CORBA stub for that component.
If the curl is not known to the container, the request will be ignored.
This method will return only when the component has actually been released, which may take some time in case there are still active requests being processed.
This method is kept for convenience, providing a specific subset of the functionality that
the more flexible releaseComponent(String, ComponentReleaseCallback) offers.
It blocks the client until the component is released or a timeout of 60 seconds has
occurred, and logs all errors of component release at level DEBUG.
componentUrl - the name/curl of the component instance as used by the managervoid releaseComponent(java.lang.String componentUrl,
ContainerServices.ComponentReleaseCallback callback)
This call will return as soon as the release request has been delivered to the ACS manager, which means that the reference count evaluation and possible component deactivation will happen only after returning from this call.
If your code must synchronize with the reference evaluation and possible component deactivation in the target container,
or if you are interested in exceptions that may occur during component deactivation,
then you should supply the optional ComponentRequestCallback object and block execution of your
calling thread until you receive the callback.
If an exception (such as no-permission) is thrown during the synchronous first part of the underlying call to the manager, then this exception will not be thrown upward by this method but will instead be reported to the optional callback object, just like any exception that happens later during the asynchronous part of the component release. The idea here is to have either "interested" clients that want to get all exceptions, or "easy" clients that do not care about any exceptions, thus do not provide a callback object, and also do not want to bother about a try/catch block.
componentUrl - the name/curl of the component instance as used by the managercallback - may be null if you do not need to wait for component deactivation or to see the results.
An new instance of ComponentReleaseCallback is required for every call.void registerComponentListener(ContainerServices.ComponentListener listener)
ComponentListener#includeForeignComponents()==false).
If the client wants to get notified even for components that it does not hold a reference to,
then ComponentListener#includeForeignComponents() should return true;
notification about components that this client does not use may be limited though, e.g.
to components collocated in the same container.
listener - si.ijs.maci.ClientOperations#components_available(si.ijs.maci.ComponentInfo[])org.omg.CORBA.Object getReferenceWithCustomClientSideTimeout(org.omg.CORBA.Object originalCorbaRef,
double timeoutSeconds)
throws AcsJContainerServicesEx
org.omg.CORBA.TIMEOUT exception will be thrown.
This allows us to override the general timeout given at the system level (e.g. orb.properties file in case of jacorb) and the container-level timeout given in the CDB container configuration. It is possible to set the timeout to values that are shorter or longer than the default timeout. You should chose a timeout value that matches the expected response time, with a large safety margin of
Note that calls to which the specified timeout should apply must be made on the object reference returned from this method, and not on the original object that gets passed to this method! Some corba implementations may apply the timeout to both objects though, or return the original object.
corbaRef - Reference to a component or an offshoot as obtained from some of the other container services methods.timeoutSeconds - the custom client side timeout in seconds, to be used for all calls to the given object reference.AcsJContainerServicesExvoid assignUniqueEntityId(EntityT entity)
throws AcsJContainerServicesEx
entity - must be freshly created andAcsJContainerServicesEx<T,F> T getTransparentXmlWrapper(java.lang.Class<T> transparentXmlIF,
F objectReference,
java.lang.Class<F> flatXmlIF)
throws AcsJContainerServicesEx
getComponent methods, in the
case of components, or by retrieving offshoots from components,
in the case of offshoots) to a "transparent-XML" RO interface.
This is only applicable to ROs that contain XML entities
in their IDL interface methods, and for which the build process
has been set up to generate XML binding classes and the "transparent-XML"
interface in addition to the standard Java-IDL compiler output.
In the case that the remote object is a component, the container can fulfill this request in two different ways:
flatXmlIF)
and the corresponding Java binding classes (in transparentXmlIF).
Object implements the
transparentXmlIF interface.
The client component that calls this method should only cast to that interface,
and does not need to know which of the two transport mechanisms are being used.transparentXmlIF - remote object interface with XML binding classes.objectReference - reference to the remote object to be wrapped, which
implements flatXmlIF.
Currently supported remote objects are ACS Components and OffShoots.flatXmlIF - remote object interface ("xxxOperations") where entity objects are represented as
serialized XML inside a CORBA struct.transparentXmlIF.AcsJContainerServicesEx<T extends OffShootOperations> OffShoot activateOffShoot(T offshootImpl,
java.lang.Class<T> idlOpInterface)
throws AcsJContainerServicesEx
In contrast to the old ContainerServicesBase.activateOffShoot(Servant) method, which always expects a
Servant (either subclass of xyzPOA skeleton or a xyzPOATie instance), this method is more flexible and
receives two arguments:
alma.ACS.OffShootOperations, but without
restricting it to be a Servant, and offshootImpl should be a corba Servant, either a subclass of the
XyzPOA skeleton, or a XyzPOATie instance (delegation model). idlOpInterface should be XyzOperations.class.
offshootImpl should be an object that implements the generated XyzJ interface
(which uses XML binding classes and extends OffShootOperations).
This object is not expected to be a Corba Servant.idlOpInterface should be XyzJ.class.
T - The type of offshootImpl, one of the xyzJ or
xyzOperations interfacesoffshootImpl - the object that implements the OffShoot logicidlOpInterface - the IDL operations interface implemented by offshootImpl;
currently, must be one of xyzOperations or xyzJCBdouble myCBdouble = alma.ACS.CBdoubleHelper.narrow(...).AcsJContainerServicesEx - if anything goes wrong,
especially if offshootImpl is does not implement alma.ACS.OffShootOperations.AlarmSource getAlarmSource()
AlarmSource owned by this object. The AlarmSource object
allows to raise and clear alarms, among other advanced operations
AlarmSource owned by this object