|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rbnb.sapi.Client
com.rbnb.sapi.PlugIn
public class PlugIn
A simple PlugIn for RBNB servers.
NOTE:
it is not recommended that this class be used directly. Instead consider
subclassing PlugInTemplate for a more streamlined
plug-in development.
This class is designed to present a simple interface for generating data to match requests.
A plug-in client has the following tasks:
PlugIn responds
with ChannelMap.Add(String) and Register(ChannelMap).
This step may be omitted, in which case all channels which request
from this PlugIn's name will be forwarded by the server.Fetch(long,PlugInChannelMap) requests from the RBNB server.
PlugInChannelMap will be filled with the channels requested
by the client, as well as the request mode and time range. These
can be determined using PlugInChannelMap.GetRequestStart(),
PlugInChannelMap.GetRequestDuration(), and PlugInChannelMap.GetRequestReference(). This last
method may return "regsitration", in which case the registered channels
should be returned, with any matching meta-data.
PutTime(). Push data into the map to
fullfill the
request using the PutData() methods.Flush(PlugInChannelMap) the
response to the server.
synchronize on the PlugIn object, as it can
Fetch and Flush simultaneously; however, a new
PlugInChannelMap object should be created before returning
to step 2.
| Constructor Summary | |
|---|---|
PlugIn()
Default constructor. |
|
| Method Summary | |
|---|---|
long |
BytesTransferred()
Reports the total number of bytes read and written by this Client. |
PlugInChannelMap |
Fetch(long blockTimeout)
Queries the server to see if any requests have been made of this PlugIn. |
PlugInChannelMap |
Fetch(long blockTimeout,
PlugInChannelMap picm)
Queries the server to see if any requests have been made of this PlugIn. |
int |
Flush(PlugInChannelMap ch)
Sends the pending channels to the server, as single-response (non-streaming). |
int |
Flush(PlugInChannelMap ch,
boolean doStream)
Deprecated. PlugIns no longer receive streaming requests directly, so it is no longer necessary to call this method with true. |
void |
Register(ChannelMap cm)
Tells the server which channels this PlugIn answers
to. |
void |
SetRingBuffer(int cache,
String mode,
int archive)
This operation is not supported in PlugIns. |
| Methods inherited from class com.rbnb.sapi.Client |
|---|
CloseRBNBConnection, CloseRBNBConnection, GetArchiveMode, GetArchiveSize, GetCacheSize, GetChannelList, GetChannelList, GetClientName, GetServerName, OpenRBNBConnection, OpenRBNBConnection, OpenRBNBConnection, VerifyConnection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PlugIn()
| Method Detail |
|---|
public long BytesTransferred()
Client
BytesTransferred in class Client
public final PlugInChannelMap Fetch(long blockTimeout,
PlugInChannelMap picm)
throws SAPIException
PutTime() is called internally on the ChannelMap
in this function with the
start and duration specified in the request. This may be
overridden with successive calls to PutTime().
picm - The ChannelMap object which is filled with the data received
from the server. If this parameter is null, a new ChannelMap is
created.blockTimeout - The amount of time (ms) to wait for data to become
available. Use 0 for no delay or any negative number for an
infinite delay.
PlugInChannelMap provided, or a newly created
one.
SAPIException - If there are problems obtaining data from
the server.PlugInChannelMap,
ChannelMap.PutTime(double,double)
public final PlugInChannelMap Fetch(long blockTimeout)
throws SAPIException
PlugInChannelMap object.
Calls Fetch(long,null).
SAPIExceptionFetch(long, PlugInChannelMap)
public int Flush(PlugInChannelMap ch,
boolean doStream)
throws SAPIException
Note: This version replaces the old doSynch
flag with the doStream flag. Synchronization was not recommended
for plug-ins, so this new function was substituted in its place.
Behavior for a false value of this flag is the same as before.
ch - The plugin channelmap to senddoStream - If true, does not wrap response with EOS (end of stream), i.e.
multi-part streaming response is being provided.
SAPIException - If there is an error while sending data to
the server.
public int Flush(PlugInChannelMap ch)
throws SAPIException
Flush(PlugInChannelMap,boolean)
with a false value for the streaming parameter.
SAPIException - If there is an error while sending data to the
server.Flush(PlugInChannelMap,boolean)
public void Register(ChannelMap cm)
throws SAPIException
PlugIn answers
to. If this method is omitted, the server will forward any
channel that identifies this PlugIn as its source.
For example, for a PlugIn called "MyPlugIn", if Register is called with a channel "MyChannel", only the channel "MyPlugIn/MyChannel" will be passed through. If Register is not called, any channel that begins with "MyPlugIn/" will be forwarded to the PlugIn.
Any data which is present in the ChannelMap
will be passed to the server as time-independent meta-data.
SAPIException - If there is an error while sending the map to
the server.
public void SetRingBuffer(int cache,
String mode,
int archive)
SetRingBuffer in class ClientUnsupportedOperationException - Not supported.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||