The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) Hostname-portlet Template Riccardo Rotondo

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Struts Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Struts Portlet Adding an Action Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
Short Portlet Programming Guide in P-Grade (Gridsphere) environment G. Hermann.
Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
J4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.
CGI programming Using Apache. Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) Riccardo Rotondo
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
1 Application Specific Module for P-GRADE Portal 2.7 Application Specific Module overview Akos Balasko MTA-SZTAKI LPDS
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) Grid Engine Riccardo Rotondo
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Rsv-control Marco Mambelli – Site Coordination meeting October 1, 2009.
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) WMPROXY API Python & C++ Diego Scardaci
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
Introduction to JavaServer Pages (JSP) Slides from Dr. Mark Llewellyn.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
Standalone Java Application vs. Java Web Application
The gLite API – PART I Giuseppe LA ROCCA INFN Catania ACGRID-II School 2-14 November 2009 Kuala Lumpur - Malaysia.
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) MPI Applications with the Grid Engine Riccardo Rotondo
1 ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1 Building Portlets with ColdFusion Pete Freitag Foundeo, Inc.
Java Portals and Portlets Submitted By: Rashi Chopra CIS 764 Fall 2007 Rashi Chopra.
Application Specific Module Tutorial Akos Balasko 02/07/
JSP Tag Libraries Lec Last Lecture Example We incorporated JavaBeans in “Course Outline” Example But still have to write java code inside java.jsp.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) The EPIKH Project Riccardo Rotondo
Overview of the Automated Build & Deployment Process Johnita Beasley Tuesday, April 29, 2008.
Table of Contents TopicSlide Administrator Login 2 Administrator Navigations 3 Managing AlternativeDr.com Blogs 4 Managing Dr. Lloyd May Blogs 5 Managing.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
SPI NIGHTLIES Alex Hodgkins. SPI nightlies  Build and test various software projects each night  Provide a nightlies summary page that displays all.
® IBM Software Group © 2006 IBM Corporation Rational Asset Manager v7.2 Using Scripting Tutorial for using command line and scripting using Ant Tasks Carlos.
S ERVLETS Form Data 19-Mar-16. F ORM P ROCESSING You must have come across many situations when you need to pass some information from your browser to.
Debugging Lab Antonio Gómez-Iglesias Texas Advanced Computing Center.
Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney.
GILDA VM Liferay V1.4. VM Requirements Virtualization – VMWare (Player(free), Workstation, etc …) – OVF image file available for other platforms Hosting.
Grid Initiatives for e-Science virtual communities in Europe and Latin America Riccardo Rotondo
The EPIKH Project Portlet Develop Introduction Riccardo Rotondo Consortium GARR Tutorial per l’integrazione.
The Developing Environment Mr. Riccardo Rotondo Consortium GARR, Rome, Italy
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) GILDA VM Liferay V1.3.
Job Management Portlet Mario Torrisi Istituto Nazionale di Fisica Nucleare – Sezione di Corso.
1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.
Development of portlets for special jobs: parametric, collections, workflows Mario Torrisi National Institute of Nuclear Physics.
Introduction to job submission portlets Riccardo Bruno INFN Dpt. Of Web course on the development.
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) Africa Joint CHAIN/EUMEDGRID- Support/EPIKH School for.
Grid Initiatives for e-Science virtual communities in Europe and Latin America Elisa Ingrà
Grid Initiatives for e-Science virtual communities in Europe and Latin America Riccardo Rotondo
Development of portlets for special jobs: parametric, collections, workflows Mario Torrisi Istituto Nazionale di Fisica Nucleare.
Convert generic gUSE Portal into a science gateway Akos Balasko.
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) Continue by your own… Riccardo Bruno
Tutorial on Science Gateways, Roma, Riccardo Rotondo Web Application Development Introduction to application servers, web applications and portlets.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
Introduction to portlet development Carla Carrubba INFN Dpt. Of Catania Giuseppina Inserra
(Exchange Programme to advance e-Infrastructure Know-How)
INVESTIGATING A SCIENCE GATEWAY FOR AN AGENT-BASED
Hostname-portlet Template
Java standalone version
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
Presentation transcript:

The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) Hostname-portlet Template Riccardo Rotondo Consortium GARR Joint CHAIN/EPIKH School for Application Porting to Science Gateways Beijing,

Portlets Standard JSR168/286 Interaction between jsp pages and java code JSP uses <form… statements to send parameters to Java code Java code extends class GenericPortlet overriding methods: –Init, doView, doHelp, doEdit, processAction Java code uses 2 Classes to exchange data from/to JSPs JSP pageJava code Application Server (Glassfish) <jsp:useBean <jsp:useBean Class Extends GenericPortlet … Class Extends GenericPortlet … Beijing, Asia4,

Portlet files (root) build.xml docroot/ WEB_INF/ css/ images/ js/ jsp_page_1.jsp … jsp_page_n.jsp Used by ‘ant’ to compile and deploy the portlet Define here JSP’s styles JSP image files Portlet JSP pages Beijing, Asia4,

Portlet files WEB_INF/ glassfish-web.xml web.xml lib/ Job/ liferay-display.xml liferay-plugin-package.properties liferay-portlet.xml portlet.xml src/ /code.java tld/ Used to define database and other resources settings Jar Library directory (local scope) Job files (Custom dir) Java source files Portlet configuration files Portlet configuration files XML structure file Beijing, Asia4,

Parameters exchange (JSP->Java) Portlet modes: –VIEW – Userd for normal portlet operations -> calls processAction() –EDIT – Userd to configure portlet parameters -> calls doEdit() –HELP – Userd to show help information -> calls doHelp() <form action=action="<portlet:actionURL portletMode="view"> <portlet:param name="param_name_1" value="param value 1"/> … <portlet:param name="param_name_n" value="param value n"/> … <form action=action="<portlet:actionURL portletMode="view"> <portlet:param name="param_name_1" value="param value 1"/> … <portlet:param name="param_name_n" value="param value n"/> … processAction(ActionRequest request,… doView/doHelp/doEdit(RenderRequest request,… // To obtain the parameter just set … String param_i = request.getParameter("param_name_i"); processAction(ActionRequest request,… doView/doHelp/doEdit(RenderRequest request,… // To obtain the parameter just set … String param_i = request.getParameter("param_name_i"); Beijing, Asia4,

Parameters exchange (Java->JSP) From Java code: Inside the JSP load values with: <% // To load variables from Portlet Class … %> " scope="request"/> <% // To reference a param value %> <% // To load variables from Portlet Class … %> " scope="request"/> <% // To reference a param value %> doView/doHelp/doEdit(RenderRequest request,… // To send the parameter just call … request.setAttribute("param_name_j", param_name_j); doView/doHelp/doEdit(RenderRequest request,… // To send the parameter just call … request.setAttribute("param_name_j", param_name_j); Beijing, Asia4,

Portlet workflow JSP page doView ProcessAction ACTION/VIEW Architecture Hostname code provides two Enum types: Actions and Views For each Action a different View can be selected and easily managed by switch statements The two enumerated types used to manage the portlet behavior Between portlet methods: ‘doView and ProcessAction’. Jsp/Java Variable: ‘ PortletStatus ’ doView JSP page ProcessAction JSP page default init Beijing, Asia4,

Portlet Session data JSP page doView ProcessAction Two objecst: actionRequest processAction() renderRequest doView() doHelp() doEdit() init ProcessAction sends parameters to RenderRequest through: ActionResponse (2 nd parameter of ProcessAction ) response.setRenderParameter("param_name_y", param_value_y); doView/doHelp/doEdit (1 st parameter) RenderResponse param_name_w= request.getParameter ("param_name_w"); Parameters to jsp and select it: request.setAttribute("JobId", inputJobId); getPortletContext().getRequestDispatcher(”/.jsp"); Beijing, Asia4,

hostname-portlet example Portlet to send a test job into a distributed infrastructure –Input:  Input file or a text  A human readable job identifier –Ouput  Hostname of running machine  File containing information about the running machine Portlet statuses –INPUT (Shows the input fields) –SUBMIT (Shows the job submission feedback) –Jsp/Java variable ‘ PortletStatus ’ input.jsp submit.jsp Beijing, Asia4,

Hostname Action/View enums Actions –ACTION_INPUT –ACTION_SUBMIT Views (Possible portlet views) –VIEW_INPUT –VIEW_SUBMIT Default Action Simply forward portlet status to the doView() in: RenderParameter Default Action Simply forward portlet status to the doView() in: RenderParameter Beijing, Asia4,

Hostname Action/View Actions –ACTION_INPUT –ACTION_SUBMIT Views –VIEW_INPUT –VIEW_SUBMIT View Select the INPUT form view input.jsp (default view mode) View Select the INPUT form view input.jsp (default view mode) Beijing, Asia4,

Hostname Action/View Actions –ACTION_INPUT –ACTION_SUBMIT Views –VIEW_INPUT –VIEW_SUBMIT This action will submit the hostname job into the distributed infrastructure This action will submit the hostname job into the distributed infrastructure " method="post”> Beijing, Asia4,

Hostname Action/View Actions –ACTION_INPUT –ACTION_SUBMIT Views –VIEW_INPUT –VIEW_SUBMIT Select the proper view showing the Information page that shows the job has been submitted Select the proper view showing the Information page that shows the job has been submitted Beijing, Asia4,

Portlet Initialization portlet.xlm contains portlet initialization parameters init parameter name init parameter value The init() method uses s to load Portlet’ default parameter values Some of the default parameters values will be used to load portlet default preferences public void init() throws PortletException { // Load default values from portlet.xml init_PortletVersion = getInitParameter(“init parameter name"); … public void init() throws PortletException { // Load default values from portlet.xml init_PortletVersion = getInitParameter(“init parameter name"); … Beijing, Asia4,

hostname’ To make parameter management easier all values are threated as String type init_PortletVersion - Portlet version number init_bdiiHost - Information system service (ldap://...:2170) init_wmsHost - Infrastructure resource manager (wms://...:7443/glite_wms_wmproxy_server) init_pxServerHost - Hostname of Robot proxy server (myproxy.ct.infn.it not used yet) init_pxRobotId - Id of the robot certificate init_pxRobotVO - Infrastructure virtual organization init_pxRobotRole - Role of generated proxy init_pxUserProxy - Standard proxy file (instead of Robots) init_pxRobotRenewalFlag - Allows automatic job renewal mechanism init_SciGwyAppId - Science Gateway application identifier '9' for GILDA VM tester application GridEngine' User tracking database (UTDB) access credentials –init_SciGwyUserTrackingDB_Hostname –init_SciGwyUserTrackingDB_Username –init_SciGwyUserTrackingDB_Password –init_SciGwyUserTrackingDB_Database – Users should not use Direct DB access to UTDB init_JobRequirements - Application job requirements init_pilotScript - Application pilot script Beijing, Asia4,

Hostname Portlet preferences getPreferences method called by both: – doView and processAction private void getPreferences( ActionRequest actionRequest,RenderRequest renderRequest) { PortletPreferences prefs=null; if(null!=actionRequest) prefs = actionRequest.getPreferences(); else if(null != renderRequest) prefs = renderRequest.getPreferences(); if (null != prefs) { // The second parameter assigns a default value pref_value=prefs.getValue(" ", " "); private void getPreferences( ActionRequest actionRequest,RenderRequest renderRequest) { PortletPreferences prefs=null; if(null!=actionRequest) prefs = actionRequest.getPreferences(); else if(null != renderRequest) prefs = renderRequest.getPreferences(); if (null != prefs) { // The second parameter assigns a default value pref_value=prefs.getValue(" ", " "); Beijing, Asia4,

Job Submission (1/4) // Job details String executable="/bin/sh"; // Application executable String arguments="pilot_script.sh"; // executable' arguments String outputPath="/tmp/"; // Output Path String outputFile="application.out"; // Application stdout String errorFile="application.err"; // Application stderr // InputSandbox (string with comma separated list of file names) String inputSandbox= appServerPath +"/WEB-INF/job/pilot_script.sh” +","+ ; // OutputSandbox (string with comma separated list of file names) String outputSandbox="generated_output_file"; Beijing, Asia4,

Job Submission (2/4) // Software tags String jdlRequirements[] = pref_JobRequirements.split(";"); int numRequirements=0; for(int i=0; i<jdlRequirements.length; i++) if(!jdlRequirements[i].equals("")) { jdlRequirements[numRequirements] = "JDLRequirements=("+jdlRequirements[i]+")"; numRequirements++; } // Instanciate the JSAGA object JSagaJobSubmission tmpJSaga = new JSagaJobSubmission(); tmpJSaga.setBDII(bdiiHost);// Infrastructure top BDII Beijing, Asia4,

Job Submission (3/4) // Proxy renewal flag if((pref_pxRobotRenewalFlag.toLowerCase()).equals("true")) pxRobotRenewalFlag=true; else pxRobotRenewalFlag=false; // Associate a valid proxy (Robot/UserProxy) // Specifying a path for local proxy it will be used instead if(pxUserProxy==null || pxUserProxy.equals("")) { tmpJSaga.useRobotProxy( pxRobotId,pxRobotVO,pxRobotRole,pxRobotRenewalFlag ); else tmpJSaga.setUserProxy(pxUserProxy); Beijing, Asia4,

Job Submission (4/4) tmpJSaga.setExecutable(executable); // Specify the executeable tmpJSaga.setArguments(arguments); // Specify the application' arguments tmpJSaga.setOutputPath(outputPath); // Specify the output directory tmpJSaga.setInputFiles(inputSandbox); // Setup input files (InputSandbox) tmpJSaga.setOutputFiles(outputSandbox); // Setup output files (OutputSandbox) tmpJSaga.setJobOutput(outputFile); // Specify the std-outputr file tmpJSaga.setJobError(errorFile); // Specify the std-error file if(numRequirements>0) tmpJSaga.setJDLRequirements(jdlRequirements); // Assign requirements // Submit the job // If a WMS is specified the call to Job submission changes if(wmsHost!=null && !wmsHost.equals("")) tmpJSaga.submitJobAsync(username,hostUTDB,applicationId,wmsHost,jobIdentifier ); else tmpJSaga.submitJobAsync( username,hostUTDB,applicationId,jobIdentifier ); Beijing, Asia4,

From hostname to your portlet Extract hostname portlet form svn svn checkout ‘ cd ’ inside the hostname-portlet directory and try to compile it with the command: ant deploy If the compilation is successful create a physical copy of the portlet directory source code –cp –r hostname-portlet -portlet Customize your portlet settings configuring several XML files: –docroot/WEB-INF/portlet.xml -portlet _portlet … init_PortletVersion Specify your Portlet' version number … other init parameters Beijing, Asia4,

Init parameters init_PortletVersion init_bdiiHost init_wmsHost init_pxServerHost init_pxRobotId init_pxRobotVO init_pxRobotRole init_pxUserProxy init_pxRobotRenewalFlag init_SciGwyAppId init_SciGwyUserTrackingDB_Hostname init_SciGwyUserTrackingDB_Username init_SciGwyUserTrackingDB_Password init_SciGwyUserTrackingDB_Database init_JobRequirements init_pilotScript Your portlet version Infrastructure settings … Robot proxy settings Robot Id, Virtual Organization, Proxy Role, Renewal Flag pxUserProxy (mutually exclusive to Robots) Allows the use of a user proxy Just provide a valid path to a proxy file Robot proxy settings Robot Id, Virtual Organization, Proxy Role, Renewal Flag pxUserProxy (mutually exclusive to Robots) Allows the use of a user proxy Just provide a valid path to a proxy file Each application has a unique Id (GridEngine) GridEngine connection credentials (Unused) Grid Job requirements Job’ pilot script (bash) Beijing, Asia4,

From hostname to your portlet –docroot/WEB-INF/portlet.xml (still) Title of yor porltlet Short title Portlet' keywords –docroot/WEB-INF/liferay-display.xml " (your institution ‘GILDA’) " (name displayed into the mangment interface) –docroot/WEB-INF/lib Overrides or extends the portlet java code global library repository (/opt/glassfish3/glassfish/domains/liferay/lib/) –docroot/WEB-INF/liferay-portlet.xml –docroot/WEB-INF/glassfish-web.xml (Information managed by App server Glassfish) –docroot/images/ Each image used by the jsp pages should be located here –docroot/icon.png Place here a 16x16 image file with your portlet icon Beijing, Asia4,

From hostname to your portlet –/docroot/WEB-INF/src/it/infn/ct/hostname_portlet.java  Make a copy of this source file into directory: /.java> WARNING: Do not forget to assign to the class the same name of the java file –Start to develop the interface modifying jsp files and change java code Enums with correct Actions and Views modes using human readable identifiers. For simple Appliocation user interfaces there will be no need to add other JSPs or action/view modes to the existing Enum –Edit the java code in order to manage your application specific interface and prepare the correct sandboxes to submit properly the job –Prepare the pilot script and use it as parameter. Beijing, Asia4,

Create NetBeans project Open new project and select: Categories: Java web Projects: Web Appliacations with existing sources. Press 'Next' Location: Point Netbeans to locate the portlet directory through the VM shared folder. Press 'Next' Accept any suggestion and proceed Press 'Next' Add other directory places: WEB-INF Content: Select the docroot/WEB-INF directory inside the portlet directory Library folder: point it to docroot/WEB-INF/lib Then press the 'Finish' button and the project will be created Right click on the project name and click on Peferences, then Libraries Select all jars pointed by :liferay_libs/ directory Beijing, Asia4,

Create Eclipse project … Beijing, Asia4,

References GILDA VM – GILDA VM Instructions – hostname portlet template – Beijing, Asia4,

Questions? Beijing, Asia4,