Top Description Methods
org.apache.derby.iapi.services.monitor

public Interface ModuleFactory

Known Direct Implementers
org.apache.derby.impl.services.monitor.BaseMonitor
Imports
org.apache.derby.shared.common.info.ProductVersionHolder, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.stream.InfoStreams, org.apache.derby.iapi.services.monitor.PersistentService, org.apache.derby.iapi.services.loader.InstanceGetter, java.util.Properties, .Locale, java.io.InputStream, .IOException

The monitor provides a central registry for all modules in the system, and manages loading, starting, and finding them.

Method Summary

Modifier and TypeMethod and Description
public InstanceGetter

Returns:

a reference InstanceGetter
classFromIdentifier
(int
identifer to associate with class
identifier
)

Obtain a class that supports the given identifier.

public Object
createPersistentService(String factoryInterface, String serviceName, Properties properties)

Create a persistent service.

public Object

Returns:

The module instance if found, or null.
findModule
(Object service, String protocol, String identifier)

Find the module in the system with the given module protocol, protocolVersion and identifier.

public Object

Returns:

a refrence to a module represeting the service or null if the service does not exist.
findService
(String protocol, String identifier)

Find a service.

public Properties
getApplicationProperties()

Return the application set of properties which correspond to the set of properties in the file derby.properties.

public String
getCanonicalServiceName(String userSpecifiedName)

Canonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.

public Thread
getDaemonThread(Runnable task, String name, boolean setMinPriority)

Get a newly created background thread.

public ProductVersionHolder
public 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.

public String
getJVMProperty(String key)

Return a property from the JVM's system set.

public 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.

public Locale
getLocaleFromString(String localeDescription)

Translate a string of the form ll[_CC[_variant]] to a Locale.

public String[]

Returns:

The list of service names, if no services exist that implement the protocol an array with zero elements is returned.
getServiceList
(String protocol)

Return an array of the service identifiers that are running and implement the passed in protocol (java interface class name).

public String
getServiceName(Object serviceModule)

Return the name of the service that the passed in module lives in.

public PersistentService

Returns:

the PersistentService or null if it does not exist
getServiceProvider
(String subSubProtocol)

Return the PersistentService for a subsubprotocol.

public PersistentService
getServiceType(Object serviceModule)

Return the PersistentService object for a service.

public InfoStreams
getSystemStreams()

Get the defined default system streams object.

public TimerFactory

Returns:

the system's Timer factory.
getTimerFactory
()

Get the Timer factory for the system.

public UUIDFactory
getUUIDFactory()

Get the UUID factory for the system.

public boolean

Returns:

true if thread was created by getDaemonThread(), false otherwise.
isDaemonThread
(Thread
the thread to check
thread
)

Check if a thread is a daemon thread created by getDaemonThread.

public Object

Returns:

a reference to a newly created object
newInstanceFromIdentifier
(int
identifer to associate with class
identifier
)

Obtain an new instance of a class that supports the given identifier.

public void
public Locale

Returns:

The new Locale for the service
setLocale
(Object serviceModule, String
A String in the form xx_YY, where xx is the language code and YY is the country code.
userDefinedLocale
)

Set the locale for the service *outside* of boot time.

public Locale
setLocale(Properties serviceProperties, String userDefinedLocale)

Set the locale for the service at boot time.

public void
shutdown()

Shut down the complete system that was started by this Monitor.

public void
shutdown(Object service)

Shut down a service that was started by this Monitor.

public Object
startModule(boolean create, Object service, String protocol, String identifier, Properties properties)

Start a module.

public Object
startNonPersistentService(String factoryInterface, String serviceName, Properties properties)

Start a non-persistent service.

public boolean

Returns:

true if the service type is handled by the monitor, false if it isn't
startPersistentService
(String
Name of the service to be started
serviceName
,
Properties
Property set made available to all modules booted for this service, through their ModuleControl.boot method.
properties
)

Start a persistent service.

public void
startServices(Properties properties, boolean bootAll)

Start all services identified by derby.service.* in the property set.

Method Detail

classFromIdentifierback to summary
public InstanceGetter classFromIdentifier(int identifier) throws StandardException

Obtain a class that supports the given identifier.

Parameters
identifier:int

identifer to associate with class

Returns:InstanceGetter

a reference InstanceGetter

Exceptions
StandardException:
See Monitor.classFromIdentifier
createPersistentServiceback to summary
public Object createPersistentService(String factoryInterface, String serviceName, Properties properties) throws StandardException

Create a persistent service.
Do not call directly - use Monitor.startPersistentService()

Exceptions
StandardException:
An attempt to create the service failed.
See Also
Monitor#createPersistentService
findModuleback to summary
public Object findModule(Object service, String protocol, String identifier)

Find the module in the system with the given module protocol, protocolVersion and identifier.

Returns:Object

The module instance if found, or null.

findServiceback to summary
public Object findService(String protocol, String identifier)

Find a service.
Do not call directly - use Monitor.findService()

Returns:Object

a refrence to a module represeting the service or null if the service does not exist.

See Also
Monitor#findService
getApplicationPropertiesback to summary
public Properties getApplicationProperties()

Return the application set of properties which correspond to the set of properties in the file derby.properties.

getCanonicalServiceNameback to summary
public String getCanonicalServiceName(String userSpecifiedName) throws StandardException

Canonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.

getDaemonThreadback to summary
public 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.

getEngineVersionback to summary
public ProductVersionHolder getEngineVersion()
getEnvironmentback to summary
public 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.

getJVMPropertyback to summary
public 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.'.

getLocaleback to summary
public 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.

getLocaleFromStringback to summary
public 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.

getServiceListback to summary
public 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:String[]

The list of service names, if no services exist that implement the protocol an array with zero elements is returned.

getServiceNameback to summary
public String getServiceName(Object serviceModule)

Return the name of the service that the passed in module lives in.

getServiceProviderback to summary
public PersistentService getServiceProvider(String subSubProtocol) throws StandardException

Return the PersistentService for a subsubprotocol.

Returns:PersistentService

the PersistentService or null if it does not exist

getServiceTypeback to summary
public PersistentService getServiceType(Object serviceModule)

Return the PersistentService object for a service. Will return null if the service does not exist.

getSystemStreamsback to summary
public InfoStreams getSystemStreams()

Get the defined default system streams object.

getTimerFactoryback to summary
public TimerFactory getTimerFactory()

Get the Timer factory for the system. The Timer factory provides access to Timer objects for various purposes.

Returns:TimerFactory

the system's Timer factory.

getUUIDFactoryback to summary
public UUIDFactory getUUIDFactory()

Get the UUID factory for the system. The UUID factory provides methods to create and recreate database unique identifiers.

isDaemonThreadback to summary
public boolean isDaemonThread(Thread thread)

Check if a thread is a daemon thread created by getDaemonThread.

Parameters
thread:Thread

the thread to check

Returns:boolean

true if thread was created by getDaemonThread(), false otherwise.

newInstanceFromIdentifierback to summary
public Object newInstanceFromIdentifier(int identifier) throws StandardException

Obtain an new instance of a class that supports the given identifier.

Parameters
identifier:int

identifer to associate with class

Returns:Object

a reference to a newly created object

Exceptions
StandardException:
See Monitor.newInstanceFromIdentifier
removePersistentServiceback to summary
public void removePersistentService(String name) throws StandardException
setLocaleback to summary
public Locale setLocale(Object serviceModule, String userDefinedLocale) throws StandardException

Set the locale for the service *outside* of boot time.

Parameters
userDefinedLocale:String

A String in the form xx_YY, where xx is the language code and YY is the country code.

Returns:Locale

The new Locale for the service

Exceptions
StandardException:
Thrown on error
setLocaleback to summary
public 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.

Exceptions
StandardException:
Derby error.
shutdownback to summary
public 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.

shutdownback to summary
public 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.

startModuleback to summary
public 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()

Exceptions
StandardException:
An attempt to start the module failed.
See Also
Monitor#startSystemModule, Monitor#bootServiceModule
startNonPersistentServiceback to summary
public Object startNonPersistentService(String factoryInterface, String serviceName, Properties properties) throws StandardException

Start a non-persistent service.
Do not call directly - use Monitor.startNonPersistentService()

Exceptions
StandardException:
An attempt to start the service failed.
See Also
Monitor#startNonPersistentService
startPersistentServiceback to summary
public 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:String

Name of the service to be started

properties:Properties

Property set made available to all modules booted for this service, through their ModuleControl.boot method.

Returns:boolean

true if the service type is handled by the monitor, false if it isn't

Exceptions
StandardException:
An attempt to start the service failed.
See Also
Monitor#startPersistentService
startServicesback to summary
public 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.