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 Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      InstanceGetter classFromIdentifier​(int identifier)
      Obtain a class that supports the given identifier.
      java.lang.Object createPersistentService​(java.lang.String factoryInterface, java.lang.String serviceName, java.util.Properties properties)
      Create a persistent service.
      java.lang.Object findModule​(java.lang.Object service, java.lang.String protocol, java.lang.String identifier)
      Find the module in the system with the given module protocol, protocolVersion and identifier.
      java.lang.Object findService​(java.lang.String protocol, java.lang.String identifier)
      Find a service.
      java.util.Properties getApplicationProperties()
      Return the application set of properties which correspond to the set of properties in the file derby.properties.
      java.lang.String getCanonicalServiceName​(java.lang.String userSpecifiedName)
      Canonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.
      java.lang.Thread getDaemonThread​(java.lang.Runnable task, java.lang.String name, boolean setMinPriority)
      Get a newly created background thread.
      ProductVersionHolder getEngineVersion()  
      java.lang.Object getEnvironment()
      Return the environment object that this system was booted in.
      java.lang.String getJVMProperty​(java.lang.String key)
      Return a property from the JVM's system set.
      java.util.Locale getLocale​(java.lang.Object serviceModule)
      Return the locale of the service that the passed in module lives in.
      java.util.Locale getLocaleFromString​(java.lang.String localeDescription)
      Translate a string of the form ll[_CC[_variant]] to a Locale.
      java.lang.String[] getServiceList​(java.lang.String protocol)
      Return an array of the service identifiers that are running and implement the passed in protocol (java interface class name).
      java.lang.String getServiceName​(java.lang.Object serviceModule)
      Return the name of the service that the passed in module lives in.
      PersistentService getServiceProvider​(java.lang.String subSubProtocol)
      Return the PersistentService for a subsubprotocol.
      PersistentService getServiceType​(java.lang.Object serviceModule)
      Return the PersistentService object for a service.
      InfoStreams getSystemStreams()
      Get the defined default system streams object.
      TimerFactory getTimerFactory()
      Get the Timer factory for the system.
      UUIDFactory getUUIDFactory()
      Get the UUID factory for the system.
      boolean isDaemonThread​(java.lang.Thread thread)
      Check if a thread is a daemon thread created by getDaemonThread(java.lang.Runnable, java.lang.String, boolean).
      java.lang.Object newInstanceFromIdentifier​(int identifier)
      Obtain an new instance of a class that supports the given identifier.
      void removePersistentService​(java.lang.String name)  
      java.util.Locale setLocale​(java.lang.Object serviceModule, java.lang.String userDefinedLocale)
      Set the locale for the service *outside* of boot time.
      java.util.Locale setLocale​(java.util.Properties serviceProperties, java.lang.String userDefinedLocale)
      Set the locale for the service at boot time.
      void shutdown()
      Shut down the complete system that was started by this Monitor.
      void shutdown​(java.lang.Object service)
      Shut down a service that was started by this Monitor.
      java.lang.Object startModule​(boolean create, java.lang.Object service, java.lang.String protocol, java.lang.String identifier, java.util.Properties properties)
      Start a module.
      java.lang.Object startNonPersistentService​(java.lang.String factoryInterface, java.lang.String serviceName, java.util.Properties properties)
      Start a non-persistent service.
      boolean startPersistentService​(java.lang.String serviceName, java.util.Properties properties)
      Start a persistent service.
      void startServices​(java.util.Properties properties, boolean bootAll)
      Start all services identified by derby.service.* in the property set.
    • Method Detail

      • findModule

        java.lang.Object findModule​(java.lang.Object service,
                                    java.lang.String protocol,
                                    java.lang.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

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

        java.util.Locale getLocale​(java.lang.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

        java.util.Locale getLocaleFromString​(java.lang.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

        java.util.Locale setLocale​(java.lang.Object serviceModule,
                                   java.lang.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

        java.util.Locale setLocale​(java.util.Properties serviceProperties,
                                   java.lang.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​(java.lang.Object serviceModule)
        Return the PersistentService object for a service. Will return null if the service does not exist.
      • getServiceProvider

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

        java.util.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​(java.lang.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

        java.lang.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

        java.lang.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

        java.lang.String[] getServiceList​(java.lang.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​(java.lang.String serviceName,
                                       java.util.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:
        Monitor.startPersistentService(java.lang.String, java.util.Properties)
      • getCanonicalServiceName

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

        java.lang.Object findService​(java.lang.String protocol,
                                     java.lang.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:
        Monitor.findService(java.lang.String, java.lang.String)
      • getSystemStreams

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

        void startServices​(java.util.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

        java.lang.String getJVMProperty​(java.lang.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

        java.lang.Thread getDaemonThread​(java.lang.Runnable task,
                                         java.lang.String name,
                                         boolean setMinPriority)
        Get a newly created background thread. The thread is set to be a daemon but is not started.
      • 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.