org.apache.jdo.impl.fostore
Class FetchRequest

java.lang.Object
  extended byorg.apache.jdo.impl.fostore.AbstractRequest
      extended byorg.apache.jdo.impl.fostore.FetchRequest
All Implemented Interfaces:
FieldRequest, Request

class FetchRequest
extends AbstractRequest
implements FieldRequest

Represents a request to read the values of one or more fields for a persistent object from the store.

Author:
Dave Bristor

Field Summary
protected  FOStoreSchemaUID fsuid
          uid corresponding to the same java.lang.Class that initializes jdoClass.
protected  JDOClass jdoClass
          Class meta data of the object represented by the constructor's given state manager
protected static int LENGTH_COOKIE
           
(package private) static org.apache.commons.logging.Log logger
          Logger
protected static I18NHelper msg
           
private  OID oid
           
protected  FOStoreOutput out
          Stream to which request writes itself.
private  java.lang.Object owner
           
private  PersistenceManagerInternal pm
           
protected  FOStorePMF pmf
          PersistenceManagerFactory via which request is being done.
protected  StateManagerInternal sm
          The state manager which is the subject of this request.
 
Constructor Summary
(package private) FetchRequest(StateManagerInternal sm, Message m, FOStorePMF pmf)
           
 
Method Summary
 void addFieldNum(int fieldNum)
          Adds to the set of fields that are to be manipulated.
 void doRequest()
          Does whatever it is that the kind of request does in actually making a request of the store.
protected  void doRequestBody()
          Subclasses must implement in this method the actual writing of their Request type-specific data.
protected  RequestId getId()
           
 StateManagerInternal getStateManager()
          Get the StateManager associated with this request, null if none.
 void handleReply(Status status, java.io.DataInput in, int length)
          Processes the results of the effect of the request in the store.
 void setFieldNums(int[] fieldNums)
          Determines which fields (at least) will be read from the store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oid

private final OID oid

owner

private final java.lang.Object owner

pm

private final PersistenceManagerInternal pm

sm

protected StateManagerInternal sm
The state manager which is the subject of this request.


pmf

protected final FOStorePMF pmf
PersistenceManagerFactory via which request is being done.


out

protected final FOStoreOutput out
Stream to which request writes itself.


jdoClass

protected JDOClass jdoClass
Class meta data of the object represented by the constructor's given state manager


fsuid

protected FOStoreSchemaUID fsuid
uid corresponding to the same java.lang.Class that initializes jdoClass.


msg

protected static final I18NHelper msg

logger

static final org.apache.commons.logging.Log logger
Logger


LENGTH_COOKIE

protected static final int LENGTH_COOKIE
See Also:
Constant Field Values
Constructor Detail

FetchRequest

FetchRequest(StateManagerInternal sm,
             Message m,
             FOStorePMF pmf)
Method Detail

doRequestBody

protected void doRequestBody()
                      throws java.io.IOException
Description copied from class: AbstractRequest
Subclasses must implement in this method the actual writing of their Request type-specific data.

Specified by:
doRequestBody in class AbstractRequest
Throws:
java.io.IOException

handleReply

public void handleReply(Status status,
                        java.io.DataInput in,
                        int length)
                 throws java.io.IOException
Description copied from interface: Request
Processes the results of the effect of the request in the store. To be invoked after the store has processed the request, and has returned information about that request, such as its status and any accompanying data.

Specified by:
handleReply in interface Request
Parameters:
in - the input stream.
length - the length of data in the stream.
status - Indication as to the success, failure, etc. of the request as handled by the store.
Throws:
java.io.IOException - if any problems reading the stream.

setFieldNums

public void setFieldNums(int[] fieldNums)
Determines which fields (at least) will be read from the store. We say 'at least' because while we guarantee that the specified fields will be read, other fields may be read; this is implementation dependent.

Specified by:
setFieldNums in interface FieldRequest
Parameters:
fieldNums - Numbers of the fields which are to be read from the store.

addFieldNum

public void addFieldNum(int fieldNum)
Adds to the set of fields that are to be manipulated.

Specified by:
addFieldNum in interface FieldRequest
Parameters:
fieldNum - Number of the field to be manipulated.

doRequest

public void doRequest()
               throws java.io.IOException
Does whatever it is that the kind of request does in actually making a request of the store.

Throws:
java.io.IOException - in case of errors with the stream.

getStateManager

public StateManagerInternal getStateManager()
Get the StateManager associated with this request, null if none.

Returns:
the StateManager.

getId

protected RequestId getId()