edu.indiana.dde.mylead.dai
Class MyLeadActivity

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
Direct Known Subclasses:
MyLeadAddAttrImpl, MyLeadCreateImpl, MyLeadDeleteAttrImpl, MyLeadDeleteImpl, MyLeadDeleteReplicaImpl, MyLeadDeleteUserImpl, MyLeadMoveImpl, MyLeadObjectExistsImpl, MyLeadQryAttrDefImpl, MyLeadQryReplicaImpl, MyLeadQryUserImpl, MyLeadQryWrkspcImpl, MyLeadQueryActivity, MyLeadReplaceAttrImpl, MyLeadReplicaActivity, MyLeadUpdateAttrImpl, MyLeadUserActivity, MyLeadUserExistsImpl, MyLeadWhiteboardImpl

public abstract class MyLeadActivity
extends uk.org.ogsadai.activity.sql.SQLActivity

Base class for myLEAD activity 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 int AUTHORITY_ADDATTR
           
protected static int AUTHORITY_CREATE
           
protected static int AUTHORITY_DEL_REPLICA
           
protected static int AUTHORITY_DEL_USER
           
protected static int AUTHORITY_DELETEATTR
           
protected static int AUTHORITY_UPDATE
           
protected  java.lang.String mActivityName
           
protected  java.lang.String mDn
           
protected  int mTimingPnt
           
protected static java.lang.String MYLEAD_DB
           
protected static java.lang.String MYLEAD_WRITER_REPLICA
           
protected static java.lang.String MYLEAD_WRITER_TBL
           
protected  long 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
MyLeadActivity(org.w3c.dom.Element element)
          Constructor
 
Method Summary
protected  ReturnType checkAuthorization(java.lang.String dn, int authorityType, int[] internalID)
          This method is passed a distinguished name and an integer flag for the type of authorization we are checking.
protected  void dumpLog(java.lang.String methodName)
          This method is called when there is an exception and we want to dump all of the messages that had been written to the temp_messages table during the stored procedure processing.
protected  void endProcessing()
          This method will complete the processing and tidy up
 void finalize()
          This method is called once this object is no longer required
protected  edu.indiana.dde.mylead.dai.Parent getObjectId(java.lang.String dn, java.lang.String objGuid)
          This routine is passed the unique global ID of a project, experiment, collection, or file.
protected  ReturnType getParameter(org.w3c.dom.Node docNode, java.lang.String paramName, LeadStringHolder param, ReturnType errorType)
          Used to get a single parameter out of a node that may contain that parameter as an element node.
protected  long getWhiteboardId(java.lang.String dn)
          This routine can be called to get the internal object ID of the top-level collection (currently project in myLEAD) which is the whiteboard default collection.
protected  void markTime(java.lang.String msg)
          Sets a timing point in the log using the description passed as a parameter and the module level mTimingPnt variable as a counter to sequence the calls.
protected  long queryTimestamp()
          This method is used to get a timestamp that is included in the root node of a query response.
protected  boolean startProcessing()
          The connection isn't returned/closed until the output is complete, i.e.
 
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, processBlock, processFirst, setCompleted, setError
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MYLEAD_DB

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

MYLEAD_WRITER_TBL

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

MYLEAD_WRITER_REPLICA

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

AUTHORITY_CREATE

protected static final int AUTHORITY_CREATE
See Also:
Constant Field Values

AUTHORITY_UPDATE

protected static final int AUTHORITY_UPDATE
See Also:
Constant Field Values

AUTHORITY_DEL_REPLICA

protected static final int AUTHORITY_DEL_REPLICA
See Also:
Constant Field Values

AUTHORITY_DEL_USER

protected static final int AUTHORITY_DEL_USER
See Also:
Constant Field Values

AUTHORITY_ADDATTR

protected static final int AUTHORITY_ADDATTR
See Also:
Constant Field Values

AUTHORITY_DELETEATTR

protected static final int AUTHORITY_DELETEATTR
See Also:
Constant Field Values

mTimingPnt

protected int mTimingPnt

mActivityName

protected java.lang.String mActivityName

mDn

protected java.lang.String mDn

startTime

protected long startTime
Constructor Detail

MyLeadActivity

public MyLeadActivity(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 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

markTime

protected void markTime(java.lang.String msg)
Sets a timing point in the log using the description passed as a parameter and the module level mTimingPnt variable as a counter to sequence the calls. The counter, message, and current time (ms) are output with colon delimiters so the timing points can esily be parsed in the log.

Parameters:
msg - String with the message to put in the log with this timing point

dumpLog

protected void dumpLog(java.lang.String methodName)
This method is called when there is an exception and we want to dump all of the messages that had been written to the temp_messages table during the stored procedure processing. If debugging is not turned on, then this method returns without dumping the messages. If debugging is turned on, then all of the messages are dumped to the log4j file.

Parameters:
methodName - The name of the method that called this routine so we can include it in the log.

checkAuthorization

protected ReturnType checkAuthorization(java.lang.String dn,
                                        int authorityType,
                                        int[] internalID)
This method is passed a distinguished name and an integer flag for the type of authorization we are checking. If the user represented by the dn is aothorized for the action being checked - such as creating new records, then a return type of OPERATION_SUCCESSFUL is returned, and otherwise the returned value is AUTHORIZATION_ERROR. If the user is autorized, then their internal ID from the mcs_writer table is returned in the internalID parameter, and otherwise it is set to zero.

Parameters:
dn - String with the distinguished name of the user as stored in the mcs_writer table
authorityType - integer flag with the type of authority being checked
internalID - the integer internal ID of the uyser in the mcs_writer table is returned

getWhiteboardId

protected long getWhiteboardId(java.lang.String dn)
This routine can be called to get the internal object ID of the top-level collection (currently project in myLEAD) which is the whiteboard default collection. This is used in a number of the activity implementations since for example the whiteboard cannot be deleted.

Parameters:
dn - String with the distinguished name of the user whos whiteboard we want
Returns:
long int with the internal ID - 0 if there was an error or user was not valid.

getObjectId

protected edu.indiana.dde.mylead.dai.Parent getObjectId(java.lang.String dn,
                                                        java.lang.String objGuid)
This routine is passed the unique global ID of a project, experiment, collection, or file. This routine finds the internal ID, and the type of the object and returns both. If there is an error, the object does not exist, or it is not owned by that user (in which case they cannot create a child) then this routine returns a Parent object with the default value of zero. The reason for getting the numeric type value from the database for the object when we already have a string value, is that if myLEAD is modified in the future to include new levels, only the activity schema needs to be modified - not the Java code.

Parameters:
dn - String with the distinguished name of the user as stored in the mcs_writer table
objGuid - String with the global ID of the object who's ID we are looking for
Returns:
Parent object populated with the object type as an integer and internal ID as a String.

startProcessing

protected boolean startProcessing()
                           throws uk.org.ogsadai.common.exception.core.CoreUserException,
                                  uk.org.ogsadai.common.exception.core.CoreSystemException,
                                  uk.org.ogsadai.common.exception.AuthorisationException
The connection isn't returned/closed until the output is complete, i.e. last block has been read

Returns:
boolean with true if there will be output, false if No more output can be expected
Throws:
CoreUserException, - CoreSystemException, AuthorisationException
uk.org.ogsadai.common.exception.core.CoreUserException
uk.org.ogsadai.common.exception.core.CoreSystemException
uk.org.ogsadai.common.exception.AuthorisationException

getParameter

protected ReturnType getParameter(org.w3c.dom.Node docNode,
                                  java.lang.String paramName,
                                  LeadStringHolder param,
                                  ReturnType errorType)
Used to get a single parameter out of a node that may contain that parameter as an element node.

Parameters:
docNode - Node for the perform document as passed to the constructor.
paramName - String with the name of the tag being sought.
param - LeadStringHolder used to pass back the result of this method.
errorType - The ReturnType returned if an error is caught when searching for a value.
Returns:
ReturnType that is either OPERATION_SUCCESSFUL or the errorType parameter

queryTimestamp

protected long queryTimestamp()
This method is used to get a timestamp that is included in the root node of a query response. Most query methods extent the MyLeadQuery Activity class but MyLeadQryWrkspcImpl extends thid MyLeadActivity class directly. Although fairly trivial, this centralizes any future changes to generating the timstamp used so all query methods are consistent.

Returns:
long integer of the format YYYYMMDDHHMMSS which is the timestamp in mySQL with YYYY being 1970 or later.

endProcessing

protected void endProcessing()
                      throws java.sql.SQLException,
                             uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException
This method will complete the processing and tidy up

Overrides:
endProcessing in class uk.org.ogsadai.activity.sql.SQLActivity
Throws:
SQLException, - ActivitySystemException
java.sql.SQLException
uk.org.ogsadai.common.exception.engine.activity.ActivitySystemException

finalize

public void finalize()
This method is called once this object is no longer required

Overrides:
finalize in class java.lang.Object