Class AbstractConnector.Library

java.lang.Object
com.priint.pubserver.plugin.PluginLibraryControl
com.priint.pubserver.plugin.AbstractConnector.Library
Enclosing class:
AbstractConnector

public abstract static class AbstractConnector.Library extends PluginLibraryControl
Simple implementation of PluginLibraryControl for a connector.

This class uses some ConcurrentHashMaps that are internally used for caching configuration and data objects related to connector instances. All functionality utilizing these maps is encapsulated within the AbstractConnector.

This class already contains implementations for startup and shutdown in @PostConstruct or @PreDestroy phase of EJB life-cycle. They may be overridden by your implementation.

In many cases subclasses of AbstractConnector#Library need no further methods or fields. Just create one subclass with appropriate annotations:

Example

(replace <MyConnectorPackageName> etc. by your names)

 @Singleton
 @Startup
 @PubServerPluginLibrary(
   id="<MyConnectorPackageName>",
   vendor="<MyCompany.com>",
   version="1.0",
   type = PluginType.CONNECTOR,
   configClasses = {<MyConnector>.class}
   )
 public class DemoConnectorLibrary extends AbstractConnector.Library {
   // intentionally left empty
 }
 
Since:
4.0.5
  • Constructor Details

    • Library

      public Library()
  • Method Details

    • startup

      @PostConstruct public void startup()
      Description copied from class: PluginLibraryControl
      Called by the @PostConstruct method of the plug-in library startup singleton bean

      • Reads the plug-in library configuration from the @PubServerPluginLibrary annotation
      • Scans all classes in the library for @PubServerPlugin annotation.
      • Registers the plug-in library.
      • Registers all classes with the @PubServerPlugin annotation as plug-ins.
      • Checks for @PubServerRole and @PubServerPermission annotations and creates entries if necessary.

      Throws LifeCycleException if something fails. This will also cause a failure of the application deployment in the JavaEE container.

      Overrides:
      startup in class PluginLibraryControl
    • shutdown

      @PreDestroy public void shutdown()
      Description copied from class: PluginLibraryControl
      Called by the @preDestroy method of the plug-in library startup singleton bean
      • Scans all classes in the library for @PubServerPlugin annotation
      • unregister the plug-in library
      • unregister all classes with the @PubServerPlugin annotation as plug-ins
      Overrides:
      shutdown in class PluginLibraryControl