alma::acs::container::ContainerServicesImpl Class Reference

Inheritance diagram for alma::acs::container::ContainerServicesImpl:
Inheritance graph
[legend]
Collaboration diagram for alma::acs::container::ContainerServicesImpl:
Collaboration graph
[legend]

List of all members.

Classes

interface  CleanUpCallback

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)
OffShoot activateOffShoot (Servant servant) throws AcsJContainerServicesEx
void deactivateOffShoot (Servant cbServant) throws AcsJContainerServicesEx
synchronized
AdvancedContainerServices 
getAdvancedContainerServices ()
void releaseAllComponents ()
ThreadFactory getThreadFactory ()
void cleanUp ()
void registerCleanUpCallback (ContainerServicesImpl.CleanUpCallback cb)

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

public< T > T getTransparentXmlComponent (Class< T > transparentXmlIF, org.omg.CORBA.Object componentReference, Class flatXmlIF) throws AcsJContainerServicesEx
AcsCorba getAcsCorba ()
void setMethodsExcludedFromInvocationLogging (String[] methodsExcludedFromInvocationLogging)

Private Member Functions

void checkOffShootServant (Servant servant) throws AcsJContainerServicesEx
int getEffectiveClientHandle ()

Private Attributes

AdvancedContainerServicesImpl advancedContainerServices
volatile UIDLibrary uidLibrary
volatile IdentifierJ identifierArchive
final boolean fakeUIDsForTesting = Boolean.getBoolean(PROPERTYNAME_FAKE_UID_FOR_TESTING)
volatile AcsLogger componentLogger
final Map< String,
org.omg.CORBA.Object > 
m_usedComponentsMap
final Map< String,
org.omg.CORBA.Object > 
m_usedNonStickyComponentsMap
final Map< String,
ComponentDescriptor
m_componentDescriptorMap
final int m_componentHandle
final String m_clientName
final AcsCorba acsCorba
final POA m_clientPOA
final ComponentStateManager m_componentStateManager
final ThreadFactory m_threadFactory
volatile String[] methodsExcludedFromInvocationLogging
ComponentListener compListener
final List< CleanUpCallbackcleanUpCallbacks

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 
) [inline]

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 cleanUpCallbacks, fakeUIDsForTesting, m_acsManagerProxy, m_clientName, m_clientPOA, m_componentDescriptorMap, m_componentHandle, m_componentStateManager, m_logger, m_threadFactory, m_usedComponentsMap, and m_usedNonStickyComponentsMap.


Member Function Documentation

OffShoot alma::acs::container::ContainerServicesImpl::activateOffShoot ( Servant  servant  )  throws AcsJContainerServicesEx [inline]
void alma::acs::container::ContainerServicesImpl::assignUniqueEntityId ( EntityT  entity  )  throws AcsJContainerServicesEx [inline]
void alma::acs::container::ContainerServicesImpl::checkOffShootServant ( Servant  servant  )  throws AcsJContainerServicesEx [inline, private]
void alma::acs::container::ContainerServicesImpl::cleanUp (  )  [inline]
void alma::acs::container::ContainerServicesImpl::deactivateOffShoot ( Servant  cbServant  )  throws AcsJContainerServicesEx [inline]

Deactivates the offshoot corba object. 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:
cbServant must implement alma.ACS.OffShootOperations.
Exceptions:
AcsJContainerServicesEx if something goes wrong, e.g., if the offshoot servant was not active.

Implements alma::acs::container::ContainerServicesBase.

String [] alma::acs::container::ContainerServicesImpl::findComponents ( String  curlWildcard,
String  typeWildcard 
) throws AcsJContainerServicesEx [inline]
void alma::acs::container::ContainerServicesImpl::fireComponentsAvailable ( List< ComponentDescriptor compDescs  )  [inline]
void alma::acs::container::ContainerServicesImpl::fireComponentsUnavailable ( List< String >  compNames  )  [inline]
AcsCorba alma::acs::container::ContainerServicesImpl::getAcsCorba (  )  [inline, package]
synchronized AdvancedContainerServices alma::acs::container::ContainerServicesImpl::getAdvancedContainerServices (  )  [inline]
DAL alma::acs::container::ContainerServicesImpl::getCDB (  )  throws AcsJContainerServicesEx [inline]
org.omg.CORBA.Object alma::acs::container::ContainerServicesImpl::getCollocatedComponent ( ComponentQueryDescriptor  compSpec,
boolean  markAsDefaul,
String  targetCompUrl 
) throws AcsJContainerServicesEx [inline]

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(), getEffectiveClientHandle(), alma::acs::logging::AcsLogger::log(), m_acsManagerProxy, m_componentDescriptorMap, m_logger, m_usedComponentsMap, si::ijs::maci::ComponentInfo::name, si::ijs::maci::ComponentInfo::reference, alma::JavaContainerError::wrappers::AcsJContainerServicesEx::setContextInfo(), alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setParameter(), and alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setParameterValue().

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

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.

References alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setParameter(), and alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setParameterValue().

org.omg.CORBA.Object alma::acs::container::ContainerServicesImpl::getComponent ( String  curl  )  throws AcsJContainerServicesEx [inline]
ComponentDescriptor alma::acs::container::ContainerServicesImpl::getComponentDescriptor ( String  curl  )  throws AcsJContainerServicesEx [inline]
org.omg.CORBA.Object alma::acs::container::ContainerServicesImpl::getComponentNonSticky ( String  curl  )  throws AcsJContainerServicesEx [inline]

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(), getEffectiveClientHandle(), alma::acs::logging::AcsLogger::log(), m_acsManagerProxy, m_logger, m_usedNonStickyComponentsMap, alma::JavaContainerError::wrappers::AcsJContainerServicesEx::setContextInfo(), alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setParameter(), and alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setParameterValue().

ComponentStateManager alma::acs::container::ContainerServicesImpl::getComponentStateManager (  )  [inline]

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.

References m_componentStateManager.

org.omg.CORBA.Object alma::acs::container::ContainerServicesImpl::getDefaultComponent ( String  componentIDLType  )  throws AcsJContainerServicesEx [inline]
org.omg.CORBA.Object alma::acs::container::ContainerServicesImpl::getDynamicComponent ( ComponentSpec  compSpec,
boolean  markAsDefault 
) throws AcsJContainerServicesEx [inline]
org.omg.CORBA.Object alma::acs::container::ContainerServicesImpl::getDynamicComponent ( ComponentQueryDescriptor  compDesc,
boolean  markAsDefault 
) throws AcsJContainerServicesEx [inline]
int alma::acs::container::ContainerServicesImpl::getEffectiveClientHandle (  )  [inline, private]

Gets the handle to be used toward the manager, which is

  • The handle obtained from the manager at login for normal clients
  • The component handle assigned by the manager at component activation time, if this ContainerServices instance is used for a component

We don't cache the handle from acsManagerProxy because it may change after a re-login, and then we get errors if the stale handle would be used.

Returns:
The correct handle to be used to identify this client to the manager.

Referenced by getCollocatedComponent(), getComponent(), getComponentNonSticky(), getDefaultComponent(), getDynamicComponent(), and releaseComponent().

AcsLogger alma::acs::container::ContainerServicesImpl::getLogger (  )  [inline]

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.

References componentLogger, and m_clientName.

String alma::acs::container::ContainerServicesImpl::getName (  )  [inline]

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

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

Implements alma::acs::container::ContainerServicesBase.

References m_clientName.

Referenced by activateOffShoot().

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

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 acsCorba, and alma::acs::container::corba::AcsCorba::wrapForRoundtripTimeout().

ThreadFactory alma::acs::container::ContainerServicesImpl::getThreadFactory (  )  [inline]
public<T> T alma::acs::container::ContainerServicesImpl::getTransparentXmlComponent ( Class< T >  transparentXmlIF,
org.omg.CORBA.Object  componentReference,
Class  flatXmlIF 
) throws AcsJContainerServicesEx [inline, package]

Converts a "flat-XML" component interface (as obtained from the various getComponent methods) to a "transparent-XML" component interface. This is only applicable to components 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. 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 component interface with XML binding classes.
componentReference reference to the component to be wrapped, as obtained through getComponent(String), thus implements flatXmlIF.
flatXmlIF component interface where entity objects are represented as serialized XML inside a CORBA struct.
Returns:
the object that implements transparentXmlIF.
.

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

References alma::JavaContainerError::wrappers::AcsJContainerServicesEx::setContextInfo().

Referenced by assignUniqueEntityId().

void alma::acs::container::ContainerServicesImpl::registerCleanUpCallback ( ContainerServicesImpl.CleanUpCallback  cb  )  [inline]

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  )  [inline]

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

If the client wants to get notified even for components that it does not hold a reference to, then ComponentListener::includeForeignComponents() should return true. ContainerServices

Parameters:
listener 
See also:
si.ijs.maci.ClientOperations::components_available(si.ijs.maci.ComponentInfo[])
Since:
ACS 6.0

Implements alma::acs::container::ContainerServices.

References compListener.

void alma::acs::container::ContainerServicesImpl::releaseAllComponents (  )  [inline]
void alma::acs::container::ContainerServicesImpl::releaseComponent ( String  curl  )  [inline]

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.

TODO optionally run in a separate thread to gain speed, especially needed for quick shutdown; consider race condition at the manager with new activation request for the same component though.

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

Implements alma::acs::container::ContainerServices.

References alma::acs::container::AcsManagerProxy::force_release_component(), getEffectiveClientHandle(), alma::acs::logging::AcsLogger::log(), m_acsManagerProxy, m_clientName, m_logger, m_usedComponentsMap, m_usedNonStickyComponentsMap, and alma::acs::container::AcsManagerProxy::release_component().

void alma::acs::container::ContainerServicesImpl::setMethodsExcludedFromInvocationLogging ( String[]  methodsExcludedFromInvocationLogging  )  [inline, 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

The externally provided instance of AcsCorba

Referenced by getReferenceWithCustomClientSideTimeout().

Referenced by ContainerServicesImpl().

Optional callback object for component available/unavailable notification

Referenced by fireComponentsAvailable(), fireComponentsUnavailable(), and registerComponentListener().

Referenced by getLogger().

Referenced by assignUniqueEntityId().

Name of the component or other client (client app or container etc)

Referenced by ContainerServicesImpl(), fireComponentsAvailable(), fireComponentsUnavailable(), getComponent(), getLogger(), getName(), and releaseComponent().

Referenced by ContainerServicesImpl().

The handle that the manager has assigned to the component to whom this ContainerServices object belongs, or 0 if this ContainerServices object does not belong to a component, in which case m_acsManagerProxy's handle should be used.

Referenced by ContainerServicesImpl().

Referenced by ContainerServicesImpl().

final Map<String, org.omg.CORBA.Object> alma::acs::container::ContainerServicesImpl::m_usedComponentsMap [private]
final Map<String, org.omg.CORBA.Object> alma::acs::container::ContainerServicesImpl::m_usedNonStickyComponentsMap [private]

Referenced by activateOffShoot().

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

Referenced by assignUniqueEntityId().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2