public class AdapterRegistry extends java.lang.Object implements AdapterRegistryMBean
JMX_REGISTRY_TYPE, REGISTRY_PREFIX, STANDARD_REGISTRY_JMX_NAME| Modifier and Type | Method and Description |
|---|---|
void |
addAdapter(AdapterManagerMBean adapterManager)
Add an
AdapterManagerMBean instance to the registry. |
void |
addConfiguration(java.util.Properties cfg) |
static void |
close(java.util.Set<javax.management.ObjectName> adapterManagers)
Convenience method to close a set of adapter managers that uses
AdapterComponentMBean.requestClose() |
javax.management.ObjectName |
createAdapter(java.lang.String xml)
Create an adapter from the given string representation.
|
javax.management.ObjectName |
createAdapter(URLString url)
Create an adapter from the given URL.
|
javax.management.ObjectName |
createAdapterFromUrl(java.lang.String url)
Create an adapter from the given URL.
|
javax.management.ObjectName |
createObjectName()
Create the object name representation of the mbean.
|
void |
destroyAdapter(AdapterManagerMBean adapter)
Close the underlying adapter and unregister from JMX.
|
void |
destroyAdapter(javax.management.ObjectName adapterName)
Close the underlying adapter and unregister from JMX.
|
static AdapterRegistryMBean |
findInstance(java.util.Properties cfg) |
java.util.Set<javax.management.ObjectName> |
getAdapters()
Get all the adapters that have been registered.
|
javax.management.ObjectName |
getBuilder(javax.management.ObjectName p)
Get a reference to the
AdapterBuilderMBean instance that built the corresponding AdapterManagerMBean instance. |
AdapterBuilderMBean |
getBuilder(java.util.Properties p)
Get the
AdapterBuilderMBean associated with given Properties object. |
AdapterBuilderMBean |
getBuilderMBean(javax.management.ObjectName p)
Get a reference to the
AdapterBuilderMBean instance that built the corresponding AdapterManagerMBean instance. |
java.util.Set<javax.management.ObjectName> |
getBuilders()
Get All the builders.
|
java.lang.String |
getClassDefinition(java.lang.String className)
In JSON format return the full class description, including subclasses and annotation detail.
|
java.util.Properties |
getConfiguration()
Return the
BootstrapProperties instance that was used to create this registry. |
URLString |
getConfigurationURL(javax.management.ObjectName adapterName)
Get the URL that was used to create the adapter associated with that ObjectName.
|
java.lang.String |
getConfigurationURLString(javax.management.ObjectName adapterName)
Get the URL that was used to create the adapter associated with that ObjectName.
|
java.lang.String |
getVersionControl()
Return the version control system that is currently in use based on
RuntimeVersionControl.getImplementationName()
|
void |
persist(java.lang.String data,
URLString configUrl)
Persist some data the given URL.
|
void |
persistAdapter(AdapterManagerMBean adapter,
java.lang.String url)
Persist the adapter to the given URL.
|
void |
persistAdapter(AdapterManagerMBean adapter,
URLString url)
Persist the adapter to the given URL.
|
void |
persistAdapter(javax.management.ObjectName adapter,
java.lang.String url)
Persist the adapter to the given URL.
|
void |
persistAdapter(javax.management.ObjectName adapter,
URLString url)
Persist the adapter to the given URL.
|
void |
putConfigurationURL(javax.management.ObjectName adapterName,
java.lang.String configUrl)
Register a URL against a given ObjectName.
|
void |
putConfigurationURL(javax.management.ObjectName adapterName,
URLString configUrl)
Register a URL against a given ObjectName.
|
void |
registerMBean()
Register this component (and all children) against the default Platform MBeanServer.
|
java.util.Set<javax.management.ObjectName> |
reloadFromConfig()
Recreate all adapters associated with this AdapterRegistry from their associated bootstrap file.
|
javax.management.ObjectName |
reloadFromConfig(javax.management.ObjectName obj)
Recreate the adapters associated with the specified objectname from their associated bootstrap file.
|
void |
reloadFromVersionControl()
Recreate all adapters associated with this AdapterRegistry from version control.
|
javax.management.ObjectName |
reloadFromVersionControl(javax.management.ObjectName obj)
Recreate the adapter associated with the specified objectname from their associated bootstrap file.
|
boolean |
removeConfigurationURL(javax.management.ObjectName adapterName)
Remove the URL that was used to create the adapter associated with the ObjectName.
|
static void |
sendShutdownEvent(java.util.Set<javax.management.ObjectName> adapterManagers)
Convenience method for sending a shutdown event for every adapter.
|
static void |
start(java.util.Set<javax.management.ObjectName> adapterManagers)
Convenience method to start a set of adapter managers that uses
AdapterComponentMBean.requestStart() |
static void |
stop(java.util.Set<javax.management.ObjectName> adapterManagers)
Convenience method to close a set of adapter managers that uses
AdapterComponentMBean.requestStop() |
static void |
unregister(java.util.Set<javax.management.ObjectName> adapterManagers)
Convenience method to close a set of adapter managers that uses
BaseComponentMBean.unregisterMBean() |
void |
unregisterMBean()
Unregister this component (and all children) from the default Platform MBeanServer.
|
void |
validateConfig(java.lang.String config)
Attempts to unmarshal the component within this target runtime unit.
|
public static AdapterRegistryMBean findInstance(java.util.Properties cfg) throws javax.management.MalformedObjectNameException, CoreException
javax.management.MalformedObjectNameExceptionCoreExceptionpublic javax.management.ObjectName createObjectName()
BaseComponentMBeancreateObjectName in interface BaseComponentMBeanpublic void registerMBean()
throws CoreException
BaseComponentMBeanregisterMBean in interface BaseComponentMBeanCoreException - wrapping any exceptionManagementFactory.getPlatformMBeanServer()public void unregisterMBean()
throws CoreException
BaseComponentMBeanunregisterMBean in interface BaseComponentMBeanCoreException - wrapping any exceptionManagementFactory.getPlatformMBeanServer()public java.util.Set<javax.management.ObjectName> getAdapters()
AdapterRegistryMBeangetAdapters in interface AdapterRegistryMBeanpublic URLString getConfigurationURL(javax.management.ObjectName adapterName)
AdapterRegistryMBean
When attempting to persist an adapter instance, you can use this method to query for the URL
that was used to create the associated adapter. This will be the URL used to create the adapter
initially (i.e. the adapterConfigURL that was resolved from
bootstrap.properties) unless the adapter was created with
AdapterRegistryMBean.createAdapter(String xml) in the first instance (in which case, you need to
figure out where you want to persist the adapter in a different way).
Internally, the URLs are keyed against the ObjectName, which means that if create adapters that
have the same logical object name, then a URLString will be returned regardless of "how" you
created the adapter. So the code below will return http://my/url if the two ObjectName
instances are considered the same.
{
@code
ObjectName on = createAdapter(new URLString("http://my/url"));
ObjectName on2 = createAdapter("<adapter>...</adapter>");
URLString url = getConfigurationURL(on2);
}
getConfigurationURL in interface AdapterRegistryMBeanadapterName - object name representation for the associated AdapterManagerMBeanpublic java.lang.String getConfigurationURLString(javax.management.ObjectName adapterName)
AdapterRegistryMBean
When attempting to persist an adapter instance, you can use this method to query for the URL that was used to create the
associated adapter. This will be the URL used to create the adapter initially (i.e. the adapterConfigURL that was
resolved from bootstrap.properties) unless the adapter was created with AdapterRegistryMBean.createAdapter(String xml) in the
first instance (in which case, you need to figure out where you want to persist the adapter in a different way).
Internally, the URLs are keyed against the ObjectName, which means that if create adapters that have the same logical object
name, then a URL will be returned regardless of "how" you created the adapter. So the code below will return
http://my/url if the two ObjectName instances are considered the same.
ObjectName on = createAdapter(new URL("http://my/url"));
ObjectName on2 = createAdapter("<adapter>...</adapter>");
URL url = getConfigurationURL(on2);
getConfigurationURLString in interface AdapterRegistryMBeanadapterName - object name representation for the associated AdapterManagerMBeanpublic boolean removeConfigurationURL(javax.management.ObjectName adapterName)
AdapterRegistryMBeanNote that calling either AdapterRegistryMBean.destroyAdapter(AdapterManagerMBean) or AdapterRegistryMBean.destroyAdapter(ObjectName) will NOT
removeConfigurationURL in interface AdapterRegistryMBeanadapterName - object name representation for the associated AdapterManagerMBeanpublic void putConfigurationURL(javax.management.ObjectName adapterName,
URLString configUrl)
AdapterRegistryMBean
Where you have used AdapterRegistryMBean.createAdapter(String); there will not be an URL associated with the newly created adapter. Use
this to register a URL against the given ObjectName, which means that AdapterRegistryMBean.getConfigurationURL(ObjectName) will not
return a null object.
putConfigurationURL in interface AdapterRegistryMBeanadapterName - object name representation for the associated AdapterManagerMBeanconfigUrl - the URL to be stored against the objectnamepublic void putConfigurationURL(javax.management.ObjectName adapterName,
java.lang.String configUrl)
throws java.io.IOException
AdapterRegistryMBean
Where you have used AdapterRegistryMBean.createAdapter(String); there will not be an URL associated with the newly created adapter. Use
this to register a URL against the given ObjectName, which means that AdapterRegistryMBean.getConfigurationURL(ObjectName) will not
return a null object.
putConfigurationURL in interface AdapterRegistryMBeanadapterName - object name representation for the associated AdapterManagerMBeanconfigUrl - the URL to be stored against the objectnamejava.io.IOExceptionpublic void persistAdapter(AdapterManagerMBean adapter, URLString url) throws CoreException, java.io.IOException
AdapterRegistryMBeanpersistAdapter in interface AdapterRegistryMBeanadapter - the adapter Manager.url - the url.CoreExceptionjava.io.IOExceptionpublic void persistAdapter(AdapterManagerMBean adapter, java.lang.String url) throws CoreException, java.io.IOException
AdapterRegistryMBeanpersistAdapter in interface AdapterRegistryMBeanadapter - the adapter Manager.url - the url.CoreExceptionjava.io.IOExceptionpublic void persistAdapter(javax.management.ObjectName adapter,
URLString url)
throws CoreException,
java.io.IOException
AdapterRegistryMBeanpersistAdapter in interface AdapterRegistryMBeanadapter - the AdapterManagerMBean ObjectName.url - the url.CoreExceptionjava.io.IOExceptionpublic void persistAdapter(javax.management.ObjectName adapter,
java.lang.String url)
throws CoreException,
java.io.IOException
AdapterRegistryMBeanpersistAdapter in interface AdapterRegistryMBeanadapter - the AdapterManagerMBean ObjectName.url - the url.CoreExceptionjava.io.IOExceptionpublic void persist(java.lang.String data,
URLString configUrl)
throws CoreException,
java.io.IOException
AdapterRegistryMBeanpersist in interface AdapterRegistryMBeandata - the data.configUrl - the url.CoreExceptionjava.io.IOExceptionpublic javax.management.ObjectName createAdapter(URLString url) throws java.io.IOException, javax.management.MalformedObjectNameException, CoreException
AdapterRegistryMBean
Create an adapter from the given URL; the license associated with this adapter is one that was derived from
bootstrap.properties.
createAdapter in interface AdapterRegistryMBeanurl - the urlAdapterManagerMBeanjava.io.IOException - an error accessing the URL.javax.management.MalformedObjectNameException - if there was a problemCoreException - an error creating the underlying adapter.public javax.management.ObjectName createAdapterFromUrl(java.lang.String url)
throws java.io.IOException,
javax.management.MalformedObjectNameException,
CoreException
AdapterRegistryMBean
Create an adapter from the given URL; the license associated with this adapter is one that was derived from
bootstrap.properties.
createAdapterFromUrl in interface AdapterRegistryMBeanurl - the urlAdapterManagerMBeanjava.io.IOException - an error accessing the URL.javax.management.MalformedObjectNameException - if there was a problemCoreException - an error creating the underlying adapter.public javax.management.ObjectName createAdapter(java.lang.String xml)
throws java.io.IOException,
javax.management.MalformedObjectNameException,
CoreException
AdapterRegistryMBean
Create an adapter from the given string; the license associated with this adapter is one that was derived from
bootstrap.properties.
createAdapter in interface AdapterRegistryMBeanxml - the string representation (generally XML).AdapterManagerMBeanjava.io.IOException - an error accessing the URL.javax.management.MalformedObjectNameException - if there was a problem with the objectname.CoreException - an error creating the underlying adapter.public void addAdapter(AdapterManagerMBean adapterManager) throws javax.management.MalformedObjectNameException, CoreException
AdapterRegistryMBeanAdapterManagerMBean instance to the registry.addAdapter in interface AdapterRegistryMBeanadapterManager - the AdapterManagerMBean instance.javax.management.MalformedObjectNameException - if there was a problem with the objectnameCoreException - if the objectname already exists in the registry.public void destroyAdapter(AdapterManagerMBean adapter) throws CoreException, javax.management.MalformedObjectNameException
AdapterRegistryMBean
Note that this uses AdapterComponentMBean.requestClose() which will block until the adapter is closed; if a timeout is
required, then make sure to use AdapterComponentMBean.requestClose(long) and possibly
AdapterManagerMBean.forceClose() before invoking this method.
destroyAdapter in interface AdapterRegistryMBeanadapter - the AdapterManagerMBean.CoreException - an error accessing the underlying adapter.javax.management.MalformedObjectNameException - if there was a problem with the objectname.public void destroyAdapter(javax.management.ObjectName adapterName)
throws javax.management.MalformedObjectNameException,
CoreException
AdapterRegistryMBean
Note that this uses AdapterComponentMBean.requestClose() which will block until the adapter is closed; if a timeout is
required, then make sure to use AdapterComponentMBean.requestClose(long) and possibly
AdapterManagerMBean.forceClose() before invoking this method.
destroyAdapter in interface AdapterRegistryMBeanadapterName - the AdapterManagerMBean.javax.management.MalformedObjectNameException - if there was a problem with the objectname.CoreException - an error accessing the underlying adapter.AdapterRegistryMBean.destroyAdapter(AdapterManagerMBean)public static void sendShutdownEvent(java.util.Set<javax.management.ObjectName> adapterManagers)
adapterManagers - set of managers.public static void start(java.util.Set<javax.management.ObjectName> adapterManagers)
throws CoreException
AdapterComponentMBean.requestStart()adapterManagers - set of managers.CoreExceptionpublic static void close(java.util.Set<javax.management.ObjectName> adapterManagers)
throws CoreException
AdapterComponentMBean.requestClose()adapterManagers - set of managers.CoreException - wrapping other exceptionspublic static void stop(java.util.Set<javax.management.ObjectName> adapterManagers)
throws CoreException
AdapterComponentMBean.requestStop()adapterManagers - set of managers.CoreException - wrapping other exceptionspublic static void unregister(java.util.Set<javax.management.ObjectName> adapterManagers)
throws CoreException
BaseComponentMBean.unregisterMBean()adapterManagers - set of managers.CoreException - wrapping other exceptionspublic java.util.Properties getConfiguration()
AdapterRegistryMBeanBootstrapProperties instance that was used to create this registry.getConfiguration in interface AdapterRegistryMBeanpublic java.lang.String getVersionControl()
AdapterRegistryMBeangetVersionControl in interface AdapterRegistryMBeanpublic void reloadFromVersionControl()
throws javax.management.MalformedObjectNameException,
CoreException,
java.net.MalformedURLException,
java.io.IOException
AdapterRegistryMBeanNote that the adapters will not be started as part of this process; this needs to be done separately.
reloadFromVersionControl in interface AdapterRegistryMBeanjavax.management.MalformedObjectNameException - if there was a problem with any objectname.CoreException - an error creating the underlying adapter(s).java.net.MalformedURLException - if there was a problem with the URL found from config.java.io.IOException - if there was a with reading the URL where the adapter is hosted.public java.util.Set<javax.management.ObjectName> reloadFromConfig()
throws javax.management.MalformedObjectNameException,
CoreException,
java.net.MalformedURLException,
java.io.IOException
AdapterRegistryMBeanNote that the adapters will not be started as part of this process; this needs to be done separately.
reloadFromConfig in interface AdapterRegistryMBeanAdapterManagerMBean instances created.javax.management.MalformedObjectNameException - if there was a problem with any objectname.CoreException - an error creating the underlying adapter(s).java.net.MalformedURLException - if there was a problem with the URL found from config.java.io.IOException - if there was a with reading the URL where the adapter is hosted.public javax.management.ObjectName reloadFromConfig(javax.management.ObjectName obj)
throws javax.management.MalformedObjectNameException,
CoreException,
java.io.IOException
AdapterRegistryMBeanNote that the adapter will not be started as part of this process; this needs to be done separately.
reloadFromConfig in interface AdapterRegistryMBeanobj - the ObjectName to reload from config.AdapterManagerMBean instances created.javax.management.MalformedObjectNameException - if there was a problem with any objectname.CoreException - an error creating the underlying adapter(s).java.io.IOException - if there was a with reading the URL where the adapter is hosted.java.net.MalformedURLException - if there was a problem with the URL found from config.public javax.management.ObjectName reloadFromVersionControl(javax.management.ObjectName obj)
throws javax.management.MalformedObjectNameException,
CoreException,
java.io.IOException
AdapterRegistryMBeanNote that the adapter will not be started as part of this process; this needs to be done separately.
reloadFromVersionControl in interface AdapterRegistryMBeanobj - the ObjectName to restart.AdapterManagerMBean instances created.javax.management.MalformedObjectNameException - if there was a problem with any objectname.CoreException - an error creating the underlying adapter(s).java.io.IOException - if there was a with reading the URL where the adapter is hosted.java.net.MalformedURLException - if there was a problem with the URL found from config.public void addConfiguration(java.util.Properties cfg)
throws javax.management.MalformedObjectNameException,
CoreException
addConfiguration in interface AdapterRegistryMBeanjavax.management.MalformedObjectNameExceptionCoreExceptionpublic void validateConfig(java.lang.String config)
throws CoreException
AdapterRegistryMBean
This will verify that the component that was configured can be unmarshalled within the target runtime system. It is largely
similar to the AdapterRegistryMBean.createAdapter(String) method, however it does not try to register a new AdapterManagerMBean as
part of the operation.
validateConfig in interface AdapterRegistryMBeanconfig - the String representation of a component.CoreException - if there was an exception unmarshalling.AdapterRegistryMBean.createAdapter(String)public java.lang.String getClassDefinition(java.lang.String className)
throws CoreException
AdapterRegistryMBeangetClassDefinition in interface AdapterRegistryMBeanclassName - - fully qualifiedCoreExceptionpublic java.util.Set<javax.management.ObjectName> getBuilders()
AdapterRegistryMBeangetBuilders in interface AdapterRegistryMBeanpublic javax.management.ObjectName getBuilder(javax.management.ObjectName p)
throws javax.management.InstanceNotFoundException
AdapterRegistryMBeanAdapterBuilderMBean instance that built the corresponding AdapterManagerMBean instance.getBuilder in interface AdapterRegistryMBeanp - a reference to the AdapterManagerMBeanAdapterBuilderMBeanjavax.management.InstanceNotFoundException - if there was no associated builder.public AdapterBuilderMBean getBuilderMBean(javax.management.ObjectName p) throws javax.management.InstanceNotFoundException
AdapterRegistryMBeanAdapterBuilderMBean instance that built the corresponding AdapterManagerMBean instance.getBuilderMBean in interface AdapterRegistryMBeanp - a reference to the AdapterManagerMBeanAdapterBuilderMBeanjavax.management.InstanceNotFoundException - if there was no associated builder.public AdapterBuilderMBean getBuilder(java.util.Properties p) throws javax.management.InstanceNotFoundException
AdapterRegistryMBeanAdapterBuilderMBean associated with given Properties object.getBuilder in interface AdapterRegistryMBeanjavax.management.InstanceNotFoundException