|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--br.shob.SharedSpace
This class represents a connection to the global space in wich the objects
are shared. Clients can share objects to other and get copies of objects
shared in the global space. The idea is that once you share or get the
object you interact with it through a SharedReference
implementation (or subclass). Each SharedSpace instance has its own
CommLayer, so a client can communicate with multiple server at once.
SharedReference
,
SharedObject
Nested Class Summary | |
protected static class |
SharedSpace.Validator
Description of the Class |
Constructor Summary | |
SharedSpace(String hostname,
int port)
Creates a new SharedSpace instance |
Method Summary | |
void |
addCacheListener(String globalName,
StorageListener listener)
Adds a StorageListener that listens on the cached objects storage. |
void |
addOwnedListener(String globalName,
StorageListener listener)
Adds a StorageListener that listens on the owned objects storage. |
protected void |
beginTrans(SharedReference reference)
This method should not be called directly. |
protected void |
commit(SharedReference reference)
This method should not be called directly. |
void |
connect(String hostname,
int port)
Conects whith the specified server. |
void |
disconnect()
Disconnects from the server. |
SharedReference |
get(String globalName)
Returns a SharedReference for a shared object. |
Set |
getCachedNames()
Gets the cachedNames attribute of the SharedSpace object |
SharedObject |
getCachedObject(String globalName)
This method should not be called by user applications. |
List |
getExternalDescriptors()
Returns a list of all the objects cached by this SharedSpace . |
List |
getInternalDescriptors()
Returns a list of all the objects shared by this SharedSpace . |
Logger |
getLogger()
Gets the logger attribute of the SharedSpace object |
SharedObject |
getObject(String globalName)
This method should not be called by user applications |
SharedReference |
getReference(SharedObject obj)
Gets the reference attribute of the SharedSpace object |
protected SharedReference |
getRemote(String globalName)
This method should not be called by user applications |
byte[] |
getRemoteClassArray(String globalName,
String className)
Gets a byte array with the class definition for className , downloading it from the owner of globalName . |
boolean |
isConnected()
Checks if this SharedSpace instance is connected to a server |
boolean |
isDebugging()
Gets the debugging flag of the SharedSpace object |
protected void |
lock(String globalName)
This method should not be called directly. |
void |
put(SharedObject obj)
This method should not be called by user applications. |
protected void |
remove(String globalName)
This method should not be called. |
void |
removeCacheListener(String globalName,
StorageListener listener)
Removes a StorageListener that listens on the cached objects storage. |
void |
removeOwnedListener(String globalName,
StorageListener listener)
Removes a StorageListener that listens on the owned objects storage. |
protected void |
rollback(SharedReference reference)
This method should not be called directly. |
void |
setDebugging(boolean flag)
Sets the debugging flag of the SharedSpace object |
void |
setLogger(Logger logger)
Sets the logger attribute of the SharedSpace object |
SharedReference |
share(String globalName,
Serializable data)
Shares an object with the specified globalName . |
SharedReference |
share(String globalName,
Serializable data,
String referenceClassName)
Shares an object with the specified globalName . |
protected void |
unlock(String globalName)
This method should not be called directly. |
protected void |
unshare(SharedReference reference)
This method should not be called directly. |
protected void |
validate(SharedReference reference)
This method should not be called directly. |
protected void |
validate(String globalName)
This method should not be called directly. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SharedSpace(String hostname, int port) throws ShobException
hostname
- the host where this object will be listening.port
- the port in which this object will be listening.
ShobException
- Description of the ExceptionMethod Detail |
public void addCacheListener(String globalName, StorageListener listener)
globalName
- the global name that the listener wants to listen tolistener
- The listener to be addedpublic void addOwnedListener(String globalName, StorageListener listener)
globalName
- the global name that the listener wants to listen tolistener
- The listener to be addedpublic void connect(String hostname, int port) throws ShobException, AlreadyLoggedInException
hostname
- the hostname of the server.port
- the port used for login.
ShobException
- thrown when an unexpected error occurs
AlreadyLoggedInException
- if this SharedSpace is already logged
to the serverpublic void disconnect() throws ShobException, NotLoggedInException
ShobException
- thrown when an unexpected error occurs
NotLoggedInException
- if this SharedSpace is not logged to the
serverpublic SharedReference get(String globalName) throws ShobException, NotSharedException
SharedReference
for a shared object.
globalName
- the global name of the object.
SharedReference
for this
object.
ShobException
- Description of the Exception
NotSharedException
- Description of the Exceptionpublic Set getCachedNames()
public SharedObject getCachedObject(String globalName)
globalName
- Description of the Parameter
public List getExternalDescriptors() throws ShobException
SharedSpace
.
ShobException
- thrown when an unexpected error occurspublic List getInternalDescriptors() throws ShobException
SharedSpace
.
ShobException
- thrown when an unexpected error occurspublic Logger getLogger()
public SharedObject getObject(String globalName)
globalName
- Description of the Parameter
public SharedReference getReference(SharedObject obj)
obj
- Description of the Parameter
public byte[] getRemoteClassArray(String globalName, String className) throws ShobException
globalName
- Description of the ParameterclassName
- Description of the Parameter
ShobException
- thrown when an unexpected error occurspublic boolean isConnected()
ClientCommLayer.isLoggedIn()
public boolean isDebugging()
public void put(SharedObject obj)
obj
- the shared object to be put inpublic void removeCacheListener(String globalName, StorageListener listener)
globalName
- the global name that the listener wants to listen tolistener
- The listener to be removedpublic void removeOwnedListener(String globalName, StorageListener listener)
globalName
- the global name that the listener wants to listen tolistener
- The listener to be removedpublic void setDebugging(boolean flag)
flag
- The new debugging valuepublic void setLogger(Logger logger)
logger
- The new logger valuepublic SharedReference share(String globalName, Serializable data, String referenceClassName) throws ShobException, AlreadySharedException
globalName
.
globalName
- the global name of the shared object.data
- the object to be shared.referenceClassName
- the class of the SharedReference
that should be returned when the method get
is
called.
ShobException
- thrown when an unexpected error occurs
AlreadySharedException
- thrown when the object is alread sharedpublic SharedReference share(String globalName, Serializable data) throws ShobException, AlreadySharedException
globalName
.
globalName
- the global name of the shared object.data
- the object to be shared.
ShobException
- thrown when an unexpected error occurs
AlreadySharedException
- when the object is already sharedprotected void beginTrans(SharedReference reference) throws ShobException, AlreadyLockedException
reference
- a SharedReference instance
ShobException
- thrown when an unexpected error occurs
AlreadyLockedException
- when the object is already lockedprotected void commit(SharedReference reference) throws ShobException, NotLockedException
reference
- A SharedReference instance
ShobException
- thrown when an unexpected error occurs
NotLockedException
- when the object is not lockedprotected SharedReference getRemote(String globalName) throws ShobException
globalName
- the global name of a shared object
ShobException
- thrown when an unexpected error occursprotected void lock(String globalName)
globalName
- Description of the Parameterprotected void remove(String globalName)
globalName
- Description of the Parameterprotected void rollback(SharedReference reference) throws ShobException, NotLockedException
reference
- a SharedReference instance
ShobException
- thrown when an unexpected error occurs
NotLockedException
- when the object is not lockedprotected void unlock(String globalName)
globalName
- Description of the Parameterprotected void unshare(SharedReference reference) throws ShobException
reference
- Description of the Parameter
ShobException
- thrown when an unexpected error occursprotected void validate(SharedReference reference) throws ShobException
reference
- a SharedReference instance
ShobException
- thrown when an unexpected error occursprotected void validate(String globalName) throws ShobException
globalName
- Description of the Parameter
ShobException
- thrown when an unexpected error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |