11 TeraGrid’07, June 4-8, 2007, Madison, WI
Building Blocks for a Simple TeraGrid Science Gateway
Yan Liu and Shaowen WangYan Liu and Shaowen Wang
Grid Research & educatiOn group @ ioWa Grid Research & educatiOn group @ ioWa (GROW)(GROW)
The University of IowaThe University of Iowa
June 4, 2007June 4, 2007
-- A GISolve Approach-- A GISolve Approach
22 TeraGrid’07, June 4-8, 2007, Madison, WI
Contributors/Contributors/CollaboratorsCollaborators
SDSCSDSC– Andrew SandersonAndrew Sanderson– Nancy Wilkins-DiehrNancy Wilkins-Diehr
UC/ANLUC/ANL– Stuart MartinStuart Martin
UIowa UIowa – Eric ShookEric Shook
33 TeraGrid’07, June 4-8, 2007, Madison, WI
ObjectivesObjectives
Use TeraGrid to support domain-specific scientific computing
Develop Grid-enabled applications to access TeraGrid capabilities
Create a GridSphere-based portal as a TeraGrid science gateway interface
Develop JSR-168 compliant portlets to build gateway components
Understand a GISolve-based workflow to steer analyses on TeraGrid
44 TeraGrid’07, June 4-8, 2007, Madison, WI
OverviewOverview
55 TeraGrid’07, June 4-8, 2007, Madison, WI
Learning CurveLearning Curve
Access TeraGrid resourcesAccess TeraGrid resources– Accounts, computing and data storageAccounts, computing and data storage
Develop Java programs for TeraGrid Develop Java programs for TeraGrid accessaccess– JGlobus Cog programmingJGlobus Cog programming– A simple visualization moduleA simple visualization module
Build a simple science gateway Grid portalBuild a simple science gateway Grid portal– JSR-168 PortletAPIJSR-168 PortletAPI– GridSphere-based portlet developmentGridSphere-based portlet development
66 TeraGrid’07, June 4-8, 2007, Madison, WI
Development CurveDevelopment Curve
Command lineCommand line– Running domain science application on Running domain science application on
TeraGridTeraGrid Grid-enabled application developmentGrid-enabled application development
– Java programmingJava programming– Application-specific SimpleGrid APIApplication-specific SimpleGrid API
Science gatewayScience gateway– SimpleGrid portalSimpleGrid portal– A straightforward GIScience (Geographic A straightforward GIScience (Geographic
Information Science) application workflowInformation Science) application workflow
77 TeraGrid’07, June 4-8, 2007, Madison, WI
Application ExampleApplication Example
DMS Spatial AnalysisDMS Spatial Analysis– Spatial interpolation based on the Spatial interpolation based on the
Dynamically Memorized Strategy (DMS)Dynamically Memorized Strategy (DMS) Application packageApplication package
– Binary executablesBinary executables– Sample datasetsSample datasets– Package directory layoutPackage directory layout
Build user-friendly science gateway Build user-friendly science gateway interfaces for scientists to perform DMS interfaces for scientists to perform DMS analysis transparently on TeraGridanalysis transparently on TeraGrid
88 TeraGrid’07, June 4-8, 2007, Madison, WI
TechnologiesTechnologies
TeraGrid accessTeraGrid access– Globus Toolkit 4.0.1 (CTSS3)Globus Toolkit 4.0.1 (CTSS3)
MyProxy, GRAM, WS-GRAM, GridFTPMyProxy, GRAM, WS-GRAM, GridFTP
ProgrammingProgramming– Java Cog kitJava Cog kit
JGlbous moduleJGlbous module
Grid portalGrid portal– GridSphere portal serverGridSphere portal server– GridSphere-based portlet development GridSphere-based portlet development
frameworkframework– JSP and GridSphere Visual UIJSP and GridSphere Visual UI
99 TeraGrid’07, June 4-8, 2007, Madison, WI
EnvironmentsEnvironments
Three tutorial portal serversThree tutorial portal servers– grow-dev1.its.uiowa.edugrow-dev1.its.uiowa.edu
Portal server softwarePortal server software– SSH client and serverSSH client and server– Globus Toolkit 4.0.1 client toolsGlobus Toolkit 4.0.1 client tools– Java J2SE 1.5Java J2SE 1.5– Ant 1.6.5Ant 1.6.5– Apache httpd 2.0.52Apache httpd 2.0.52– Tomcat 5.5.23Tomcat 5.5.23– GridSphere 3.0.5 (customized)GridSphere 3.0.5 (customized)– MySQL server 4.0.20MySQL server 4.0.20
TeraGrid sitesTeraGrid sites– UC, NCSA, and SDSCUC, NCSA, and SDSC
1010 TeraGrid’07, June 4-8, 2007, Madison, WI
User AccountsUser Accounts
TeraGrid training accountsTeraGrid training accounts– train01 – train19train01 – train19– Gateway head nodes:Gateway head nodes:
tg-login.ncsa.teragrid.orgtg-login.ncsa.teragrid.org tg-login.uc.teragrid.org (through ncsa or sdsc)tg-login.uc.teragrid.org (through ncsa or sdsc) Tg-login.sdsc.teragrid.orgTg-login.sdsc.teragrid.org
Portal accountsPortal accounts– train1 – train 19train1 – train 19– Password is dispatched with tutorial materialsPassword is dispatched with tutorial materials– URL: URL:
https://${portal_server}/gridsphere/gridspherhttps://${portal_server}/gridsphere/gridspheree
1111 TeraGrid’07, June 4-8, 2007, Madison, WI
User Accounts (Cont’d)User Accounts (Cont’d)
MySQL database accountsMySQL database accounts– Same user names as TeraGrid training accountsSame user names as TeraGrid training accounts– Password same as your portal account passwordPassword same as your portal account password
Tutorial server UNIX accountsTutorial server UNIX accounts– Same user names as TeraGrid training accountsSame user names as TeraGrid training accounts– Password dispatched with tutorial materialsPassword dispatched with tutorial materials– BASH shell environmentBASH shell environment
Tutorial packageTutorial package– In $HOME/SimpleGridIn $HOME/SimpleGrid
1212 TeraGrid’07, June 4-8, 2007, Madison, WI
Exercise 1: Setup Exercise 1: Setup Development Development EnvironmentEnvironment
Login to one of the three tutorial Login to one of the three tutorial serversservers– SSH login: username@${tutorial_server}SSH login: username@${tutorial_server}
Environment setupEnvironment setup
cd ~# add simplegrid-env.sh in your .bashrcvi .simplegrid-env.sh
1313 TeraGrid’07, June 4-8, 2007, Madison, WI
OutlineOutline
Part I: Basic TeraGrid services and Part I: Basic TeraGrid services and tools tools
Part II: SimpleGrid API Part II: SimpleGrid API development for Grid-enabled development for Grid-enabled analysisanalysis
Part III: SimpleGrid portal Part III: SimpleGrid portal developmentdevelopment
1414 TeraGrid’07, June 4-8, 2007, Madison, WI
Part I: Part I: Basic TeraGrid Basic TeraGrid Services and ToolsServices and Tools
Questions to answerQuestions to answer– Where are your home directories on all 3 Where are your home directories on all 3
TeraGrid sites?TeraGrid sites?– What is your grid certificate identity?– How do you create a grid proxy with a
specified duration using MyProxy?– Are you able to transfer a sample dataset to
a specified TeraGrid site?– How to submit a job and return immediately
without waiting for its completion?
1515 TeraGrid’07, June 4-8, 2007, Madison, WI
DMS Binary Package DMS Binary Package Deployment Deployment
SSH loginSSH login Setup your TeraGrid account environmentSetup your TeraGrid account environment
## content of your .soft setting@teragrid-basic# TeraGrid wide Globus 4 and Grid software [email protected]# Platform recommended development software suite@teragrid-dev
Deploy DMS binary package to all three sites Deploy DMS binary package to all three sites
scp SimpleGrid/applications/dms.uc.tar.gz [email protected]:./ssh [email protected]:./tar xvfz ./dms.uc.tar.gz
1616 TeraGrid’07, June 4-8, 2007, Madison, WI
Get a Grid ProxyGet a Grid Proxy
[tomcat@grow-dev1 ~]$ myproxy-logon -l gisolve -t 100 -s myproxy.teragrid.orgEnter MyProxy pass phrase:A credential has been received for user gisolve in /tmp/x509up_u502.
[tomcat@grow-dev1 ~]$ grid-proxy-infosubject : /C=US/O=National Center for Supercomputing Applications/CN=Gisolve Community Userissuer : /C=US/O=National Center for Supercomputing Applications/CN=Certification Authorityidentity : /C=US/O=National Center for Supercomputing Applications/CN=Gisolve Community Usertype : end entity credentialstrength : 1024 bitspath : /tmp/x509up_u502timeleft : 99:59:54 (4.1 days)
http://teragrid.org/userinfo/access/
1717 TeraGrid’07, June 4-8, 2007, Madison, WI
Transfer a Sample Transfer a Sample DatasetDataset
http://teragrid.org/userinfo/data/gridftp.php
[tomcat@grow-dev1 test]$ globus-url-copy file:/home/tomcat/SimpleGrid/simplegrid/webapp/storage/samples/sample gsiftp://gridftp-hg.ncsa.teragrid.org:2811/~/sample1
[tomcat@grow-dev1 test]$ ssh [email protected]
tg-login2 ac/gisolve> ls -l sample1-rw-r--r-- 1 gisolve lpt 1116491 2007-05-29 21:28 sample1
http://teragrid.org/userinfo/data/transfer_location.php
1818 TeraGrid’07, June 4-8, 2007, Madison, WI
GRAM Job SubmissionGRAM Job Submission
RSL (for UC)RSL (for UC)
CommandsCommands
&(jobType="single")(count=1)(host_count="1")(project=TG-SES070007N)(directory="/home/gisolve/gisolve/DMS/release")(executable=/home/gisolve/gisolve/DMS/release/process.pl)(arguments="500" "500" "20" "/home/gisolve/sample1" "/home/gisolve/result1")(stdout="stdout.gisolve.test")(stderr="stderr.gisolve.test")
$ globusrun -b -f ./gt2.rsl -r tg-grid.uc.teragrid.org:2120/jobmanager-pbsglobus_gram_client_callback_allow successfulGRAM Job submission successfulhttps://tg-grid1.uc.teragrid.org:50004/19686/1180493030/$ globus-job-status https://tg-grid1.uc.teragrid.org:50004/19686/1180493030/DONE
1919 TeraGrid’07, June 4-8, 2007, Madison, WI
WS-GRAM Job WS-GRAM Job SubmissionSubmission
RSL (XML)RSL (XML)
<job> <factoryEndpoint xmlns:gram="http://www.globus.org/namespaces/2004/10/gram/job" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"> <wsa:Address>https://tg-login1.uc.teragrid.org:8443/wsrf/services/ManagedJobFactoryService </wsa:Address> <wsa:ReferenceProperties> <gram:ResourceID>PBS</gram:ResourceID> </wsa:ReferenceProperties> </factoryEndpoint> <executable>/home/gisolve/gisolve/DMS/release/process.pl</executable> <directory>/home/gisolve/gisolve/DMS/release</directory> <argument>500</argument> <argument>500</argument> <argument>20</argument> <argument>/home/gisolve/sample1</argument> <argument>/home/gisolve/result1</argument> <stdout>/users/gisolve/gisolve/DMS/results/stdout.sample1</stdout> <stderr>/users/gisolve/gisolve/DMS/results/stderr.sample1</stderr></job>
2020 TeraGrid’07, June 4-8, 2007, Madison, WI
Command: globusrun-ws -submit -f rsl_xml_fileCommand: globusrun-ws -submit -f rsl_xml_file
WS-GRAM Job WS-GRAM Job SubmissionSubmission
http://teragrid.org/userinfo/jobs/globus.php
2121 TeraGrid’07, June 4-8, 2007, Madison, WI
Analysis ProcessAnalysis Process
Get a grid proxyGet a grid proxy Transfer a dataset to specified TeraGrid Transfer a dataset to specified TeraGrid
sitessites Submit Grid jobs to run DMS binary Submit Grid jobs to run DMS binary
executables against the transferred executables against the transferred datasetdataset
Collect results backCollect results back Visualize resultsVisualize results
– Will be shown laterWill be shown later
2222 TeraGrid’07, June 4-8, 2007, Madison, WI
Part II: SimpleGrid API Development Part II: SimpleGrid API Development for Grid-enabled Analysisfor Grid-enabled Analysis
How to do Part I in a programming way?How to do Part I in a programming way? PurposePurpose
– Automate the access to TeraGrid resources as a Grid-Automate the access to TeraGrid resources as a Grid-enabled applicationenabled application
PackagePackage– Location: SimpleGrid/simplegrid/src/Location: SimpleGrid/simplegrid/src/– SimpleGrid API for DMS analysisSimpleGrid API for DMS analysis
org.gisolve.demo.app.*org.gisolve.demo.app.* org.gisolve.demo.grid.*org.gisolve.demo.grid.* org.gisolve.demo.util.*org.gisolve.demo.util.*
– Libraries Libraries All jars from ${GLOBUS_LOCATION}/libAll jars from ${GLOBUS_LOCATION}/lib
– Particularly cog-jglobus.jarParticularly cog-jglobus.jar JFreeChart libraries for visualizationJFreeChart libraries for visualization
http://www.globus.org/cog/manual-user.pdf
2323 TeraGrid’07, June 4-8, 2007, Madison, WI
Get a Grid ProxyGet a Grid Proxy
ClassClass– org.gisolve.demo.grid.security.SimpleCredorg.gisolve.demo.grid.security.SimpleCred
Two methods to get a proxyTwo methods to get a proxy– Load an existing valid proxy fileLoad an existing valid proxy file
SimpleCred::load()SimpleCred::load()
– Create a proxy by contacting with a Create a proxy by contacting with a MyProxy serverMyProxy server
SimpleCred::logon()SimpleCred::logon()
Export proxy to a fileExport proxy to a file– SimpleCred::export()SimpleCred::export()
2424 TeraGrid’07, June 4-8, 2007, Madison, WI
Transfer a Sample Transfer a Sample DatasetDataset
ClassClass– org.gisolve.demo.grid.data.SimpleTranorg.gisolve.demo.grid.data.SimpleTran
sfersfer Local<->remote transferLocal<->remote transfer
– SimpleTransfer::remote2local()SimpleTransfer::remote2local()– SimpleTransfer::local2remote()SimpleTransfer::local2remote()
Third-party transferThird-party transfer– Refer to Cog manual (version 1.1)Refer to Cog manual (version 1.1)
http://wiki.cogkit.org
2525 TeraGrid’07, June 4-8, 2007, Madison, WI
GRAM Job SubmissionGRAM Job Submission
ClassClass– org.gisolve.demo.grid.job.SimpleRunGorg.gisolve.demo.grid.job.SimpleRunG
T2T2– org.gisolve.demo.grid.job.SimpleRSLorg.gisolve.demo.grid.job.SimpleRSL
RSL generationRSL generation– Application specificApplication specific
GT2 job submissionGT2 job submission– Use batch mode in which a call Use batch mode in which a call
returns immediately with a job handlereturns immediately with a job handle
2626 TeraGrid’07, June 4-8, 2007, Madison, WI
GRAM Job Submission: GRAM Job Submission: MPIMPI
MPI on TeraGridMPI on TeraGrid– User “softenv | grep mpi” to see different User “softenv | grep mpi” to see different
MPI settingsMPI settings MPI job submission through GlobusMPI job submission through Globus
– Specify “count” element in RSLSpecify “count” element in RSL ““count” is the number of processes to spawncount” is the number of processes to spawn
– Specify “host_count” element in RSLSpecify “host_count” element in RSL ““host_count” is the number of CPUs for MPI host_count” is the number of CPUs for MPI
executionexecution– ““count = host_count” means each CPU runs count = host_count” means each CPU runs
one MPI processone MPI process– Specify “jobType=mpi” in RSLSpecify “jobType=mpi” in RSL
2727 TeraGrid’07, June 4-8, 2007, Madison, WI
WS-GRAM Job WS-GRAM Job SubmissionSubmission
ClassClass– org.gisolve.demo.grid.job.SimpleRunGT4org.gisolve.demo.grid.job.SimpleRunGT4– org.gisolve.demo.grid.job.SimpleRSLorg.gisolve.demo.grid.job.SimpleRSL
RSL generationRSL generation– Application specificApplication specific
GT4 job submissionGT4 job submission– Use batch mode in which a call returns Use batch mode in which a call returns
immediately with a job handleimmediately with a job handle– Note that it uses a different globus package Note that it uses a different globus package
org.globus.exec.*org.globus.exec.*
http://www.globus.org/toolkit/docs/4.0/execution/wsgram/developer-index.html#id2563059
2828 TeraGrid’07, June 4-8, 2007, Madison, WI
How to Write RSL?How to Write RSL?
RSL schemaRSL schema– http://globus.org/toolkit/docs/4.0/http://globus.org/toolkit/docs/4.0/
execution/wsgram/schemas/execution/wsgram/schemas/gram_job_description.htmlgram_job_description.html
GT2 and GT4 schema comparisonGT2 and GT4 schema comparison– http://www.globus.org/toolkit/docs/http://www.globus.org/toolkit/docs/
4.0/execution/wsgram/4.0/execution/wsgram/WS_GRAM_Migrating_Guide.htmlWS_GRAM_Migrating_Guide.html
2929 TeraGrid’07, June 4-8, 2007, Madison, WI
Exercise 2Exercise 2
Test SimpleGrid APITest SimpleGrid API– Source simplegrid-env.shSource simplegrid-env.sh– SimpleGrid/bin/runTest2.shSimpleGrid/bin/runTest2.sh
3030 TeraGrid’07, June 4-8, 2007, Madison, WI
Part III: SimpleGrid Part III: SimpleGrid Portal DevelopmentPortal Development
Science gateways to TeraGridScience gateways to TeraGrid– Provide an online access points to TeraGridProvide an online access points to TeraGrid– Aggregate domain science application-level capabilitiesAggregate domain science application-level capabilities– Hide the complexity of using TeraGridHide the complexity of using TeraGrid– Portal is commonly used to meet such needsPortal is commonly used to meet such needs
FocusFocus– Provide transparent access to TeraGrid for domain Provide transparent access to TeraGrid for domain
scientistsscientists– Build application-oriented workflow inside portal for easy Build application-oriented workflow inside portal for easy
access by usersaccess by users– Technical details for portlet developmentTechnical details for portlet development
GridSphereGridSphere PortletAPIPortletAPI GridSphere-based portlet developmentGridSphere-based portlet development
3131 TeraGrid’07, June 4-8, 2007, Madison, WI
GridSphereGridSphere
FeaturesFeatures– http://www.gridsphere.orghttp://www.gridsphere.org– Open sourceOpen source– PortletAPI (JSR-168) compliantPortletAPI (JSR-168) compliant– Object persistence support through HibernateObject persistence support through Hibernate
GridSphere 3.0.5GridSphere 3.0.5– Download: Download: https://svn.gridsphere.org/https://svn.gridsphere.org/– Requirements: java, ant, tomcat, mysqlRequirements: java, ant, tomcat, mysql– Build: ant installBuild: ant install
Be sure to change hibernate.properties, build.propertiesBe sure to change hibernate.properties, build.properties Copy mysql jdbc driver to Copy mysql jdbc driver to
${CATALINE_HOME}/common/lib/${CATALINE_HOME}/common/lib/– Development using EclipseDevelopment using Eclipse
Instructions will be added in our online documentationInstructions will be added in our online documentation
3232 TeraGrid’07, June 4-8, 2007, Madison, WI
Exercise 3Exercise 3
DemoDemo– GridSphere interfaceGridSphere interface– New portlet project creationNew portlet project creation
3333 TeraGrid’07, June 4-8, 2007, Madison, WI
SimpleGrid PortletsSimpleGrid Portlets
Location: SimpleGrid/simplegridLocation: SimpleGrid/simplegrid Two portletsTwo portlets
– UserPortletUserPortlet Display user informationDisplay user information Initialize or renew grid proxyInitialize or renew grid proxy
– Automatic renewal after initializationAutomatic renewal after initialization
– DMSPortletDMSPortlet DMS workflow controlDMS workflow control Build user interfaces for DMS analysisBuild user interfaces for DMS analysis
Each tutorial user will build and deploy their Each tutorial user will build and deploy their version of SimpleGrid portlets (project name is version of SimpleGrid portlets (project name is simplegrid_${USER})simplegrid_${USER})
3434 TeraGrid’07, June 4-8, 2007, Madison, WI
Introduction to Introduction to SimpleGrid SimpleGrid DevelopmentDevelopment
3535 TeraGrid’07, June 4-8, 2007, Madison, WI
SimpleGrid Project SimpleGrid Project LayoutLayout
src/org.gisolve.demo.portletssrc/org.gisolve.demo.portlets– Portlet action classesPortlet action classes
lib/lib/– Libraries for Globus and JFreeChartLibraries for Globus and JFreeChart
webapp/jsp/webapp/jsp/– JSP pages for user interface renderingJSP pages for user interface rendering
webapp/WEB-INF/persistence/hibernate.propertieswebapp/WEB-INF/persistence/hibernate.properties– Configuration for backend database accessConfiguration for backend database access
webapp/WEB-INF/portlet.xmlwebapp/WEB-INF/portlet.xml– Portlet definitionPortlet definition
Defines unique portlet id, the portlet class, etc.Defines unique portlet id, the portlet class, etc. webapp/simplegrid.propertieswebapp/simplegrid.properties
– SimpleGrid specific configuration about Grid resourcesSimpleGrid specific configuration about Grid resources– Loaded at the first time the UserPortlet is visitedLoaded at the first time the UserPortlet is visited
build.xmlbuild.xml– Ant build file to compile, deploy, and install SimpleGrid portlets to GridSphereAnt build file to compile, deploy, and install SimpleGrid portlets to GridSphere– Need to change if you have your own libraries or packages developedNeed to change if you have your own libraries or packages developed
build.propertiesbuild.properties– Define project name and location of GridSphere where SimpleGrid finds Define project name and location of GridSphere where SimpleGrid finds
dependent GridSphere java classes and PortletAPI (javax.portlet.*) definitionsdependent GridSphere java classes and PortletAPI (javax.portlet.*) definitions
3636 TeraGrid’07, June 4-8, 2007, Madison, WI
Runtime Runtime ConfigurationsConfigurations simplegrid.propertiessimplegrid.properties
3737 TeraGrid’07, June 4-8, 2007, Madison, WI
Portlet ContainerPortlet Container
PortletAPI (JSR-168 specification)PortletAPI (JSR-168 specification)– Portlet specificationPortlet specification– What are not defined?What are not defined?
Object persistence: store portlet status in permanent storageObject persistence: store portlet status in permanent storage Portlet rendering methodPortlet rendering method
– JSP, Velocity, GridSphere Visual UI (JSP taglib), Java Server FaceJSP, Velocity, GridSphere Visual UI (JSP taglib), Java Server Face GridSphere: JSR-168 compliant portlet containerGridSphere: JSR-168 compliant portlet container
– Implemented javax.portlet.*Implemented javax.portlet.*– Hibernate as object persistence technologiesHibernate as object persistence technologies– JPS-based Visual UI renderingJPS-based Visual UI rendering– What are not standardized? What are not standardized?
ActionPortlet based on Visual UIActionPortlet based on Visual UI Portlet service framework (from WebSphere)Portlet service framework (from WebSphere)
– Other open source portlet containersOther open source portlet containers Apache Jetspeed/Pluto, SakaiApache Jetspeed/Pluto, Sakai
3838 TeraGrid’07, June 4-8, 2007, Madison, WI
PortletAPI (JSR-168 PortletAPI (JSR-168 Specification)Specification)
Sample portletSample portlet– GridSphere jsrtutorial: ActionHelloworldGridSphere jsrtutorial: ActionHelloworld
Portlet modesPortlet modes– VIEW (doView()): the default display modeVIEW (doView()): the default display mode– EDIT (doEdit()): preference/configuration EDIT (doEdit()): preference/configuration
editingediting– HELP (doHelp()): help informationHELP (doHelp()): help information
Base portlet: GenericPortletBase portlet: GenericPortlet PorletURLPorletURL
– Generate actionURL and renderURL in Generate actionURL and renderURL in response pageresponse page
http://www.gridsphere.org/gridsphere/gridsphere/guest/download/r/
3939 TeraGrid’07, June 4-8, 2007, Madison, WI
PortletAPI (JSR-168 PortletAPI (JSR-168 Specification)Specification)
PortletRequestPortletRequest– Get parameters from portlet containerGet parameters from portlet container
ActionRequestActionRequest– Used in action processingUsed in action processing
RenderRequestRenderRequest– Used in renderingUsed in rendering
PortletResponsePortletResponse– Pass parameters to portlet containerPass parameters to portlet container
ActionResponseActionResponse– Parameters set in ActionResponse will be passed to Parameters set in ActionResponse will be passed to
RenderRequestRenderRequest RenderResponseRenderResponse
– Used in rendering response pageUsed in rendering response page Action processingAction processing
– processAction(ActionRequest, ActionResponse)processAction(ActionRequest, ActionResponse) Default renderingDefault rendering
– doView(RenderRequest, RenderResponse)doView(RenderRequest, RenderResponse)
4040 TeraGrid’07, June 4-8, 2007, Madison, WI
PortletAPI (JSR-168 PortletAPI (JSR-168 Specification)Specification)
Portlet definition (portlet.xml)Portlet definition (portlet.xml)<portlet> <description xml:lang="en">SimpleGrid user portlet</description> <portlet-name>SimpleGridUserGisolve</portlet-name> <display-name xml:lang="en">SimpleGrid user gisolve</display-name> <portlet-class>org.gisolve.demo.portlets.UserPortlet</portlet-class> <expiration-cache>0</expiration-cache> <init-param> <name>aname</name> <value>avalue</value> </init-param> <supports> <mime-type>text/html</mime-type> <portlet-mode>view</portlet-mode> <portlet-mode>edit</portlet-mode> <portlet-mode>help</portlet-mode> </supports> <supported-locale>en</supported-locale> <portlet-info> <title>SimpleGrid User home for gisolve</title> <short-title>simplegrid-gisolve</short-title> <keywords>simplegrid, gisolve, user</keywords> </portlet-info> <portlet-preferences> <preference>
…… </preference> </portlet-preferences></portlet>
4141 TeraGrid’07, June 4-8, 2007, Madison, WI
QuestionsQuestions– How to direct actions to corresponding How to direct actions to corresponding
action methods?action methods? Avoid a big processAction()Avoid a big processAction()
– How to get parameters from How to get parameters from PortletRequest?PortletRequest?
– How to render response pages?How to render response pages?– How to communicate between How to communicate between
portlets?portlets?
Portlet DevelopmentPortlet Development
4242 TeraGrid’07, June 4-8, 2007, Madison, WI
Portlet DevelopmentPortlet Development
GridSphere Visual UIGridSphere Visual UI– Rendering: JSP tag-libRendering: JSP tag-lib– Action: ActionPortletAction: ActionPortlet
VelocityVelocity– Rendering: Velocity templatesRendering: Velocity templates– Action: VelocityPortletAction: VelocityPortlet
http://www.gridsphere.org/gridsphere/docs/TagGuide/TagGuide.html
http://www.collab-ogce.org/ogce2/velocity-portlets.html
4343 TeraGrid’07, June 4-8, 2007, Madison, WI
Exercise 4Exercise 4
Deploy your SimpleGrid project Deploy your SimpleGrid project (simplegrid_${USER}) to gridsphere (simplegrid_${USER}) to gridsphere containercontainer– Use “ant install” for a fresh installUse “ant install” for a fresh install– Use “ant deploy” for update (it does not clear Use “ant deploy” for update (it does not clear
database content)database content)– Look at Look at
$CATALINA_HOME/webapps/simplegrid_$$CATALINA_HOME/webapps/simplegrid_${USER}/WEB-INF/lib to see project jars {USER}/WEB-INF/lib to see project jars generated by deploymentgenerated by deployment
How does Gridsphere know your project?How does Gridsphere know your project?
4444 TeraGrid’07, June 4-8, 2007, Madison, WI
GridSphere-based GridSphere-based Portlet DevelopmentPortlet Development
Visual UI taglib for renderingVisual UI taglib for rendering
Portlet classPortlet class– Extend ActionPortletExtend ActionPortlet– All beans are constructed from ActionFormEvent or All beans are constructed from ActionFormEvent or
RenderFromEventRenderFromEvent– Get PortletRequest and PortletResponse from FormEventGet PortletRequest and PortletResponse from FormEvent– Use setNextState() to point to JSP page in rendering methodsUse setNextState() to point to JSP page in rendering methods– Use setNextState() to point to rendering method in action Use setNextState() to point to rendering method in action
methodsmethods
<%@ taglib uri="/portletUI" prefix="ui" %><%@ taglib uri="http://java.sun.com/portlet" prefix="portlet“ %><portlet:defineObjects/>
4545 TeraGrid’07, June 4-8, 2007, Madison, WI
Example: UserPortletExample: UserPortlet
UserPortlet::show()UserPortlet::show()– Default rendering method which displays user Default rendering method which displays user
information and grid proxy configuration in JSPinformation and grid proxy configuration in JSP– In JSP, Bean is used to render the values of user In JSP, Bean is used to render the values of user
forms forms Java code is embedded to directly access Java code is embedded to directly access
RenderRequest for grid proxy informationRenderRequest for grid proxy information
UserPortlet::configSimpleCred()UserPortlet::configSimpleCred()– Action method to retrieve grid proxy either Action method to retrieve grid proxy either
from MyProxy server or locally from a valid from MyProxy server or locally from a valid proxy fileproxy file
4646 TeraGrid’07, June 4-8, 2007, Madison, WI
UserPortlet InterfaceUserPortlet Interface
4747 TeraGrid’07, June 4-8, 2007, Madison, WI
Velocity-based Portlet Velocity-based Portlet DevelopmentDevelopment
Portlet definitionPortlet definition– Initial template nameInitial template name– velocity.propertiesvelocity.properties
Action classAction class– Get parameters: ActionRequest.getParameter()Get parameters: ActionRequest.getParameter()– Rendering: VelocityContext.put(name, object)Rendering: VelocityContext.put(name, object)– Action methods: called based on their names through Java Action methods: called based on their names through Java
ReflectionReflection Velocity templateVelocity template
#if( !$gisolve_portal_error_info.equals("") ) <pre><p><font face="Arial Narrow“ color="red">$gisolve_portal_error_info</font><p></pre> <hr>#end<form name="dms0002" method="POST" action="$actionURL"> <input type="submit" value="Return“ name="actionMethod_doDms_return"></form><hr><p>
http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html
4848 TeraGrid’07, June 4-8, 2007, Madison, WI
DMS Analysis DMS Analysis Workflow in PortalWorkflow in Portal
Workflow control is done by keeping Workflow control is done by keeping state information in PortletSession as state information in PortletSession as attributesattributes
Portlet communicationPortlet communication– Need to coordinate two portletsNeed to coordinate two portlets
PortletSession.getAttribute(name, PortletSession.getAttribute(name, PortletSession.APPLICATION_SCOPE)PortletSession.APPLICATION_SCOPE)
PortletSession.setAttribute(name, value, PortletSession.setAttribute(name, value, PortletSession.APPLICATION_SCOPE)PortletSession.APPLICATION_SCOPE)
Learn how SimpleGrid remembers Learn how SimpleGrid remembers current status of each jobcurrent status of each job
4949 TeraGrid’07, June 4-8, 2007, Madison, WI
DMSPortlet InterfaceDMSPortlet Interface
5050 TeraGrid’07, June 4-8, 2007, Madison, WI
Exercise 5Exercise 5
Run DMS portlet and get visualization Run DMS portlet and get visualization resultsresults– Result page plots results after the analysisResult page plots results after the analysis– Do you see your job is running on TeraGrid?Do you see your job is running on TeraGrid?
Refresh job statusRefresh job status Verify it by using “qstat | grep gisolve” to see the Verify it by using “qstat | grep gisolve” to see the
status of your jobstatus of your job
– Thread in SimpleGrid portletsThread in SimpleGrid portlets File transfer and result visualization access the same File transfer and result visualization access the same
portal server and are time-consumingportal server and are time-consuming Threads are used to respond to user requests quicklyThreads are used to respond to user requests quickly
5151 TeraGrid’07, June 4-8, 2007, Madison, WI
Visualization on Visualization on TeraGridTeraGrid
SimpleGrid uses JFreeChart for SimpleGrid uses JFreeChart for simple local visualizationsimple local visualization
We are evaluating the integration We are evaluating the integration between GISolve and ParaView on between GISolve and ParaView on TeraGrid to support advanced TeraGrid to support advanced visualizationvisualization
http://tg-portal.uc.teragrid.org/
5252 TeraGrid’07, June 4-8, 2007, Madison, WI
SummarySummary
SimpleGrid provides basic components to SimpleGrid provides basic components to develop science and engineering gatewaysdevelop science and engineering gateways– This tutorial includes code, links, and examplesThis tutorial includes code, links, and examples– Based on a real-world GIS applicationBased on a real-world GIS application
SimpleGrid is also used in GISolve, SimpleGrid is also used in GISolve, TeraGrid GIScience gateway TeraGrid GIScience gateway
Gateway server setup instructions and Gateway server setup instructions and additional materials will be provided in additional materials will be provided in GISolve/TeraGrid online documentationGISolve/TeraGrid online documentation
5353 TeraGrid’07, June 4-8, 2007, Madison, WI
Q & AQ & A
Questions and comments?Questions and comments? Thanks!Thanks!
Top Related