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
Modifier and TypeMethodDescriptionclassFromIdentifier
(int identifier) Obtain a class that supports the given identifier.createPersistentService
(String factoryInterface, String serviceName, Properties properties) Create a persistent service.findModule
(Object service, String protocol, String identifier) Find the module in the system with the given module protocol, protocolVersion and identifier.findService
(String protocol, String identifier) Find a service.Return the application set of properties which correspond to the set of properties in the file derby.properties.getCanonicalServiceName
(String userSpecifiedName) Canonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.getDaemonThread
(Runnable task, String name, boolean setMinPriority) Get a newly created background thread.Return the environment object that this system was booted in.getJVMProperty
(String key) Return a property from the JVM's system set.Return the locale of the service that the passed in module lives in.getLocaleFromString
(String localeDescription) Translate a string of the form ll[_CC[_variant]] to a Locale.String[]
getServiceList
(String protocol) Return an array of the service identifiers that are running and implement the passed in protocol (java interface class name).getServiceName
(Object serviceModule) Return the name of the service that the passed in module lives in.getServiceProvider
(String subSubProtocol) Return the PersistentService for a subsubprotocol.getServiceType
(Object serviceModule) Return the PersistentService object for a service.Get the defined default system streams object.Get the Timer factory for the system.Get the UUID factory for the system.boolean
isDaemonThread
(Thread thread) Check if a thread is a daemon thread created bygetDaemonThread(java.lang.Runnable, java.lang.String, boolean)
.newInstanceFromIdentifier
(int identifier) Obtain an new instance of a class that supports the given identifier.void
Set the locale for the service *outside* of boot time.setLocale
(Properties serviceProperties, 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
Shut down a service that was started by this Monitor.startModule
(boolean create, Object service, String protocol, String identifier, Properties properties) Start a module.startNonPersistentService
(String factoryInterface, String serviceName, Properties properties) Start a non-persistent service.boolean
startPersistentService
(String serviceName, Properties properties) Start a persistent service.void
startServices
(Properties properties, boolean bootAll) Start all services identified by derby.service.* in the property set.
-
Method Details
-
findModule
Find the module in the system with the given module protocol, protocolVersion and identifier.- Returns:
- The module instance if found, or null.
-
getServiceName
Return the name of the service that the passed in module lives in. -
getLocale
Return the locale of the service that the passed in module lives in. Will return null if no-locale has been defined. -
getLocaleFromString
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
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
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
Return the PersistentService object for a service. Will return null if the service does not exist. -
getServiceProvider
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
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
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
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
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
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 startedproperties
- 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
- 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
Canonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.- Throws:
StandardException
-
findService
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
Start all services identified by derby.service.* in the property set. If bootAll is true the services that are persistent will be booted. -
getJVMProperty
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
Get a newly created background thread. The thread is set to be a daemon but is not started. -
isDaemonThread
Check if a thread is a daemon thread created bygetDaemonThread(java.lang.Runnable, java.lang.String, boolean)
.- Parameters:
thread
- the thread to check- Returns:
true
ifthread
was created bygetDaemonThread()
,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.
-