|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
unsw.cse.mica.tools.proxy.Proxy
public class Proxy
A Proxy represents the client-side version of information that lives somewhere on the Swarm server. It is essentially a wrapper for a Mob. However, since Mobs are considered immutable on the server-side, editing a Mob basically involves deleting the old Mob and writing a new one. We need some way to have a single client-side object that tracks an edit as a shift from one Mob to another. A Proxy does just that, it holds onto a single Mob and allows the editing of its fields and the ability to apply the edits to the server-side. This apply action deletes the current Mob (by ID) from the server, writes the current information as a new Mob and updates the Mob ID it now refers to.
Method Summary | |
---|---|
boolean |
applyChanges()
Transmit the current state of this Proxy to the server. |
boolean |
equals(java.lang.Object proxyObj)
Two proxies are considered to be equal if their names are not null and are equal. |
Mob |
getMob()
Return a Mob representation of this Proxy. |
java.lang.String |
getMobName()
Convenience method for getting the name of the Mob under this Proxy. |
int |
hashCode()
The contract for a hash code for an object requires that if two objects are equal() their hash codes must be the same. |
void |
setMob(Mob mob)
Update this Proxy's fields using the information in the given Mob |
void |
setMobName(java.lang.String mobName)
Convenience method for setting the name of the underlying mob |
java.lang.String |
toString()
|
void |
update()
Get the contents of this proxy from the server. |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public void setMob(Mob mob)
mob
- The new information for this Proxypublic Mob getMob()
public java.lang.String getMobName()
public void setMobName(java.lang.String mobName)
mobName
- The new name for the Mob shadowed by this Proxypublic boolean equals(java.lang.Object proxyObj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean applyChanges() throws MicaException
true
iff the changes were successfully made on the
server.
MicaException
public void update() throws MicaException
MicaException
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |