org.hypergraphdb.peer.jxta
Class JXTARemotePeer

java.lang.Object
  extended by org.hypergraphdb.peer.RemotePeer
      extended by org.hypergraphdb.peer.jxta.JXTARemotePeer

public class JXTARemotePeer
extends RemotePeer

Author:
Cipri Costa Remote peer implementation based on JXTA.

Constructor Summary
JXTARemotePeer(net.jxta.document.Advertisement adv)
           
 
Method Summary
 HGHandle add(java.lang.Object atom)
          Adds the atom on the remote peer.
 void copyFrom(HGPersistentHandle handle)
          Copies the atom with a given handle from the remote peer to the local peer.
 void copyTo(HGHandle handle)
          Copies the atom from a given handle from the local peer to the remote peer.
 void define(HGPersistentHandle handle, java.lang.Object atom)
          Similar to add but with a given handle
 java.lang.Object get(HGHandle handle)
           
 java.util.ArrayList<?> query(HGQueryCondition condition, boolean getObjects)
          Executes a query on the remote peer
 HGHandle remove(HGPersistentHandle handle)
          Removes the handle from the remote peer.
 void replace(HGPersistentHandle handle, java.lang.Object atom)
          Replaces the atom with the given handle on the remote peer.
 
Methods inherited from class org.hypergraphdb.peer.RemotePeer
endBatch, flushBatch, getLocalPeer, getName, insideBatch, setLocalPeer, setName, startBatch, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JXTARemotePeer

public JXTARemotePeer(net.jxta.document.Advertisement adv)
Method Detail

query

public java.util.ArrayList<?> query(HGQueryCondition condition,
                                    boolean getObjects)
Description copied from class: RemotePeer
Executes a query on the remote peer

Specified by:
query in class RemotePeer
Parameters:
condition - a HGQueryCondition to be executed on the remote peer.
getObjects - if true the actual objects are returned, otherwise the client will just get a set of handles.
Returns:
The result of the remote query (depending on the getObjects parameter the list will contain the objects of just the handles)

get

public java.lang.Object get(HGHandle handle)
Specified by:
get in class RemotePeer
Parameters:
handle - The handle of the atom to be retrieved
Returns:
The atom with the given handle from the remote peer. If no such handle exists on the remote peer, the function will return null

copyFrom

public void copyFrom(HGPersistentHandle handle)
Description copied from class: RemotePeer
Copies the atom with a given handle from the remote peer to the local peer.

Specified by:
copyFrom in class RemotePeer

add

public HGHandle add(java.lang.Object atom)
Description copied from class: RemotePeer
Adds the atom on the remote peer. The operation is implemented using the replication mechanism, so, even if it fails, it is registered in the logs and will be sent to the target when the target will start a catch-up phase.

Specified by:
add in class RemotePeer
Parameters:
atom - The atom to be added
Returns:

define

public void define(HGPersistentHandle handle,
                   java.lang.Object atom)
Description copied from class: RemotePeer
Similar to add but with a given handle

Specified by:
define in class RemotePeer

copyTo

public void copyTo(HGHandle handle)
Description copied from class: RemotePeer
Copies the atom from a given handle from the local peer to the remote peer.

Specified by:
copyTo in class RemotePeer

remove

public HGHandle remove(HGPersistentHandle handle)
Description copied from class: RemotePeer
Removes the handle from the remote peer. The operation is implemented using the replication mechanism, so, even if it fails, it is registered in the logs and will be sent to the target when the target will start a catch-up phase.

Specified by:
remove in class RemotePeer
Parameters:
handle - the handle to remove from the remote peer.
Returns:

replace

public void replace(HGPersistentHandle handle,
                    java.lang.Object atom)
Description copied from class: RemotePeer
Replaces the atom with the given handle on the remote peer. The operation is implemented using the replication mechanism, so, even if it fails, it is registered in the logs and will be sent to the target when the target will start a catch-up phase.

Specified by:
replace in class RemotePeer
Parameters:
handle - the handle of the atom to be replaced
atom - the new atom