Class AdapterRegistry

    • Method Detail

      • findInstance

        public static AdapterRegistryMBean findInstance​(java.util.Properties cfg)
                                                 throws javax.management.MalformedObjectNameException,
                                                        CoreException
        Throws:
        javax.management.MalformedObjectNameException
        CoreException
      • createObjectName

        public javax.management.ObjectName createObjectName()
        Description copied from interface: BaseComponentMBean
        Create the object name representation of the mbean.
        Specified by:
        createObjectName in interface BaseComponentMBean
        Returns:
        the object name.
      • getAdapters

        public java.util.Set<javax.management.ObjectName> getAdapters()
        Description copied from interface: AdapterRegistryMBean
        Get all the adapters that have been registered.
        Specified by:
        getAdapters in interface AdapterRegistryMBean
        Returns:
        set of ObjectNames that can be looked up in JMX.
      • getConfigurationURL

        public URLString getConfigurationURL​(javax.management.ObjectName adapterName)
        Description copied from interface: AdapterRegistryMBean
        Get the URL that was used to create the adapter associated with that ObjectName.

        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);
         }
         
        Specified by:
        getConfigurationURL in interface AdapterRegistryMBean
        Parameters:
        adapterName - object name representation for the associated AdapterManagerMBean
        Returns:
        the URL that was used to create the object, or null, if AdapterRegistryMBean.createAdapter(String xml) was used to create a new adapter.
      • getConfigurationURLString

        public java.lang.String getConfigurationURLString​(javax.management.ObjectName adapterName)
        Description copied from interface: AdapterRegistryMBean
        Get the URL that was used to create the adapter associated with that ObjectName.

        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);
         
         
        Specified by:
        getConfigurationURLString in interface AdapterRegistryMBean
        Parameters:
        adapterName - object name representation for the associated AdapterManagerMBean
        Returns:
        the URL that was used to create the object, or null, if AdapterRegistryMBean.createAdapter(String xml) was used to create a new adapter.
      • createAdapter

        public javax.management.ObjectName createAdapter​(URLString url)
                                                  throws java.io.IOException,
                                                         javax.management.MalformedObjectNameException,
                                                         CoreException
        Description copied from interface: AdapterRegistryMBean
        Create an adapter from the given URL.

        Create an adapter from the given URL; the license associated with this adapter is one that was derived from bootstrap.properties.

        Specified by:
        createAdapter in interface AdapterRegistryMBean
        Parameters:
        url - the url
        Returns:
        the object name representing for the associated AdapterManagerMBean
        Throws:
        java.io.IOException - an error accessing the URL.
        javax.management.MalformedObjectNameException - if there was a problem
        CoreException - an error creating the underlying adapter.
      • createAdapterFromUrl

        public javax.management.ObjectName createAdapterFromUrl​(java.lang.String url)
                                                         throws java.io.IOException,
                                                                javax.management.MalformedObjectNameException,
                                                                CoreException
        Description copied from interface: AdapterRegistryMBean
        Create an adapter from the given URL.

        Create an adapter from the given URL; the license associated with this adapter is one that was derived from bootstrap.properties.

        Specified by:
        createAdapterFromUrl in interface AdapterRegistryMBean
        Parameters:
        url - the url
        Returns:
        the object name representing for the associated AdapterManagerMBean
        Throws:
        java.io.IOException - an error accessing the URL.
        javax.management.MalformedObjectNameException - if there was a problem
        CoreException - an error creating the underlying adapter.
      • createAdapter

        public javax.management.ObjectName createAdapter​(java.lang.String xml)
                                                  throws java.io.IOException,
                                                         javax.management.MalformedObjectNameException,
                                                         CoreException
        Description copied from interface: AdapterRegistryMBean
        Create an adapter from the given string representation.

        Create an adapter from the given string; the license associated with this adapter is one that was derived from bootstrap.properties.

        Specified by:
        createAdapter in interface AdapterRegistryMBean
        Parameters:
        xml - the string representation (generally XML).
        Returns:
        the object name representing for the associated AdapterManagerMBean
        Throws:
        java.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.
      • sendShutdownEvent

        public static void sendShutdownEvent​(java.util.Set<javax.management.ObjectName> adapterManagers)
        Convenience method for sending a shutdown event for every adapter.
        Parameters:
        adapterManagers - set of managers.
      • close

        public static void close​(java.util.Set<javax.management.ObjectName> adapterManagers)
                          throws CoreException
        Convenience method to close a set of adapter managers that uses AdapterComponentMBean.requestClose()
        Parameters:
        adapterManagers - set of managers.
        Throws:
        CoreException - wrapping other exceptions
      • stop

        public static void stop​(java.util.Set<javax.management.ObjectName> adapterManagers)
                         throws CoreException
        Convenience method to close a set of adapter managers that uses AdapterComponentMBean.requestStop()
        Parameters:
        adapterManagers - set of managers.
        Throws:
        CoreException - wrapping other exceptions
      • unregister

        public static void unregister​(java.util.Set<javax.management.ObjectName> adapterManagers)
                               throws CoreException
        Convenience method to close a set of adapter managers that uses BaseComponentMBean.unregisterMBean()
        Parameters:
        adapterManagers - set of managers.
        Throws:
        CoreException - wrapping other exceptions
      • reloadFromVersionControl

        public void reloadFromVersionControl()
                                      throws javax.management.MalformedObjectNameException,
                                             CoreException,
                                             java.net.MalformedURLException,
                                             java.io.IOException
        Description copied from interface: AdapterRegistryMBean
        Recreate all adapters associated with this AdapterRegistry from version control.

        Note that the adapters will not be started as part of this process; this needs to be done separately.

        Specified by:
        reloadFromVersionControl in interface AdapterRegistryMBean
        Throws:
        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.
      • reloadFromConfig

        public java.util.Set<javax.management.ObjectName> reloadFromConfig()
                                                                    throws javax.management.MalformedObjectNameException,
                                                                           CoreException,
                                                                           java.net.MalformedURLException,
                                                                           java.io.IOException
        Description copied from interface: AdapterRegistryMBean
        Recreate all adapters associated with this AdapterRegistry from their associated bootstrap file.

        Note that the adapters will not be started as part of this process; this needs to be done separately.

        Specified by:
        reloadFromConfig in interface AdapterRegistryMBean
        Returns:
        a set of object name representing for the associated AdapterManagerMBean instances created.
        Throws:
        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.
      • reloadFromConfig

        public javax.management.ObjectName reloadFromConfig​(javax.management.ObjectName obj)
                                                     throws javax.management.MalformedObjectNameException,
                                                            CoreException,
                                                            java.io.IOException
        Description copied from interface: AdapterRegistryMBean
        Recreate the adapters associated with the specified objectname from their associated bootstrap file.

        Note that the adapter will not be started as part of this process; this needs to be done separately.

        Specified by:
        reloadFromConfig in interface AdapterRegistryMBean
        Parameters:
        obj - the ObjectName to reload from config.
        Returns:
        The ObjectName representing for the associated AdapterManagerMBean instances created.
        Throws:
        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.
      • reloadFromVersionControl

        public javax.management.ObjectName reloadFromVersionControl​(javax.management.ObjectName obj)
                                                             throws javax.management.MalformedObjectNameException,
                                                                    CoreException,
                                                                    java.io.IOException
        Description copied from interface: AdapterRegistryMBean
        Recreate the adapter associated with the specified objectname from their associated bootstrap file.

        Note that the adapter will not be started as part of this process; this needs to be done separately.

        Specified by:
        reloadFromVersionControl in interface AdapterRegistryMBean
        Parameters:
        obj - the ObjectName to restart.
        Returns:
        The ObjectName representing for the associated AdapterManagerMBean instances created.
        Throws:
        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.
      • getClassDefinition

        public java.lang.String getClassDefinition​(java.lang.String className)
                                            throws CoreException
        Description copied from interface: AdapterRegistryMBean
        In JSON format return the full class description, including subclasses and annotation detail.
        Specified by:
        getClassDefinition in interface AdapterRegistryMBean
        Parameters:
        className - - fully qualified
        Returns:
        JSON class definition.
        Throws:
        CoreException
      • getBuilders

        public java.util.Set<javax.management.ObjectName> getBuilders()
        Description copied from interface: AdapterRegistryMBean
        Get All the builders.
        Specified by:
        getBuilders in interface AdapterRegistryMBean
        Returns:
        all the available builders.