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
- enableTracker
- (Optional) Default is false. Whether or not to send tracker updates to a product tracker. This is generally desirable, but is disabled by default for the paranoid.
- 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
Fields Modifier and Type Field Description static java.lang.String
BUILD_ARGUMENT
Run the builder.static java.lang.String
CONFIG_FILE_ARGUMENT
Custom config file locations.static java.lang.String
CONSOLE_REDIRECT_PROPERTY_NAME
Whether or not to redirect stdout and stderr to log file.static java.lang.String
DEFAULT_CONFIG_FILE
Default location of config file.static java.lang.String
DEFAULT_CONSOLE_REDIRECT
Default console redirect value (don't redirect).static java.lang.String
DEFAULT_ENABLE_ADMIN_SOCKET
Default bool for admin socket propertystatic java.lang.String
DEFAULT_LOGDIRECTORY
Default directory for logging.static java.lang.String
DEFAULT_LOGFILE
Default location for log file.static java.lang.String
DEFAULT_LOGLEVEL
Default log level is INFO.static java.lang.String
ENABLE_ADMIN_SOCKET
Property used to enable Admin Socketstatic java.lang.String
ENABLE_TRACKER_PROPERTY_NAME
Property used to disable tracker updates.static java.lang.String
JAR_CONFIG_FILE
Defaults are loaded from inside the jar file.static java.lang.String
LISTENERS_PROPERTY_NAME
Property containing list of senders.static java.lang.String
LOGDIRECTORY_PROPERTY_NAME
Property with location for log directory.static java.lang.String
LOGLEVEL_PROPERTY_NAME
Log level property name.static java.lang.String
PDL_CLIENT_VERSION_PROPERTY
Property name used on products for current RELEASE_VERSION.static java.lang.String
RECEIVE_ARGUMENT
Run the client.static java.lang.String
RECEIVERS_PROPERTY_NAME
Property containing list of receivers.static java.lang.String
RELEASE_VERSION
The "release" version number.static java.lang.String
SEARCH_ARGUMENT
Run the search.static java.lang.String
SEND_ARGUMENT
Run the builder.static java.lang.String
SVN_LAST_CHANGED_DATE
SVN LastChangedDate property.static java.lang.String
SVN_REVISION
SVN Revision property.static java.lang.String
SVN_VERSION
SVN Id property.static java.lang.String
TRACK_ARGUMENT
Run the tracker.static java.lang.String
USAGE_ARGUMENT
Show usage.-
Fields inherited from interface gov.usgs.earthquake.distribution.Bootstrappable
RUN_EXCEPTION_EXIT_CODE
-
-
Constructor Summary
Constructors Constructor Description ProductClient()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Config config)
Process configuration settings.long
getFreeMemory()
java.lang.String
getListenerQueueStatus()
java.util.List<NotificationListener>
getListeners()
long
getMaxMemory()
java.util.List<NotificationReceiver>
getReceivers()
static java.lang.String
getUsage()
java.lang.String
getVersion()
void
loadListeners(Config config)
Load listeners from a Config object.void
loadReceivers(Config config)
Load NotificationReceivers from a Config object.void
run(java.lang.String[] args)
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 Detail
-
RELEASE_VERSION
public static final java.lang.String RELEASE_VERSION
The "release" version number.- See Also:
- Constant Field Values
-
PDL_CLIENT_VERSION_PROPERTY
public static final java.lang.String PDL_CLIENT_VERSION_PROPERTY
Property name used on products for current RELEASE_VERSION.- See Also:
- Constant Field Values
-
SVN_VERSION
public static final java.lang.String SVN_VERSION
SVN Id property.- See Also:
- Constant Field Values
-
SVN_REVISION
public static final java.lang.String SVN_REVISION
SVN Revision property.- See Also:
- Constant Field Values
-
SVN_LAST_CHANGED_DATE
public static final java.lang.String SVN_LAST_CHANGED_DATE
SVN LastChangedDate property.- See Also:
- Constant Field Values
-
JAR_CONFIG_FILE
public static final java.lang.String JAR_CONFIG_FILE
Defaults are loaded from inside the jar file.- See Also:
- Constant Field Values
-
DEFAULT_CONFIG_FILE
public static final java.lang.String DEFAULT_CONFIG_FILE
Default location of config file.- See Also:
- Constant Field Values
-
CONFIG_FILE_ARGUMENT
public static final java.lang.String CONFIG_FILE_ARGUMENT
Custom config file locations.- See Also:
- Constant Field Values
-
BUILD_ARGUMENT
public static final java.lang.String BUILD_ARGUMENT
Run the builder.- See Also:
- Constant Field Values
-
TRACK_ARGUMENT
public static final java.lang.String TRACK_ARGUMENT
Run the tracker.- See Also:
- Constant Field Values
-
SEND_ARGUMENT
public static final java.lang.String SEND_ARGUMENT
Run the builder.- See Also:
- Constant Field Values
-
RECEIVE_ARGUMENT
public static final java.lang.String RECEIVE_ARGUMENT
Run the client.- See Also:
- Constant Field Values
-
SEARCH_ARGUMENT
public static final java.lang.String SEARCH_ARGUMENT
Run the search.- See Also:
- Constant Field Values
-
USAGE_ARGUMENT
public static final java.lang.String USAGE_ARGUMENT
Show usage.- See Also:
- Constant Field Values
-
RECEIVERS_PROPERTY_NAME
public static final java.lang.String RECEIVERS_PROPERTY_NAME
Property containing list of receivers.- See Also:
- Constant Field Values
-
LISTENERS_PROPERTY_NAME
public static final java.lang.String LISTENERS_PROPERTY_NAME
Property containing list of senders.- See Also:
- Constant Field Values
-
LOGLEVEL_PROPERTY_NAME
public static final java.lang.String LOGLEVEL_PROPERTY_NAME
Log level property name.- See Also:
- Constant Field Values
-
DEFAULT_LOGLEVEL
public static final java.lang.String DEFAULT_LOGLEVEL
Default log level is INFO.- See Also:
- Constant Field Values
-
LOGDIRECTORY_PROPERTY_NAME
public static final java.lang.String LOGDIRECTORY_PROPERTY_NAME
Property with location for log directory.- See Also:
- Constant Field Values
-
DEFAULT_LOGDIRECTORY
public static final java.lang.String DEFAULT_LOGDIRECTORY
Default directory for logging.- See Also:
- Constant Field Values
-
DEFAULT_LOGFILE
public static final java.lang.String DEFAULT_LOGFILE
Default location for log file.- See Also:
- Constant Field Values
-
CONSOLE_REDIRECT_PROPERTY_NAME
public static final java.lang.String CONSOLE_REDIRECT_PROPERTY_NAME
Whether or not to redirect stdout and stderr to log file.- See Also:
- Constant Field Values
-
DEFAULT_CONSOLE_REDIRECT
public static final java.lang.String DEFAULT_CONSOLE_REDIRECT
Default console redirect value (don't redirect).- See Also:
- Constant Field Values
-
ENABLE_TRACKER_PROPERTY_NAME
public static final java.lang.String ENABLE_TRACKER_PROPERTY_NAME
Property used to disable tracker updates.- See Also:
- Constant Field Values
-
ENABLE_ADMIN_SOCKET
public static final java.lang.String ENABLE_ADMIN_SOCKET
Property used to enable Admin Socket- See Also:
- Constant Field Values
-
DEFAULT_ENABLE_ADMIN_SOCKET
public static final java.lang.String DEFAULT_ENABLE_ADMIN_SOCKET
Default bool for admin socket property- See Also:
- Constant Field Values
-
-
Method Detail
-
configure
public void configure(Config config) throws java.lang.Exception
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:
java.lang.Exception
- if configuration exceptions occur.
-
loadListeners
public void loadListeners(Config config) throws java.lang.Exception
Load listeners from a Config object.- Parameters:
config
- the configuration.- Throws:
java.lang.Exception
- if error occurs
-
loadReceivers
public void loadReceivers(Config config) throws java.lang.Exception
Load NotificationReceivers from a Config object.- Parameters:
config
- the configuration- Throws:
java.lang.Exception
- if error occurs
-
startup
public void startup() throws java.lang.Exception
Start up all listeners and receivers.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultConfigurable
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
shutdown
public void shutdown() throws java.lang.Exception
Shut down all receivers and listeners.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classDefaultConfigurable
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
run
public void run(java.lang.String[] args) throws java.lang.Exception
Entry point into Product Distribution.- Specified by:
run
in interfaceBootstrappable
- Parameters:
args
- argument- Throws:
java.lang.Exception
- Exception
-
getReceivers
public java.util.List<NotificationReceiver> getReceivers()
- Returns:
- The list of receivers
-
getListeners
public java.util.List<NotificationListener> getListeners()
- Returns:
- The list of listeners
-
getUsage
public static java.lang.String getUsage()
- Returns:
- Product usage
-
getListenerQueueStatus
public java.lang.String getListenerQueueStatus()
- Specified by:
getListenerQueueStatus
in interfaceProductClientMBean
- Returns:
- A string describing the current listener queues.
-
getVersion
public java.lang.String 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
-
-