|
||||||||||
| 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.Source
public class Source
A simple data source for RBNB servers. This class is designed to present a simple interface for sourcing data to RBNB servers, via the RMap API.
A data source client has the following tasks:
ChannelMap object.ChannelMap.Add(java.lang.String).
ChannelMap.PutTime(double,double) or
ChannelMap.PutTimeAuto(java.lang.String).ChannelMap.PutData(int,byte[],int).Flush(ChannelMap) data to RBNB server. Steps 2 - 4 may be repeated as desired. Also note that the time may be set for the entire frame, that is only once per Flush() before any calls to PutData(); for each channel, that is once per PutData(); or for individual data blocks, where PutTime & PutData() are called multiple times per frame on the same channel.
Use Register(ChannelMap) to publicize channels in advance of
sending them to the RBNB server.
Note: Multi-channel ChannelMaps must remain consistent (same number and names) from one flush to another for the life of the data source. This is because consistent sets of channels are written to unique ring-buffers in the server, which for efficiency are restricted to contain a consistent set of channels across all frames stored in each such ring-buffer.
| Constructor Summary | |
|---|---|
Source()
Default constructor. |
|
Source(int cacheSize,
String archiveMode,
int archiveSize)
A convenience constructor which initializes values for the cache size, archive mode, and archive size. |
|
| Method Summary | |
|---|---|
long |
BytesTransferred()
Reports the total number of bytes read and written by this Client. |
void |
ClearCache()
Flushes any data currently in the Ring Buffer cache into the disk archive. |
ChannelMap |
Delete(ChannelMap toDelete)
Calls Delete(ChannelMap, ChannelMap) with null
for the result parameter. |
ChannelMap |
Delete(ChannelMap toDelete,
ChannelMap result)
Deletes the maps specified in toDelete. |
void |
Detach()
Close the connection with the server, but retain the server-side handler and its ring buffer(s) such that sink clients can continue to access previously written data. |
int |
Flush(ChannelMap ch)
Sends the pending channels to the server, unsynchronized. |
int |
Flush(ChannelMap ch,
boolean doSynch)
Sends the pending channels to the server, optionally waiting for confirmation before returning. |
void |
Register(ChannelMap cm)
Tells the server which channels this Source will
generate. |
| Methods inherited from class com.rbnb.sapi.Client |
|---|
CloseRBNBConnection, CloseRBNBConnection, GetArchiveMode, GetArchiveSize, GetCacheSize, GetChannelList, GetChannelList, GetClientName, GetServerName, OpenRBNBConnection, OpenRBNBConnection, OpenRBNBConnection, SetRingBuffer, VerifyConnection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Source()
cacheSize = 100 framesarchiveSize = 0 frames (off)
public Source(int cacheSize,
String archiveMode,
int archiveSize)
Client.SetRingBuffer(int, String, int)
with the specified options.
cacheSize - Size of the memory cache, in frames.archiveMode - The mode for the optional archive. Should be one
of the following: archiveSize - The size of the desired archive, in frames. Ignored
except for "create" and "append".Client.CloseRBNBConnection(),
Client.SetRingBuffer(int,String,int)| Method Detail |
|---|
public long BytesTransferred()
Client
BytesTransferred in class Client
public int Flush(ChannelMap ch)
throws SAPIException
Flush(ChannelMap,boolean)
with a false value for the synchronization parameter.
SAPIException - If there is an error while sending data to
the server.Flush(ChannelMap,boolean)
public int Flush(ChannelMap ch,
boolean doSynch)
throws SAPIException
ChannelMap are erased after they are sent, although the names
are preserved.
doSynch - If true, this Source will communicate with the server
to verify that the communication was successful.
SAPIException - If there is an error while sending data to
the server.
public void Register(ChannelMap cm)
throws SAPIException
Source will
generate. It also sends any data present in the
ChannelMap as time-independent meta-data.
NOTE: It is strongly recommended that the data placed
into the ChannelMap used with Register be placed with
ChannelMap.PutUserInfo(int, String). This allows the server
to combine this data with its server generated meta-data. Otherwise
the server generated data is overridden.
SAPIException - If there is an error while sending the map to
the server.
public ChannelMap Delete(ChannelMap toDelete,
ChannelMap result)
throws SAPIException
If result is null, a new channel map is created.
SAPIException
public ChannelMap Delete(ChannelMap toDelete)
throws SAPIException
Delete(ChannelMap, ChannelMap) with null
for the result parameter.
SAPIException
public void ClearCache()
throws SAPIException
SAPIExceptionpublic final void Detach()
If you wish to close the connection and prevent access to the data
at the server, use Client.CloseRBNBConnection().
A new client can reattach to the detached server-side handler by using the following calls:
Source src = new Source(cacheSize,"append",archiveSize)
src.OpenRBNBConnection(rbnbAddress,clientName)
Note: while it is possible to Detach from a
Source that does not have an archive, it is not possible
at this time to reattach to it.
Client.OpenRBNBConnection(String,String),
Client.CloseRBNBConnection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||