public abstract class ComponentHelper
extends java.lang.Object
COMPONENT_HELPERS=on Makefile setting).
The method implementations in this class perform checks on the data returned
from the subclass methods (framework-style design). In that sense, ComponentHelper
is part of the container, whereas its subclass belongs to the component.
The methods that return a Class
object should be implemented like return XxxPOATie.class; so that the absence
of this class can be discovered at compile time.
(Therefore don't use classForName which evades compile time checking.)
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
componentInstanceName |
| Constructor and Description |
|---|
ComponentHelper(java.util.logging.Logger containerLogger)
Subclasses must override and call this constructor ("
super(containerLogger)"). |
| Modifier and Type | Method and Description |
|---|---|
protected abstract ComponentLifecycle |
_createComponentImpl()
Method _createComponentImpl to be provided by subclasses.
|
protected java.lang.String[] |
_getComponentMethodsExcludedFromInvocationLogging()
Tells the container to not automatically log calls to certain component interface methods.
|
protected java.lang.Object |
_getInterfaceTranslator(java.lang.Object defaultInterfaceTranslator)
To be overridden by subclass only if it wants its own interface translator to be used.
|
protected abstract java.lang.Class<? extends ACSComponentOperations> |
_getOperationsInterface()
Gets the xxOperations interface as generated by the IDL compiler.
|
protected abstract java.lang.Class<? extends org.omg.PortableServer.Servant> |
_getPOATieClass()
This method must be provided by the component helper class.
|
protected ComponentLifecycle |
getComponentImpl()
Gets the component implementation.
|
protected java.util.logging.Logger |
getComponentLogger()
Gets the component logger.
|
protected java.lang.Class<?> |
getInternalInterface()
Gets the component's implemented functional IF.
|
java.lang.Class<? extends ACSComponentOperations> |
getOperationsInterface()
Gets the xxOperations interface as generated by the IDL compiler by calling
_getOperationsInterface(). |
protected boolean |
requiresOrbCentralLogSuppression()
Do not overwrite this method unless you absolutely need to
(currently only for the archive logger component!)
|
public ComponentHelper(java.util.logging.Logger containerLogger)
super(containerLogger)").containerLogger - logger used by this base class.protected final java.util.logging.Logger getComponentLogger()
protected final ComponentLifecycle getComponentImpl() throws AcsJComponentCreationEx, AcsJJavaComponentHelperEx
getInternalInterface.ComponentLifecycle
and the functional interface.AcsJJavaComponentHelperEx - if the component implementation construction failed or
if the component does not implement its declared functional interface.AcsJComponentCreationExprotected abstract ComponentLifecycle _createComponentImpl() throws AcsJComponentCreationEx
AcsJComponentCreationEx - if the component implementation class could not be instantiatedprotected abstract java.lang.Class<? extends org.omg.PortableServer.Servant> _getPOATieClass()
return DummyComponentPOATie.class;.public final java.lang.Class<? extends ACSComponentOperations> getOperationsInterface()
throws AcsJJavaComponentHelperEx
_getOperationsInterface().AcsJJavaComponentHelperEx - if the subclass methdod throws something or returns null.protected abstract java.lang.Class<? extends ACSComponentOperations> _getOperationsInterface()
Class object associated with the operations interface.protected java.lang.Class<?> getInternalInterface()
throws AcsJJavaComponentHelperEx
To be overridden by the component helper class only if the InternalInterface differs from the OperationsInterface.
AcsJJavaComponentHelperExprotected java.lang.Object _getInterfaceTranslator(java.lang.Object defaultInterfaceTranslator)
throws AcsJJavaComponentHelperEx
The returned interface translator must implement the component's operations interface,
and must take care of translating in, inout parameters,
forwarding the call to the respective method in the component implementation,
and then translating out, inout parameters, and the return value.
It is foreseen that the necessary translations for most methods will be done
automatically by the dynamic proxy classes. Some methods may require manual translation,
e.g. if an expression that involves xml entity classes is too complex for the
dynamic proxy.
On the other end of the spectrum, a manual implementation may
choose to in parameter, because the binding object
will only be routed through to another component, so first unmarshalling
and later marshalling it would be an unnecessary performance loss.
In that case, the manual interface translator could call an additional
method in the component implementation which expects the marshalled xml
rather than the binding object.
To facilitate the implementation of a manual interface translator,
the defaultInterfaceTranslator is provided; it is a dynamic
proxy object that implements the component's operations interface and
forwards all calls to the component implementation created in
_createComponentImpl, performing type translations in between.
The methods that should be handled automatically can then be directly
delegated to that proxy object, and only those methods that require
special care need to be implemented by hand.
defaultInterfaceTranslator - the default translator that the custon translator may
use to delegate some or all method invocations to.AcsJJavaComponentHelperExprotected java.lang.String[] _getComponentMethodsExcludedFromInvocationLogging()
ACSComponentOperations#componentState().
Dealing with OffShoots: offshoots that follow the Corba Tie-approach enjoy automatic method invocation logging
just like components do. In the rare event that you explicitly activate offshoots from your component,
and want to suppress automatic logging for certain methods, return String(s) in the
following format: OFFSHOOT::<offshootinterfacename>#<methodname>.
Example for ALMA archive: "OFFSHOOT::Operational#retrieveFragment".
Note that returning Strings is fine (compared with more sophisticated Method objects)
because the functional component interface methods cannot have parameter polymorphism thanks to IDL limitations.
Thus there is no ambiguity in the method names.
protected boolean requiresOrbCentralLogSuppression()
If true then the ORB logger will not send any log messages to the central (remote) Log service
after activation of this component, regardless of any kind (env var, CDB, dynamic) log level settings.
Local stdout logging by the ORB is not affected.
Currently the ORB log suppression is not reversible: even when the component which requested this
is unloaded, the ORB logger will not resume sending remote log messages.
This may change in the future though.
Note that getComponentMethodsExcludedFromInvocationLogging can switch off automatic logging
done by the container on behalf of the component. However, the ORB does not use a logger-per-component
concept, and thus can't be told selectively to not log anything for a particualar component.
The entire process (container and all components) are affected by suppressing the ORB's remote logging.
This method addresses the special problem of an infrastructural component that receives log messages from the Log service and writes them to the archive. Any message logged by the ORB on the receiver side would go back to the Log service and be received by the infrastructural component, with positive feedback leading to an explosion of log messages. Therefore we can't rely on log level settings and must categorically rule out such feedback loops.