org.apache.jdo.impl.fostore
Class AbstractFieldRequest

java.lang.Object
  extended byorg.apache.jdo.impl.fostore.AbstractRequest
      extended byorg.apache.jdo.impl.fostore.AbstractFieldRequest
All Implemented Interfaces:
org.apache.jdo.state.FieldManager, Request
Direct Known Subclasses:
InsertRequest

abstract class AbstractFieldRequest
extends AbstractRequest
implements org.apache.jdo.state.FieldManager

This is an AbstractRequest that uses an exception-throwing implementation FieldManager to implement that interface. Subclasses can override particular FieldManager methods they need. E.g., a subclass might override only the storeABCField methods, knowing that its fetchABCField methods will never be invoked.

Author:
Dave Bristor

Field Summary
private  AbstractFieldManager afm
           
protected  FOStoreSchemaUID fsuid
          uid corresponding to the same java.lang.Class that initializes jdoClass.
protected  org.apache.jdo.model.jdo.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 org.apache.jdo.util.I18NHelper msg
           
protected  FOStoreOutput out
          Stream to which request writes itself.
protected  FOStorePMF pmf
          PersistenceManagerFactory via which request is being done.
protected  org.apache.jdo.state.StateManagerInternal sm
          The state manager which is the subject of this request.
 
Constructor Summary
(package private) AbstractFieldRequest(org.apache.jdo.state.StateManagerInternal sm, Message m, FOStorePMF pmf)
           
 
Method Summary
 void doRequest()
          Does whatever it is that the kind of request does in actually making a request of the store.
protected abstract  void doRequestBody()
          Subclasses must implement in this method the actual writing of their Request type-specific data.
 boolean fetchBooleanField(int fieldNum)
           
 byte fetchByteField(int fieldNum)
           
 char fetchCharField(int fieldNum)
           
 double fetchDoubleField(int fieldNum)
           
 float fetchFloatField(int fieldNum)
           
 int fetchIntField(int fieldNum)
           
 long fetchLongField(int fieldNum)
           
 java.lang.Object fetchObjectField(int fieldNum)
           
 short fetchShortField(int fieldNum)
           
 java.lang.String fetchStringField(int fieldNum)
           
protected  RequestId getId()
           
 org.apache.jdo.state.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 storeBooleanField(int fieldNum, boolean value)
           
 void storeByteField(int fieldNum, byte value)
           
 void storeCharField(int fieldNum, char value)
           
 void storeDoubleField(int fieldNum, double value)
           
 void storeFloatField(int fieldNum, float value)
           
 void storeIntField(int fieldNum, int value)
           
 void storeLongField(int fieldNum, long value)
           
 void storeObjectField(int fieldNum, java.lang.Object value)
           
 void storeShortField(int fieldNum, short value)
           
 void storeStringField(int fieldNum, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

afm

private AbstractFieldManager afm

sm

protected org.apache.jdo.state.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 org.apache.jdo.model.jdo.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 org.apache.jdo.util.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

AbstractFieldRequest

AbstractFieldRequest(org.apache.jdo.state.StateManagerInternal sm,
                     Message m,
                     FOStorePMF pmf)
Method Detail

storeBooleanField

public void storeBooleanField(int fieldNum,
                              boolean value)
Specified by:
storeBooleanField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeBooleanField(int fieldNum, boolean value)

fetchBooleanField

public boolean fetchBooleanField(int fieldNum)
Specified by:
fetchBooleanField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchBooleanField(int fieldNum)

storeCharField

public void storeCharField(int fieldNum,
                           char value)
Specified by:
storeCharField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeCharField(int fieldNum, char value)

fetchCharField

public char fetchCharField(int fieldNum)
Specified by:
fetchCharField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchCharField(int fieldNum)

storeByteField

public void storeByteField(int fieldNum,
                           byte value)
Specified by:
storeByteField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeByteField(int fieldNum, byte value)

fetchByteField

public byte fetchByteField(int fieldNum)
Specified by:
fetchByteField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchByteField(int fieldNum)

storeShortField

public void storeShortField(int fieldNum,
                            short value)
Specified by:
storeShortField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeShortField(int fieldNum, short value)

fetchShortField

public short fetchShortField(int fieldNum)
Specified by:
fetchShortField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchShortField(int fieldNum)

storeIntField

public void storeIntField(int fieldNum,
                          int value)
Specified by:
storeIntField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeIntField(int fieldNum, int value)

fetchIntField

public int fetchIntField(int fieldNum)
Specified by:
fetchIntField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchIntField(int fieldNum)

storeLongField

public void storeLongField(int fieldNum,
                           long value)
Specified by:
storeLongField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeLongField(int fieldNum, long value)

fetchLongField

public long fetchLongField(int fieldNum)
Specified by:
fetchLongField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchLongField(int fieldNum)

storeFloatField

public void storeFloatField(int fieldNum,
                            float value)
Specified by:
storeFloatField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeFloatField(int fieldNum, float value)

fetchFloatField

public float fetchFloatField(int fieldNum)
Specified by:
fetchFloatField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchFloatField(int fieldNum)

storeDoubleField

public void storeDoubleField(int fieldNum,
                             double value)
Specified by:
storeDoubleField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeDoubleField(int fieldNum, double value)

fetchDoubleField

public double fetchDoubleField(int fieldNum)
Specified by:
fetchDoubleField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchDoubleField(int fieldNum)

storeStringField

public void storeStringField(int fieldNum,
                             java.lang.String value)
Specified by:
storeStringField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeStringField(int fieldNum, String value)

fetchStringField

public java.lang.String fetchStringField(int fieldNum)
Specified by:
fetchStringField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchStringField(int fieldNum)

storeObjectField

public void storeObjectField(int fieldNum,
                             java.lang.Object value)
Specified by:
storeObjectField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.storeObjectField(int fieldNum, Object value)

fetchObjectField

public java.lang.Object fetchObjectField(int fieldNum)
Specified by:
fetchObjectField in interface org.apache.jdo.state.FieldManager
See Also:
FieldManager.fetchObjectField(int fieldNum)

getId

protected RequestId getId()

doRequest

public final void doRequest()
                     throws java.io.IOException
Description copied from interface: Request
Does whatever it is that the kind of request does in actually making a request of the store.

Specified by:
doRequest in interface Request
Throws:
java.io.IOException - in case of errors with the stream.
See Also:
Request.doRequest()

doRequestBody

protected abstract void doRequestBody()
                               throws java.io.IOException
Subclasses must implement in this method the actual writing of their Request type-specific data.

Throws:
java.io.IOException

getStateManager

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

Specified by:
getStateManager in interface Request
Returns:
the StateManager.

handleReply

public void handleReply(Status status,
                        java.io.DataInput in,
                        int length)
                 throws java.io.IOException
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.

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.