org.apache.jdo.impl.fostore
Class LoginRequest

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

class LoginRequest
extends AbstractRequest

Request to login to a database.

Version:
1.0
Author:
Craig Russell

Field Summary
(package private)  boolean create
          A flag telling whether to create the database
(package private)  java.lang.String dbname
          The database name from the PMF URL property.
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.
(package private)  java.lang.String password
          The password from the PMF password property.
protected  FOStorePMF pmf
          PersistenceManagerFactory via which request is being done.
(package private)  byte[] secret
          The secret constructed from the user, timestamp, and password.
protected  org.apache.jdo.state.StateManagerInternal sm
          The state manager which is the subject of this request.
(package private)  long timestamp
          This is the Date.getTime() of the time the request was created.
(package private)  java.lang.String user
          The user from the PMF user property.
 
Constructor Summary
LoginRequest(Message m, FOStorePMF pmf, java.lang.String dbname, java.lang.String user, java.lang.String password, boolean create)
          Creates new LoginRequest
 
Method Summary
 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()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbname

java.lang.String dbname
The database name from the PMF URL property.


user

java.lang.String user
The user from the PMF user property.


password

java.lang.String password
The password from the PMF password property.


timestamp

long timestamp
This is the Date.getTime() of the time the request was created. It is used to construct the shared secret to verify the password at the server side, without transmitting the password in clear.


secret

byte[] secret
The secret constructed from the user, timestamp, and password.


create

boolean create
A flag telling whether to create the database


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

LoginRequest

public LoginRequest(Message m,
                    FOStorePMF pmf,
                    java.lang.String dbname,
                    java.lang.String user,
                    java.lang.String password,
                    boolean create)
Creates new LoginRequest

Parameters:
m - the Message
pmf - the PersistenceManagerFactory
user - the user
password - the password
Method Detail

doRequestBody

protected void doRequestBody()
                      throws java.io.IOException
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 - if any errors constructing the stream

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 -
length -
status - Indication as to the success, failure, etc. of the request as handled by the store.
Throws:
java.io.IOException

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()

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.