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.StringBUILD_ARGUMENTRun the builder.static java.lang.StringCONFIG_FILE_ARGUMENTCustom config file locations.static java.lang.StringCONSOLE_REDIRECT_PROPERTY_NAMEWhether or not to redirect stdout and stderr to log file.static java.lang.StringDEFAULT_CONFIG_FILEDefault location of config file.static java.lang.StringDEFAULT_CONSOLE_REDIRECTDefault console redirect value (don't redirect).static java.lang.StringDEFAULT_ENABLE_ADMIN_SOCKETDefault bool for admin socket propertystatic java.lang.StringDEFAULT_LOGDIRECTORYDefault directory for logging.static java.lang.StringDEFAULT_LOGFILEDefault location for log file.static java.lang.StringDEFAULT_LOGLEVELDefault log level is INFO.static java.lang.StringENABLE_ADMIN_SOCKETProperty used to enable Admin Socketstatic java.lang.StringENABLE_TRACKER_PROPERTY_NAMEProperty used to disable tracker updates.static java.lang.StringJAR_CONFIG_FILEDefaults are loaded from inside the jar file.static java.lang.StringLISTENERS_PROPERTY_NAMEProperty containing list of senders.static java.lang.StringLOGDIRECTORY_PROPERTY_NAMEProperty with location for log directory.static java.lang.StringLOGLEVEL_PROPERTY_NAMELog level property name.static java.lang.StringPDL_CLIENT_VERSION_PROPERTYProperty name used on products for current RELEASE_VERSION.static java.lang.StringRECEIVE_ARGUMENTRun the client.static java.lang.StringRECEIVERS_PROPERTY_NAMEProperty containing list of receivers.static java.lang.StringRELEASE_VERSIONThe "release" version number.static java.lang.StringSEARCH_ARGUMENTRun the search.static java.lang.StringSEND_ARGUMENTRun the builder.static java.lang.StringSVN_LAST_CHANGED_DATESVN LastChangedDate property.static java.lang.StringSVN_REVISIONSVN Revision property.static java.lang.StringSVN_VERSIONSVN Id property.static java.lang.StringTRACK_ARGUMENTRun the tracker.static java.lang.StringUSAGE_ARGUMENTShow 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 voidconfigure(Config config)Process configuration settings.longgetFreeMemory()java.lang.StringgetListenerQueueStatus()java.util.List<NotificationListener>getListeners()longgetMaxMemory()java.util.List<NotificationReceiver>getReceivers()static java.lang.StringgetUsage()java.lang.StringgetVersion()voidloadListeners(Config config)Load listeners from a Config object.voidloadReceivers(Config config)Load NotificationReceivers from a Config object.voidrun(java.lang.String[] args)Entry point into Product Distribution.voidshutdown()Shut down all receivers and listeners.voidstartup()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:DefaultConfigurableProcess configuration settings. Called before startup().- Specified by:
configurein interfaceConfigurable- Overrides:
configurein 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.ExceptionStart up all listeners and receivers.- Specified by:
startupin interfaceConfigurable- Overrides:
startupin classDefaultConfigurable- Throws:
java.lang.Exception- if exceptions occur while starting.
-
shutdown
public void shutdown() throws java.lang.ExceptionShut down all receivers and listeners.- Specified by:
shutdownin interfaceConfigurable- Overrides:
shutdownin classDefaultConfigurable- Throws:
java.lang.Exception- if exceptions occur while starting.
-
run
public void run(java.lang.String[] args) throws java.lang.ExceptionEntry point into Product Distribution.- Specified by:
runin 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:
getListenerQueueStatusin interfaceProductClientMBean- Returns:
- A string describing the current listener queues.
-
getVersion
public java.lang.String getVersion()
- Specified by:
getVersionin interfaceProductClientMBean- Returns:
- client version
-
getMaxMemory
public long getMaxMemory()
- Specified by:
getMaxMemoryin interfaceProductClientMBean- Returns:
- maximum amount of memory
-
getFreeMemory
public long getFreeMemory()
- Specified by:
getFreeMemoryin interfaceProductClientMBean- Returns:
- amount of free memory
-
-