public class DummyContainerServices extends DummyContainerServicesBase implements ContainerServices
Note that ContainerServicesImpl would drag in AcsManagerProxy,
so that it seems cleaner to create a dummy class for which the unit test
can override a few methods.
ContainerServices.ComponentListener, ContainerServices.ComponentReleaseCallback, ContainerServices.ComponentReleaseCallbackWithLogginglogger, name| Constructor and Description |
|---|
DummyContainerServices(java.lang.String name,
java.util.logging.Logger logger) |
| 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.
|
<T> AcsEventPublisher<T> |
createNotificationChannelPublisher(java.lang.String channelName,
java.lang.Class<T> eventType)
Creates a new
AcsEventPublisher object for a given channel. |
<T> AcsEventPublisher<T> |
createNotificationChannelPublisher(java.lang.String channelName,
java.lang.String channelNotifyServiceDomainName,
java.lang.Class<T> eventType)
Similar to
ContainerServicesBase.createNotificationChannelPublisher(String, Class),
but with additional NC domain specification. |
<T> AcsEventSubscriber<T> |
createNotificationChannelSubscriber(java.lang.String channelName,
java.lang.Class<T> eventType)
Creates a new
AcsEventSubscriber object, which is the abstraction of a Notification Channel subscriber (consumer),
for the given channel name. |
<T> AcsEventSubscriber<T> |
createNotificationChannelSubscriber(java.lang.String channelName,
java.lang.String channelNotifyServiceDomainName,
java.lang.Class<T> eventType)
Creates a new
AcsEventSubscriber object, which is the abstraction of a Notification Channel subscriber (consumer),
for the given channel name and notify service domain name. |
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
ContainerServices.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.
|
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, deactivateOffShoot, getAdvancedContainerServices, getCDB, getLogger, getName, getThreadFactoryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitactivateOffShoot, deactivateOffShoot, getAdvancedContainerServices, getCDB, getLogger, getName, getThreadFactorypublic DummyContainerServices(java.lang.String name,
java.util.logging.Logger logger)
name - logger - A JDK logger will be wrapped to become an AcsLogger. If null, a new logger gets created.public <T extends OffShootOperations> OffShoot activateOffShoot(T offshootImpl,
java.lang.Class<T> idlOpInterface)
throws AcsJContainerServicesEx
ContainerServices
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.
activateOffShoot in interface ContainerServicesT - 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.alma.acs.container.ContainerServices#activateOffShoot(alma.acs.container.OffShootOperations, java.lang.Class)public ComponentStateManager getComponentStateManager()
ContainerServicesComponentStateManager 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.
getComponentStateManager in interface ContainerServicesRuntimeException, - see #check()ContainerServices.getComponentStateManager()public org.omg.CORBA.Object getComponent(java.lang.String componentUrl)
throws AcsJContainerServicesEx
ContainerServicesget_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().
getComponent in interface ContainerServicescomponentUrl - the ACS CURL of the deployed component instance.AcsJContainerServicesEx - if something goes wrong.ContainerServices.getComponent(java.lang.String)public org.omg.CORBA.Object getComponentNonSticky(java.lang.String curl)
throws AcsJContainerServicesEx
ContainerServicesA 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.
getComponentNonSticky in interface ContainerServicescurl - the component URL (component instance name)AcsJContainerServicesEx - if something goes wrongContainerServices.getComponentNonSticky(java.lang.String)public org.omg.CORBA.Object getDefaultComponent(java.lang.String componentIDLType)
throws AcsJContainerServicesEx
ContainerServicesIDL: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
ContainerServices.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.
getDefaultComponent in interface ContainerServicesAcsJContainerServicesExContainerServices.getDefaultComponent(java.lang.String)public org.omg.CORBA.Object getCollocatedComponent(java.lang.String compUrl,
java.lang.String targetCompUrl)
throws AcsJContainerServicesEx
ContainerServicesgetCollocatedComponent in interface ContainerServicescompUrl - 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.ContainerServices.getCollocatedComponent(java.lang.String, java.lang.String)public org.omg.CORBA.Object getCollocatedComponent(ComponentQueryDescriptor compSpec, boolean markAsDefaul, java.lang.String targetCompUrl) throws AcsJContainerServicesEx
ContainerServicesContainerServices.getCollocatedComponent(String, String).getCollocatedComponent in interface ContainerServicescompSpec - 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.ContainerServices.getCollocatedComponent(alma.acs.component.ComponentQueryDescriptor, boolean, java.lang.String)public org.omg.CORBA.Object getDynamicComponent(ComponentQueryDescriptor compSpec, boolean markAsDefault) throws AcsJContainerServicesEx
ContainerServices
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
ContainerServices.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.
getDynamicComponent in interface ContainerServicescompSpec - the description of the component to be createdmarkAsDefault - if true, the new component will become the default component for its IDL type.AcsJContainerServicesExContainerServices.getDynamicComponent(alma.acs.component.ComponentQueryDescriptor, boolean)public org.omg.CORBA.Object getDynamicComponent(ComponentSpec compSpec,
boolean markAsDefault)
throws AcsJContainerServicesEx
ContainerServices
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
ContainerServices.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.
getDynamicComponent in interface ContainerServicescompSpec - the description of the component to be createdmarkAsDefault - if true, the new component will become the default component for its IDL type.AcsJContainerServicesExalma.acs.container.ContainerServices#getDynamicComponent(alma.acs.container.ComponentSpec, boolean)public java.lang.String[] findComponents(java.lang.String curlWildcard,
java.lang.String typeWildcard)
throws AcsJContainerServicesEx
ContainerServicesgetComponent
to obtain the reference.findComponents in interface ContainerServicescurlWildcard - (null is understood as "*")typeWildcard - (null is understood as "*")RuntimeException, - see #check()AcsJContainerServicesExContainerServices.findComponents(java.lang.String, java.lang.String)public ComponentDescriptor getComponentDescriptor(java.lang.String componentUrl) throws AcsJContainerServicesEx
ContainerServices
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.
getComponentDescriptor in interface ContainerServicescomponentUrl - the unique name of a componentRuntimeException, - see #check()AcsJContainerServicesExContainerServices.getComponentDescriptor(java.lang.String)public void releaseComponent(java.lang.String componentUrl)
ContainerServices_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 ContainerServices.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.
releaseComponent in interface ContainerServicescomponentUrl - the name/curl of the component instance as used by the managerContainerServices.releaseComponent(java.lang.String)public void releaseComponent(java.lang.String componentUrl,
ContainerServices.ComponentReleaseCallback callback)
ContainerServicesThis 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.
releaseComponent in interface ContainerServicescomponentUrl - 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.alma.acs.container.ContainerServices#releaseComponent(String, ComponentRequestCallback)public void registerComponentListener(ContainerServices.ComponentListener listener)
ContainerServicesComponentListener#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.
registerComponentListener in interface ContainerServicesContainerServices.registerComponentListener(alma.acs.container.ContainerServices.ComponentListener)public org.omg.CORBA.Object getReferenceWithCustomClientSideTimeout(org.omg.CORBA.Object originalCorbaRef,
double timeoutSeconds)
throws AcsJContainerServicesEx
ContainerServicesorg.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.
getReferenceWithCustomClientSideTimeout in interface ContainerServicestimeoutSeconds - the custom client side timeout in seconds, to be used for all calls to the given object reference.AcsJContainerServicesExContainerServices.getReferenceWithCustomClientSideTimeout(org.omg.CORBA.Object, double)public void assignUniqueEntityId(EntityT entity)
throws AcsJContainerServicesEx
ContainerServicesassignUniqueEntityId in interface ContainerServicesentity - must be freshly created andAcsJContainerServicesExalma.acs.container.ContainerServices#assignUniqueEntityId(alma.acs.container.EntityT)public <T,F> T getTransparentXmlWrapper(java.lang.Class<T> transparentXmlIF,
F objectReference,
java.lang.Class<F> flatXmlIF)
throws AcsJContainerServicesEx
ContainerServicesgetComponent 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.getTransparentXmlWrapper in interface ContainerServicestransparentXmlIF - 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.AcsJContainerServicesExContainerServices.getTransparentXmlWrapper(java.lang.Class, java.lang.Object, java.lang.Class)public <T> AcsEventSubscriber<T> createNotificationChannelSubscriber(java.lang.String channelName, java.lang.Class<T> eventType) throws AcsJContainerServicesEx
ContainerServicesBaseAcsEventSubscriber object, which is the abstraction of a Notification Channel subscriber (consumer),
for the given channel name.
The created subscriber will be automatically disconnected when the component or client that created it through this method
is finished, in case the user doesn't explicitly do it before.createNotificationChannelSubscriber in interface ContainerServicesBasecreateNotificationChannelSubscriber in class DummyContainerServicesBasechannelName - The Notification Channel name to listen toeventType - The type of event that can be sent using the AcsEventSubscriber, e.g. "MySchedulingEvent.class".
The specific event type should be used unless more than one event types must be received by this subscriber,
in which case you can specify a common base type (e.g. "IDLEntity.class" in case of different IDL-generated structs),
or just "Object" for total type freedom (though the underlying pub-sub framework may later throw runtime exceptions
if unsupported event types are received).AcsJContainerServicesEx - if anything goes wrong while creating the subscriberalma.acs.container.ContainerServices#createNotificationChannelSubscriber(String)public <T> AcsEventSubscriber<T> createNotificationChannelSubscriber(java.lang.String channelName, java.lang.String channelNotifyServiceDomainName, java.lang.Class<T> eventType) throws AcsJContainerServicesEx
ContainerServicesBaseAcsEventSubscriber object, which is the abstraction of a Notification Channel subscriber (consumer),
for the given channel name and notify service domain name.
The created subscriber will be automatically disconnected when the component or client that created it through this method
is finished, in case the user doesn't explicitly do it before.
Details of the NC domain concept:
createNotificationChannelSubscriber in interface ContainerServicesBasecreateNotificationChannelSubscriber in class DummyContainerServicesBasechannelName - The Notification Channel name to listen tochannelNotifyServiceDomainName - The Notification Channel Service Domain name.eventType - See ContainerServicesBase.createNotificationChannelPublisher(String, Class).AcsJContainerServicesEx - if anything goes wrong while creating the subscriberalma.acs.container.ContainerServices#createNotificationChannelSubscriber(String, String)public <T> AcsEventPublisher<T> createNotificationChannelPublisher(java.lang.String channelName, java.lang.Class<T> eventType) throws AcsJContainerServicesEx
ContainerServicesBaseAcsEventPublisher object for a given channel.
It is the abstraction of a Corba Notification Channel supplier, a DDS publisher,
or a publisher for some other supported pub/sub technology.
The user is expected to call AcsEventPublisher.disconnect() when the publisher is no longer needed.
To avoid resource problems, the ContainerServices object calls this method during its own deactivation,
just in case the user forgot to do so.
createNotificationChannelPublisher in interface ContainerServicesBasecreateNotificationChannelPublisher in class DummyContainerServicesBasechannelName - The Notification Channel name where events will be published.eventType - The type of event that can be sent using the AcsEventPublisher, e.g. "MySchedulingEvent.class".
Specifying the type offers additional compile time checking.
It should generally be used unless more than one event type must be sent through this publisher,
in which case you can specify a common base type (e.g. "IDLEntity" in case of different IDL-generated structs),
or just "Object" for total type freedom (though the underlying pub-sub framework may later throw runtime exceptions
if unsupported event types get used).AcsJContainerServicesEx - if anything goes wrong while creating the publisherContainerServices#createNotificationChannelPublisher(String)public <T> AcsEventPublisher<T> createNotificationChannelPublisher(java.lang.String channelName, java.lang.String channelNotifyServiceDomainName, java.lang.Class<T> eventType) throws AcsJContainerServicesEx
ContainerServicesBaseContainerServicesBase.createNotificationChannelPublisher(String, Class),
but with additional NC domain specification.
Details of this NC domain concept:
createNotificationChannelPublisher in interface ContainerServicesBasecreateNotificationChannelPublisher in class DummyContainerServicesBasechannelNotifyServiceDomainName - The Notification Channel Service Domain name.AcsJContainerServicesExContainerServices#createNotificationChannelPublisher(String, String)public AlarmSource getAlarmSource()
ContainerServicesAlarmSource owned by this object. The AlarmSource object
allows to raise and clear alarms, among other advanced operations
getAlarmSource in interface ContainerServicesAlarmSource owned by this object