public class DummyContainerServicesBase extends java.lang.Object implements ContainerServicesBase
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.
| Modifier and Type | Field and Description |
|---|---|
protected AcsLogger |
logger |
protected java.lang.String |
name |
| Constructor and Description |
|---|
DummyContainerServicesBase(java.lang.String name,
java.util.logging.Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
<T extends org.omg.PortableServer.Servant & OffShootOperations> |
activateOffShoot(T cbServant)
Activates a CORBA servant that implements alma.ACS.OffShoot.
|
<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. |
void |
deactivateOffShoot(java.lang.Object offshootImpl)
Deactivates the offshoot object previously activated through the
#activateOffShoot(Object, Class) method. |
AdvancedContainerServices |
getAdvancedContainerServices()
More specialized methods are available from the
AdvancedContainerServices. |
DAL |
getCDB()
Convenience method for accessing the Configuration Database.
|
AcsLogger |
getLogger()
Gets a
Logger object that the component should use for logging. |
java.lang.String |
getName()
Delivers the unique instance name for the component.
|
java.util.concurrent.ThreadFactory |
getThreadFactory()
Gets a
ThreadFactory, to be used as input for other classes from the concurrent library
(such as ThreadPoolExecutor), or simply to create new Threads. |
protected final java.lang.String name
protected final AcsLogger logger
public DummyContainerServicesBase(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 java.lang.String getName()
ContainerServicesBasegetName in interface ContainerServicesBasepublic AcsLogger getLogger()
ContainerServicesBaseLogger object that the component should use for logging.
The Logger will be set up with a namespace specific to the component
that uses this ContainerServices instance.
Specific logger extensions that only apply to certain subsystems can be used
by wrapping this logger with a class such as AntennaContextLogger.
getLogger in interface ContainerServicesBaseRuntimeException, - see #check()ContainerServicesBase.getLogger()public DAL getCDB()
throws AcsJContainerServicesEx
ContainerServicesBaseCurrently more than a convenience, given that the CDB is not yet a Java component, but a separate service...
getCDB in interface ContainerServicesBaseAcsJContainerServicesExContainerServicesBase.getCDB()public <T extends org.omg.PortableServer.Servant & OffShootOperations> OffShoot activateOffShoot(T cbServant)
throws AcsJContainerServicesEx
ContainerServicesBasealma.ACS.Callback.
The OffShoot servant can be either a subclass of the xyzPOA skeleton, or a xyzPOATie instance (delegation model). Since ACS 4.1.2, a tie servant is detected, and interception code gets inserted between the POATie skeleton and the offshoot implementation class. This way, the container can intercept (and log) calls to offshoots in the same way as it does for calls to components. It is therefore recommended to use the tie approach for all offshoot servants, unless there is a reason to avoid container interception.
Note that since ACS 9.0 we are using generics to express that the offshoot impl object must be both a corba servant and implement OffShootOperations.
activateOffShoot in interface ContainerServicesBasecbServant - the CORBA-generated servant, e.g. CBdoublePOA;
must implement alma.ACS.OffShootOperations.CBdouble myCBdouble = alma.ACS.CBdoubleHelper.narrow(...).AcsJContainerServicesExContainerServicesBase.activateOffShoot(org.omg.PortableServer.Servant)public void deactivateOffShoot(java.lang.Object offshootImpl)
throws AcsJContainerServicesEx
ContainerServicesBase#activateOffShoot(Object, Class) method.
Caution: this method returns immediately, while the underlying
POAOperations.deactivate_object(byte[]) still
works on the deactivation. If ContainerServicesBase.activateOffShoot(Servant) is called too shortly
after deactivation, an exception will be thrown. TODO: find a remedydeactivateOffShoot in interface ContainerServicesBaseoffshootImpl - the offshoot object implementationAcsJContainerServicesExContainerServicesBase.deactivateOffShoot(java.lang.Object)public AdvancedContainerServices getAdvancedContainerServices()
ContainerServicesBaseAdvancedContainerServices.getAdvancedContainerServices in interface ContainerServicesBaseContainerServicesBase.getAdvancedContainerServices()public java.util.concurrent.ThreadFactory getThreadFactory()
ContainerServicesBaseThreadFactory, to be used as input for other classes from the concurrent library
(such as ThreadPoolExecutor), or simply to create new Threads.
All user-created threads should come from the factory returned here, so "new Thread(...)" should
not appear anywhere in component code.
The returned thread factory creates new threads configured to run well in the container environment, e.g.
Thread.stop() (which even though deprecated, seems like the perfect choice
in this particular situation).
Otherwise a faulty components could permanently take away resources from a running container
and from the other components.
getThreadFactory in interface ContainerServicesBaseContainerServicesBase.getThreadFactory()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 ContainerServicesBasechannelName - 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 ContainerServicesBasechannelName - 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 ContainerServicesBasechannelName - 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 ContainerServicesBasechannelNotifyServiceDomainName - The Notification Channel Service Domain name.AcsJContainerServicesExContainerServices#createNotificationChannelPublisher(String, String)