All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class amarquee.QSession

java.lang.Object
   |
   +----amarquee.QSessionPrivate
           |
           +----amarquee.QSession

public class QSession
extends QSessionPrivate
Creates a new connection to an AMarqueed server.
AMarquee 1.48


Constructor Index

 o QSession(String, int, String)
Create a new QSession.
 o QSession(String, int, String, boolean)
Create a new QSession.
 o QSession(String, int, String, boolean, AMarqueeListener)
Create a new QSession.

Method Index

 o addAMarqueeListener(AMarqueeListener)
Add an AMarqueeListener
 o ClearSubscriptionsOp(int)
Remove a subscription or all your subscriptions

This function may be used to tell the AMarquee server that you wish to remove one or all of your current subscriptions.

 o close()
Close this session
 o DebugOp(String)
Send a debug message to server
Causes the AMarquee server to display the given string in its debug output window, if the debug output window is open.
Probably not that useful!
 o DeleteOp(String)
Delete a variable in the programs home directory

This function tells the AMarquee server to remove and free the entries stored in wildpath.

 o GetAndSubscribeOp(String, int)
Get the given data items, and start watching them

This function is a combination of the GetOp() and SubscribeOp() methods.

 o getError()
Return the last connect error code, as found in AMarquee.class
 o GetOp(String, int)
Get a variable in the programs home directory on server

This function instructs the AMarquee server to retrieve the data associated with the given wildpath and download it.

 o GetParameterOp(String)
Get a server parameter (setting)
 o getPort()
Get the current TCP-port
 o Go(int)
Send the queing transactions.
 o InfoOp()
Request that the AMarquee server respond with an "info ping" message.

Works essentially the same as PingOp(), only the returned event will be an aMarqueeInfo(AMarqueeEvent e).

 o KillClientsOp(String)
Cause other clients to be disconnected from the server.

With this function you can forcibly remove the AMarqueed connections from other client programs that are logged in to the same server.

 o MessageOp(String, byte[], int)
Send a message to one or more other clients.

This function allows you to send a buffer of data to other clients on the AMarquee server without permanently storing any information on the server.

 o MessageOp(String, String)
Send a message to one or more other clients.

This function allows you to send a buffer of data to other clients on the AMarquee server without permanently storing any information on the server.

 o NumQueuedBytes()
number of bytes currently being queued.
Returns the number of bytes of data that have been sent to the TCP thread for this QSession, but have not yet been sent to the TCP stack by the TCP thread.
 o NumQueuedPackets()
number of packets currently being queued.
Returns the number of messages that have been sent to the TCP thread for this QSession, but have not yet been processed by the TCP thread.
 o PingOp()
Requests that the Amarquee server respond with a "ping" message.

This function tells the AMarquee server to return a ping aMarqueePing(AMarqueeEvent).

 o QErrorName(int)
Get a text representation of an error code
 o ReleasePrivilegesOp(int)
Relinquish special privileges/abilities.

With this function you can give up your special permissions that were previously given you as the result of a call to RequestPrivilegesOp().

 o removeAMarqueeListener(AMarqueeListener)
Remove an AMarqueeListener
 o RenameOp(String, String)
Rename a variable in the programs home directory

This function tells the AMarquee server to rename a node to another label.

 o RequestPrivilegesOp(int)
Ask for special privileges/abilities.

This function lets your client ask the server for permission to do certain operations that are otherwise restricted.

 o SetAccessOp(String)
Set a path describing which other clients may access your data.

By default, any other AMarquee client may download your client's data.

 o SetMessageAccessOp(String, int)
Specify which other clients may send you messages with MessageOp().

This function allows you to specify which other clients may send you data directly using the MessageOp() method.

 o SetOp(String, byte[], int)
Create or update a data item with a new buffer of data

This function allows you to upload to the server data you wish to be made public.

 o SetOp(String, String)
Create or update a data item with a new buffer of data

This function allows you to upload to the server data you wish to be made public.

 o SetParameterOp(String, String)
Set a server parameter (setting)
 o StreamOp(String, byte[], int)
Create or update a data item with a new buffer of data.
 o StreamOp(String, String)
Create or update a data item with a new buffer of data.
 o SubscribeOp(String, int)
Start watching the given data items for updates

This function tells the AMarquee server that your client has a continuing interest in the given data item(s) specified in "wildpath".

 o SysMessageOp(String, String)
Send a system message to one or more other clients

This function allows you to send a text message to all clients who have requested, via RequestPrivilegesOp(), AMarquee.QPRIV_GETSYSMESSAGE access.

Constructors

 o QSession
 public QSession(String hostName,
                 int port,
                 String progName) throws SessionCreationException
Create a new QSession. Not asynchroneous. Will block until connect Creates a new TCP-handling thread and attempts to connect it to the specified AMarqueed server.
Note: This function is synchronous -- it will not return until either a TCP connection has been made to the remote host, or the attempt has failed. If the connection fails, this function will return null with no side effects, and SessionCreationException will be thrown.

Parameters:
hostName - String - The IP name of the computer to connect to. (e.g. foo.bar.com)
port - int - The port to connect on. Port 2957 is the "official" AMarqueed port.
progName - String - A String indicating the name the client program wishes to use. If another client from your host has already registered the progname, the server for that client will close its connection and quit so that your client program will still be uniquely addressable.
Throws: SessionCreationException
- if it fails to connect
 o QSession
 public QSession(String hostName,
                 int port,
                 String progName,
                 boolean async) throws SessionCreationException
Create a new QSession. Asynchroneous or not. Works the same as the constructor above, but if you set async=true, instead of waiting for the TCP connection to be fully established, it returns immediately.
When (and if) the TCP connection does connect to the target computer, your program will be notified via a an aMarqueeConnected(AMarqueeEvent e) event.
If the TCP connection fails, you will notified via an aMarqueeLostConnection(AMarqueeEvent e) event.
Any transactions (*Op(), Go(), etc) that you send to a QSession that is still connecting will not be processed until after the TCP connection has been established.

Parameters:
hostName - String - The IP name of the computer to connect to. (e.g. foo.bar.com)
port - int - The port to connect on. Port 2957 is the "official" AMarqueed port.
progName - String - A String indicating the name the client program wishes to use. If another client from your host has already registered the progname, the server for that client will close its connection and quit so that your client program will still be uniquely addressable.
async - boolean - Should it be asynchroneous, i.e return before connect.
 o QSession
 public QSession(String hostName,
                 int port,
                 String progName,
                 boolean async,
                 AMarqueeListener list) throws SessionCreationException
Create a new QSession. Asynchroneous or not. With an AMarqueelistener. Same as above constructor. But here you can pass a reference to listener.

Parameters:
hostName - String - The IP name of the computer to connect to. (e.g. foo.bar.com)
port - int - The port to connect on. Port 2957 is the "official" AMarqueed port.
progName - String - A String indicating the name the client program wishes to use. If another client from your host has already registered the progname, the server for that client will close its connection and quit so that your client program will still be uniquely addressable.
async - boolean - Should it be asynchroneous, i.e return before connect.
list - amarquee.AMarqueeListener - Add an AMarqueeListener

Methods

 o addAMarqueeListener
 public void addAMarqueeListener(AMarqueeListener list)
Add an AMarqueeListener

Parameters:
list - amarquee.AMarqueeListener - the object to add as listener
 o ClearSubscriptionsOp
 public int ClearSubscriptionsOp(int which)
Remove a subscription or all your subscriptions

This function may be used to tell the AMarquee server that you wish to remove one or all of your current subscriptions.

NOTE:
No error will be returned, and no harm done, if you specify the deletion of a subscription id that you do not have in effect.

Parameters:
which - int - The transaction ID of the subscription to clear (as was returned to you by SubscribeOp(), or 0 if you wish to clear all of your current subscriptions.
Returns:
int - transaction id, 0 on failure
 o close
 public synchronized void close()
Close this session

 o DebugOp
 public int DebugOp(String buffer)
Send a debug message to server
Causes the AMarquee server to display the given string in its debug output window, if the debug output window is open.
Probably not that useful!

Parameters:
buffer - String - The debug string
Returns:
int - transaction id
 o DeleteOp
 public int DeleteOp(String wildpath)
Delete a variable in the programs home directory

This function tells the AMarquee server to remove and free the entries stored in wildpath.

This function may also be used in direct client-to-client connections (as created via QSession and HostQSession), in which case the other client will receive an aMarqueeDelete() event.

NOTE:
You may only remove entries in your own directory. Attempting to remove other people's data will result in you being sent an aMarqueeUnPrivileged() event.

This function will also immediately delete any streaming buffers that were created for the given node(s) via StreamOp. To ensure that all stream updates were received, you may want to do a Go(AMarquee.QGOF_SYNC) and wait for the returned aMarqueePing() event before DeleteOp'ing the node(s).

Parameters:
wildpath - String - a wildpath describing which variable(s) to delete
Returns:
int - transaction id
 o GetAndSubscribeOp
 public int GetAndSubscribeOp(String wildpath,
                              int maxLen)
Get the given data items, and start watching them

This function is a combination of the GetOp() and SubscribeOp() methods. Calling this function is the same as calling GetOp() followed by SubscribeOp(), with the same arguments. This function is handy when you need to know the current state of some data and also want to be notified when the data changes.

The advantages of this function over calling GetOp() and QSubscribeOp() separately are twofold: first off, you only have to remember the ID number of one operation, rather than two; and secondly, it eliminates the possibility of race conditions between the two operations.

Parameters:
wildpath - String - a wildpath describing which variable(s) to receive
maxLen - int - the maximum length in bytes you want to receive. -1 means no limit.
Returns:
int - transaction id
 o getError
 public int getError()
Return the last connect error code, as found in AMarquee.class

Returns:
int - the error code
 o GetOp
 public int GetOp(String wildpath,
                  int maxLen)
Get a variable in the programs home directory on server

This function instructs the AMarquee server to retrieve the data associated with the given wildpath and download it. Once the results are downloaded, they will be sent to your process asynchronously as aMarqueeSubAdded(AMarqueeEvent e) events.

NOTE:
It is sometimes difficult to tell when your GetOp query is complete and you have received all your results from the query. Since each op is processed in order, you can do this by sending a PingOp after the QGetOp, or by specifying AMarquee.QGOF_SYNC for the flags argument in the Go call. Then when you get the ping packet, you know your query has finished.

Parameters:
wildpath - String - a wildpath describing which variable(s) to get
maxLen - int - the maximum length in bytes you want to receive. -1 means no limit. Larger data buffers will be truncated to this length. Since data items can be arbitrarily large, you can use this to avoid unpleasant surprises.
Returns:
int - transaction id
 o GetParameterOp
 public int GetParameterOp(String paramName)
Get a server parameter (setting)

Parameters:
paramName - String - the parameterName as found in documentation
Returns:
int - transaction id
 o getPort
 public int getPort()
Get the current TCP-port

Returns:
int - the TCP-port
Overrides:
getPort in class QSessionPrivate
 o Go
 public int Go(int flags)
Send the queing transactions. All methods with xxxxOp will be sent when you invoke this method.

Parameters:
flags - int - optional flags as found in AMarquee.class
Returns:
int - transaction id
Overrides:
Go in class QSessionPrivate
 o InfoOp
 public int InfoOp()
Request that the AMarquee server respond with an "info ping" message.

Works essentially the same as PingOp(), only the returned event will be an aMarqueeInfo(AMarqueeEvent e). From the QMessage you can get the QRunInfo object with getQRunInfo() method, reflecting the current memory state of the AMarquee server.

This function may also be used in direct client-to-client connections (as created via QSession and HostQSession), in which case the other client will receive an info QMessage.

NOTE:
Of course, any memory state info sent to you by the AMarquee server is very likely to be out of date by the time you get it!

Also, when using the contents of QRunInfo to estimate how much information you can safely store on the AMarquee server, it will be helpful to know that the server makes a copy of everything it receives before deleting the original data, so getAvail() should be AT LEAST 2 times the amount you wish to upload, and probably 3 or 4 times is safer.

Returns:
int - transaction id
 o KillClientsOp
 public int KillClientsOp(String hosts)
Cause other clients to be disconnected from the server.

With this function you can forcibly remove the AMarqueed connections from other client programs that are logged in to the same server. This function is intended to be used by administration programs only, and thus it requires special permission to use.

This command will never cause your own client to be disconnected, even if your /hostName/progName is included in the hosts argument's specification.

Parameters:
hosts - String - A hostname specifier describing which hosts and/or programs should be disconnected. This should be a string in the form of "/hostExp/progExp".
Returns:
int - transaction id
 o MessageOp
 public int MessageOp(String hosts,
                      byte buffer[],
                      int bufferLength)
Send a message to one or more other clients.

This function allows you to send a buffer of data to other clients on the AMarquee server without permanently storing any information on the server. This can be more efficient than using subscriptions, with SubscribeOp, to transmit data, and it allows you to easily specify which clients should receive the message, on a per-message basis.

Your message will be sent to every host that matches the regular expression specified in the "hosts" argument, provided that that host has specified that it will accept messages from your client (via SetMessageAccessOp(). The regular expression in "hosts" should be of the form "/foo/bar".

If no other clients received your message (either because no clients matching your specification existed, or because they have not granted you message access), you will be receive an aMarqueeUnPrivileged() event. notifying you of this.

When another client sends your client a MessageOp, the QMessage you receive will have a getID() of zero, and the getPath() will retrurn a reference the path of the home node of the message's sender (e.g. "/host/prog").

This function may also be used in direct client-to-client connections (as created via QSession and HostQSession), in which case the data in the arguments is received directly by the other client.

NOTE:
By default, all clients have messaging access turned off. So in order to send a message to a client, that client must have first allowed it with SetMessageAccessOp().

Data passed with this function will be streamed, so you do not have to worry about synchronization.

Parameters:
wildpath - String - a wildpath describing which hosts to send the message to.
buffer - byte[] - a byte array to send.
bufferLength - - the length of the buffer.
Returns:
int - transaction id
 o MessageOp
 public int MessageOp(String hosts,
                      String buffer)
Send a message to one or more other clients.

This function allows you to send a buffer of data to other clients on the AMarquee server without permanently storing any information on the server. This can be more efficient than using subscriptions, with SubscribeOp, to transmit data, and it allows you to easily specify which clients should receive the message, on a per-message basis.

Your message will be sent to every host that matches the regular expression specified in the "hosts" argument, provided that that host has specified that it will accept messages from your client (via SetMessageAccessOp(). The regular expression in "hosts" should be of the form "/foo/bar".

If no other clients received your message (either because no clients matching your specification existed, or because they have not granted you message access), you will be receive an aMarqueeUnPrivileged() event. notifying you of this.

When another client sends your client a MessageOp, the QMessage you receive will have a getID() of zero, and the getPath() will retrurn a reference the path of the home node of the message's sender (e.g. "/host/prog").

This function may also be used in direct client-to-client connections (as created via QSession and HostQSession), in which case the data in the arguments is received directly by the other client.

NOTE:
By default, all clients have messaging access turned off. So in order to send a message to a client, that client must have first allowed it with SetMessageAccessOp().

Data passed with this function will be streamed, so you do not have to worry about synchronization.

Parameters:
wildpath - String - a wildpath describing which hosts to send the message to.
buffer - String - the String to send
Returns:
int - transaction id
 o NumQueuedBytes
 public long NumQueuedBytes()
number of bytes currently being queued.
Returns the number of bytes of data that have been sent to the TCP thread for this QSession, but have not yet been sent to the TCP stack by the TCP thread. This value does not include any "overhead" introduced by the AMarquee system messages or headers--it only tracks the sum of sizes of the user's queued data buffers. No thread synchronization is done, so the value returned should be considered approximate only. This function can be used to see if bytes are being queued faster than they are being sent, and thus take corrective action before too much memory is allocated for queued packets.

Returns:
long
 o NumQueuedPackets
 public long NumQueuedPackets()
number of packets currently being queued.
Returns the number of messages that have been sent to the TCP thread for this QSession, but have not yet been processed by the TCP thread. This value includes one point for each transaction generated by the *Op() calls, as well as one point per QGo() call. No thread synchronization is done, so the value returned should be considered approximate only. This function can be used to see if packets are being queued faster than they are being sent, and thus take corrective action before too much memory is allocated for queued packets.

Returns:
long
 o PingOp
 public int PingOp()
Requests that the Amarquee server respond with a "ping" message.

This function tells the AMarquee server to return a ping aMarqueePing(AMarqueeEvent). This can be useful if you wish to be sure that your AMarquee process has completed all previous operations you may have sent it.

This function may also be used in direct client-to-client connections (as created via QSession and HostQSession), in which case the other client will receive an QMessage containing how much memory is free on your machine.

NOTE:
While this operation will help you synchronize to the completion of work by your *own* AMarqueed server process, it will not guarantee that by the time you receive your "ping" event, that your changes have been propagated to all the *other* AMarqueed processes. You can use Go(AMarquee.QGOF_SYNC)'s ping reply to guarantee that.

Returns:
int - the transaction id
 o QErrorName
 public String QErrorName(int err)
Get a text representation of an error code

Returns:
String - the explaination
 o ReleasePrivilegesOp
 public int ReleasePrivilegesOp(int privBits)
Relinquish special privileges/abilities.

With this function you can give up your special permissions that were previously given you as the result of a call to RequestPrivilegesOp().

Parameters:
privBits - int - A bit-chord specifying which special priviliges you want to give up. The following constants are currently available:

To see which constants may be or'd together into privBits, read the RequestPrivilegesOp documentation.

Returns:
int - transaction id
 o removeAMarqueeListener
 public void removeAMarqueeListener(AMarqueeListener list)
Remove an AMarqueeListener

 o RenameOp
 public int RenameOp(String path,
                     String label)
Rename a variable in the programs home directory

This function tells the AMarquee server to rename a node to another label. Nodes may only be renamed in their current directory; they can not be moved to another directory with this command.

NOTE:
Other clients will see this operation as a deletion of the old node and the creation of the new one.

Also note that while "path" should be a regular node path name, "label" should just be just the name of the node itself--the rest of the path is assumed to be the same.

You can only rename nodes in your own directory tree.

Parameters:
path - String - the name of the variable to rename
label - String - the name to rename to
Returns:
int - transaction id
 o RequestPrivilegesOp
 public int RequestPrivilegesOp(int privBits)
Ask for special privileges/abilities.

This function lets your client ask the server for permission to do certain operations that are otherwise restricted. The server may or may not actually grant you permission.

Parameters:
privBits - int - bit-chord specifying which special privileges you want. The following constants are currently available:

AMarquee.QPRIV_KILLCLIENTS - The ability to use KillClientsOp() to disconnect other client programs.

AMarquee.QPRIV_SENDSYSMESSAGES - The ability to send system messages with SysMessageOp() to other client programs.

AMarquee.QPRIV_GETSYSMESSAGES - The ability to receive system messages sent by other programs. (This privilege is guaranteed to be granted to any client that requests it)

AMarquee.QPRIV_ADMIN - The ability to change system settings via SetParameterOp().

AMarquee.QPRIV_ALLPRIVILEGES - This constant is equivalent to all the above constants OR'd together.

Returns:
int - transaction id
 o SetAccessOp
 public int SetAccessOp(String hosts)
Set a path describing which other clients may access your data.

By default, any other AMarquee client may download your client's data. But it may be that you only want to share your data with certain clients. This function allows you to set an access control path, in the form of "/hostExp/progExp", to specify exactly which other AMarquee clients may look at your data. Clients that are not included in your access path will not be notified when your data is updated, and they will not see any data in your directory via GetOp(), either.

NOTE:
While you can hide your data from other clients, you cannot hide your presence. Unauthorized clients will still be able to see your root node, and may still be notified when your session begins or ends.

If you specify an access pattern that excludes your own data(!), you will not be able to read your data using global node paths (e.g. GetOp("/myhost/myprog/mydata") will not return any events to you), but you can still read your data using local node paths (e.g. GetOp("mydata"), which means the same thing, will work).

You can always SetOp to your directory, no matter what.

Parameters:
hosts - String - A string describing which hosts that is allowed to access your home directory on server. Wildcards are allowed. Regular expression. e.g. /#?/#?, which means any host and any program
Returns:
int - transaction id
 o SetMessageAccessOp
 public int SetMessageAccessOp(String hosts,
                               int maxBytes)
Specify which other clients may send you messages with MessageOp().

This function allows you to specify which other clients may send you data directly using the MessageOp() method.

NOTE:
When you first connect, messaging access is turned off, and no other client may send you messages. (This ensures that you do not receive QMessages that you were not expecting!)

Parameters:
hosts - String - A string describing which hosts that is allowed to send your client a message. Wildcards are allowed. Regular expression. e.g. /#?/#?, which means any host and any program
maxBytes - int - maximum number of bytes to receive. Messages longer that "maxBytes" bytes long will be truncated before they are sent to you. -1 means unlimited length.
Returns:
int - transaction id, 0 for failure.
 o SetOp
 public int SetOp(String path,
                  byte buffer[],
                  int bufferLength)
Create or update a data item with a new buffer of data

This function allows you to upload to the server data you wish to be made public. The data sent is stored as a simple buffer of bytes, and can thus be any data type you wish to send.

This function may also be used in direct client-to-client connections (as created via QSession and HostQSession), in which case the data in the arguments is received directly by the other client.

NOTE:
You may only set nodes in your own directory.

This function is preferable to StreamOp() when the data you are posting is absolute, and it matters more that the other client programs see the latest revision of the data as soon as possible, than to have them always receive every update of the data. Also, this function is more memory-efficient that StreamOp().

This operation will immediately clear any streaming data buffers that were previously in use for the given node. Thus, if you were previously using StreamOp() on a node and then want to do a QSetOp on that same node, it is a good idea to do a Go(AMarquee.QGOF_SYNC) and wait for the sync event, i.e. aMarqueePing(AMarqueeEvent e), first, before execting the SetOp, so that none of your streamed updates will be lost.

Parameters:
path - String - name of the variable to set
buffer - byte[] - the buffer to set the variable to
maxLen - int - the length of the buffer.
Returns:
int - transaction id
 o SetOp
 public int SetOp(String path,
                  String buffer)
Create or update a data item with a new buffer of data

This function allows you to upload to the server data you wish to be made public. The data sent is stored as a simple buffer of bytes, and can thus be any data type you wish to send.

This function may also be used in direct client-to-client connections (as created via QSession and HostQSession), in which case the data in the arguments is received directly by the other client.

NOTE:
You may only set nodes in your own directory.

This function is preferable to StreamOp() when the data you are posting is absolute, and it matters more that the other client programs see the latest revision of the data as soon as possible, than to have them always receive every update of the data. Also, this function is more memory-efficient that StreamOp().

This operation will immediately clear any streaming data buffers that were previously in use for the given node. Thus, if you were previously using StreamOp() on a node and then want to do a QSetOp on that same node, it is a good idea to do a Go(AMarquee.QGOF_SYNC) and wait for the sync event, i.e. aMarqueePing(AMarqueeEvent e), first, before execting the SetOp, so that none of your streamed updates will be lost.

Parameters:
path - String - name of the variable to set
buffer - String - the String to set the variable to
Returns:
int - transaction id
 o SetParameterOp
 public int SetParameterOp(String paramName,
                           String newValue)
Set a server parameter (setting)

Parameters:
paramName - String - the parameterName as found in documentation
newValue - String - the string to set it to
Returns:
int - transaction id
 o StreamOp
 public int StreamOp(String path,
                     byte buffer[],
                     int bufferLength)
Create or update a data item with a new buffer of data. Use data streaming so that other clients will not miss any updates, even if you don't use any synchronization.

This function works essentially the same as SetOp(), except that you do not need to worry about data synchronization problems (e.g. changing the data in a node a second time before some clients had read the first value). Instead, the AMarquee server will ensure that all stream updates are seen by all interested clients, in the order they were sent.

In direct client-to-client connections, this function operates exactly the same as SetOp() does.

NOTE:
You may only stream nodes in your own directory.

StreamOp is less memory-efficient on the server side than SetOp is, because the server may have to keep around multiple revisions of your data in the node you StreamOp on.

Parameters:
path - String - name of the variable to set
buffer - byte[] - the buffer to set the variable to
maxLen - int - the length of the buffer.
Returns:
int - transaction id
 o StreamOp
 public int StreamOp(String path,
                     String buffer)
Create or update a data item with a new buffer of data. Use data streaming so that other clients will not miss any updates, even if you don't use any synchronization.

This function works essentially the same as SetOp(), except that you do not need to worry about data synchronization problems (e.g. changing the data in a node a second time before some clients had read the first value). Instead, the AMarquee server will ensure that all stream updates are seen by all interested clients, in the order they were sent.

In direct client-to-client connections, this function operates exactly the same as SetOp() does.

NOTE:
You may only stream nodes in your own directory.

StreamOp is less memory-efficient on the server side than SetOp is, because the server may have to keep around multiple revisions of your data in the node you StreamOp on.

Like SetOp but more memory intense on the server.

Parameters:
path - String - name of the variable to set
buffer - String - the String to set the variable to
Returns:
int - transaction id
 o SubscribeOp
 public int SubscribeOp(String wildpath,
                        int maxLen)
Start watching the given data items for updates

This function tells the AMarquee server that your client has a continuing interest in the given data item(s) specified in "wildpath". When any items meeting the pattern specified in "wildpath" are created, changed, or deleted, you will be sent aMarqueeSubAdded(AMarqueeEvent e) event reflecting their new contents. (Nodes being deleted will result in you receiving an aMarqueeSubRemoved(AMarqueeEvent e) event.)

NOTE:
This function will not cause any data to be sent to you until a change in the data's state occurs. If you are just starting up your session and wish to get the full current state of the data, you should probably send a GetAndSubscribeOp instead.

If a client whose data you are watching disconnects, you will get messages indicating that each node you are watching has been deleted. (If you want to know for sure that a disconnection is taking place and not just a bunch of manual deletions, watch the client's root node (e.g. "/progName/clientName")--this node will only ever be deleted when the client disconnects.

Parameters:
wildpath - String - a wildpath describing which variable(s) to receive
maxLen - int - the maximum length in bytes you want to receive. -1 means no limit.
Returns:
int - transaction id
 o SysMessageOp
 public int SysMessageOp(String hosts,
                         String message)
Send a system message to one or more other clients

This function allows you to send a text message to all clients who have requested, via RequestPrivilegesOp(), AMarquee.QPRIV_GETSYSMESSAGE access. Note that in order to use this function, your client must have AMarquee.QPRIV_SENDSYSMESSAGE access.

Your message will be sent to every host that matches the regular expression specified in the "hosts" argument, as long as the client hav AMarquee.QPRIV_GETSYSMESSAGE access.

The regular expression in "hosts" should be of the form "/foo/bar".

If no other clients received your message (either because no clients matching your specification existed, or because they do not have AMarquee.QPRIV_GETSYSMESSAGE access), you will be receive an aMarqueeUnPrivileged(AMarqueeEvent e) event with a QMessage notifying you of this. You will also receive an aMarqueeUnPrivileged(AMarqueeEvent e) event if you did not have AMarquee.QPRIV_SENDSYSMESSAGE access when you called this function.

When another client sends your client a SysMessageOp, the aMarqueeSysMsg(AmarqueeEvent) method in your message handling object will be invoked. getPath() on the QMessage will give you the the path of the home node of the message's sender (e.g. "/host/prog"). By calling getData() on the QMessage you will get the text of the message body.

NOTE:
By default, all clients have system messaging access turned off. So in order to send a system message to a client, that client must have first allowed it with RequestPrivilegesOp().

Data passed with this function will be streamed, so you do not have to worry about synchronization.

Parameters:
hosts - String - a wildpath describing which hosts to send the message to.
message - String - the String to send
Returns:
int - transaction id

All Packages  Class Hierarchy  This Package  Previous  Next  Index