Package gov.usgs.earthquake.distribution
Class ProductClient
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.distribution.ProductClient
- All Implemented Interfaces:
Bootstrappable
,ProductClientMBean
,Configurable
public class ProductClient
extends DefaultConfigurable
implements ProductClientMBean, Bootstrappable
The entry point to product distribution.
The ProductClient implements the Configurable interface and can use the
following configuration parameters:
- receivers
- (Required) A comma separated list of section names that should be loaded as NotificationReceiver objects. Each receiver is a source of notifications for listeners.
- listeners
- (Required) A comma separated list of section names that should be loaded as NotificationListener objects. Each listener receives notifications from receivers.
- logdirectory
- (Optional) Log directory. Default is "log", relative to the current
working directory. Log files using a naming convention
ProductClient_YYYYMMDD.log
. - loglevel
- (Optional) Default is INFO. One of SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST
- redirectconsole
- (Optional) Default is false. Whether or not to redirect console output to the log file.
All listeners listen to all receivers for notifications.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Run the builder.static final String
Whether or not to redirect stdout and stderr to log file.static final String
Default console redirect value (don't redirect).static final String
Default bool for admin socket propertystatic final String
Default directory for logging.static final String
Default log level is INFO.static final String
Property used to enable Admin Socketstatic final String
Property containing list of senders.static final String
Property with location for log directory.static final String
Log level property name.static final String
Property name used on products for current RELEASE_VERSION.static final String
Run the client.static final String
Property containing list of receivers.static final String
The "release" version number.static final String
Run the search.static final String
Run the builder.static final String
SVN LastChangedDate property.static final String
SVN Revision property.static final String
SVN Id property.static final String
Show usage.Fields inherited from interface gov.usgs.earthquake.distribution.Bootstrappable
RUN_EXCEPTION_EXIT_CODE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Process configuration settings.long
long
static String
getUsage()
void
loadListeners
(Config config) Load listeners from a Config object.void
loadReceivers
(Config config) Load NotificationReceivers from a Config object.void
Entry point into Product Distribution.void
shutdown()
Shut down all receivers and listeners.void
startup()
Start up all listeners and receivers.Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
Field Details
-
RELEASE_VERSION
The "release" version number.- See Also:
-
PDL_CLIENT_VERSION_PROPERTY
Property name used on products for current RELEASE_VERSION.- See Also:
-
SVN_VERSION
SVN Id property.- See Also:
-
SVN_REVISION
SVN Revision property.- See Also:
-
SVN_LAST_CHANGED_DATE
SVN LastChangedDate property.- See Also:
-
BUILD_ARGUMENT
Run the builder.- See Also:
-
SEND_ARGUMENT
Run the builder.- See Also:
-
RECEIVE_ARGUMENT
Run the client.- See Also:
-
SEARCH_ARGUMENT
Run the search.- See Also:
-
USAGE_ARGUMENT
Show usage.- See Also:
-
RECEIVERS_PROPERTY_NAME
Property containing list of receivers.- See Also:
-
LISTENERS_PROPERTY_NAME
Property containing list of senders.- See Also:
-
LOGLEVEL_PROPERTY_NAME
Log level property name.- See Also:
-
DEFAULT_LOGLEVEL
Default log level is INFO.- See Also:
-
LOGDIRECTORY_PROPERTY_NAME
Property with location for log directory.- See Also:
-
DEFAULT_LOGDIRECTORY
Default directory for logging.- See Also:
-
CONSOLE_REDIRECT_PROPERTY_NAME
Whether or not to redirect stdout and stderr to log file.- See Also:
-
DEFAULT_CONSOLE_REDIRECT
Default console redirect value (don't redirect).- See Also:
-
ENABLE_ADMIN_SOCKET
Property used to enable Admin Socket- See Also:
-
DEFAULT_ENABLE_ADMIN_SOCKET
Default bool for admin socket property- See Also:
-
-
Constructor Details
-
ProductClient
public ProductClient()
-
-
Method Details
-
configure
Description copied from class:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultConfigurable
- Parameters:
config
- the Config object with settings.- Throws:
Exception
- if configuration exceptions occur.
-
loadListeners
Load listeners from a Config object.- Parameters:
config
- the configuration.- Throws:
Exception
- if error occurs
-
loadReceivers
Load NotificationReceivers from a Config object.- Parameters:
config
- the configuration- Throws:
Exception
- if error occurs
-
startup
Start up all listeners and receivers.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultConfigurable
- Throws:
Exception
- if exceptions occur while starting.
-
shutdown
Shut down all receivers and listeners.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classDefaultConfigurable
- Throws:
Exception
- if exceptions occur while starting.
-
run
Entry point into Product Distribution.- Specified by:
run
in interfaceBootstrappable
- Parameters:
args
- argument- Throws:
Exception
- Exception
-
getReceivers
- Returns:
- The list of receivers
-
getListeners
- Returns:
- The list of listeners
-
getUsage
- Returns:
- Product usage
-
getListenerQueueStatus
- Specified by:
getListenerQueueStatus
in interfaceProductClientMBean
- Returns:
- A string describing the current listener queues.
-
getVersion
- Specified by:
getVersion
in interfaceProductClientMBean
- Returns:
- client version
-
getMaxMemory
public long getMaxMemory()- Specified by:
getMaxMemory
in interfaceProductClientMBean
- Returns:
- maximum amount of memory
-
getFreeMemory
public long getFreeMemory()- Specified by:
getFreeMemory
in interfaceProductClientMBean
- Returns:
- amount of free memory
-