org.apache.derby.impl.services.monitor
Class FileMonitor
- java.lang.Object
-
- org.apache.derby.impl.services.monitor.FileMonitor
-
- All Implemented Interfaces:
- BundleFinder, ModuleFactory
public final class FileMonitor extends java.lang.ObjectImplementation of the monitor that uses the class loader that the its was loaded in for all class loading.
-
-
Constructor Summary
Constructors Constructor and Description FileMonitor()FileMonitor(java.util.Properties properties, java.io.PrintWriter log)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description InstanceGetterclassFromIdentifier(int fmtId)Obtain a class that supports the given identifier.java.lang.ObjectcreatePersistentService(java.lang.String factoryInterface, java.lang.String name, java.util.Properties properties)Create a persistent service.java.lang.ObjectfindModule(java.lang.Object serviceModule, java.lang.String factoryInterface, java.lang.String identifier)Find the module in the system with the given module protocol, protocolVersion and identifier.java.lang.ObjectfindService(java.lang.String factoryInterface, java.lang.String serviceName)Find a service.java.util.PropertiesgetApplicationProperties()Return the application set of properties which correspond to the set of properties in the file derby.properties.java.util.ResourceBundlegetBundle(java.lang.String messageId)Get the locale from the ContextManager and then find the bundle based upon that locale.java.lang.StringgetCanonicalServiceName(java.lang.String userSpecifiedName)Canonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.java.lang.ThreadgetDaemonThread(java.lang.Runnable task, java.lang.String name, boolean setMinPriority)Get a newly created background thread.ProductVersionHoldergetEngineVersion()java.lang.ObjectgetEnvironment()Return the environment object that this system was booted in.java.lang.StringgetJVMProperty(java.lang.String key)Return a property from the JVM's system set.java.util.LocalegetLocale(java.lang.Object serviceModule)Return the locale of the service that the passed in module lives in.java.util.LocalegetLocaleFromString(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.StringgetServiceName(java.lang.Object serviceModule)Return the name of the service that the passed in module lives in.PersistentServicegetServiceProvider(java.lang.String subSubProtocol)Return the PersistentService for a subsubprotocol.PersistentServicegetServiceType(java.lang.Object serviceModule)Return the PersistentService object for a service.InfoStreamsgetSystemStreams()Get the defined default system streams object.TimerFactorygetTimerFactory()Returns the Timer factory for this system.UUIDFactorygetUUIDFactory()Return the UUID factory for this system.java.lang.ObjectnewInstanceFromIdentifier(int identifier)Obtain an new instance of a class that supports the given identifier.voidremovePersistentService(java.lang.String name)Removes a PersistentService.java.util.LocalesetLocale(java.lang.Object serviceModule, java.lang.String userDefinedLocale)Set the locale for the service *outside* of boot time.java.util.LocalesetLocale(java.util.Properties serviceProperties, java.lang.String userDefinedLocale)Set the locale for the service at boot time.voidsetThreadPriority(int priority)Set the priority of the current thread.voidshutdown()Shut down the complete system that was started by this Monitor.voidshutdown(java.lang.Object serviceModule)Shut down a service that was started by this Monitor.java.lang.ObjectstartModule(boolean create, java.lang.Object serviceModule, java.lang.String factoryInterface, java.lang.String identifier, java.util.Properties properties)Start a module.java.lang.ObjectstartNonPersistentService(java.lang.String factoryInterface, java.lang.String serviceName, java.util.Properties properties)Start a non-persistent service.booleanstartPersistentService(java.lang.String name, java.util.Properties properties)Start a peristent service.voidstartServices(java.util.Properties properties, boolean bootAll)Start all services identified by derby.service.* in the property set.
-
-
-
Constructor Detail
-
FileMonitor
public FileMonitor()
-
FileMonitor
public FileMonitor(java.util.Properties properties, java.io.PrintWriter log)
-
-
Method Detail
-
getEnvironment
public java.lang.Object getEnvironment()
Description copied from interface:ModuleFactoryReturn 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.
-
getJVMProperty
public final java.lang.String getJVMProperty(java.lang.String key)
Description copied from interface:ModuleFactoryReturn 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
public final java.lang.Thread getDaemonThread(java.lang.Runnable task, java.lang.String name, boolean setMinPriority)Description copied from interface:ModuleFactoryGet a newly created background thread. The thread is set to be a daemon but is not started.- Specified by:
getDaemonThreadin interfaceModuleFactory
-
setThreadPriority
public final void setThreadPriority(int priority)
Description copied from interface:ModuleFactorySet the priority of the current thread. If the current thread was not returned by getDaemonThread() then no action is taken.- Specified by:
setThreadPriorityin interfaceModuleFactory
-
getEngineVersion
public final ProductVersionHolder getEngineVersion()
-
getSystemStreams
public InfoStreams getSystemStreams()
Description copied from interface:ModuleFactoryGet the defined default system streams object.- Specified by:
getSystemStreamsin interfaceModuleFactory
-
shutdown
public void shutdown()
Description copied from interface:ModuleFactoryShut down the complete system that was started by this Monitor. Will cause the stop() method to be called on each loaded module.- Specified by:
shutdownin interfaceModuleFactory
-
shutdown
public void shutdown(java.lang.Object serviceModule)
Shut down a service that was started by this Monitor. Will cause the stop() method to be called on each loaded module.- Specified by:
shutdownin interfaceModuleFactory
-
getCanonicalServiceName
public java.lang.String getCanonicalServiceName(java.lang.String userSpecifiedName) throws StandardExceptionDescription copied from interface:ModuleFactoryCanonicalize a service name, mapping different user-specifications of a database name onto a single, standard name.- Specified by:
getCanonicalServiceNamein interfaceModuleFactory- Throws:
StandardException
-
findService
public java.lang.Object findService(java.lang.String factoryInterface, java.lang.String serviceName)Description copied from interface:ModuleFactoryFind a service.
Do not call directly - use Monitor.findService()- Specified by:
findServicein interfaceModuleFactory- 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)
-
getLocale
public java.util.Locale getLocale(java.lang.Object serviceModule)
Description copied from interface:ModuleFactoryReturn the locale of the service that the passed in module lives in. Will return null if no-locale has been defined.- Specified by:
getLocalein interfaceModuleFactory
-
getLocaleFromString
public java.util.Locale getLocaleFromString(java.lang.String localeDescription) throws StandardExceptionDescription copied from interface:ModuleFactoryTranslate 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.- Specified by:
getLocaleFromStringin interfaceModuleFactory- Throws:
StandardException
-
getServiceName
public java.lang.String getServiceName(java.lang.Object serviceModule)
Return the name of the service that the passed in module lives in.- Specified by:
getServiceNamein interfaceModuleFactory
-
setLocale
public java.util.Locale setLocale(java.lang.Object serviceModule, java.lang.String userDefinedLocale) throws StandardExceptionSet the locale for the service *outside* of boot time.- Specified by:
setLocalein interfaceModuleFactoryuserDefinedLocale- 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- Standard Derby error.
-
setLocale
public java.util.Locale setLocale(java.util.Properties serviceProperties, java.lang.String userDefinedLocale) throws StandardExceptionSet the locale for the service at boot time. The passed in properties must be the one passed to the boot method.- Specified by:
setLocalein interfaceModuleFactory- Throws:
StandardException- Standard Derby error.
-
getServiceType
public PersistentService getServiceType(java.lang.Object serviceModule)
Return the PersistentService object for a service. Will return null if the service does not exist.- Specified by:
getServiceTypein interfaceModuleFactory
-
startModule
public java.lang.Object startModule(boolean create, java.lang.Object serviceModule, java.lang.String factoryInterface, java.lang.String identifier, java.util.Properties properties) throws StandardExceptionStart a module.- Specified by:
startModulein interfaceModuleFactory- Throws:
StandardException- se An attempt to start the module failed.- See Also:
ModuleFactory.startModule(boolean, java.lang.Object, java.lang.String, java.lang.String, java.util.Properties)
-
findModule
public java.lang.Object findModule(java.lang.Object serviceModule, java.lang.String factoryInterface, java.lang.String identifier)Description copied from interface:ModuleFactoryFind the module in the system with the given module protocol, protocolVersion and identifier.- Specified by:
findModulein interfaceModuleFactory- Returns:
- The module instance if found, or null.
-
classFromIdentifier
public InstanceGetter classFromIdentifier(int fmtId) throws StandardException
Obtain a class that supports the given identifier.- Specified by:
classFromIdentifierin interfaceModuleFactory- Parameters:
fmtId- identifer to associate with class- Returns:
- a reference InstanceGetter
- Throws:
StandardException- See Monitor.classFromIdentifier- See Also:
ModuleFactory.classFromIdentifier(int)
-
newInstanceFromIdentifier
public java.lang.Object newInstanceFromIdentifier(int identifier) throws StandardExceptionObtain an new instance of a class that supports the given identifier.- Specified by:
newInstanceFromIdentifierin interfaceModuleFactory- Parameters:
identifier- identifer to associate with class- Returns:
- a reference to a newly created object or null if a matching class cannot be found.
- Throws:
StandardException- See Monitor.newInstanceFromIdentifier
-
getApplicationProperties
public java.util.Properties getApplicationProperties()
Description copied from interface:ModuleFactoryReturn the application set of properties which correspond to the set of properties in the file derby.properties.- Specified by:
getApplicationPropertiesin interfaceModuleFactory
-
getServiceList
public 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).- Specified by:
getServiceListin interfaceModuleFactory- Returns:
- The list of service names, if no services exist that implement the protocol an array with zero elements is returned.
- See Also:
ModuleFactory.getServiceList(java.lang.String)
-
startServices
public void startServices(java.util.Properties properties, boolean bootAll)Description copied from interface:ModuleFactoryStart all services identified by derby.service.* in the property set. If bootAll is true the services that are persistent will be booted.- Specified by:
startServicesin interfaceModuleFactory
-
startPersistentService
public final boolean startPersistentService(java.lang.String name, java.util.Properties properties) throws StandardExceptionStart a peristent service.- Specified by:
startPersistentServicein interfaceModuleFactory- Parameters:
name- 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:
ModuleFactory.startPersistentService(java.lang.String, java.util.Properties),Monitor.startPersistentService(java.lang.String, java.util.Properties)
-
createPersistentService
public java.lang.Object createPersistentService(java.lang.String factoryInterface, java.lang.String name, java.util.Properties properties) throws StandardExceptionCreate a persistent service.- Specified by:
createPersistentServicein interfaceModuleFactory- Returns:
- The module from the service if it was created successfully, null if a service already existed.
- Throws:
StandardException- An exception was thrown trying to create the service.- See Also:
Monitor.createPersistentService(java.lang.String, java.lang.String, java.util.Properties)
-
removePersistentService
public void removePersistentService(java.lang.String name) throws StandardExceptionRemoves a PersistentService. Could be used for drop database.- Specified by:
removePersistentServicein interfaceModuleFactory- Parameters:
name- : Service name to be removed.- Throws:
StandardException
-
startNonPersistentService
public java.lang.Object startNonPersistentService(java.lang.String factoryInterface, java.lang.String serviceName, java.util.Properties properties) throws StandardExceptionStart a non-persistent service.- Specified by:
startNonPersistentServicein interfaceModuleFactory- Throws:
StandardException- An attempt to start the service failed.- See Also:
Monitor.startNonPersistentService(java.lang.String, java.lang.String, java.util.Properties),ModuleFactory.startNonPersistentService(java.lang.String, java.lang.String, java.util.Properties)
-
getServiceProvider
public PersistentService getServiceProvider(java.lang.String subSubProtocol) throws StandardException
Description copied from interface:ModuleFactoryReturn the PersistentService for a subsubprotocol.- Specified by:
getServiceProviderin interfaceModuleFactory- Returns:
- the PersistentService or null if it does not exist
- Throws:
StandardException
-
getUUIDFactory
public UUIDFactory getUUIDFactory()
Return the UUID factory for this system. Returns null if there isn't one. See com.ibm.db2j.system.System- Specified by:
getUUIDFactoryin interfaceModuleFactory
-
getTimerFactory
public TimerFactory getTimerFactory()
Returns the Timer factory for this system.- Specified by:
getTimerFactoryin interfaceModuleFactory- Returns:
- the system's Timer factory.
-
getBundle
public java.util.ResourceBundle getBundle(java.lang.String messageId)
Get the locale from the ContextManager and then find the bundle based upon that locale.- Specified by:
getBundlein interfaceBundleFinder- Parameters:
messageId- Message being searched for.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG