edu.indiana.dde.mylead.agent
Class MyLeadAgent

java.lang.Object
  extended byedu.indiana.extreme.gsx.service.grid_service.GridServiceImpl
      extended byedu.indiana.dde.mylead.agent.MyLeadAgent
All Implemented Interfaces:
edu.indiana.extreme.gsx.port_type.GridServicePortType, MyLeadAgentInterface

public class MyLeadAgent
extends edu.indiana.extreme.gsx.service.grid_service.GridServiceImpl
implements MyLeadAgentInterface, edu.indiana.extreme.gsx.port_type.GridServicePortType


Nested Class Summary
 
Nested classes inherited from class edu.indiana.extreme.gsx.service.grid_service.GridServiceImpl
edu.indiana.extreme.gsx.service.grid_service.GridServiceImpl.SimpleServiceDataGarbageCollector, edu.indiana.extreme.gsx.service.grid_service.GridServiceImpl.Terminator
 
Field Summary
static String USAGE
           
static boolean useXindice
           
 
Fields inherited from class edu.indiana.extreme.gsx.service.grid_service.GridServiceImpl
autoTerminate, factoryLocator, handleResolverLocator, queryExpressionHandlerMap, queryExpressionSdeIdMap, sdeFactory, sdm, terminateAfter, terminateBefore, terminator, terminatorThread, thisServiceLocator
 
Constructor Summary
MyLeadAgent()
           
MyLeadAgent(edu.indiana.extreme.gsx.sde.ServiceDataManagerInterface sdm)
           
MyLeadAgent(String someName)
           
 
Method Summary
 String addAttribute(String uID, String attribute, String resourceID)
          [To Do] add a dynamic attribute to the object specified with the resourceID
 String addAttributes(String uID, edu.indiana.extreme.lead.types.StringArrayDocument attributes, String resourceID)
          [To Do]add multiple dynamic attributes to the object specified with the resourceID.
 void addMyLeadServiceInfo(edu.indiana.extreme.lead.types.MyLeadServiceInfoDocument myleadsrvinfo)
          Add a new service information.
 void addUserInfo(edu.indiana.extreme.lead.types.MyLeadUserInfoDocument userinfo)
          Add a new user information.
 void closeExperiment(String uID, String resourceID)
          [TO DO] Add a dynamic attribute to existing element workflow engine can use this API for adding workflow instance, workflow template, or adding annotation for experiment.
 void closeMyLeadConnections()
          close all of the connection to mylead server.
 String createCollection(String uID, String leadResource, String parentResourceID, boolean assignNewResourceID)
          create a file collection.
 String createExperiment(String uID, String leadResource, String parentProjectResourceID, boolean assignNewResourceID)
          Create mylead Experiment for generating collection (with userid) This method creates an active experiment under the specified userID.
 String createProject(String uID, String leadResource, boolean assignNewResourceID)
          create a project
 edu.indiana.extreme.gsx.base_types.DestroyResponseDocument destroy(edu.indiana.extreme.gsx.base_types.DestroyDocument doc)
          implement destroy, reqd by grid service impl.
 String doesUserHaveMyLeadAccount(String uid)
          check if mylead server has user account under a user id
 edu.indiana.extreme.lead.types.StringArrayDocument getActiveExperiment(String uID, String proj)
          return all active experiment name running under the username and the project name.
 edu.indiana.extreme.lead.types.StringArrayDocument getActiveProject(String uID)
          return all active project name running under the username and the project name.
 edu.indiana.extreme.lead.types.MyLeadUserInfoArrayDocument getAllUserInfo()
          Retrieve mylead all user information.
 edu.indiana.extreme.lead.types.MyLeadServiceInfoArrayDocument getMyLeadServiceInfo(String userId)
          Retrieve mylead service information.
 edu.indiana.extreme.lead.types.MyLeadUserInfoDocument getUserInfo(String userid)
          Retrieve mylead user information.
 void initConfValues()
           
 void initNotificationPort(String topicID)
           
static void main(String[] args)
           
 String queryLEADMetadata(String uid, String resourceID)
           
 String registerFile(String uid, String leadResource, String datasourcelocation, String parentResourceID, boolean assignNewResourceID)
          This interface is for registering a file from the workflow emulator.
 String registerFiles(String uid, edu.indiana.extreme.lead.types.StringArrayDocument leadResource, edu.indiana.extreme.lead.types.StringArrayDocument datasourcelocation, String parentResourceID, boolean assignNewResourceID)
          [To Do] bulk load of files This interface is for registering a file from the workflow engine, emulator and Geo-GUI.
 String retrieveFile(String uid, String resourceID, String targetLocation)
           
 void retrieveFiles(String uid, edu.indiana.extreme.lead.types.StringArrayDocument resourceID, edu.indiana.extreme.lead.types.StringArrayDocument targetLocation)
           
 void setMyLeadServiceInfo(edu.indiana.extreme.lead.types.MyLeadServiceInfoDocument myleadsrvinfo)
          Modify service information.
 void setUserInfo(edu.indiana.extreme.lead.types.MyLeadUserInfoDocument userinfo)
          Modify user information.
 void shutdownExperiment(String uID, String resourceID)
          Shutdown this session.
static void startService(MyLeadAgent serviceImpl, String serviceHandle, int portNumber, boolean browseable, int notifPort)
          Create and start simple grid service with given handle on given port
 String updateAttribute(String uID, String attribute, String resourceID)
          [To Do] update an attribute to the object specified with the resourceID
 
Methods inherited from class edu.indiana.extreme.gsx.service.grid_service.GridServiceImpl
addSupportedTypes, buildFindResult, deleteByServiceDataNameImpl, deleteByServiceDataURIImpl, findByExtensibilityType, findServiceData, getCurrentTerminationTime, getFactory, getHandleResolver, getNormalizedHandle, getSdeUriFromId, getServiceDataManager, getServiceHandle, getServiceLocator, insertServiceDataImpl, registerQueryExpressionHandler, requestTerminationAfter, requestTerminationBefore, setByServiceDataNameImpl, setFactory, setHandleResolver, setServiceData, setServiceLocator, unregisterQueryExpressionHandler, updateCurrentTerminationTimeSDE, updateTerminateAfter, updateTerminateBefore, updateTerminationTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.indiana.extreme.gsx.port_type.GridServicePortType
findServiceData, requestTerminationAfter, requestTerminationBefore, setServiceData
 

Field Detail

USAGE

public static final String USAGE
See Also:
Constant Field Values

useXindice

public static final boolean useXindice
See Also:
Constant Field Values
Constructor Detail

MyLeadAgent

public MyLeadAgent()
            throws Exception

MyLeadAgent

public MyLeadAgent(String someName)
            throws Exception

MyLeadAgent

public MyLeadAgent(edu.indiana.extreme.gsx.sde.ServiceDataManagerInterface sdm)
            throws Exception
Method Detail

initConfValues

public void initConfValues()

initNotificationPort

public void initNotificationPort(String topicID)

destroy

public edu.indiana.extreme.gsx.base_types.DestroyResponseDocument destroy(edu.indiana.extreme.gsx.base_types.DestroyDocument doc)
implement destroy, reqd by grid service impl. Calls system.exit() after a few seconds.

Specified by:
destroy in interface edu.indiana.extreme.gsx.port_type.GridServicePortType

getMyLeadServiceInfo

public edu.indiana.extreme.lead.types.MyLeadServiceInfoArrayDocument getMyLeadServiceInfo(String userId)
                                                                                   throws Exception
Retrieve mylead service information. This method returns the mylead service information associated to the specified user, This method can process wildcard charactor also. To retrieve all information available mylead service, please fill the userId as "*".

It returns MyLeadServiceInfoArrayDocument defined in AHM Demo version Schema. The return document includes,

Specified by:
getMyLeadServiceInfo in interface MyLeadAgentInterface
Parameters:
userId - user's DN associating the service information. "*" will return whole list of the service information
Returns:
MyLeadServiceInfoArrayDocument
Throws:
Exception

setMyLeadServiceInfo

public void setMyLeadServiceInfo(edu.indiana.extreme.lead.types.MyLeadServiceInfoDocument myleadsrvinfo)
                          throws Exception
Modify service information. This method modifies already existing service information.

Specified by:
setMyLeadServiceInfo in interface MyLeadAgentInterface
Parameters:
myleadsrvinfo - MyLeadServiceInfoDocument
Throws:
Exception

addMyLeadServiceInfo

public void addMyLeadServiceInfo(edu.indiana.extreme.lead.types.MyLeadServiceInfoDocument myleadsrvinfo)
                          throws Exception
Add a new service information. This method creates a new service information.

Specified by:
addMyLeadServiceInfo in interface MyLeadAgentInterface
Parameters:
myleadsrvinfo - MyLeadServiceInfoDocument
Throws:
Exception

getAllUserInfo

public edu.indiana.extreme.lead.types.MyLeadUserInfoArrayDocument getAllUserInfo()
                                                                          throws Exception
Retrieve mylead all user information. This method returns information of the all users existing over all distributed mylead server. Each MyLead keeps complete user information accessing any of mylead service. From the return document, requesters can retrieve the user's mylead location.

Return docuement is structured as MyLeadUserInfoArrayDocuement which includes items defined in the FGDC section 10 contact information.

Specified by:
getAllUserInfo in interface MyLeadAgentInterface
Returns:
MyLeadUserInfoArrayDocument
Throws:
Exception

getUserInfo

public edu.indiana.extreme.lead.types.MyLeadUserInfoDocument getUserInfo(String userid)
                                                                  throws Exception
Retrieve mylead user information. This method returns information of specified user. The userID argument must specify existing user's user id.

Specified by:
getUserInfo in interface MyLeadAgentInterface
Returns:
MyLeadServiceInfoDocument
Throws:
Exception

setUserInfo

public void setUserInfo(edu.indiana.extreme.lead.types.MyLeadUserInfoDocument userinfo)
                 throws Exception
Modify user information. This method modifies existing user's information. userinfo argument must specify an existing user's information in MyLeadUserInfoDocuement.

Specified by:
setUserInfo in interface MyLeadAgentInterface
Parameters:
userinfo - MyLeadUserInfoDocument
Throws:
Exception

addUserInfo

public void addUserInfo(edu.indiana.extreme.lead.types.MyLeadUserInfoDocument userinfo)
                 throws Exception
Add a new user information. This method creates a user account in mylead. Athentication of administrator will be required in the next version of mylead.

Specified by:
addUserInfo in interface MyLeadAgentInterface
Parameters:
userinfo - MyLeadUserInfoDocument
Throws:
Exception

getActiveExperiment

public edu.indiana.extreme.lead.types.StringArrayDocument getActiveExperiment(String uID,
                                                                              String proj)
                                                                       throws Exception
return all active experiment name running under the username and the project name. This is for administrators.

Parameters:
uID - user id as a String
proj - project name as a String
Returns:
StringArrayDocument array of active experiment name
Throws:
Exception

getActiveProject

public edu.indiana.extreme.lead.types.StringArrayDocument getActiveProject(String uID)
                                                                    throws Exception
return all active project name running under the username and the project name. This is for administrators.

Parameters:
uID - user id as a String
Returns:
StringArrayDocument array of active experiment name
Throws:
Exception

createExperiment

public String createExperiment(String uID,
                               String leadResource,
                               String parentProjectResourceID,
                               boolean assignNewResourceID)
                        throws Exception
Create mylead Experiment for generating collection (with userid) This method creates an active experiment under the specified userID.

Specified by:
createExperiment in interface MyLeadAgentInterface
Parameters:
uID - user id as a String
leadResource - LEAD metadata for new experiment
parentProjectResourceID - ResourceID of the project
assignNewResourceID - If it is true, mylead agent will assign new resource ID
Returns:
String ResourceID of new experiment
Throws:
Exception

createCollection

public String createCollection(String uID,
                               String leadResource,
                               String parentResourceID,
                               boolean assignNewResourceID)
                        throws Exception
create a file collection.

Specified by:
createCollection in interface MyLeadAgentInterface
Parameters:
uID - user id as a String
leadResource - LEAD metadata for new collection
assignNewResourceID - if it is true mylead agent will assign new resource ID for this collection
Returns:
String resourceID of new collection
Throws:
Exception

registerFile

public String registerFile(String uid,
                           String leadResource,
                           String datasourcelocation,
                           String parentResourceID,
                           boolean assignNewResourceID)
                    throws Exception
This interface is for registering a file from the workflow emulator. The metadata of the file product is stored in the mylead, and the actual data product is stored in a mass storage service.

Specified by:
registerFile in interface MyLeadAgentInterface
Parameters:
uid - user's id that will be used for storing the metadata
leadResource - metadata of the object to import
datasourcelocation - actual location of the data
parentResourceID - the ResourceID of the direct parent node if it is "", the file is registered in the whiteboard space.
assignNewResourceID - if it is true, myleadagent will assign a new resourceID.
Returns:
String mylead returns the GUID of the object the user imported.
Throws:
Exception

registerFiles

public String registerFiles(String uid,
                            edu.indiana.extreme.lead.types.StringArrayDocument leadResource,
                            edu.indiana.extreme.lead.types.StringArrayDocument datasourcelocation,
                            String parentResourceID,
                            boolean assignNewResourceID)
                     throws Exception
[To Do] bulk load of files This interface is for registering a file from the workflow engine, emulator and Geo-GUI. The metadata of the file product is stored in the mylead, and the actual data product is stored in a mass storage service.

Specified by:
registerFiles in interface MyLeadAgentInterface
Parameters:
uid - user's id that will be used for storing the metadata
leadResource - metadata of the object to import
datasourcelocation - actual location of the data
parentResourceID - the ResourceID of the direct parent node if it is "", the file is registered in the whiteboard space.
assignNewResourceID - if it is true, myleadagent will assign a new resourceID.
Returns:
String mylead returns a GUID of new file.
Throws:
Exception

closeExperiment

public void closeExperiment(String uID,
                            String resourceID)
                     throws Exception
[TO DO] Add a dynamic attribute to existing element workflow engine can use this API for adding workflow instance, workflow template, or adding annotation for experiment. public void addAttributes(String uID, String parentResourceID, String attrName, String attrValue) throws Exception; /** Close this session. This will remove the session after performing all of the request delivered so far. For more request, it throws exception.

Specified by:
closeExperiment in interface MyLeadAgentInterface
Parameters:
uID - user id as a String
resourceID - resourceID of the experiment being closed
Returns:
void
Throws:
Exception

shutdownExperiment

public void shutdownExperiment(String uID,
                               String resourceID)
                        throws Exception
Shutdown this session. This will force the session to close immediatly and the requests in the queue will be removed.

Specified by:
shutdownExperiment in interface MyLeadAgentInterface
Parameters:
uID - user id as a String
resourceID - resourceID of the experiment being shutdown
Returns:
void
Throws:
Exception

addAttribute

public String addAttribute(String uID,
                           String attribute,
                           String resourceID)
                    throws Exception
[To Do] add a dynamic attribute to the object specified with the resourceID

Specified by:
addAttribute in interface MyLeadAgentInterface
Parameters:
uID - user ID as a String
attribute - dynamic attribute that user wants to add it MUST satisfy the partial schema of LEAD metadata Otherwise, mylead server throws an exception
resourceID - the resourceID of the object that an attribute will be added to
Returns:
String status of the adding dynamic attribute
Throws:
Exception

addAttributes

public String addAttributes(String uID,
                            edu.indiana.extreme.lead.types.StringArrayDocument attributes,
                            String resourceID)
                     throws Exception
[To Do]add multiple dynamic attributes to the object specified with the resourceID. This bulk attribute load provides better performance

Specified by:
addAttributes in interface MyLeadAgentInterface
Parameters:
uID - user ID as a String
attributes - An array of string which contains dynamic attributes that user wants to add Each of string MUST satisfy the partial schema of LEAD metadata Otherwise, mylead server throws an exception
resourceID - the resourceID of the object that an attribute will be added to
Returns:
String status of the adding dynamic attribute
Throws:
Exception

updateAttribute

public String updateAttribute(String uID,
                              String attribute,
                              String resourceID)
                       throws Exception
[To Do] update an attribute to the object specified with the resourceID

Specified by:
updateAttribute in interface MyLeadAgentInterface
Parameters:
uID - user ID as a String
attribute - dynamic attribute that user wants to add it MUST satisfy the partial schema of LEAD metadata Otherwise, mylead server throws an exception
resourceID - the resourceID of the object that an attribute will be added to
Returns:
String status of the adding dynamic attribute
Throws:
Exception

createProject

public String createProject(String uID,
                            String leadResource,
                            boolean assignNewResourceID)
                     throws Exception
create a project

Specified by:
createProject in interface MyLeadAgentInterface
Parameters:
uID - user id as a String
assignNewResourceID - if it is true mylead agent will assign new resource ID for this collection
Returns:
String resource ID of the new project
Throws:
Exception

queryLEADMetadata

public String queryLEADMetadata(String uid,
                                String resourceID)
                         throws Exception
Specified by:
queryLEADMetadata in interface MyLeadAgentInterface
Throws:
Exception

retrieveFile

public String retrieveFile(String uid,
                           String resourceID,
                           String targetLocation)
                    throws Exception
Specified by:
retrieveFile in interface MyLeadAgentInterface
Throws:
Exception

retrieveFiles

public void retrieveFiles(String uid,
                          edu.indiana.extreme.lead.types.StringArrayDocument resourceID,
                          edu.indiana.extreme.lead.types.StringArrayDocument targetLocation)
                   throws Exception
Specified by:
retrieveFiles in interface MyLeadAgentInterface
Throws:
Exception

doesUserHaveMyLeadAccount

public String doesUserHaveMyLeadAccount(String uid)
                                 throws Exception
check if mylead server has user account under a user id

Specified by:
doesUserHaveMyLeadAccount in interface MyLeadAgentInterface
Parameters:
uid - user id as a String
Returns:
String (if the user has account returns "true" otherwise "false")
Throws:
Exception

closeMyLeadConnections

public void closeMyLeadConnections()
                            throws Exception
close all of the connection to mylead server. This API is for administrator only. If the mylead administror wants to stop mylead agent, please call this API first. Otherwise, OGSA-DAI life-span can cause performance problem.

Specified by:
closeMyLeadConnections in interface MyLeadAgentInterface
Throws:
Exception

startService

public static void startService(MyLeadAgent serviceImpl,
                                String serviceHandle,
                                int portNumber,
                                boolean browseable,
                                int notifPort)
                         throws Exception
Create and start simple grid service with given handle on given port

Parameters:
serviceHandle - a String
portNumber - an int
Returns:
a SimpleGridService
Throws:
Exception

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception