com.smaxe.me.uv.client
Class SharedObject

java.lang.Object
  extended by com.smaxe.me.uv.client.SharedObject

public final class SharedObject
extends java.lang.Object

SharedObject - remote shared object implementation.

Version:
1.1.10
Author:
Andrei Sochirca
See Also:
JUV RTMP Client (J2ME edition)

Nested Class Summary
static class SharedObject.Change
          Change - change event item.
static interface SharedObject.IListener
          IListener - SharedObject listener.
static class SharedObject.ListenerAdapter
          ListenerAdapter - SharedObject.IListener adapter.
 
Field Summary
static ObjectEncoding defaultObjectEncoding
          Default object encoding.
 
Constructor Summary
SharedObject(java.lang.String name)
          Constructor.
SharedObject(java.lang.String name, boolean persistent)
          Constructor.
 
Method Summary
 void addEventListener(SharedObject.IListener listener)
          Registers an event listener.
 void clear()
          For local shared objects, purges all of the data and deletes the shared object from the disk.
 java.lang.Object client()
          Returns the object on which callback methods should be invoked.
 void client(java.lang.Object client)
          Sets the object on which callback methods should be invoked.
 void close()
          Closes the connection between a remote shared object and the server.
 void connect(NetConnection connection, java.lang.String params)
          Connects to a remote shared object on the server through the specified connection.
 java.util.Hashtable data()
          Returns shared object data.
protected  void fireOnAsyncError(java.lang.String message, java.lang.Exception e)
          Fires 'On Async Error' event.
protected  void fireOnNetStatus(java.util.Hashtable info)
          Fires 'On Net Status' event.
protected  void fireOnSync(java.util.Vector changeList)
          Fires 'On Sync' event.
 void flush(int minDiskSpace)
          Immediately writes a locally persistent shared object to a local file.
 int fps()
          Returns fps.
 void fps(int fps)
          Specifies the number of times per second that a client's changes to a shared object are sent to the server.
 java.lang.String getName()
          Returns shared object name.
 boolean isPersistent()
          Checks if shared object is persistent.
 ObjectEncoding objectEncoding()
          Returns object encoding.
 void objectEncoding(ObjectEncoding encoding)
          The object encoding (AMF version).
 void removeEventListener(SharedObject.IListener listener)
          Removes the listener.
 void send(java.lang.String action, java.lang.Object[] args)
          Broadcasts a message to all clients connected to the specified remote shared object, including the client that sent the message.
 void setDirty(java.lang.String propertyName)
          Indicates to the server that the value of a property in the shared object has changed.
 void setProperty(java.lang.String propertyName, java.lang.Object value)
          Updates the value of a property in a shared object and indicates to the server that the value of the property has changed.
 int size()
          Returns current size of the shared object, in bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultObjectEncoding

public static ObjectEncoding defaultObjectEncoding
Default object encoding.

Constructor Detail

SharedObject

public SharedObject(java.lang.String name,
                    boolean persistent)
Constructor.

Parameters:
name - local shared object name
persistent - persistent flag

SharedObject

public SharedObject(java.lang.String name)
Constructor.

Parameters:
name - name
Method Detail

getName

public final java.lang.String getName()
Returns shared object name.

Returns:
shared object name

isPersistent

public boolean isPersistent()
Checks if shared object is persistent.

Returns:
true if shared object is persistent; otherwise false

client

public void client(java.lang.Object client)
Sets the object on which callback methods should be invoked.

Parameters:
client - the object on which callback methods should be invoked

client

public java.lang.Object client()
Returns the object on which callback methods should be invoked.

Returns:
the object on which callback methods should be invoked

fps

public void fps(int fps)
Specifies the number of times per second that a client's changes to a shared object are sent to the server.

Parameters:
fps - number of updates per second

fps

public int fps()
Returns fps.

Returns:
fps

objectEncoding

public ObjectEncoding objectEncoding()
Returns object encoding.

Returns:
object encoding

objectEncoding

public void objectEncoding(ObjectEncoding encoding)
The object encoding (AMF version).

Parameters:
encoding - encoding to set

clear

public void clear()
For local shared objects, purges all of the data and deletes the shared object from the disk.


connect

public void connect(NetConnection connection,
                    java.lang.String params)
Connects to a remote shared object on the server through the specified connection.

Parameters:
connection - connection
params - connection parameters

send

public void send(java.lang.String action,
                 java.lang.Object[] args)
Broadcasts a message to all clients connected to the specified remote shared object, including the client that sent the message.

Parameters:
action - action
args - arguments (0 or more)

data

public java.util.Hashtable data()
Returns shared object data.

Returns:
collection of attributes assigned to the data property of the object

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.Object value)
Updates the value of a property in a shared object and indicates to the server that the value of the property has changed.

Parameters:
propertyName - property name
value - value

size

public int size()
Returns current size of the shared object, in bytes.

Returns:
current size of the shared object, in bytes

close

public void close()
Closes the connection between a remote shared object and the server.


setDirty

public void setDirty(java.lang.String propertyName)
Indicates to the server that the value of a property in the shared object has changed.

Parameters:
propertyName - property name

flush

public void flush(int minDiskSpace)
Immediately writes a locally persistent shared object to a local file.

Parameters:
minDiskSpace -

addEventListener

public void addEventListener(SharedObject.IListener listener)
Registers an event listener.

Parameters:
listener - listener to add

removeEventListener

public void removeEventListener(SharedObject.IListener listener)
Removes the listener.

Parameters:
listener - listener to remove

fireOnAsyncError

protected final void fireOnAsyncError(java.lang.String message,
                                      java.lang.Exception e)
Fires 'On Async Error' event.

Parameters:
message -
e -

fireOnNetStatus

protected final void fireOnNetStatus(java.util.Hashtable info)
Fires 'On Net Status' event.

Parameters:
info -

fireOnSync

protected final void fireOnSync(java.util.Vector changeList)
Fires 'On Sync' event.

Parameters:
changeList -