Classes | Public Member Functions | Static Public Attributes | Protected Attributes | Package Functions | Package Attributes

alma.acs.container.ContainerServicesImpl Class Reference

Inheritance diagram for alma.acs.container.ContainerServicesImpl:
alma.acs.container.ContainerServices alma.acs.container.ContainerServicesBase

List of all members.

Classes

interface  CleanUpCallback
class  ComponentReleaseCallbackCorbaHandler

Public Member Functions

 ContainerServicesImpl (AcsManagerProxy acsManagerProxy, POA componentPOA, AcsCorba acsCorba, AcsLogger logger, int componentHandle, String clientCurl, ComponentStateManager componentStateManager, ThreadFactory threadFactory)
String getName ()
ComponentStateManager getComponentStateManager ()
AcsLogger getLogger ()
void registerComponentListener (ComponentListener listener)
void fireComponentsAvailable (List< ComponentDescriptor > compDescs)
void fireComponentsUnavailable (List< String > compNames)
void assignUniqueEntityId (EntityT entity) throws AcsJContainerServicesEx
String[] findComponents (String curlWildcard, String typeWildcard) throws AcsJContainerServicesEx
ComponentDescriptor getComponentDescriptor (String curl) throws AcsJContainerServicesEx
org.omg.CORBA.Object getComponent (String curl) throws AcsJContainerServicesEx
org.omg.CORBA.Object getComponentNonSticky (String curl) throws AcsJContainerServicesEx
org.omg.CORBA.Object getDefaultComponent (String componentIDLType) throws AcsJContainerServicesEx
org.omg.CORBA.Object getCollocatedComponent (String compUrl, String targetCompUrl) throws AcsJContainerServicesEx
org.omg.CORBA.Object getCollocatedComponent (ComponentQueryDescriptor spec, boolean markAsDefaul, String targetCompUrl) throws AcsJContainerServicesEx
org.omg.CORBA.Object getDynamicComponent (ComponentQueryDescriptor compDesc, boolean markAsDefault) throws AcsJContainerServicesEx
org.omg.CORBA.Object getDynamicComponent (ComponentSpec compSpec, boolean markAsDefault) throws AcsJContainerServicesEx
org.omg.CORBA.Object getReferenceWithCustomClientSideTimeout (org.omg.CORBA.Object originalCorbaRef, double timeoutSeconds) throws AcsJContainerServicesEx
DAL getCDB () throws AcsJContainerServicesEx
void releaseComponent (String curl)
void releaseComponent (String curl, ComponentReleaseCallback callback)
void deactivateOffShoot (Object offshootImpl) throws AcsJContainerServicesEx
synchronized
AdvancedContainerServices 
getAdvancedContainerServices ()
void releaseAllComponents ()
ThreadFactory getThreadFactory ()
void cleanUp ()
void registerCleanUpCallback (ContainerServicesImpl.CleanUpCallback cb)
AcsEventSubscriber createNotificationChannelSubscriber (String channelName) throws AcsJContainerServicesEx
AcsEventSubscriber createNotificationChannelSubscriber (String channelName, String channelNotifyServiceDomainName) throws AcsJContainerServicesEx
AcsEventPublisher createNotificationChannelPublisher (String channelName) throws AcsJContainerServicesEx
AcsEventPublisher createNotificationChannelPublisher (String channelName, String channelNotifyServiceDomainName) throws AcsJContainerServicesEx
void raiseAlarm (String faultFamily, String faultMember, int faultCode) throws AcsJContainerServicesEx
void clearAlarm (String faultFamily, String faultMember, int faultCode) throws AcsJContainerServicesEx
AlarmSource getAlarmSource () throws AcsJContainerServicesEx

Static Public Attributes

static final String PROPERTYNAME_FAKE_UID_FOR_TESTING = "acs.container.fakeUIDsForTesting"

Protected Attributes

final AcsManagerProxy m_acsManagerProxy
final AcsLogger m_logger

Package Functions

void setComponentXmlTranslatorProxy (Object xmlTranslatorProxy)
public< T extends Servant
&OffShootOperations > OffShoot 
activateOffShoot (T servant) throws AcsJContainerServicesEx
public< T extends
OffShootOperations > OffShoot 
activateOffShoot (T offshootImpl, Class< T > idlOpInterface) throws AcsJContainerServicesEx
public< T, F > T getTransparentXmlWrapper (Class< T > transparentXmlIF, F flatXmlObject, Class< F > flatXmlIF) throws AcsJContainerServicesEx
AcsCorba getAcsCorba ()
void setMethodsExcludedFromInvocationLogging (String[] methodsExcludedFromInvocationLogging)

Package Attributes

final String CLASSNAME_NC_SUBSCRIBER = "alma.acs.nc.refactored.NCSubscriber"
final String CLASSNAME_NC_PUBLISHER = "alma.acs.nc.refactored.NCPublisher"

Detailed Description

Implementation of the ContainerServices interface. To be used by ACS components, as well as any other clients that need access to components.

This class is "cheap" to instantiate because many resources it uses are singletons and or objects otherwise shared among instances. It should thus be ok to create one instance per component or other client.

This class has to be thread-safe, because a component's functional methods can be called from different ORB threads, or because the component could itself create threads, each of them accessing this object.

Author:
hsommer Apr 1, 2003 2:28:01 PM

Constructor & Destructor Documentation

alma.acs.container.ContainerServicesImpl.ContainerServicesImpl ( AcsManagerProxy  acsManagerProxy,
POA  componentPOA,
AcsCorba  acsCorba,
AcsLogger  logger,
int  componentHandle,
String  clientCurl,
ComponentStateManager  componentStateManager,
ThreadFactory  threadFactory 
)

ctor.

Parameters:
acsManagerProxy 
componentPOA the POA for the component. Can be the root POA or some other specialized POA.
acsCorba Encapsulates the ORB and all POAs
logger logger to be used by this class
componentHandle handle to be used for identification when sending requests to the manager. For components, this should be the component handle assigned by the manager; for other clients, it should be 0 to indicate that the handle obtained at manager login should be used.
clientCurl 
componentStateManager can be null if this class is instantiated for a component client outside of a container
threadFactory to be used for getThreadFactory

References alma.acs.container.ContainerServicesImpl.m_acsManagerProxy, alma.acs.container.ContainerServicesImpl.m_logger, and alma.acs.alarmsystem.source.AlarmSource.start().


Member Function Documentation

public<T extends Servant & OffShootOperations> OffShoot alma.acs.container.ContainerServicesImpl.activateOffShoot ( T  servant  )  throws AcsJContainerServicesEx [package]
public<T extends OffShootOperations> OffShoot alma.acs.container.ContainerServicesImpl.activateOffShoot ( T  offshootImpl,
Class< T idlOpInterface 
) throws AcsJContainerServicesEx [package]
void alma.acs.container.ContainerServicesImpl.clearAlarm ( String  faultFamily,
String  faultMember,
int  faultCode 
) throws AcsJContainerServicesEx

Clears the alarm described by the given triplet.Alarms are described with a unique triplet, which is composed by a faultFamily, a faultMember and a faultCode, and referred to as FaultState. A particular alarm is mapped by exactly one FaultState, and vice-versa. The faultFamily field identifies a set of elements of the same kind, and that present the same failures (e.g., all power supplies, which could be represented by the "PS" string). The faultMember field identifies the particular instance of the given faultFamily that is currently clearing the alarm. The faultCode field identifies the particular error that is being informed. Its value must match the corresponding one stored in the Alarm Service configuration that describes the situation being reported as corrected.

Parameters:
faultFamily The alarm's fault family
faultMember The alarm's fault member
faultCode The alarm's fault code
Exceptions:
AcsJContainerServicesEx if anything goes wrong while clearing the alarm
Deprecated:
The new getAlarmSource() method should be used instead, calling AlarmSource#clearAlarm(String, String, int) on the returned object

Deprecated:

Implements alma.acs.container.ContainerServices.

AcsEventPublisher alma.acs.container.ContainerServicesImpl.createNotificationChannelPublisher ( String  channelName  )  throws AcsJContainerServicesEx
AcsEventPublisher alma.acs.container.ContainerServicesImpl.createNotificationChannelPublisher ( String  channelName,
String  channelNotifyServiceDomainName 
) throws AcsJContainerServicesEx
AcsEventSubscriber alma.acs.container.ContainerServicesImpl.createNotificationChannelSubscriber ( String  channelName  )  throws AcsJContainerServicesEx
AcsEventSubscriber alma.acs.container.ContainerServicesImpl.createNotificationChannelSubscriber ( String  channelName,
String  channelNotifyServiceDomainName 
) throws AcsJContainerServicesEx
void alma.acs.container.ContainerServicesImpl.deactivateOffShoot ( Object  offshootImpl  )  throws AcsJContainerServicesEx

Deactivates the offshoot object previously activated through the activateOffShoot(Object, Class) method. Caution: this method returns immediately, while the underlying org.omg.PortableServer.POAOperations#deactivate_object(byte[]) still works on the deactivation. If activateOffShoot(Servant) is called too shortly after deactivation, an exception will be thrown. TODO: find a remedy

Parameters:
offshootImpl the offshoot object implementation
Exceptions:
AcsJContainerServicesEx if something goes wrong, e.g., if the corresponding offshoot servant was not active.

Implements alma.acs.container.ContainerServicesBase.

String [] alma.acs.container.ContainerServicesImpl.findComponents ( String  curlWildcard,
String  typeWildcard 
) throws AcsJContainerServicesEx
void alma.acs.container.ContainerServicesImpl.fireComponentsAvailable ( List< ComponentDescriptor compDescs  ) 
void alma.acs.container.ContainerServicesImpl.fireComponentsUnavailable ( List< String >  compNames  ) 
AcsCorba alma.acs.container.ContainerServicesImpl.getAcsCorba (  )  [package]
synchronized AdvancedContainerServices alma.acs.container.ContainerServicesImpl.getAdvancedContainerServices (  ) 
AlarmSource alma.acs.container.ContainerServicesImpl.getAlarmSource (  )  throws AcsJContainerServicesEx

Returns the AlarmSource owned by this object. The AlarmSource object allows to raise and clear alarms, among other advanced operations

Returns:
The AlarmSource owned by this object
Exceptions:
AcsJContainerServicesEx if anything goes wrong

Implements alma.acs.container.ContainerServices.

Referenced by alma.acs.container.AcsContainer.initialize().

org.omg.CORBA.Object alma.acs.container.ContainerServicesImpl.getCollocatedComponent ( String  compUrl,
String  targetCompUrl 
) throws AcsJContainerServicesEx

Gets a component that will run collocated with a given component.

Parameters:
compUrl the component's name (URL)
targetCompUrl the name (URL) of the target component, in whose container we also want compUrl to run.
Returns:
the component reference, which should be cast using the appropriate CORBA narrow operation. Never null.
Exceptions:
AcsJContainerServicesEx If the call failed and no component reference could be obtained.
Since:
ACS 5.0.3

Implements alma.acs.container.ContainerServices.

org.omg.CORBA.Object alma.acs.container.ContainerServicesImpl.getCollocatedComponent ( ComponentQueryDescriptor  compSpec,
boolean  markAsDefaul,
String  targetCompUrl 
) throws AcsJContainerServicesEx

Dynamic version of getCollocatedComponent(String, String).

Parameters:
compSpec the description of the component to be created
markAsDefaul 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.
Returns:
Exceptions:
AcsJContainerServicesEx If the call failed and no component reference could be obtained.
Since:
ACS 6.0.4

Implements alma.acs.container.ContainerServices.

References alma.acs.container.AcsManagerProxy.get_collocated_component(), alma.acs.logging.AcsLogger.log(), alma.acs.container.ContainerServicesImpl.m_acsManagerProxy, and alma.acs.container.ContainerServicesImpl.m_logger.

org.omg.CORBA.Object alma.acs.container.ContainerServicesImpl.getComponent ( String  curl  )  throws AcsJContainerServicesEx
org.omg.CORBA.Object alma.acs.container.ContainerServicesImpl.getComponentNonSticky ( String  curl  )  throws AcsJContainerServicesEx

Gets a non-sticky reference to a component. This is typically used by "weak clients" such as graphical user interfaces that only want to observe the running system without interfering with its functioning.

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.

Parameters:
curl the component URL (component instance name)
Returns:
the CORBA proxy for the component.
Exceptions:
AcsJContainerServicesEx if something goes wrong
Since:
ACS 6.0

Implements alma.acs.container.ContainerServices.

References alma.acs.container.AcsManagerProxy.get_component_non_sticky(), alma.acs.logging.AcsLogger.log(), alma.acs.container.ContainerServicesImpl.m_acsManagerProxy, and alma.acs.container.ContainerServicesImpl.m_logger.

ComponentStateManager alma.acs.container.ContainerServicesImpl.getComponentStateManager (  ) 

Delivers the 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.

Returns:
the state manager
See also:
alma.ACS.ComponentStates

This method should only be called by a component that lives inside a container; a component client that is not a component itself should not call it, would result in a NPE!

See also:
alma.acs.container.ContainerServices.getComponentStateManager()

Implements alma.acs.container.ContainerServices.

org.omg.CORBA.Object alma.acs.container.ContainerServicesImpl.getDynamicComponent ( ComponentQueryDescriptor  compDesc,
boolean  markAsDefault 
) throws AcsJContainerServicesEx
org.omg.CORBA.Object alma.acs.container.ContainerServicesImpl.getDynamicComponent ( ComponentSpec  compSpec,
boolean  markAsDefault 
) throws AcsJContainerServicesEx
AcsLogger alma.acs.container.ContainerServicesImpl.getLogger (  ) 

The component must retrieve its logger object from this interface (as opposed to using the ClientLogManager singleton) so that the container is free to give away loggers that are somehow tailored to the particular component.

The goal is to have "componentName" and other fields in all ALMA log entries, and have tool support for filtering logs by component, subsystem, user, ...

See also:
alma.acs.container.ContainerServices.getLogger()

Implements alma.acs.container.ContainerServicesBase.

String alma.acs.container.ContainerServicesImpl.getName (  ) 

Gets the component name (which the component does not know statically)

See also:
alma.acs.container.ContainerServices.getName()

Implements alma.acs.container.ContainerServicesBase.

Referenced by alma.acs.container.ContainerServicesImpl.activateOffShoot().

org.omg.CORBA.Object alma.acs.container.ContainerServicesImpl.getReferenceWithCustomClientSideTimeout ( org.omg.CORBA.Object  originalCorbaRef,
double  timeoutSeconds 
) throws AcsJContainerServicesEx

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. If the total call, including de-/serialization and network travel, takes longer than the given timeout, an 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.

Parameters:
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.
Returns:
A new object reference which should be used to make calls with the specified timeout applied.

Implements alma.acs.container.ContainerServices.

References alma.acs.container.corba.AcsCorba.wrapForRoundtripTimeout().

ThreadFactory alma.acs.container.ContainerServicesImpl.getThreadFactory (  ) 
public<T, F> T alma.acs.container.ContainerServicesImpl.getTransparentXmlWrapper ( Class< T transparentXmlIF,
flatXmlObject,
Class< F >  flatXmlIF 
) throws AcsJContainerServicesEx [package]

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. 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:

  1. Remote component: if the specified component runs in a different container, a dynamic wrapper object will be created around the provided CORBA stub. The wrapper object will translate between entity object parameters in the form of serialized XML (as found in flatXmlIF) and the corresponding Java binding classes (in transparentXmlIF).
  2. Collocated component: if the specified component runs in the same container, the container may choose to shortcut the (de-) serialization of XML binding classes. In this case, Java binding classes are transported in memory, and all communication with the other component is done without CORBA.

In either case, the returned 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.

Parameters:
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.
Returns:
the object that implements transparentXmlIF.
.

TODO: implement shortcutting of xml (de-)serialization for collocated component or offshoot: ask AcsContainer if it knows componentReference, and if it has transpXml-IF; if so, get component impl directly; check if respective component helper allows direct calls to transpXmlIF (by not implementing _getInterfaceTranslator, or some explicit flag); move intercepting layer (ContainerSealant) so that it's still in between the components.

See also:
alma.acs.container.ContainerServices.getTransparentXmlComponent(java.lang.Class, org.omg.CORBA.Object, java.lang.Class)

Implements alma.acs.container.ContainerServices.

Referenced by alma.acs.container.ContainerServicesImpl.assignUniqueEntityId().

void alma.acs.container.ContainerServicesImpl.raiseAlarm ( String  faultFamily,
String  faultMember,
int  faultCode 
) throws AcsJContainerServicesEx

Raises the alarm described by the given triplet.Alarms are described with a unique triplet, which is composed by a faultFamily, a faultMember and a faultCode, and referred to as FaultState. A particular alarm is mapped by exactly one FaultState, and vice-versa. The faultFamily field identifies a set of elements of the same kind, and that present the same failures (e.g., all power supplies, which could be represented by the "PS" string). The faultMember field identifies the particular instance of the given faultFamily that is currently raising the alarm. The faultCode field identifies the particular error that is being informed. Its value must match the corresponding one stored in the Alarm Service configuration that describes the situation being reported as faulty.

Parameters:
faultFamily The alarm's fault family
faultMember The alarm's fault member
faultCode The alarm's fault code
Exceptions:
AcsJContainerServicesEx if anything goes wrong while raising the alarm
Deprecated:
The new getAlarmSource() method should be used instead, calling AlarmSource#raiseAlarm(String, String, int) on the returned object

Deprecated:

Implements alma.acs.container.ContainerServices.

void alma.acs.container.ContainerServicesImpl.registerCleanUpCallback ( ContainerServicesImpl.CleanUpCallback  cb  ) 

This is a hack: NC classes can register themselves to be notified, in order to release remote Corba resources (and prevent crashes of Notify Service...). Note that without this hack, the lifecycle of NC classes is only managed by the application code, which means that ACS could not enforce the clean up.

remove this once the NC classes are properly integrated into container services

Parameters:
cb 
Since:
ACS 8.1.0
void alma.acs.container.ContainerServicesImpl.registerComponentListener ( ComponentListener  listener  ) 
void alma.acs.container.ContainerServicesImpl.releaseComponent ( String  curl  ) 

Releases the specified component reference. This involves notification of the manager, as well as calling _release() on the CORBA stub. If the curl is not known to the container, the request will be ignored.

Note that references to other components are released by this method, where the components hosted inside this container act as clients. These referenced components may run inside this or some other container/container.

Since ACS 9.1 this method is implemented by delegating to releaseComponent(String, alma.acs.container.ContainerServices.ComponentReleaseCallback), keeping the old synchronous behavior by blocking on a callback object, with a timeout of 60 seconds. Since ACS 10.0, errors are logged at level DEBUG.

See also:
alma.acs.container.ContainerServices.releaseComponent(java.lang.String)

Implements alma.acs.container.ContainerServices.

References alma.acs.logging.AcsLogger.log(), and alma.acs.container.ContainerServicesImpl.m_logger.

void alma.acs.container.ContainerServicesImpl.releaseComponent ( String  componentUrl,
ComponentReleaseCallback  callback 
)

Releases the reference to the specified component. Releasing a component reference may result in the deactivation of that component, if no other clients hold (sticky) references.

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.

Parameters:
componentUrl the name/curl of the component instance as used by the manager
callback may be null if you do not need to wait for component activation or to see the results. An new instance of ComponentReleaseCallback is required for every call.
Since:
ACS 9.1

Implements alma.acs.container.ContainerServices.

References alma.acs.container.AcsManagerProxy.force_release_component(), alma.acs.logging.AcsLogger.log(), alma.acs.container.ContainerServicesImpl.m_acsManagerProxy, alma.acs.container.ContainerServicesImpl.m_logger, and alma.acs.container.AcsManagerProxy.release_component().

void alma.acs.container.ContainerServicesImpl.setComponentXmlTranslatorProxy ( Object  xmlTranslatorProxy  )  [package]
void alma.acs.container.ContainerServicesImpl.setMethodsExcludedFromInvocationLogging ( String[]  methodsExcludedFromInvocationLogging  )  [package]

With this optional call, automatic invocation logging for certain offshoot methods can be disabled.

Parameters:
methodsExcludedFromInvocationLogging 
See also:
ComponentHelper.getComponentMethodsExcludedFromInvocationLogging()

Referenced by alma.acs.container.ComponentAdapter.setMethodsExcludedFromInvocationLogging().


Member Data Documentation

final String alma.acs.container.ContainerServicesImpl.CLASSNAME_NC_PUBLISHER = "alma.acs.nc.refactored.NCPublisher" [package]
final String alma.acs.container.ContainerServicesImpl.CLASSNAME_NC_SUBSCRIBER = "alma.acs.nc.refactored.NCSubscriber" [package]
final String alma.acs.container.ContainerServicesImpl.PROPERTYNAME_FAKE_UID_FOR_TESTING = "acs.container.fakeUIDsForTesting" [static]

cheat property that allows testing without identifier archive present, because UIDs will be faked


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties