com.sun.sgs.impl.service.data.store.net
Interface DataStoreServer

All Superinterfaces:
Remote
All Known Implementing Classes:
DataStoreClientRemote, DataStoreProtocol, DataStoreProtocolClient, DataStoreServerImpl

public interface DataStoreServer
extends Remote

Defines the network interface for the data store server.


Method Summary
 void abort(long tid)
          Aborts the transaction.
 void commit(long tid)
          Commits the transaction.
 long createObject(long tid)
          Reserves an object ID for a new object.
 long createTransaction(long timeout)
          Creates a new transaction, and returns the associated ID, which will not be negative.
 BindingValue getBinding(long tid, String name)
          Obtains the object ID bound to a name.
 int getClassId(long tid, byte[] classInfo)
          Returns the class ID to represent classes with the specified class information.
 byte[] getClassInfo(long tid, int classId)
          Returns the class information associated with the specified class ID.
 byte[] getObject(long tid, long oid, boolean forUpdate)
          Obtains the data associated with an object ID.
 void markForUpdate(long tid, long oid)
          Notifies the server that an object is going to be modified.
 long newNodeId()
          Returns a new node ID for use with a newly started node.
 String nextBoundName(long tid, String name)
          Returns the next name after the specified name that has a binding, or null if there are no more bound names.
 long nextObjectId(long tid, long oid)
          Returns the object ID for the next object after the object with the specified ID, or -1 if there are no more objects.
 boolean prepare(long tid)
          Prepares the transaction to commit.
 void prepareAndCommit(long tid)
          Prepares and commits the transaction.
 BindingValue removeBinding(long tid, String name)
          Removes the binding for a name.
 void removeObject(long tid, long oid)
          Removes the object with the specified object ID.
 BindingValue setBinding(long tid, String name, long oid)
          Binds an object ID to a name.
 void setObject(long tid, long oid, byte[] data)
          Specifies data to associate with an object ID.
 void setObjects(long tid, long[] oids, byte[][] dataArray)
          Specifies data to associate with a series of object IDs.
 

Method Detail

newNodeId

long newNodeId()
               throws IOException
Returns a new node ID for use with a newly started node.

Returns:
the new node ID
Throws:
IOException - if a network problem occurs

createObject

long createObject(long tid)
                  throws IOException
Reserves an object ID for a new object. Note that calling other operations using this ID are not required to find the objects until setObject is called. Aborting a transaction is also not required to unassign any of the IDs so long as other operations treat them as non-existent objects.

Parameters:
tid - the ID of the transaction under which the operation should take place
Returns:
the new object ID
Throws:
IllegalArgumentException - if tid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

markForUpdate

void markForUpdate(long tid,
                   long oid)
                   throws IOException
Notifies the server that an object is going to be modified.

Parameters:
tid - the ID of the transaction under which the operation should take place
oid - the object ID
Throws:
IllegalArgumentException - if tid or oid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

getObject

byte[] getObject(long tid,
                 long oid,
                 boolean forUpdate)
                 throws IOException
Obtains the data associated with an object ID. If the forUpdate parameter is true, the caller is stating its intention to modify the object.

Parameters:
tid - the ID of the transaction under which the operation should take place
oid - the object ID
forUpdate - whether the caller intends to modify the object
Returns:
the data associated with the object ID
Throws:
IllegalArgumentException - if tid or oid is negative
ObjectNotFoundException - if the object is not found
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

setObject

void setObject(long tid,
               long oid,
               byte[] data)
               throws IOException
Specifies data to associate with an object ID.

Parameters:
tid - the ID of the transaction under which the operation should take place
oid - the object ID
data - the data
Throws:
IllegalArgumentException - if tid or oid is negative, or if data is empty
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

setObjects

void setObjects(long tid,
                long[] oids,
                byte[][] dataArray)
                throws IOException
Specifies data to associate with a series of object IDs.

Parameters:
tid - the ID of the transaction under which the operation should take place
oids - the object IDs
dataArray - the associated data values
Throws:
IllegalArgumentException - if tid is negative, if oids and data are not the same length, or if oids contains a value that is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

removeObject

void removeObject(long tid,
                  long oid)
                  throws IOException
Removes the object with the specified object ID.

Parameters:
tid - the ID of the transaction under which the operation should take place
oid - the object ID
Throws:
IllegalArgumentException - if tid or oid is negative
ObjectNotFoundException - if the object is not found
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

getBinding

BindingValue getBinding(long tid,
                        String name)
                        throws IOException
Obtains the object ID bound to a name. If the name is bound, the return value contains the object ID that the name is bound to and a next name of null. If the name is not bound, the return value contains an object ID of -1 and the next name found, which may be null.

Parameters:
tid - the ID of the transaction under which the operation should take place
name - the name
Returns:
information about the object ID and the next name
Throws:
IllegalArgumentException - if tid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

setBinding

BindingValue setBinding(long tid,
                        String name,
                        long oid)
                        throws IOException
Binds an object ID to a name. If the name is bound, the return value contains an arbitrary non-negative object ID and a next name of null. If the name is not bound, the return value contains an object ID of -1 and the next name found, which may be null.

Parameters:
tid - the ID of the transaction under which the operation should take place
name - the name
oid - the object ID
Returns:
information about the object ID and the next name
Throws:
IllegalArgumentException - if tid or oid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

removeBinding

BindingValue removeBinding(long tid,
                           String name)
                           throws IOException
Removes the binding for a name. If the name is bound, the return value contains an arbitrary non-negative object ID, otherwise it contains -1. In all cases, the return value contains the next name found, which may be null.

Parameters:
tid - the ID of the transaction under which the operation should take place
name - the name
Returns:
information about the object ID and the next name
Throws:
IllegalArgumentException - if tid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

nextBoundName

String nextBoundName(long tid,
                     String name)
                     throws IOException
Returns the next name after the specified name that has a binding, or null if there are no more bound names. If name is null, then the search starts at the beginning.

Parameters:
tid - the ID of the transaction under which the operation should take place
name - the name to search after, or null to start at the beginning
Returns:
the next name with a binding following name, or null if there are no more bound names
Throws:
IllegalArgumentException - if tid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

getClassId

int getClassId(long tid,
               byte[] classInfo)
               throws IOException
Returns the class ID to represent classes with the specified class information. Obtains an existing ID for the class information if present; otherwise, stores the information and returns the new ID associated with it. Class IDs are always greater than 0. The class information is the serialized form of the ObjectStreamClass instance that serialization uses to represent the class.

Parameters:
tid - the ID of the transaction under which the operation should take place
classInfo - the class information
Returns:
the associated class ID
Throws:
IllegalArgumentException - if tid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

getClassInfo

byte[] getClassInfo(long tid,
                    int classId)
                    throws ClassInfoNotFoundException,
                           IOException
Returns the class information associated with the specified class ID. The class information is the serialized form of the ObjectStreamClass instance that serialization uses to represent the class.

Parameters:
tid - the ID of the transaction under which the operation should take place
classId - the class ID
Returns:
the associated class information
Throws:
IllegalArgumentException - if tid is negative, or if classId is not greater than 0
ClassInfoNotFoundException - if the ID is not found
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
IllegalStateException - if the operation failed because of a problem with the transaction
IOException - if a network problem occurs

nextObjectId

long nextObjectId(long tid,
                  long oid)
                  throws IOException
Returns the object ID for the next object after the object with the specified ID, or -1 if there are no more objects. If objectId is -1, then returns the ID of the first object. The IDs returned by this method will not include ones for objects that have already been removed, and may not include identifiers for objects created after an iteration has begun. It is not an error for the object associated with the specified identifier to have already been removed.

Parameters:
tid - the ID of the transaction
oid - the identifier of the object to search after, or -1 to request the first object
Returns:
the identifier of the next object following the object with identifier oid, or -1 if there are no more objects
Throws:
IllegalArgumentException - if tid or oid is negative
TransactionAbortedException - if the transaction was aborted due to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a problem with the current transaction
IOException - if a network problem occurs

createTransaction

long createTransaction(long timeout)
                       throws IOException
Creates a new transaction, and returns the associated ID, which will not be negative.

Parameters:
timeout - the number of milliseconds the resulting transaction should be allowed to run before it times out
Returns:
the ID of the new transaction
Throws:
IllegalArgumentException - if the argument is less than or equal to 0
IOException - if a network problem occurs

prepare

boolean prepare(long tid)
                throws IOException
Prepares the transaction to commit. Returns true when no state was modified, and neither commit or abort should be called.

Parameters:
tid - the ID of the transaction
Returns:
true if this participant is read-only, otherwise false
Throws:
IllegalArgumentException - if tid is negative
IllegalStateException - if the transaction has been prepared, committed, or aborted, or if the transaction is not known
IOException - if a network problem occurs

commit

void commit(long tid)
            throws IOException
Commits the transaction.

Parameters:
tid - the ID of the transaction
Throws:
IllegalArgumentException - if tid is negative
IllegalStateException - if the transaction has not been prepared, if it has been committed or aborted, or if the transaction is not known
IOException - if a network problem occurs

prepareAndCommit

void prepareAndCommit(long tid)
                      throws IOException
Prepares and commits the transaction.

Parameters:
tid - the ID of the transaction
Throws:
IllegalArgumentException - if tid is negative
IllegalStateException - if the transaction has been prepared, committed, or aborted, or if the transaction is not known
IOException - if a network problem occurs

abort

void abort(long tid)
           throws IOException
Aborts the transaction.

Parameters:
tid - the ID of the transaction
Throws:
IllegalArgumentException - if tid is negative
IllegalStateException - if the transaction has been committed or aborted, or if the transaction is not known
IOException - if a network problem occurs

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved