|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.xmlstore.stores.AbstractXMLStore<ValueReference>
org.planx.xmlstore.stores.DistributedXMLStore
public class DistributedXMLStore
A peer-to-peer XMLStore that uses Kademlia as routing module.
It only operates on location independent ValueReferences. If an
XMLStore that does not operate on ValueReferences is
used as the underlying XMLStore (e.g. LocalXMLStore), it must
be wrapped in a TranslatorXMLStore. System applications that need access
to the routing module instance can get so by calling the getDistributedMap()
method.
The store implements the ExecXMLStore interface,
but it will throw UnsupportedOperationException if
exec is invoked and the underlying XML Store does not
implement the ExecXMLStore interface.
| Constructor Summary | |
|---|---|
DistributedXMLStore(XMLStore<ValueReference> xmlstore,
int udpPort,
int tcpPort,
InetSocketAddress bootstrap)
Creates a DistributedXMLStore which listens for routing requests on the
specified UDP port and listens for data transfer requests on the specified
TCP port. |
|
DistributedXMLStore(XMLStore<ValueReference> xmlstore,
int udpPort,
int tcpPort,
InetSocketAddress bootstrap,
Configuration conf,
int repLevel)
Creates a DistributedXMLStore which listens for routing requests on the
specified UDP port and listens for data transfer requests on the specified
TCP port. |
|
| Method Summary | |
|---|---|
void |
close()
The method is used to let the XMLStore properly commit all
data to the underlying ressource, release resources, and so
forth. |
ValueReference |
exec(ValueReference code,
ValueReference args)
Execute the code referenced by codeRef supplied
with the argument reference by argsRef. |
DistributedMap |
getDistributedMap()
Returns the DistributedMap used by this DistributedXMLStore
to exchange peer-to-peer information. |
NameServer<ValueReference> |
getNameServer()
Returns a GlobalNameServer that uses the same DistributedMap
as this DistributedXMLStore. |
Node |
load(ValueReference vref)
If the Reference is not known in the underlying
XMLStore it is looked up in the network and loaded from
another peer if it exists. |
ValueReference |
save(Node node)
Always saves locally even if the node might already be stored elsewhere in the network. |
| Methods inherited from class org.planx.xmlstore.stores.AbstractXMLStore |
|---|
toString |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DistributedXMLStore(XMLStore<ValueReference> xmlstore,
int udpPort,
int tcpPort,
InetSocketAddress bootstrap)
throws IOException
DistributedXMLStore which listens for routing requests on the
specified UDP port and listens for data transfer requests on the specified
TCP port. The XMLStore is bootstraped to an existing XMLStore network
by specifying a bootstrap IP and UDP port. If the bootstrap IP is
null the XML Store will not attempt to connect to an existing
network. The DistributedXMLStore only saves locally.
xmlstore - The underlying XMLStore.udpPort - UDP port on which to listen for routing requeststcpPort - TCP port on which to listen for data transfer requestsbootstrap - IP and UDP port of an existing peer in the network
IOException
public DistributedXMLStore(XMLStore<ValueReference> xmlstore,
int udpPort,
int tcpPort,
InetSocketAddress bootstrap,
Configuration conf,
int repLevel)
throws IOException
Creates a DistributedXMLStore which listens for routing requests on the
specified UDP port and listens for data transfer requests on the specified
TCP port. The XMLStore is bootstraped to an existing XMLStore network
by specifying a bootstrap IP and UDP port. If the bootstrap IP is
null the XMLStore will not attempt to connect to an existing
network.
The DistributedXMLStore always saves locally but will also replicate
data to repLevel other peers, where repLevel is
a number which is less than or equal to Configuration.K. This
coupling between repLevel and the Kademlia implementation
of the routing layer should be viewed as a short-coming of the Kademlia
implementation rather than a restriction on future routing layer
implementations.
xmlstore - The underlying XMLStore.udpPort - UDP port on which to listen for routing requeststcpPort - TCP port on which to listen for data transfer requestsbootstrap - IP and UDP port of an existing peer in the networkconf - Kademlia configuration. If null a default
configuration is used.repLevel - Replication level, that is, number of peers beyond
the local peer that saved data will be replicated to. Note that for
the Kademlia routing implementation, this number can at most be
K - the Kademlia bucket/neighbourhood size.
IOException| Method Detail |
|---|
public NameServer<ValueReference> getNameServer()
GlobalNameServer that uses the same DistributedMap
as this DistributedXMLStore.
getNameServer in interface XMLStore<ValueReference>getNameServer in class AbstractXMLStore<ValueReference>public DistributedMap getDistributedMap()
DistributedMap used by this DistributedXMLStore
to exchange peer-to-peer information.
public void close()
throws IOException
XMLStoreXMLStore properly commit all
data to the underlying ressource, release resources, and so
forth. Once close has been issued on an XMLStore, the store
is no longer available for handling requests. Any subsequent
request to the store will result in an exception being
thrown. An XMLStore implementation has to ensure that
this happens.
close in interface XMLStore<ValueReference>close in class AbstractXMLStore<ValueReference>IOException - if it is not possible to properly close the store
public ValueReference save(Node node)
throws IOException
save in interface XMLStore<ValueReference>save in class AbstractXMLStore<ValueReference>node - representing XML data in the form of semi-structured tree data
IOException - if an error occurs during disk, network, etc access
public Node load(ValueReference vref)
throws IOException
Reference is not known in the underlying
XMLStore it is looked up in the network and loaded from
another peer if it exists. If the Reference could
not be found an UnknownReferenceException is thrown.
load in interface XMLStore<ValueReference>load in class AbstractXMLStore<ValueReference>vref - the Reference to the data
IOException - if an error occurs during disk, network, etc access
UnknownReferenceException - if the data referenced is not stored
in the XMLStore or the Reference is of
a type not supported by the XMLStore
public ValueReference exec(ValueReference code,
ValueReference args)
throws IOException,
ExecException,
UnsupportedOperationException
ExecXMLStorecodeRef supplied
with the argument reference by argsRef. Returns
a reference to the result of the execution.
exec in interface ExecXMLStore<ValueReference>code - the Reference to a
binary node containing class code implementing StoredCodeargs - reference to arguments
IOException - if an error occurs during loading of code or arguments
ExecException
UnsupportedOperationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||