edu.indiana.dde.mylead.dai
Class MyLeadReplicaActivity

java.lang.Object
  extended by uk.org.ogsadai.engine.Activity
      extended by uk.org.ogsadai.activity.sql.SQLActivity
          extended by edu.indiana.dde.mylead.dai.MyLeadActivity
              extended by edu.indiana.dde.mylead.dai.MyLeadReplicaActivity
Direct Known Subclasses:
MyLeadCreateReplicaImpl, MyLeadUpdateReplicaImpl

public abstract class MyLeadReplicaActivity
extends MyLeadActivity

Handles Replica related Elements from a Grid Data Service Document.


Nested Class Summary
 
Nested classes/interfaces inherited from class uk.org.ogsadai.activity.sql.SQLActivity
uk.org.ogsadai.activity.sql.SQLActivity.ParameterInput, uk.org.ogsadai.activity.sql.SQLActivity.StreamInput, uk.org.ogsadai.activity.sql.SQLActivity.ValueInput
 
Field Summary
protected static java.lang.String CREATOR_DN
           
protected static java.lang.String DEFAULT_DATE
           
protected  int mBadDate
           
protected  int mBadReplicas
           
protected  int mNoData
           
protected  int mUserId
           
protected static java.lang.String[] REPLICA_COL_NAMES
           
protected static java.lang.String REPLICA_NAME
           
protected static java.lang.String[] REPLICA_TAGS
           
protected static java.lang.String REPLICA_TBL_CREATETIME
           
protected static java.lang.String REPLICA_TBL_CREATOR
           
protected static java.lang.String REPLICA_TBL_MODIFIEDBY
           
protected static java.lang.String REPLICA_TBL_MODIFYTIME
           
protected static java.lang.String REPLICA_TBL_NAME
           
protected static java.lang.String REPLICA_TBL_UPDDATE
           
protected static java.lang.String REPLICA_UPDDATE
           
protected  org.w3c.dom.NodeList replicaList
           
protected static java.lang.String USER_COL_DN
           
protected static java.lang.String USER_COL_ID
           
 
Fields inherited from class edu.indiana.dde.mylead.dai.MyLeadActivity
AUTHORITY_ADDATTR, AUTHORITY_CREATE, AUTHORITY_DEL_REPLICA, AUTHORITY_DEL_USER, AUTHORITY_DELETEATTR, AUTHORITY_UPDATE, mActivityName, mDn, mTimingPnt, MYLEAD_DB, MYLEAD_WRITER_REPLICA, MYLEAD_WRITER_TBL, startTime
 
Fields inherited from class uk.org.ogsadai.activity.sql.SQLActivity
CREATE_DATABASE, DROP_DATABASE, EXPRESSION, mAllInput, mConnection, mConnectionManager, mCredentials, mExpression, mExpressionInput, mInputStreams, mIsTransaction, mNameToInput, mOpenConnection, mOutput, mStatement, RESULT_STREAM, SQL_PARAMETERS, STORED_PROCEDURE, WEB_ROW_SET_STREAM
 
Fields inherited from class uk.org.ogsadai.engine.Activity
mContext, mExternalInputs, mExternalOutputs, mInternalInputs, mInternalOutputs
 
Constructor Summary
MyLeadReplicaActivity(org.w3c.dom.Element element)
          Constructor
 
Method Summary
protected  ReturnType getReplicaResult(int authority)
          This method is called by processBlock, and it processes each replica node in the perform document .
 void processBlock()
          This method will return the output on the outputStream.
protected abstract  void processReplica(org.w3c.dom.Node replicaNode)
          This abstract method must be overridden by any class that extends this abstract class.
 
Methods inherited from class edu.indiana.dde.mylead.dai.MyLeadActivity
checkAuthorization, dumpLog, endProcessing, finalize, getObjectId, getParameter, getWhiteboardId, markTime, queryTimestamp, startProcessing
 
Methods inherited from class uk.org.ogsadai.activity.sql.SQLActivity
getResult, initialise, loadNextExpression, parseCommand, parseResultStream, parseSQLParameters, prepareStatement, setupInputStreamNames
 
Methods inherited from class uk.org.ogsadai.engine.Activity
cleanUp, connectsTo, getActivityConfiguration, getName, getObservableStatus, getProperties, getStatus, hasActivityConfiguration, hasProperties, processFirst, setCompleted, setError
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DATE

protected static final java.lang.String DEFAULT_DATE
See Also:
Constant Field Values

USER_COL_DN

protected static final java.lang.String USER_COL_DN
See Also:
Constant Field Values

USER_COL_ID

protected static final java.lang.String USER_COL_ID
See Also:
Constant Field Values

CREATOR_DN

protected static final java.lang.String CREATOR_DN
See Also:
Constant Field Values

REPLICA_NAME

protected static final java.lang.String REPLICA_NAME
See Also:
Constant Field Values

REPLICA_TBL_NAME

protected static final java.lang.String REPLICA_TBL_NAME
See Also:
Constant Field Values

REPLICA_TAGS

protected static final java.lang.String[] REPLICA_TAGS

REPLICA_COL_NAMES

protected static final java.lang.String[] REPLICA_COL_NAMES

REPLICA_UPDDATE

protected static final java.lang.String REPLICA_UPDDATE
See Also:
Constant Field Values

REPLICA_TBL_UPDDATE

protected static final java.lang.String REPLICA_TBL_UPDDATE
See Also:
Constant Field Values

REPLICA_TBL_CREATOR

protected static final java.lang.String REPLICA_TBL_CREATOR
See Also:
Constant Field Values

REPLICA_TBL_CREATETIME

protected static final java.lang.String REPLICA_TBL_CREATETIME
See Also:
Constant Field Values

REPLICA_TBL_MODIFYTIME

protected static final java.lang.String REPLICA_TBL_MODIFYTIME
See Also:
Constant Field Values

REPLICA_TBL_MODIFIEDBY

protected static final java.lang.String REPLICA_TBL_MODIFIEDBY
See Also:
Constant Field Values

mUserId

protected int mUserId

replicaList

protected org.w3c.dom.NodeList replicaList

mNoData

protected int mNoData

mBadReplicas

protected int mBadReplicas

mBadDate

protected int mBadDate
Constructor Detail

MyLeadReplicaActivity

public MyLeadReplicaActivity(org.w3c.dom.Element element)
                      throws uk.org.ogsadai.common.exception.engine.activity.ActivityUserException,
                             uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException
Constructor

Parameters:
element - Element containing Statement conforming to schema for this activity. It is assumed schema checks have been carried out.
Throws:
uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException - If there is a problem constructing the activity due to an implementation error or OGSA-DAI confguration problem.
uk.org.ogsadai.common.exception.engine.activity.ActivityUserException - If there is a problem constructing the activity due to a user mistake such as an invalid setting.
Method Detail

getReplicaResult

protected ReturnType getReplicaResult(int authority)
                               throws java.sql.SQLException,
                                      uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException,
                                      uk.org.ogsadai.common.exception.engine.activity.ActivityUserException
This method is called by processBlock, and it processes each replica node in the perform document . It returns either true or false to processBlock. The getResult method must return a boolean value even though it's not used by processBlock in this case. The reason is that getResult is a method in the underlying SQLActivity method.

Returns:
ReturnType indicating if getResult was successful.
Throws:
java.sql.SQLException
uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException
uk.org.ogsadai.common.exception.engine.activity.ActivityUserException

processReplica

protected abstract void processReplica(org.w3c.dom.Node replicaNode)
This abstract method must be overridden by any class that extends this abstract class. This method is called by the getReplicaResult method and passes the node for a user from the perform document.


processBlock

public void processBlock()
This method will return the output on the outputStream. After the MyLeadReplicaActivity instance has been constructed, all of the parameters have been parsed from the input perform document. OGSA-DAI will then call processBlock(). When this method is called, if there is not a connection, a connection will be acquired (or processing is complete). If a connection is established (either new or already existing) then getResult() will be called. The getResult() method will put the output to mOutput. Compared to other activities which may process in blocks, this activity always writes it result out as a single block since only the status ir returned. No Exceptions are thrown since they will be flagged as a status flag with the activity and the output stream will be closed On error endProcessing is called and the ERROR status is set.

Specified by:
processBlock in class uk.org.ogsadai.engine.Activity