Package gov.usgs.earthquake.eidsutil
Class CorbaSender
- java.lang.Object
-
- gov.usgs.earthquake.eidsutil.CorbaSender
-
public class CorbaSender extends java.lang.Object
ACorbaSender
is essentially a client-side wrapper for theQWFeeder
IDL file specified by ISTI. This class is designed to provide simplified CORBA interaction with a QWServer (EIDS) machine. All the varied methods of sending messages are provided, however they are wrapped into a single method, namely,sendMessage
. See the method documentation for details.- Since:
- 0.0.1
-
-
Constructor Summary
Constructors Constructor Description CorbaSender(java.lang.String host, java.lang.String port)
Initializes theCorbaSender
such that it is ready to send a message to the specifiedhost
over the specifiedport
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Cleanupprotected com.isti.quakewatch.server.qw_feeder.QWFeeder
getFeeder()
Retrieve a QWFeeder object associated with this CorbaSender.boolean
sendMessage(java.lang.String message)
Sends a data event message.boolean
sendMessage(java.lang.String message, java.lang.String feederSourceHost, long feederSrcHostMsgId)
Sends a data event message.boolean
sendMessage(java.lang.String domain, java.lang.String type, java.lang.String message)
Sends a data event message.boolean
sendMessage(java.lang.String domain, java.lang.String type, java.lang.String name, java.lang.String message)
Sends a data event message.boolean
sendMessage(java.lang.String domain, java.lang.String type, java.lang.String message, java.lang.String feederSourceHost, long feederSrcHostMsgId)
Sends a data event message.boolean
sendMessage(java.lang.String domain, java.lang.String type, java.lang.String name, java.lang.String message, java.lang.String feederSourceHost, long feederSrcHostMsgId)
Sends a data event message.
-
-
-
Constructor Detail
-
CorbaSender
public CorbaSender(java.lang.String host, java.lang.String port) throws org.omg.CORBA.ORBPackage.InvalidName, org.omg.PortableServer.POAManagerPackage.AdapterInactive
Initializes theCorbaSender
such that it is ready to send a message to the specifiedhost
over the specifiedport
. This uses theQWFeeder
idl specified by ISTI as the underlying feeder. After instantiating aCorbaSender
through this constructor, the instance is 100% ready to use. One downside is one cannot reuse that instance to send messages to another host; for such a feature one must instantiate a new object.- Parameters:
host
- The host machine (ip or cname) to which you want to send the messages using thisCorbaSender
.port
- The port number to send messages to on the host.- Throws:
org.omg.CORBA.ORBPackage.InvalidName
- If the RootPOA is not aware of the type of object we request from it.org.omg.PortableServer.POAManagerPackage.AdapterInactive
- If the poaManager is not active.
-
-
Method Detail
-
destroy
public void destroy()
Cleanup
-
getFeeder
protected com.isti.quakewatch.server.qw_feeder.QWFeeder getFeeder()
Retrieve a QWFeeder object associated with this CorbaSender. First checks if the object is "non_existent", and if so re-narrows the object.- Returns:
- QWFeeder object, or null if unable to narrow.
-
sendMessage
public boolean sendMessage(java.lang.String message)
Sends a data event message. If the event data does not begin with a “DataMessage” XML element then the data will be surrounded with one. The “sendSourced...” methods are preferred because the feeder-source host name and message number are used for improved message tracking.- Parameters:
message
- The data event message string.- Returns:
true
after the message has been successfully stored and processed;false
if an error occurred.
-
sendMessage
public boolean sendMessage(java.lang.String domain, java.lang.String type, java.lang.String message)
Sends a data event message. If the event data does not begin with a “DataMessage” XML element then the data will be surrounded with one. The “sendSourced...” methods are preferred because the feeder-source host name and message number are used for improved message tracking.- Parameters:
domain
- The domain name to use.type
- The type name to use.message
- The data event message string.- Returns:
true
after the message has been successfully stored and processed;false
if an error occurred.
-
sendMessage
public boolean sendMessage(java.lang.String domain, java.lang.String type, java.lang.String name, java.lang.String message)
Sends a data event message. If the event data does not begin with a “DataMessage” XML element then the data will be surrounded with one. The “sendSourced...” methods are preferred because the feeder-source host name and message number are used for improved message tracking.- Parameters:
domain
- The domain name to use.type
- The type name to use.name
- The event name to use.message
- The data event message string.- Returns:
true
after the message has been successfully stored and processed;false
if an error occurred.
-
sendMessage
public boolean sendMessage(java.lang.String message, java.lang.String feederSourceHost, long feederSrcHostMsgId)
Sends a data event message. If the event data does not begin with a “DataMessage” XML element then the data will be surrounded with one. The “sendSourced...” methods are preferred because the feeder-source host name and message number are used for improved message tracking.- Parameters:
message
- The data event message string.feederSourceHost
- The data-source host string for the message.feederSrcHostMsgId
- the message-ID number from the data source (positive value incremented after each message).- Returns:
true
after the message has been successfully stored and processed;false
if an error occurred.
-
sendMessage
public boolean sendMessage(java.lang.String domain, java.lang.String type, java.lang.String message, java.lang.String feederSourceHost, long feederSrcHostMsgId)
Sends a data event message. If the event data does not begin with a “DataMessage” XML element then the data will be surrounded with one. The “sendSourced...” methods are preferred because the feeder-source host name and message number are used for improved message tracking.- Parameters:
domain
- The domain name to use.type
- The type name to use.message
- The data event message string.feederSourceHost
- The data-source host string for the message.feederSrcHostMsgId
- The message-ID number from the data source (positive value incremented after each message).- Returns:
true
after the message has been successfully stored and processed;false
if an error occurred.
-
sendMessage
public boolean sendMessage(java.lang.String domain, java.lang.String type, java.lang.String name, java.lang.String message, java.lang.String feederSourceHost, long feederSrcHostMsgId)
Sends a data event message. If the event data does not begin with a “DataMessage” XML element then the data will be surrounded with one. The “sendSourced...” methods are preferred because the feeder-source host name and message number are used for improved message tracking.- Parameters:
domain
- The domain name to use.type
- The type name to use.name
- The event name to use.message
- The data event message string.feederSourceHost
- The data-source host string for the message.feederSrcHostMsgId
- The message-ID number from the data source (positive value incremented after each message).- Returns:
true
after the message has been successfully stored and processed;false
if an error occurred.
-
-