edu.indiana.dde.mylead.dai
Class MyLeadUserActivity

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.MyLeadUserActivity
Direct Known Subclasses:
MyLeadCreateUserImpl, MyLeadUpdateUserImpl

public abstract class MyLeadUserActivity
extends MyLeadActivity


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[] ADDR_COL_NAMES
           
protected static java.lang.String[] ADDR_TAGS
           
protected static java.lang.String CREATOR_DN
           
protected  int mBadDn
           
protected  int mBadProtocol
           
protected  int mBadReplicas
           
protected  int mBadStorage
           
protected  int mBadUsers
           
protected  int mBadWhtBrd
           
protected  int mNoData
           
protected  int mUserId
           
protected static java.lang.String RES_TAG_NICKNAME
           
protected static java.lang.String RES_TAG_PROTOCOL
           
protected static java.lang.String[] RES_TAGS
           
protected static java.lang.String[] RESOURCE_COL_NAMES
           
protected static java.lang.String TBL_PROTOCOL
           
protected static java.lang.String TBL_PROTOCOL_RES
           
protected static java.lang.String TBL_PROTOCOL_WRITER
           
protected static java.lang.String TBL_RESOURCE_ID
           
protected static java.lang.String TBL_RESOURCE_NNAME
           
protected static java.lang.String TBL_WRITER_REPLICA
           
protected static java.lang.String USER_ADDR
           
protected static java.lang.String USER_COL_DN
           
protected static java.lang.String USER_COL_ID
           
protected static java.lang.String[] USER_COL_NAMES
           
protected static java.lang.String USER_DN
           
protected static java.lang.String USER_LASTMOD_DATE_COL
           
protected static java.lang.String USER_LASTMOD_ID_COL
           
protected static java.lang.String USER_REPLICA
           
protected static java.lang.String USER_STORAGE
           
protected static java.lang.String[] USER_TAGS
           
protected  org.w3c.dom.NodeList userList
           
 
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
MyLeadUserActivity(org.w3c.dom.Element element)
          Constructor
 
Method Summary
protected  void addResource(org.w3c.dom.Node rn, java.lang.String userDn)
          This method is called for each storage resource node to be added.
protected  ReturnType getUserResult(int rights)
          This method does the actual processing of the user data.
 void processBlock()
          This method will return the output on the outputStream.
protected abstract  void processUser(org.w3c.dom.Node userNode)
          This abstract method must be overridden by any class that extends this abstract class.
protected  boolean updateReplica(org.w3c.dom.Node userNode, java.lang.String userDn)
          This method can be called by the processUser methods in classes extending this class to handle checking if a replica was specified and trying to update it.
 
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

CREATOR_DN

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

USER_DN

protected static final java.lang.String USER_DN
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

USER_TAGS

protected static final java.lang.String[] USER_TAGS

USER_COL_NAMES

protected static final java.lang.String[] USER_COL_NAMES

USER_ADDR

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

ADDR_TAGS

protected static final java.lang.String[] ADDR_TAGS

ADDR_COL_NAMES

protected static final java.lang.String[] ADDR_COL_NAMES

USER_LASTMOD_ID_COL

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

USER_LASTMOD_DATE_COL

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

USER_REPLICA

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

TBL_WRITER_REPLICA

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

USER_STORAGE

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

RES_TAG_NICKNAME

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

TBL_RESOURCE_NNAME

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

TBL_RESOURCE_ID

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

RES_TAGS

protected static final java.lang.String[] RES_TAGS

RESOURCE_COL_NAMES

protected static final java.lang.String[] RESOURCE_COL_NAMES

RES_TAG_PROTOCOL

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

TBL_PROTOCOL

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

TBL_PROTOCOL_RES

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

TBL_PROTOCOL_WRITER

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

mUserId

protected int mUserId

userList

protected org.w3c.dom.NodeList userList

mNoData

protected int mNoData

mBadUsers

protected int mBadUsers

mBadDn

protected int mBadDn

mBadWhtBrd

protected int mBadWhtBrd

mBadReplicas

protected int mBadReplicas

mBadStorage

protected int mBadStorage

mBadProtocol

protected int mBadProtocol
Constructor Detail

MyLeadUserActivity

public MyLeadUserActivity(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 a myLEAD user 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

getUserResult

protected ReturnType getUserResult(int rights)
                            throws java.sql.SQLException,
                                   uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException,
                                   uk.org.ogsadai.common.exception.engine.activity.ActivityUserException
This method does the actual processing of the user data. If it encounters any error in executing or in the data (e.g., the user does not exist) then an error counter is incremented and a total count of the different types of possible errors is returned to the user. This method is called by the getResult method in classes extending this class. The parameter passed is the rights needed.

Parameters:
rights - integer indicating the rights needed: 1=create, 2=update
Returns:
ReturnType indicating success or not.
Throws:
SQLException, - ActivitySystemException, ActivityUserException
java.sql.SQLException
uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException
uk.org.ogsadai.common.exception.engine.activity.ActivityUserException

processUser

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


addResource

protected void addResource(org.w3c.dom.Node rn,
                           java.lang.String userDn)
This method is called for each storage resource node to be added.

Parameters:
rn - Node for a storage resource from the perform document.
userDn - The distinguished name of the user being processed.

updateReplica

protected boolean updateReplica(org.w3c.dom.Node userNode,
                                java.lang.String userDn)
This method can be called by the processUser methods in classes extending this class to handle checking if a replica was specified and trying to update it.

Parameters:
userNode - Node from the perform document for the user being processed.
userDn - The distinguished name of the user being processed.
Returns:
boolean to indicate if any update was done

processBlock

public void processBlock()
This method will return the output on the outputStream. After the MyLeadUserActivity 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