Interface ModuleFactory

All Known Implementing Classes:
BaseMonitor, FileMonitor

public interface ModuleFactory
The monitor provides a central registry for all modules in the system, and manages loading, starting, and finding them.
  • Method Details

    • findModule

      Object findModule(Object service, String protocol, String identifier)
      Find the module in the system with the given module protocol, protocolVersion and identifier.
      Returns:
      The module instance if found, or null.
    • getServiceName

      String getServiceName(Object serviceModule)
      Return the name of the service that the passed in module lives in.
    • getLocale

      Locale getLocale(Object serviceModule)
      Return the locale of the service that the passed in module lives in. Will return null if no-locale has been defined.
    • getLocaleFromString

      Locale getLocaleFromString(String localeDescription) throws StandardException
      Translate a string of the form ll[_CC[_variant]] to a Locale. This is in the Monitor because we want this translation to be in only one place in the code.
      Throws:
      StandardException
    • setLocale

      Locale setLocale(Object serviceModule, String userDefinedLocale) throws StandardException
      Set the locale for the service *outside* of boot time.
      Parameters:
      userDefinedLocale - A String in the form xx_YY, where xx is the language code and YY is the country code.
      Returns:
      The new Locale for the service
      Throws:
      StandardException - Thrown on error
    • setLocale

      Locale setLocale(Properties serviceProperties, String userDefinedLocale) throws StandardException
      Set the locale for the service at boot time. The passed-in properties must be the one passed to the boot method.
      Throws:
      StandardException - Derby error.
    • getServiceType

      PersistentService getServiceType(Object serviceModule)
      Return the PersistentService object for a service. Will return null if the service does not exist.
    • getServiceProvider

      PersistentService getServiceProvider(String subSubProtocol) throws StandardException
      Return the PersistentService for a subsubprotocol.
      Returns:
      the PersistentService or null if it does not exist
      Throws:
      StandardException
    • getApplicationProperties

      Properties getApplicationProperties()
      Return the application set of properties which correspond to the set of properties in the file derby.properties.
    • shutdown

      void shutdown()
      Shut down the complete system that was started by this Monitor. Will cause the stop() method to be called on each loaded module.
    • shutdown

      void shutdown(Object service)
      Shut down a service that was started by this Monitor. Will cause the stop() method to be called on each loaded module. Requires that a context stack exist.
    • classFromIdentifier

      InstanceGetter classFromIdentifier(int identifier) throws StandardException
      Obtain a class that supports the given identifier.
      Parameters:
      identifier - identifer to associate with class
      Returns:
      a reference InstanceGetter
      Throws:
      StandardException - See Monitor.classFromIdentifier
    • newInstanceFromIdentifier

      Object newInstanceFromIdentifier(int identifier) throws StandardException
      Obtain an new instance of a class that supports the given identifier.
      Parameters:
      identifier - identifer to associate with class
      Returns:
      a reference to a newly created object
      Throws:
      StandardException - See Monitor.newInstanceFromIdentifier
    • getEnvironment

      Object getEnvironment()
      Return the environment object that this system was booted in. This is a free form object that is set by the method the system is booted. For example when running in a Marimba system it is set to the maribma application context. In most environments it will be set to a java.io.File object representing the system home directory. Code that call this method usualy have predefined knowledge of the type of the returned object, e.g. Marimba store code knows that this will be set to a marimba application context.
    • getServiceList

      String[] getServiceList(String protocol)
      Return an array of the service identifiers that are running and implement the passed in protocol (java interface class name). This list is a snapshot of the current running systesm, once the call returns the service may have been shutdown or new ones added.
      Returns:
      The list of service names, if no services exist that implement the protocol an array with zero elements is returned.
    • startPersistentService

      boolean startPersistentService(String serviceName, Properties properties) throws StandardException
      Start a persistent service.
      Do not call directly - use Monitor.startPersistentService()

      The poperty set passed in is for boot options for the modules required to start the service. It does not support defining different or new modules implementations.

      Parameters:
      serviceName - Name of the service to be started
      properties - Property set made available to all modules booted for this service, through their ModuleControl.boot method.
      Returns:
      true if the service type is handled by the monitor, false if it isn't
      Throws:
      StandardException - An attempt to start the service failed.
      See Also:
    • createPersistentService

      Object createPersistentService(String factoryInterface, String serviceName, Properties properties) throws StandardException
      Create a persistent service.
      Do not call directly - use Monitor.startPersistentService()
      Throws:
      StandardException - An attempt to create the service failed.
      See Also:
    • removePersistentService

      void removePersistentService(String name) throws StandardException
      Throws:
      StandardException
    • startNonPersistentService

      Object startNonPersistentService(String factoryInterface, String serviceName, Properties properties) throws StandardException
      Start a non-persistent service.
      Do not call directly - use Monitor.startNonPersistentService()
      Throws:
      StandardException - An attempt to start the service failed.
      See Also:
    • getCanonicalServiceName

      String getCanonicalServiceName(String userSpecifiedName) throws StandardException
      Canonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.
      Throws:
      StandardException
    • findService

      Object findService(String protocol, String identifier)
      Find a service.
      Do not call directly - use Monitor.findService()
      Returns:
      a refrence to a module represeting the service or null if the service does not exist.
      See Also:
    • startModule

      Object startModule(boolean create, Object service, String protocol, String identifier, Properties properties) throws StandardException
      Start a module.
      Do not call directly - use Monitor.startSystemModule() or Monitor.bootServiceModule()
      Throws:
      StandardException - An attempt to start the module failed.
      See Also:
    • getSystemStreams

      InfoStreams getSystemStreams()
      Get the defined default system streams object.
    • startServices

      void startServices(Properties properties, boolean bootAll)
      Start all services identified by derby.service.* in the property set. If bootAll is true the services that are persistent will be booted.
    • getJVMProperty

      String getJVMProperty(String key)
      Return a property from the JVM's system set. In a Java2 environment this will be executed as a privileged block if and only if the property starts with 'derby.'. If a SecurityException occurs, null is returned.
    • getDaemonThread

      Thread getDaemonThread(Runnable task, String name, boolean setMinPriority)
      Get a newly created background thread. The thread is set to be a daemon but is not started.
    • isDaemonThread

      boolean isDaemonThread(Thread thread)
      Check if a thread is a daemon thread created by getDaemonThread(java.lang.Runnable, java.lang.String, boolean).
      Parameters:
      thread - the thread to check
      Returns:
      true if thread was created by getDaemonThread(), false otherwise.
    • getEngineVersion

      ProductVersionHolder getEngineVersion()
    • getUUIDFactory

      UUIDFactory getUUIDFactory()
      Get the UUID factory for the system. The UUID factory provides methods to create and recreate database unique identifiers.
    • getTimerFactory

      TimerFactory getTimerFactory()
      Get the Timer factory for the system. The Timer factory provides access to Timer objects for various purposes.
      Returns:
      the system's Timer factory.