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 StringRun the builder.static final StringWhether or not to redirect stdout and stderr to log file.static final StringDefault console redirect value (don't redirect).static final StringDefault bool for admin socket propertystatic final StringDefault directory for logging.static final StringDefault log level is INFO.static final StringProperty used to enable Admin Socketstatic final StringProperty containing list of senders.static final StringProperty with location for log directory.static final StringLog level property name.static final StringProperty name used on products for current RELEASE_VERSION.static final StringRun the client.static final StringProperty containing list of receivers.static final StringThe "release" version number.static final StringRun the search.static final StringRun the builder.static final StringSVN LastChangedDate property.static final StringSVN Revision property.static final StringSVN Id property.static final StringShow usage.Fields inherited from interface gov.usgs.earthquake.distribution.Bootstrappable
RUN_EXCEPTION_EXIT_CODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidProcess configuration settings.longlongstatic StringgetUsage()voidloadListeners(Config config) Load listeners from a Config object.voidloadReceivers(Config config) Load NotificationReceivers from a Config object.voidEntry 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 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:DefaultConfigurableProcess configuration settings. Called before startup().- Specified by:
configurein interfaceConfigurable- Overrides:
configurein 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:
startupin interfaceConfigurable- Overrides:
startupin classDefaultConfigurable- Throws:
Exception- if exceptions occur while starting.
-
shutdown
Shut down all receivers and listeners.- Specified by:
shutdownin interfaceConfigurable- Overrides:
shutdownin classDefaultConfigurable- Throws:
Exception- if exceptions occur while starting.
-
run
Entry point into Product Distribution.- Specified by:
runin 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:
getListenerQueueStatusin interfaceProductClientMBean- Returns:
- A string describing the current listener queues.
-
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
-