|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcs138.tapestry.TapestryNodeImpl
public class TapestryNodeImpl
The actual implementation of the TapestryNode. You will write most of your code here.
| Constructor Summary | |
|---|---|
TapestryNodeImpl()
|
|
| Method Summary | |
|---|---|
boolean |
equals(TapestryNode x)
Returns true if the hashes for both nodes are equal. |
java.lang.Object |
findObject(java.lang.String key)
Route towards the surrogate nodes for the key's salted hash values and attempt to get the closest location for the object from the first surrogate node that is successfully contacted. |
TapestryEnvironment |
getEnvironment()
Returns the environment which this node was created in. |
java.lang.String |
getIdentifier()
Returns the identifying string for this node. |
boolean |
getLocation(java.lang.String key,
java.math.BigInteger hash,
cs138.tapestry.TapestryResponseInterface response)
Called by other nodes that would like to know where it can find replicas for the object associated with the given key. |
java.lang.Class<? extends NodeMonitor> |
getMonitorInterface()
This returns the Node implementation specific monitor that will be used. |
TapestryNeighborMap |
getNeighborMap()
Returns the remote stub for this node's neighbor map. |
java.math.BigInteger |
getNodeHash()
Returns the hash value for this node. |
int |
getNumObjects()
Returns the number of objects stored at this node. |
java.lang.Object |
getObject(java.lang.String key)
Return a copy of the object identified by the specified key. |
java.util.List<java.lang.String> |
getObjectList()
Returns a list of the keys stored at this replica. |
java.util.LinkedList<TapestryObjectLocation> |
getObjectLocations()
Returns a list of the object to location mappings stored at this node. |
void |
hello(TapestryNodePrivate node)
This method is called by another node when it has recently entered the network. |
void |
initialize(java.lang.String id,
ManageableNode node,
NodeMonitor monitor)
Initializes a new node |
boolean |
notifySurrogate(TapestryNodePrivate node)
This node is being informed by the caller that the node specified by the "node" variable has just started and might be the new surrogate for some of the mappings this node is holding. |
void |
ping()
This method is used in nodes to determine that they are still up. |
boolean |
publishLocation(java.lang.String key,
java.math.BigInteger hash,
TapestryNodeCache cache)
Called by other nodes in an attempt to publish the location of an object (with a specific salted hash value) at this node. |
void |
publishObject(java.lang.String key,
java.lang.Object data)
You should store a copy of the object at this node and then attempt to contact the object's surrogate to publish this node as a location for the object. |
void |
removeLocation(java.lang.String key,
TapestryNodeCache cache)
Called by other nodes when they would like to remove a replica from the object location information for the object specified by the given key. |
void |
stop()
Performs a hard shutdown at this node. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TapestryNodeImpl()
throws java.rmi.RemoteException
java.rmi.RemoteException| Method Detail |
|---|
public void initialize(java.lang.String id,
ManageableNode node,
NodeMonitor monitor)
throws java.rmi.RemoteException
ManageableNode
initialize in interface ManageableNodeid - The identifier of the nodenode - A gateway node, may be nullmonitor - The default monitor to attach
java.rmi.RemoteException
public void stop()
throws java.rmi.RemoteException
stop in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.stop()
public boolean notifySurrogate(TapestryNodePrivate node)
throws java.rmi.RemoteException
notifySurrogate in interface TapestryNodePrivatenode - Another Tapestry node.
java.rmi.RemoteExceptioncs138.tapestry.TapestryNodeFactory.TapestryNodePrivate#notifySurrogate(cs138.tapestry.TapestryNodeFactory.TapestryNodePrivate)
public void hello(TapestryNodePrivate node)
throws java.rmi.RemoteException
hello in interface TapestryNodePrivatenode - Another Tapestry node.
java.rmi.RemoteExceptioncs138.tapestry.TapestryNodeFactory.TapestryNodePrivate#hello(cs138.tapestry.TapestryNodeFactory.TapestryNodePrivate)
public java.lang.Object findObject(java.lang.String key)
throws java.rmi.RemoteException
findObject in interface TapestryNodekey - The object's key.
java.rmi.RemoteExceptionTapestryNode.findObject(java.lang.String)
public boolean publishLocation(java.lang.String key,
java.math.BigInteger hash,
TapestryNodeCache cache)
throws java.rmi.RemoteException
publishLocation in interface TapestryNodePrivatekey - The object's key.hash - The salted hash of the key.cache - The cache of the node at which a replica of the object is stored.
java.rmi.RemoteExceptioncs138.tapestry.TapestryNodePrivate#publishLocation(java.lang.String,
java.math.BigInteger, cs138.tapestry.TapestryNodePrivate)
public boolean getLocation(java.lang.String key,
java.math.BigInteger hash,
cs138.tapestry.TapestryResponseInterface response)
throws java.rmi.RemoteException
getLocation in interface TapestryNodePrivatekey - The object's key.hash - The key's salted hash.response - The cache to store the object location information in.
java.rmi.RemoteExceptioncs138.tapestry.TapestryNodePrivate#getLocation(java.lang.String,
java.math.BigInteger,
cs138.tapestry.TapestryEnvironment.TapestryResponseCache)
public void removeLocation(java.lang.String key,
TapestryNodeCache cache)
throws java.rmi.RemoteException
removeLocation in interface TapestryNodePrivatekey - The object's key.cache - The failed replica of the object.
java.rmi.RemoteExceptionTapestryNodePrivate.removeLocation(java.lang.String,
cs138.tapestry.TapestryNodeCache)
public void publishObject(java.lang.String key,
java.lang.Object data)
throws java.rmi.RemoteException
publishObject in interface TapestryNodekey - The key for the object.data - The object's data.
java.rmi.RemoteExceptionTapestryNode.publishObject(java.lang.String,
java.lang.Object)
public java.lang.Object getObject(java.lang.String key)
throws java.rmi.RemoteException
getObject in interface TapestryNodePrivatekey - The key for the object
java.rmi.RemoteExceptioncs138.tapestry.TapestryNode#getObject(java.lang.String)
public java.util.List<java.lang.String> getObjectList()
throws java.rmi.RemoteException
getObjectList in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.getObjectList()
public java.lang.String getIdentifier()
throws java.rmi.RemoteException
getIdentifier in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.getIdentifier()
public java.math.BigInteger getNodeHash()
throws java.rmi.RemoteException
getNodeHash in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.getNodeHash()
public int getNumObjects()
throws java.rmi.RemoteException
getNumObjects in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.getNumObjects()
public TapestryNeighborMap getNeighborMap()
throws java.rmi.RemoteException
getNeighborMap in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.getNeighborMap()
public TapestryEnvironment getEnvironment()
throws java.rmi.RemoteException
getEnvironment in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.getEnvironment()
public boolean equals(TapestryNode x)
throws java.rmi.RemoteException
equals in interface TapestryNodex - Another Tapestry node.
java.rmi.RemoteExceptionTapestryNode.equals(cs138.tapestry.TapestryNode)
public java.util.LinkedList<TapestryObjectLocation> getObjectLocations()
throws java.rmi.RemoteException
getObjectLocations in interface TapestryNodejava.rmi.RemoteExceptionTapestryNode.getObjectLocations()
public void ping()
throws java.rmi.RemoteException
ManageableNode
ping in interface ManageableNodejava.rmi.RemoteException
public java.lang.Class<? extends NodeMonitor> getMonitorInterface()
throws java.rmi.RemoteException
ManageableNode
getMonitorInterface in interface ManageableNodejava.rmi.RemoteException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||