Class RASManager
- java.lang.Object
-
- com.ibm.ras.mgr.RASManager
-
- All Implemented Interfaces:
- RASIManager, RASConstants
Deprecated.As of WAS 6.0, recommend using java.util.logging
public class RASManager extends java.lang.Object implements RASConstants, RASIManager
RASManageris a manager of RAS objects. It is an additional feature to the RAS Toolkit. That is, an application can use the RAS Tookit without a RAS Manager by creating all of the required toolkit objects in an application. This may be suitable for "smaller" applications in which the trace state and output device can be hard-coded, or passed to the application when it starts. In more complex environments, an application can be written to use a RAS Manager to acquire itsRASLoggers. This generally lightens the load on the application programmer.The RAS Manager can also provide RAS configuration information to a graphical program, which would allow an end-user or administrator to reconfigure the RAS system -- turning specific loggers on or off, for example.
The RAS Manager deals primarily in configuration data. That is, it must be told which RAS objects it can create, what their options are and how they are connected. When an object, such as a message logger, is requested by an application, the RAS Manager creates it from its configuration data and returns the object. Only one instance of a RAS object is created. This allows different applications, or components of a single application, to share RAS objects.
The RAS Manager configuration is organized as one or more "groups." Groups are a way for an application to distinguish its loggers and handlers from others that may be controlled by the RAS Manager. It is recommended that each application organize its loggers into one or more RAS groups. Handlers are usually considered to be system-wide resources and are, therfore, typically contained in the "base group."
This base group can also contain other groups. The RAS Manager thus implements a "flat tree" of groups. That is, groups may only be added to the base group. An application can impose a logical structure of groups within groups by carefully selecting group names. One way to do this is to use a naming scheme similar to Java package names. This would be very useful to a graphical program that wished to display RAS configurations to an end-user.
An application normally only uses the
getMessageLoggerandgetTraceLoggermethods. The RAS Manager will attach to the logger any handlers which are included in the logger's configuration and any formatters which are included in the handler's configuration. The RAS Manager will search the group containing the logger and then the base group for the handler configuration information. If no handlers are included in the logger's configuration, the RAS Manager will use the set of default handlers. Formatter configurations are searched for in the same manner as handler configurations.In some environments, a RAS Manager may be able to get its initial configuration from persistent storage (such as a properties file or an LDAP database) and, possibly, save it there as well. This medium is represented by the
RASIDataStoreinterface, whoserestoreConfigandsaveConfigmethods provide this function. Two examples of aRASIDataStoreare provided in this package:RASDefaultDataStoreassumes that no persistent store is available. TherestoreConfigandsaveConfigmethods perform no function.RASPropertyDataStoregets its configuration from a properties file of a specific format.
RASBaseGroupand zero or moreRASGroupsand passing this to the RAS Manager through thesetBaseGroupmethod. However, the preferred approach is to use persistent storage.
-
-
Field Summary
Fields Modifier and Type Field and Description protected static java.lang.ObjectdsLockDeprecated.An object on which the manager can synchronize for data store operations.protected static java.lang.ObjectgetMgrLockDeprecated.An object on which the manager can synchronize when getting the manager.protected static java.lang.ObjectgetObjLockDeprecated.An object on which the manager can synchronize when getting a RAS object such as a logger.-
Fields inherited from interface com.ibm.ras.RASConstants
KEY_CLASS_NAME, KEY_CLIENT, KEY_COMPONENT, KEY_DATE_FORMAT, KEY_DEFAULT_HANDLERS, KEY_DEFAULT_MESSAGE_HANDLERS, KEY_DEFAULT_TRACE_HANDLERS, KEY_DESCRIPTION, KEY_ENCODING, KEY_EXCEPTION, KEY_EXCEPTION_TRACE, KEY_FILE_NAME, KEY_FORMATTER_NAMES, KEY_GROUP, KEY_HANDLER_NAMES, KEY_HEX_DATA, KEY_IS_CIRCULAR, KEY_IS_LOGGING, KEY_IS_SYNC, KEY_LOGGER, KEY_LOGGING_CLASS, KEY_LOGGING_METHOD, KEY_MAX_FILE_SIZE, KEY_MAX_FILES, KEY_MAX_QUEUE_SIZE, KEY_MESSAGE_EVENT_CLASSES, KEY_MESSAGE_FILE, KEY_MESSAGE_MASK, KEY_NAME, KEY_ORGANIZATION, KEY_PRODUCT, KEY_RETRY_INTERVAL, KEY_SEPARATOR, KEY_SERVER, KEY_SOCKET_PORT, KEY_SOCKET_SERVER, KEY_SUPPRESSED_KEYS, KEY_THREAD_ID, KEY_TIME_FORMAT, KEY_TRACE_EVENT_CLASSES, KEY_TRACE_MASK, RAS_VERSION
-
-
Constructor Summary
Constructors Modifier Constructor and Description protectedRASManager(RASIDataStore store)Deprecated.Creates aRASManager.
-
Method Summary
Methods Modifier and Type Method and Description voidaddDataStore(RASIDataStore store)Deprecated.Adds aRASIDataStoreto this manager.protected voidaddFormatters(RASIHandler handler, RASConfig cfg, RASGroup group)Deprecated.Add formatters to a newly-created handler, according to the handler's configuration.protected voidaddHandlers(RASILogger logger, RASConfig cfg, RASGroup group)Deprecated.Add handlers to a logger, according to the logger's configuration.protected voidfinalize()Deprecated.Clean up resources in use before the garbage collector destroys this object.RASBaseGroupgetBaseGroup()Deprecated.Gets the entire RAS configuration.java.util.EnumerationgetDataStores()Deprecated.Gets the data store objects in use by this manager.RASIFormattergetFormatter(java.lang.String name)Deprecated.Gets a formatter from the base group.RASIFormattergetFormatter(java.lang.String name, RASGroup group)Deprecated.Gets a formatter from a group.RASIFormattergetFormatter(java.lang.String name, java.lang.String groupName)Deprecated.Gets a formatter from the named group.RASIHandlergetHandler(java.lang.String name)Deprecated.Gets a handler from the base group.RASIHandlergetHandler(java.lang.String name, RASGroup group)Deprecated.Gets a handler from a group.RASIHandlergetHandler(java.lang.String name, java.lang.String groupName)Deprecated.Gets a handler from the named group.static RASManagergetManager()Deprecated.Gets theRASManager.static RASManagergetManager(RASIDataStore store)Deprecated.Gets theRASManager.RASIMessageLoggergetMessageLogger(java.lang.String name)Deprecated.Gets a message logger from the base group.RASIMessageLoggergetMessageLogger(java.lang.String name, RASGroup group)Deprecated.Gets a message logger from a group.RASIMessageLoggergetMessageLogger(java.lang.String name, java.lang.String groupName)Deprecated.Gets a message logger from the named group.protected RASObjectgetObject(RASConfig cfg)Deprecated.Gets aRASObjectfrom its configuration.RASITraceLoggergetTraceLogger(java.lang.String name)Deprecated.Gets a trace logger from the base group.RASITraceLoggergetTraceLogger(java.lang.String name, RASGroup group)Deprecated.Gets a trace logger from a group.RASITraceLoggergetTraceLogger(java.lang.String name, java.lang.String groupName)Deprecated.Gets a trace logger from the named group.voidremoveDataStore(RASIDataStore store)Deprecated.Removes aRASIDataStorefrom this manager.protected voidremoveFormatters(RASIHandler handler, RASGroup group)Deprecated.Removes formatters from a handler.protected voidremoveHandlers(RASILogger logger, RASGroup group)Deprecated.Removes handlers from a logger.voidrestoreConfig()Deprecated.Restores theRASManagerconfiguration from persistent storage.voidreturnFormatter(RASIFormatter formatter)Deprecated.Returns a formatter to its group.voidreturnFormatter(RASIFormatter formatter, RASGroup group)Deprecated.Returns a formatter to a group.voidreturnFormatter(RASIFormatter formatter, java.lang.String groupName)Deprecated.Returns a formatter to the named group.voidreturnHandler(RASIHandler handler)Deprecated.Returns a handler to its group.voidreturnHandler(RASIHandler handler, RASGroup group)Deprecated.Returns a handler to a group.voidreturnHandler(RASIHandler handler, java.lang.String groupName)Deprecated.Returns a handler to the named group.voidreturnMessageLogger(RASIMessageLogger logger)Deprecated.Returns a message logger to its group.voidreturnMessageLogger(RASIMessageLogger logger, RASGroup group)Deprecated.Returns a message logger to a group.voidreturnMessageLogger(RASIMessageLogger logger, java.lang.String groupName)Deprecated.Returns a message logger to the named group.voidreturnTraceLogger(RASITraceLogger logger)Deprecated.Returns a trace logger to its group.voidreturnTraceLogger(RASITraceLogger logger, RASGroup group)Deprecated.Returns a trace logger to a group.voidreturnTraceLogger(RASITraceLogger logger, java.lang.String groupName)Deprecated.Returns a trace logger to the named group.voidsaveConfig()Deprecated.Saves theRASManagerconfiguration to persistent storage.voidsetBaseGroup(RASBaseGroup baseGroup)Deprecated.Sets the entire RAS configuration.
-
-
-
Field Detail
-
dsLock
protected static final java.lang.Object dsLock
Deprecated.An object on which the manager can synchronize for data store operations.
-
getMgrLock
protected static final java.lang.Object getMgrLock
Deprecated.An object on which the manager can synchronize when getting the manager.
-
getObjLock
protected static final java.lang.Object getObjLock
Deprecated.An object on which the manager can synchronize when getting a RAS object such as a logger.
-
-
Constructor Detail
-
RASManager
protected RASManager(RASIDataStore store)
Deprecated.Creates aRASManager. This method is protected to force applications to use the factory methodgetManager.- Parameters:
store- An object which implements theRASIDataStoreinterface.
-
-
Method Detail
-
getManager
public static RASManager getManager()
Deprecated.Gets theRASManager. If the RAS Manager has already been created through a previous call togetManager, that manager is returned. Otherwise, a new manager is created and returned.A manager created with this method has no data store from which it can read a configuration. The
addDataStoremethod can be used to add a data store to an existing manager.- Returns:
- The RAS manager.
-
getManager
public static RASManager getManager(RASIDataStore store)
Deprecated.Gets theRASManager. If the RAS Manager has already been created through a previous call togetManager, that manager is returned. Otherwise, a new manager is created and returned.- Parameters:
store- An object which implements theRASIDataStoreinterface.- Returns:
- The RAS manager.
-
addDataStore
public void addDataStore(RASIDataStore store)
Deprecated.Adds aRASIDataStoreto this manager. After adding a data store, userestoreConfigto restore the configuration from the data store.Only one data store is supported in this implementation. A new data store replaces the current store.
- Specified by:
addDataStorein interfaceRASIManager- Parameters:
store- An object which implements theRASIDataStoreinterface.
-
removeDataStore
public void removeDataStore(RASIDataStore store)
Deprecated.Removes aRASIDataStorefrom this manager.Only one data store is supported in this implementation. If the requested store is in use, it is removed. Otherwise, nothing is changed.
- Specified by:
removeDataStorein interfaceRASIManager- Parameters:
store- An object which implements theRASIDataStoreinterface.
-
getDataStores
public java.util.Enumeration getDataStores()
Deprecated.Gets the data store objects in use by this manager.Only one data store is supported in this implementation. It is returned in a
Vector(to support future enhancements).- Specified by:
getDataStoresin interfaceRASIManager- Returns:
- An
Enumerationof data stores.
-
restoreConfig
public void restoreConfig() throws RASIOExceptionDeprecated.Restores theRASManagerconfiguration from persistent storage. If the RAS Manager has not been given aRASIDataStoreto use, this method does nothing.- Specified by:
restoreConfigin interfaceRASIManager- Throws:
RASIOException
-
saveConfig
public void saveConfig() throws RASIOExceptionDeprecated.Saves theRASManagerconfiguration to persistent storage. If the RAS Manager has not been given aRASIDataStoreto use, this method does nothing.- Specified by:
saveConfigin interfaceRASIManager- Throws:
RASIOException
-
getMessageLogger
public RASIMessageLogger getMessageLogger(java.lang.String name)
Deprecated.Gets a message logger from the base group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getMessageLoggerin interfaceRASIManager- Parameters:
name- The name of the message logger.- Returns:
- A message logger or
nullif the requested logger was not found.
-
getMessageLogger
public RASIMessageLogger getMessageLogger(java.lang.String name, java.lang.String groupName)
Deprecated.Gets a message logger from the named group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getMessageLoggerin interfaceRASIManager- Parameters:
name- The name of the message logger.groupName- The name of theRASGroup.- Returns:
- A message logger or
nullif the requested logger was not found.
-
getMessageLogger
public RASIMessageLogger getMessageLogger(java.lang.String name, RASGroup group)
Deprecated.Gets a message logger from a group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getMessageLoggerin interfaceRASIManager- Parameters:
name- The name of the message logger.group- TheRASGroup.- Returns:
- A message logger or
nullif the requested logger was not found.
-
returnMessageLogger
public void returnMessageLogger(RASIMessageLogger logger)
Deprecated.Returns a message logger to its group. The logger is queried to determine the group with which it is associated. If the logger isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnMessageLoggerin interfaceRASIManager- Parameters:
logger- The logger being returned.
-
returnMessageLogger
public void returnMessageLogger(RASIMessageLogger logger, java.lang.String groupName)
Deprecated.Returns a message logger to the named group. If the logger or group name isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnMessageLoggerin interfaceRASIManager- Parameters:
logger- The logger being returned.groupName- The name of theRASGroup.
-
returnMessageLogger
public void returnMessageLogger(RASIMessageLogger logger, RASGroup group)
Deprecated.Returns a message logger to a group. If the logger or group isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnMessageLoggerin interfaceRASIManager- Parameters:
logger- The logger being returned.group- TheRASGroup.
-
getTraceLogger
public RASITraceLogger getTraceLogger(java.lang.String name)
Deprecated.Gets a trace logger from the base group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getTraceLoggerin interfaceRASIManager- Parameters:
name- The name of the trace logger.- Returns:
- A trace logger or
nullif the requested logger was not found.
-
getTraceLogger
public RASITraceLogger getTraceLogger(java.lang.String name, java.lang.String groupName)
Deprecated.Gets a trace logger from the named group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getTraceLoggerin interfaceRASIManager- Parameters:
name- The name of the trace logger.groupName- The name of theRASGroup.- Returns:
- A trace logger or
nullif the requested logger was not found.
-
getTraceLogger
public RASITraceLogger getTraceLogger(java.lang.String name, RASGroup group)
Deprecated.Gets a trace logger from a group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getTraceLoggerin interfaceRASIManager- Parameters:
name- The name of the trace logger.group- TheRASGroup.- Returns:
- A trace logger or
nullif the requested logger was not found.
-
returnTraceLogger
public void returnTraceLogger(RASITraceLogger logger)
Deprecated.Returns a trace logger to its group. The logger is queried to determine the group with which it is associated. If the logger isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnTraceLoggerin interfaceRASIManager- Parameters:
logger- The logger being returned.
-
returnTraceLogger
public void returnTraceLogger(RASITraceLogger logger, java.lang.String groupName)
Deprecated.Returns a trace logger to the named group. If the logger or group name isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnTraceLoggerin interfaceRASIManager- Parameters:
logger- The logger being returned.groupName- The name of theRASGroup.
-
returnTraceLogger
public void returnTraceLogger(RASITraceLogger logger, RASGroup group)
Deprecated.Returns a trace logger to a group. If the logger or group isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnTraceLoggerin interfaceRASIManager- Parameters:
logger- The logger being returned.group- TheRASGroup.
-
getHandler
public RASIHandler getHandler(java.lang.String name)
Deprecated.Gets a handler from the base group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getHandlerin interfaceRASIManager- Parameters:
name- The name of the handler.- Returns:
- A handler or
nullif the requested handler was not found.
-
getHandler
public RASIHandler getHandler(java.lang.String name, java.lang.String groupName)
Deprecated.Gets a handler from the named group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getHandlerin interfaceRASIManager- Parameters:
name- The name of the handler.groupName- The name of theRASGroup.- Returns:
- A handler or
nullif the requested handler was not found.
-
getHandler
public RASIHandler getHandler(java.lang.String name, RASGroup group)
Deprecated.Gets a handler from a group.If the logger configuration includes handlers, they will automatically be attached to the logger. It should not be necessary for an application to use the
getHandlermethod.- Specified by:
getHandlerin interfaceRASIManager- Parameters:
name- The name of the handler.group- TheRASGroup.- Returns:
- A handler or
nullif the requested handler was not found.
-
returnHandler
public void returnHandler(RASIHandler handler)
Deprecated.Returns a handler to its group. The handler is queried to determine the group with which it is associated. If the handler isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnHandlerin interfaceRASIManager- Parameters:
handler- The handler being returned.
-
returnHandler
public void returnHandler(RASIHandler handler, java.lang.String groupName)
Deprecated.Returns a handler to the named group. If the handler or group name isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnHandlerin interfaceRASIManager- Parameters:
handler- The handler being returned.groupName- The name of theRASGroup.
-
returnHandler
public void returnHandler(RASIHandler handler, RASGroup group)
Deprecated.Returns a handler to a group. If the handler or group isnull, this method does nothing.If the logger configuration includes handlers, they will automatically be detached from the logger. It should not be necessary for an application to use the
returnHandlermethod.- Specified by:
returnHandlerin interfaceRASIManager- Parameters:
handler- The handler being returned.group- TheRASGroup.
-
getFormatter
public RASIFormatter getFormatter(java.lang.String name)
Deprecated.Gets a formatter from the base group.If the handler configuration includes formatters, they will automatically be attached to the handler. It should not be necessary for an application to use the
getFormattermethod.- Specified by:
getFormatterin interfaceRASIManager- Parameters:
name- The name of the formatter.- Returns:
- A formatter or
nullif the requested formatter was not found.
-
getFormatter
public RASIFormatter getFormatter(java.lang.String name, java.lang.String groupName)
Deprecated.Gets a formatter from the named group.If the handler configuration includes formatters, they will automatically be attached to the handler. It should not be necessary for an application to use the
getFormattermethod.- Specified by:
getFormatterin interfaceRASIManager- Parameters:
name- The name of the formatter.groupName- The name of theRASGroup.- Returns:
- A formatter or
nullif the requested formatter was not found.
-
getFormatter
public RASIFormatter getFormatter(java.lang.String name, RASGroup group)
Deprecated.Gets a formatter from a group.If the handler configuration includes formatters, they will automatically be attached to the handler. It should not be necessary for an application to use the
getFormattermethod.- Specified by:
getFormatterin interfaceRASIManager- Parameters:
name- The name of the formatter.group- TheRASGroup.- Returns:
- A formatter or
nullif the requested formatter was not found.
-
returnFormatter
public void returnFormatter(RASIFormatter formatter)
Deprecated.Returns a formatter to its group. The formatter is queried to determine the group with which it is associated. If the formatter isnull, this method does nothing.If the handler configuration includes formatters, they will automatically be detached from the handler. It should not be necessary for an application to use the
returnFormattermethod.- Specified by:
returnFormatterin interfaceRASIManager- Parameters:
formatter- The formatter being returned.
-
returnFormatter
public void returnFormatter(RASIFormatter formatter, java.lang.String groupName)
Deprecated.Returns a formatter to the named group. If the formatter or group name isnull, this method does nothing.If the handler configuration includes formatters, they will automatically be detached from the handler. It should not be necessary for an application to use the
returnFormattermethod.- Specified by:
returnFormatterin interfaceRASIManager- Parameters:
formatter- The formatter being returned.groupName- The name of theRASGroup.
-
returnFormatter
public void returnFormatter(RASIFormatter formatter, RASGroup group)
Deprecated.Returns a formatter to a group. If the formatter or group isnull, this method does nothing.If the handler configuration includes formatters, they will automatically be detached from the handler. It should not be necessary for an application to use the
returnFormattermethod.- Specified by:
returnFormatterin interfaceRASIManager- Parameters:
formatter- The formatter being returned.group- TheRASGroup.
-
getBaseGroup
public RASBaseGroup getBaseGroup()
Deprecated.Gets the entire RAS configuration.- Specified by:
getBaseGroupin interfaceRASIManager- Returns:
- The base RAS group containing the entire configuration.
-
setBaseGroup
public void setBaseGroup(RASBaseGroup baseGroup)
Deprecated.Sets the entire RAS configuration.- Specified by:
setBaseGroupin interfaceRASIManager- Parameters:
baseGroup- The base RAS group containing the entire configuration.
-
getObject
protected RASObject getObject(RASConfig cfg)
Deprecated.Gets aRASObjectfrom its configuration. If the object has been created already, it is returned. If not, a new object is instantiated and returned.- Parameters:
cfg- The configuration of the object.- Returns:
- A RAS object or
nullif the requested object was not found.
-
addHandlers
protected void addHandlers(RASILogger logger, RASConfig cfg, RASGroup group)
Deprecated.Add handlers to a logger, according to the logger's configuration. This method will compare any handler's already attached to the logger with the current configuration and add or remove handlers as required to match the configuration.- Parameters:
logger- The RAS logger.cfg- The RAS logger configuration.group- TheRASGroupin which the logger configuration was found.
-
removeHandlers
protected void removeHandlers(RASILogger logger, RASGroup group)
Deprecated.Removes handlers from a logger.- Parameters:
logger- The RAS logger.group- TheRASGroupin which the logger configuration was found.
-
addFormatters
protected void addFormatters(RASIHandler handler, RASConfig cfg, RASGroup group)
Deprecated.Add formatters to a newly-created handler, according to the handler's configuration.- Parameters:
handler- The RAS handler.cfg- The RAS handler configuration.group- TheRASGroupin which the handler configuration was found.
-
removeFormatters
protected void removeFormatters(RASIHandler handler, RASGroup group)
Deprecated.Removes formatters from a handler.- Parameters:
handler- The RAS handler.group- TheRASGroupin which the handler configuration was found.
-
finalize
protected void finalize() throws java.lang.ThrowableDeprecated.Clean up resources in use before the garbage collector destroys this object.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-