Public Member Functions | Public Attributes | Protected Member Functions | Static Package Functions | Private Member Functions | Private Attributes
com.phidgets.Dictionary Class Reference

List of all members.

Public Member Functions

final void add (String key, String val) throws PhidgetException
final void add (String key, String val, boolean persistent) throws PhidgetException
final void addServerConnectListener (ServerConnectListener l)
final void addServerDisconnectListener (ServerDisconnectListener l)
final void close () throws PhidgetException
 Dictionary () throws PhidgetException
final String get (String key) throws PhidgetException
final native String getServerAddress () throws PhidgetException
final native String getServerID () throws PhidgetException
final native int getServerPort () throws PhidgetException
final native boolean isAttached () throws PhidgetException
final native boolean isAttachedToServer () throws PhidgetException
final void open (String ipAddress, int port, String password) throws PhidgetException
final void open (String ipAddress, int port) throws PhidgetException
final void open (String serverID, String password) throws PhidgetException
final void open (String serverID) throws PhidgetException
final void remove (String pattern) throws PhidgetException
final void removeServerConnectListener (ServerConnectListener l)
final void removeServerDisconnectListener (ServerDisconnectListener l)
String toString ()

Public Attributes

long handle = 0

Protected Member Functions

void finalize ()

Static Package Functions

 [static initializer]

Private Member Functions

final native long create () throws PhidgetException
void enableEvents (boolean b)
native void enableServerConnectEvents (boolean b)
native void enableServerDisconnectEvents (boolean b)
void fireServerConnect (ServerConnectEvent e)
void fireServerDisconnect (ServerDisconnectEvent e)
final native void nativeAddKey (String key, String val, int persistent) throws PhidgetException
final native void nativeClose () throws PhidgetException
final native void nativeDelete () throws PhidgetException
final native String nativeGetKey (String key) throws PhidgetException
final native void nativeOpenRemote (String serverID, String pass) throws PhidgetException
final native void nativeOpenRemoteIP (String ipAddress, int port, String pass) throws PhidgetException
final native void nativeRemoveKey (String keyPattern) throws PhidgetException

Private Attributes

long nativeServerConnectHandler = 0
long nativeServerDisconnectHandler = 0
LinkedList serverConnectListeners = new LinkedList()
LinkedList serverDisconnectListeners = new LinkedList()

Detailed Description

This class represents the Phidget Dictionary.

The Phidget Dictionary is a service provided by the Phidget Webservice. The Webservice maintains a centralized dictionary of key-value pairs that can be accessed and changed from any number of clients.

Note that the Webservice uses this dictionary to control access to Phidgets through the openRemote and openRemoteIP interfaces, and as such, you should never add or modify a key that starts with /PSK/ or /PCK/, unless you want to explicitly modify Phidget specific data -- and this is highly discouraged, as it's very easy to break things. Listening to these keys is fine if so desired.

The intended use for the dictionary is as a central repository for communication and persistent storage of data between several client applications. As an example - a higher level interface exposed by one application -- which controls the Phidgets, for others to access -- rather then every client talking directly to the Phidgets themselves.

The dictionary makes use of extended regular expressions for key matching.

Author:
Phidgets Inc.

Definition at line 31 of file Dictionary.java.


Constructor & Destructor Documentation

The default constructor. Creating a Phidget Dictionary object will initialize the dictionary handle internally, but open still needs to be called to actually work with it.

Definition at line 74 of file Dictionary.java.


Member Function Documentation

com.phidgets.Dictionary.[static initializer] ( ) [inline, static, package]
final void com.phidgets.Dictionary.add ( String  key,
String  val 
) throws PhidgetException [inline]

Adds a new key to the Dictionary, or modifies the value of an existing key.

The key can only contain numbers, letters, "/", ".", "-", "_", and must begin with a letter, "_" or "/".

The value can contain any value.

The key will stay in the dictionary until explicitly removed.

Definition at line 140 of file Dictionary.java.

final void com.phidgets.Dictionary.add ( String  key,
String  val,
boolean  persistent 
) throws PhidgetException [inline]

Adds a new key to the Dictionary, or modifies the value of an existing key.

The key can only contain numbers, letters, "/", ".", "-", "_", and must begin with a letter, "_" or "/".

The value can contain any value.

The persistent value controls whether a key will stay in the dictionary after the client that created it disconnects. If persistent == 0, the key is removed when the connection closes. Otherwise the key remains in the dictionary until it is explicitly removed.

Definition at line 157 of file Dictionary.java.

final void com.phidgets.Dictionary.addServerConnectListener ( ServerConnectListener  l) [inline]

Adds an serverConnect listener. The serverConnect handler is a method that will be called when a connection to a server is made

There is no limit on the number of serverConnect handlers that can be registered for a particular Manager.

Parameters:
lAn implemetation of the ServerConnectListener interface

Definition at line 257 of file Dictionary.java.

final void com.phidgets.Dictionary.addServerDisconnectListener ( ServerDisconnectListener  l) [inline]

Adds an serverDisconnect listener. The serverDisconnect handler is a method that will be called when a connection to a server is terminated.

There is no limit on the number of serverDisconnect handlers that can be registered for a particular Manager.

Parameters:
lAn implemetation of the ServerDisconnectListener interface

Definition at line 299 of file Dictionary.java.

Closes this Dictionary. This will shut down all threads dealing with this Dictionary and you won't receive any more events.

Exceptions:
PhidgetExceptionIf this Dictionary is not opened.

Definition at line 235 of file Dictionary.java.

final native long com.phidgets.Dictionary.create ( ) throws PhidgetException [private]
void com.phidgets.Dictionary.enableEvents ( boolean  b) [inline, private]

Definition at line 241 of file Dictionary.java.

void com.phidgets.Dictionary.finalize ( ) [inline, protected]

Definition at line 338 of file Dictionary.java.

void com.phidgets.Dictionary.fireServerConnect ( ServerConnectEvent  e) [inline, private]

Definition at line 277 of file Dictionary.java.

void com.phidgets.Dictionary.fireServerDisconnect ( ServerDisconnectEvent  e) [inline, private]

Definition at line 319 of file Dictionary.java.

final String com.phidgets.Dictionary.get ( String  key) throws PhidgetException [inline]

Gets the value for a key.

Definition at line 175 of file Dictionary.java.

Returns the Address of a Phidget Webservice when this Dictionary was opened as remote. This may be an IP Address or a hostname.

Returns:
Server Address
Exceptions:
PhidgetExceptionif this Dictionary was not opened.
final native String com.phidgets.Dictionary.getServerID ( ) throws PhidgetException

Returns the Server ID of a Phidget Webservice when this Dictionary was opened as remote. This is an arbitrary server identifier, independant of IP address and Port.

Returns:
Server ID
Exceptions:
PhidgetExceptionif this Dictionary was not opened.

Returns the Port of a Phidget Webservice when this Dictionary was opened as remote.

Returns:
Server Port
Exceptions:
PhidgetExceptionif this Dictionary was not opened.
final native boolean com.phidgets.Dictionary.isAttached ( ) throws PhidgetException

Returns the attached status of this Dictionary.

Returns:
Status
Exceptions:
PhidgetExceptionIf this Dictionary is not opened.

Returns the network attached status for remotely opened Phidgets. This method returns True or False, depending on whether a connection to the Phidget WebService is open - or not. If this is false for a remote Phidget then the connection is not active - either because a connection has not yet been established, or because the connection was terminated.

Returns:
Status
Exceptions:
PhidgetExceptionIf this Phidget is not opened.
final native void com.phidgets.Dictionary.nativeAddKey ( String  key,
String  val,
int  persistent 
) throws PhidgetException [private]
final native void com.phidgets.Dictionary.nativeClose ( ) throws PhidgetException [private]
final native void com.phidgets.Dictionary.nativeDelete ( ) throws PhidgetException [private]
final native String com.phidgets.Dictionary.nativeGetKey ( String  key) throws PhidgetException [private]
final native void com.phidgets.Dictionary.nativeOpenRemote ( String  serverID,
String  pass 
) throws PhidgetException [private]
final native void com.phidgets.Dictionary.nativeOpenRemoteIP ( String  ipAddress,
int  port,
String  pass 
) throws PhidgetException [private]
final native void com.phidgets.Dictionary.nativeRemoveKey ( String  keyPattern) throws PhidgetException [private]
final void com.phidgets.Dictionary.open ( String  ipAddress,
int  port,
String  password 
) throws PhidgetException [inline]

Open this Dictionary remotely and securely, using an IP Address.

This method is the same as open(String ipAddress, int port), except that it specifies a password. This password can be set as a parameter when starting the Phidget Webservice.

Definition at line 186 of file Dictionary.java.

final void com.phidgets.Dictionary.open ( String  ipAddress,
int  port 
) throws PhidgetException [inline]

Open this Dictionary remotely using an IP Address.

This version of open is network based, and relies on the Phidget Webservice running at the specified Address and Port before open is called.

Parameters:
ipAddressIP Address or hostname of the Phidget Webservice
portPort of the Phidget Webservice
Exceptions:
PhidgetExceptionif the Phidget Webservice cannot be contacted

Definition at line 201 of file Dictionary.java.

final void com.phidgets.Dictionary.open ( String  serverID,
String  password 
) throws PhidgetException [inline]

Open this Dictionary remotely and securely, using a Server ID.

This method is the same as open(String serverID), except that it specifies a password. This password can be set as a parameter when starting the Phidget Webservice.

Definition at line 212 of file Dictionary.java.

final void com.phidgets.Dictionary.open ( String  serverID) throws PhidgetException [inline]

Open this Dictionary remotely using a Server ID.

This version of open is network based.

Parameters:
serverIDServerID of the Phidget Webservice

Definition at line 224 of file Dictionary.java.

final void com.phidgets.Dictionary.remove ( String  pattern) throws PhidgetException [inline]

Removes a key, or set of keys, from the Dictionary.

The key name is a regular expressions pattern, and so care must be taken to only have it match the specific keys you want to remove.

Definition at line 167 of file Dictionary.java.

final void com.phidgets.Dictionary.removeServerConnectListener ( ServerConnectListener  l) [inline]

Removes an serverConnect listener. This will remove a previously added serverConnect listener.

Definition at line 269 of file Dictionary.java.

final void com.phidgets.Dictionary.removeServerDisconnectListener ( ServerDisconnectListener  l) [inline]

Removes an serverDisconnect listener. This will remove a previously added serverDisconnect listener.

Definition at line 311 of file Dictionary.java.

String com.phidgets.Dictionary.toString ( ) [inline]

Return a Sring describing this dictionary.

Definition at line 333 of file Dictionary.java.


Member Data Documentation

Definition at line 68 of file Dictionary.java.

Definition at line 248 of file Dictionary.java.

Definition at line 290 of file Dictionary.java.

LinkedList com.phidgets.Dictionary.serverConnectListeners = new LinkedList() [private]

Definition at line 247 of file Dictionary.java.

LinkedList com.phidgets.Dictionary.serverDisconnectListeners = new LinkedList() [private]

Definition at line 289 of file Dictionary.java.


The documentation for this class was generated from the following file:


pedal_monitor
Author(s): Pedro Mendes
autogenerated on Fri Jun 6 2014 18:37:22