public class AdapterManager extends ComponentManagerImpl<Adapter> implements AdapterManagerMBean, AdapterRuntimeManager
AdapterManagerMBean
.ComponentManagerImpl.ComponentNotificationType
log
NOTIF_MSG_FORCE_CLOSE
ADAPTER_PREFIX, CHANNEL_PREFIX, EQUALS, ID_PREFIX, JMX_ADAPTER_TYPE, JMX_CHANNEL_TYPE, JMX_CONSUMER_MONITOR_TYPE, JMX_DOMAIN_NAME, JMX_FAILED_MESSAGE_RETRIER_TYPE, JMX_FS_MONITOR_TYPE, JMX_INFLIGHT_TYPE, JMX_LOG_HANDLER_TYPE, JMX_METRICS_TYPE, JMX_MSG_ERR_DIGESTER_TYPE, JMX_NOTIFIER_TYPE, JMX_RETRY_MONITOR_TYPE, JMX_WORKFLOW_TYPE, KEY_ADAPTER, KEY_CHANNEL, KEY_ID, KEY_WORKFLOW, NOTIF_MSG_CLOSED, NOTIF_MSG_CONFIG_UPDATED, NOTIF_MSG_INITIALISED, NOTIF_MSG_RESTARTED, NOTIF_MSG_STARTED, NOTIF_MSG_STOPPED, NOTIF_TYPE_ADAPTER_CONFIG, NOTIF_TYPE_ADAPTER_LIFECYCLE, NOTIF_TYPE_CHANNEL_CONFIG, NOTIF_TYPE_CHANNEL_LIFECYCLE, NOTIF_TYPE_WORKFLOW_CONFIG, NOTIF_TYPE_WORKFLOW_LIFECYCLE, PROPERTY_SEPARATOR, WORKFLOW_PREFIX
Constructor and Description |
---|
AdapterManager(Adapter owner) |
Modifier and Type | Method and Description |
---|---|
boolean |
addAndBindSharedConnection(java.lang.String xmlString)
Add an
AdaptrisConnection to the adapter's shared components. |
boolean |
addAndBindSharedService(java.lang.String xmlString)
Add an
Service to the adapter's shared components. |
javax.management.ObjectName |
addChannel(java.lang.String xml)
Add a
Channel to this adapter. |
boolean |
addChild(ChannelRuntimeManager cmb)
Add a a child to this parent.
|
boolean |
addChildJmxComponent(ChildRuntimeInfoComponent comp) |
boolean |
addChildren(java.util.Collection<ChannelRuntimeManager> coll)
Add some children to this parent (optional operation).
|
boolean |
addSharedConnection(java.lang.String xmlString)
Add an
AdaptrisConnection to the adapter's shared components.. |
boolean |
addSharedService(java.lang.String xmlString)
Add a
Service to the adapter's shared components. |
protected void |
checkTransitionTo(ComponentState futureState)
Check whether the transition is allowed in the context of the current component's (or parent's) state.
|
void |
childUpdated()
Notifies a parent that a child component has been updated.
|
boolean |
containsSharedConnection(java.lang.String connectionId)
Check if the associated connectionId is already present in the shared connections.
|
boolean |
containsSharedService(java.lang.String serviceId)
Check if the associated serviceId is already present in the shared services.
|
java.lang.String |
createObjectHierarchyString()
Create an ObjectName key/value pair hierarchy.
|
javax.management.ObjectName |
createObjectName()
Create the object name representation of the mbean.
|
boolean |
equals(java.lang.Object o)
Equality is based on the underlying ObjectName.
|
void |
forceClose()
Forcibly close the associated adapter.
|
java.lang.String |
getAdapterBuildVersion()
Get the adapter build version.
|
java.util.Collection<BaseComponentMBean> |
getAllDescendants()
Get all the descendants of this ParentComponent implementation.
|
java.util.List<java.lang.String> |
getArtifactIdentifiers()
Get a list of all the modules currently installed for this adapter.
|
java.util.Collection<javax.management.ObjectName> |
getChildren()
Get the list of
ObjectName instances that map to all the immeidate child components of this parent. |
java.util.Collection<javax.management.ObjectName> |
getChildRuntimeInfoComponents() |
java.util.List<java.lang.String> |
getModuleVersions()
Get a list of all the modules currently installed for this adapter.
|
javax.management.MBeanNotificationInfo[] |
getNotificationInfo() |
protected java.lang.String |
getNotificationType(ComponentManagerImpl.ComponentNotificationType type) |
java.util.Collection<java.lang.String> |
getSharedConnectionIds()
Get all the connection unique-ids that are currently registered as a shared connection.
|
java.util.Collection<java.lang.String> |
getSharedServiceIds()
Get all the service unique-ids that are currently registered as a shared service.
|
Adapter |
getWrappedComponent()
Get the component that this implementation manages.
|
int |
hashCode() |
void |
registerMBean()
Register this component (and all children) against the default Platform MBeanServer.
|
boolean |
removeChannel(java.lang.String id)
Remove a
Channel from this adapter. |
boolean |
removeChild(ChannelRuntimeManager cmb)
Remove a Child from this parent.
|
boolean |
removeChildJmxComponent(ChildRuntimeInfoComponent comp) |
boolean |
removeChildren(java.util.Collection<ChannelRuntimeManager> coll)
Remove some children from this parent.
|
boolean |
removeSharedComponent(java.lang.String id)
Convenience method to do both
AdapterManagerMBean.removeSharedService(String) and #removeSharedConnection(String) at once. |
boolean |
removeSharedConnection(java.lang.String connectionId)
Remove a connection from the adapter's shared connections.
|
boolean |
removeSharedService(java.lang.String serviceId)
Remove a service from the adapter's shared components.
|
long |
requestStartTime()
Returns timestamp of the last start time for this component
|
long |
requestStopTime()
Returns timestamp of the last stop time for this component
|
void |
sendLifecycleEvent(AdapterLifecycleEvent event)
Send an
AdapterLifecycleEvent to any configured event handlers. |
void |
setFailedMessageRetrier(java.lang.String xml)
Set the
FailedMessageRetrier for this adapter. |
void |
setMessageErrorHandler(java.lang.String xml)
Set the
ProcessingExceptionHandler for this adapter. |
java.lang.String |
toString() |
void |
unregisterMBean()
Unregister this component (and all children) from the default Platform MBeanServer.
|
asXml, closeQuietly, createLifecycleNotification, ensureState, getComponentState, getConfiguration, getUniqueId, getWrappedComponentClassname, marshalAndSendNotification, marshalConfig, registerSelf, requestClose, requestClose, requestInit, requestInit, requestRestart, requestRestart, requestStart, requestStart, requestStop, requestStop, sendConfigUpdateNotification, unregisterSelf
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getWrappedComponentClassname
getComponentState, getConfiguration, getUniqueId, requestClose, requestClose, requestInit, requestInit, requestRestart, requestRestart, requestStart, requestStart, requestStop, requestStop
public AdapterManager(Adapter owner) throws javax.management.MalformedObjectNameException, CoreException
javax.management.MalformedObjectNameException
CoreException
public javax.management.ObjectName createObjectName() throws javax.management.MalformedObjectNameException
BaseComponentMBean
createObjectName
in interface BaseComponentMBean
javax.management.MalformedObjectNameException
- on exception.public long requestStartTime()
AdapterComponentMBean
requestStartTime
in interface AdapterComponentMBean
public long requestStopTime()
AdapterComponentMBean
requestStopTime
in interface AdapterComponentMBean
public java.util.Collection<javax.management.ObjectName> getChildren() throws javax.management.MalformedObjectNameException
ParentComponentMBean
ObjectName
instances that map to all the immeidate child components of this parent.getChildren
in interface ParentComponentMBean
ObjectName
instances.javax.management.MalformedObjectNameException
public boolean addChild(ChannelRuntimeManager cmb) throws CoreException
ParentComponent
addChild
in interface ParentComponent<ChannelRuntimeManager>
cmb
- a channel managerCoreException
- wrapping any underlying exceptionSet.add(Object)
public boolean removeChild(ChannelRuntimeManager cmb) throws CoreException
ParentComponent
removeChild
in interface ParentComponent<ChannelRuntimeManager>
cmb
- a channel managerCoreException
- wrapping any underlying exceptionSet.remove(Object)
public boolean addChildren(java.util.Collection<ChannelRuntimeManager> coll) throws CoreException
ParentComponent
addChildren
in interface ParentComponent<ChannelRuntimeManager>
coll
- a collection of items to be added.CoreException
- wrapping any underlying exceptionSet.addAll(Collection)
public boolean removeChildren(java.util.Collection<ChannelRuntimeManager> coll) throws CoreException
ParentComponent
removeChildren
in interface ParentComponent<ChannelRuntimeManager>
coll
- a collection of items to be removed.CoreException
- wrapping any underlying exceptionSet.addAll(Collection)
public Adapter getWrappedComponent()
AdapterRuntimeComponent
getWrappedComponent
in interface AdapterRuntimeComponent<Adapter>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
protected void checkTransitionTo(ComponentState futureState) throws CoreException
ComponentManagerImpl
checkTransitionTo
in class ComponentManagerImpl<Adapter>
futureState
- the state we want to transition to.CoreException
- if the state transition check fails.public java.util.Collection<BaseComponentMBean> getAllDescendants()
AdapterRuntimeComponent
getAllDescendants
in interface AdapterRuntimeComponent<Adapter>
getAllDescendants
in interface ParentComponent<ChannelRuntimeManager>
public java.util.Collection<javax.management.ObjectName> getChildRuntimeInfoComponents() throws javax.management.MalformedObjectNameException
getChildRuntimeInfoComponents
in interface ParentRuntimeInfoComponentMBean
javax.management.MalformedObjectNameException
public boolean addChildJmxComponent(ChildRuntimeInfoComponent comp)
addChildJmxComponent
in interface ParentRuntimeInfoComponent
public boolean removeChildJmxComponent(ChildRuntimeInfoComponent comp)
removeChildJmxComponent
in interface ParentRuntimeInfoComponent
public java.lang.String createObjectHierarchyString()
HierarchicalMBean
createObjectHierarchyString
in interface HierarchicalMBean
createObjectHierarchyString
in interface ParentComponent<ChannelRuntimeManager>
public boolean addSharedConnection(java.lang.String xmlString) throws CoreException, java.lang.IllegalArgumentException
AdapterManagerMBean
AdaptrisConnection
to the adapter's shared components..addSharedConnection
in interface AdapterManagerMBean
xmlString
- the string representation of the connection.CoreException
- wrapping any other exceptionjava.lang.IllegalArgumentException
- if the connection does not have an unique-idpublic boolean addAndBindSharedConnection(java.lang.String xmlString) throws CoreException, java.lang.IllegalStateException
AdapterManagerMBean
AdaptrisConnection
to the adapter's shared components. and bind it to JNDI.
This is primarily for adding shared connections when the Adapter is currently started. Runtime manipulation of the adapter
allows you to invoke AdapterManagerMBean.addChannel(String)
while the adapter is running. If the Channel
object
contains a reference to a shared connection, then you should use this method to add the and bind the shared connection to JNDI
ready for use.
addAndBindSharedConnection
in interface AdapterManagerMBean
xmlString
- the string representation of the connection.CoreException
- wrapping any other exceptionjava.lang.IllegalStateException
- if the state of the adapter is actually closed, in which case you should use
AdapterManagerMBean.addSharedConnection(String)
instead..public boolean removeSharedConnection(java.lang.String connectionId) throws CoreException, java.lang.IllegalStateException
AdapterManagerMBean
removeSharedConnection
in interface AdapterManagerMBean
connectionId
- the connection unique-id to remove.CoreException
- wrapping any other exceptionjava.lang.IllegalStateException
- if the state of the adapter is not closed.public boolean containsSharedConnection(java.lang.String connectionId) throws CoreException
AdapterManagerMBean
containsSharedConnection
in interface AdapterManagerMBean
connectionId
- the connection unique-id to check forCoreException
- wrapping any other exceptionpublic java.util.Collection<java.lang.String> getSharedConnectionIds() throws CoreException
AdapterManagerMBean
getSharedConnectionIds
in interface AdapterManagerMBean
CoreException
- wrapping any other exceptionpublic boolean addSharedService(java.lang.String xmlString) throws CoreException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
AdapterManagerMBean
Service
to the adapter's shared components.addSharedService
in interface AdapterManagerMBean
xmlString
- the string representation of the service.CoreException
- wrapping any other exceptionjava.lang.IllegalStateException
- if the state of the adapter is not closed.java.lang.IllegalArgumentException
- if the connection does not have an unique-idpublic boolean addAndBindSharedService(java.lang.String xmlString) throws CoreException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
AdapterManagerMBean
Service
to the adapter's shared components. and bind it to JNDI.
This is primarily for adding shared services when the Adapter is currently started. Runtime manipulation of the adapter allows
you to invoke AdapterManagerMBean.addChannel(String)
while the adapter is running. If the Channel
object
contains a reference to a shared service, then you should use this method to add the and bind the shared connection to JNDI
ready for use.
addAndBindSharedService
in interface AdapterManagerMBean
xmlString
- the string representation of the service.CoreException
- wrapping any other exceptionjava.lang.IllegalStateException
- if the state of the adapter is actually closed, in which case you should use
AdapterManagerMBean.addSharedConnection(String)
instead..java.lang.IllegalArgumentException
- if the connection does not have an unique-idpublic boolean removeSharedService(java.lang.String serviceId) throws CoreException, java.lang.IllegalStateException
AdapterManagerMBean
removeSharedService
in interface AdapterManagerMBean
serviceId
- the shared service unique-id to remove.CoreException
- wrapping any other exceptionjava.lang.IllegalStateException
- if the state of the adapter is not closed.public boolean containsSharedService(java.lang.String serviceId) throws CoreException
AdapterManagerMBean
containsSharedService
in interface AdapterManagerMBean
serviceId
- the shared service unique-id to remove.CoreException
- wrapping any other exceptionpublic java.util.Collection<java.lang.String> getSharedServiceIds() throws CoreException
AdapterManagerMBean
getSharedServiceIds
in interface AdapterManagerMBean
CoreException
- wrapping any other exceptionpublic boolean removeSharedComponent(java.lang.String id) throws CoreException, java.lang.IllegalStateException
AdapterManagerMBean
AdapterManagerMBean.removeSharedService(String)
and #removeSharedConnection(String)
at once.removeSharedComponent
in interface AdapterManagerMBean
id
- the shared id to remove.CoreException
- wrapping any other exceptionjava.lang.IllegalStateException
- if the state of the adapter is not closed.public javax.management.ObjectName addChannel(java.lang.String xml) throws CoreException, javax.management.MalformedObjectNameException
AdapterManagerMBean
Channel
to this adapter.addChannel
in interface AdapterManagerMBean
xml
- the string representation of the channel.CoreException
- wrapping any exceptionjavax.management.MalformedObjectNameException
- upon ObjectName errors.public boolean removeChannel(java.lang.String id) throws CoreException, javax.management.MalformedObjectNameException
AdapterManagerMBean
Channel
from this adapter.
This also removes the associated ChannelManager
and calls BaseComponentMBean.unregisterMBean()
.
removeChannel
in interface AdapterManagerMBean
id
- the id of the channel to remove.CoreException
- wrapping any exceptionjavax.management.MalformedObjectNameException
- upon ObjectName errors.public void setMessageErrorHandler(java.lang.String xml) throws CoreException
AdapterManagerMBean
ProcessingExceptionHandler
for this adapter.setMessageErrorHandler
in interface AdapterManagerMBean
xml
- the string representation of the error handler.CoreException
- wrapping any exceptionpublic void setFailedMessageRetrier(java.lang.String xml) throws CoreException
AdapterManagerMBean
FailedMessageRetrier
for this adapter.setFailedMessageRetrier
in interface AdapterManagerMBean
xml
- the string representation of the error handler.CoreException
- wrapping any exceptionpublic void registerMBean() throws CoreException
BaseComponentMBean
registerMBean
in interface BaseComponentMBean
CoreException
- wrapping any exceptionManagementFactory.getPlatformMBeanServer()
public void unregisterMBean() throws CoreException
BaseComponentMBean
unregisterMBean
in interface BaseComponentMBean
CoreException
- wrapping any exceptionManagementFactory.getPlatformMBeanServer()
public void childUpdated() throws CoreException
ParentComponent
childUpdated
in interface ParentComponent<ChannelRuntimeManager>
CoreException
public java.lang.String getAdapterBuildVersion()
AdapterManagerMBean
getAdapterBuildVersion
in interface AdapterManagerMBean
public java.util.List<java.lang.String> getModuleVersions()
AdapterManagerMBean
getModuleVersions
in interface AdapterManagerMBean
public java.util.List<java.lang.String> getArtifactIdentifiers()
AdapterManagerMBean
getArtifactIdentifiers
in interface AdapterManagerMBean
groupId:artifactId:version
.public void sendLifecycleEvent(AdapterLifecycleEvent event) throws CoreException
AdapterManagerMBean
AdapterLifecycleEvent
to any configured event handlers.sendLifecycleEvent
in interface AdapterManagerMBean
event
- the AdapterLifecycleEvent
to send.CoreException
- wrapping any exceptionpublic javax.management.MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo
in interface javax.management.NotificationBroadcaster
getNotificationInfo
in class javax.management.NotificationBroadcasterSupport
protected java.lang.String getNotificationType(ComponentManagerImpl.ComponentNotificationType type)
getNotificationType
in class ComponentManagerImpl<Adapter>
public void forceClose() throws CoreException
AdapterManagerMBean
In the event that there is a concrete AllowsRetriesConnection
that is configured incorrectly, and set
with infinite retries; then the adapter will appear to be stuck waiting in the incorrect state (generally, attempting to
initialise) when asked nicely to stop. Use this method to forcibly terminate whatever operations are being attempted and to
shutdown the adapter.
forceClose
in interface AdapterManagerMBean
CoreException