Application Specific Module Tutorial Akos Balasko 02/07/2012 1.

Slides:



Advertisements
Similar presentations
Struts Portlet Adding an Action Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
Advertisements

JSF Portlet Backing Beans and UI Components Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in.
Home This training presentation is designed to introduce the Residency Management Suite to new users. This presentation covers the following topics: Login.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
© 2007 IBM Corporation ® Luciano Silva, Robert Loredo 12/20/2007 WDF Applications on BlackBerry devices IBM WebSphere® Dashboard Framework.
Indianapolis Java User Group JSR-168 Portal Presentation Introduction: Kurt Desserich.
SETUP AND CONFIGURATIONS WEBLOGIC SERVER. 1.Weblogic Installation 2.Creating domain through configuration wizard 3.Creating domain using existing template.
Page 1 of 23 The FMT system utilizes Roles to determine ownership and levels of responsibility within the FMT system. The Well Licensee/Unit Operator is.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
Portals and portlets Sean C. Sullivan October 24, 2006 Portland Java Users Group.
Struts Portlet Database Interaction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
A Servlet’s Job Read explicit data sent by client (form data) Read implicit data sent by client (request headers) Generate the results Send the explicit.
Database Updates Made Easy In WebFocus Using SQL And HTML Painter Sept 2011 Lender Processing Services 1.
TUTORIAL (1) Software installation Written by: Eng. Ahmed Mohamed Abdel Ghafar, Edited by Eng. Muhammed Hammad, Eng. Hamdy Soltan & Eng. Osama Talaat.
Developing an Application-Specific Portal with P-GRADE Portal 2.9 Author: Ákos Balaskó, Date :
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Web-based Document Management System By Group 3 Xinyi Dong Matthew Downs Joshua Ferguson Sriram Gopinath Sayan Kole.
Struts 2.0 an Overview ( )
Recruitment Office Procedures Job Posting Requests Creating a Search Committee –Adding Search Committee MembersAdding Search Committee Members –Designating.
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) Hostname-portlet Template Riccardo Rotondo
Self Guided Tour for Query V8.4 Basic Features. 2 This Self Guided Tour is meant as a review only for Query V8.4 Basic Features and not as a substitute.
AQS Web Quick Reference Guide Changing Raw Data Values Using Maintenance 1. From Main Menu, click Maintenance, Sample Values, Raw Data 2. Enter monitor.
For Version 6.0 and later Lattice3D Reporter Tutorial For Version 6.0 and later LATTICE TECHNOLOGY, INC.
WaveMaker Visual AJAX Studio 4.0 Training Authentication.
© 2003 By Default! A Free sample background from Slide 1 Week 2  Free PHP Hosting Setup  PHP Backend  Backend Security 
Chapter 5 Java Servlets. Objectives Explain the nature of a servlet and its operation Use the appropriate servlet methods in a web application Code the.
Li Tak Sing COMPS311F. Static attributes in Servlets Since Servlets are also Java classes, you can also use static attributes to store values that can.
INDIVIDUAL ACHIEVEMENT. EDUCATIONAL EXCELLENCE. ADMINISTRATIVE INNOVATION. INSTITUTIONAL PERFORMANCE. 1 Develop and Deploy JSR-168 Portlets Presented by:
Chapter 7 Java Server Pages. Objectives Explain how the separation of concerns principle applies to JSP Describe the operation and life-cycle of a JSP.
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
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,
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
SCI-BUS is supported by the FP7 Capacities Programme under contract nr RI Creating the Autodock gateway from WS-PGRADE/gUSE and making it cloud-enabled.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
1 ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1 Building Portlets with ColdFusion Pete Freitag Foundeo, Inc.
Mark Dixon 1 09 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
ASM Hands-on. What will we learn? ● How to install an ASM-based web-application in gUSE ● How to develop ASM-related parts of an interface for – Importing.
1 CS 3870/CS 5870: Note 07 Lab 3 Lab 4 Test 1: Two Tables.
Java Portals and Portlets Submitted By: Rashi Chopra CIS 764 Fall 2007 Rashi Chopra.
Convert generic gUSE Portal into a science gateway Akos Balasko 02/07/
Plugin management in Geronimo admin console
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Table of Contents TopicSlide Administrator Login 2 Administrator Navigations 3 Managing AlternativeDr.com Blogs 4 Managing Dr. Lloyd May Blogs 5 Managing.
Introduction to Taverna Online and Interaction service Aleksandra Pawlik University of Manchester.
©SoftMoore ConsultingSlide 1 Filters. Filters can be used in a web application to intercept, examine, and possibly transform requests or responses associated.
Vakgroep Informatietechnologie – Onderzoeksgroep (naam) Web Centric Design of Distributed Software.
Convert generic gUSE Portal into a science gateway Akos Balasko.
Struts Framework Day-2 Ashok Chakravarti. DataSource Usage Sample Struts-config.xml …
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
Chapter 12© copyright Janson Industries Java Server Faces ▮ Explain the JSF framework ▮ SDO (service data objects) ▮ Facelets ▮ Pagecode classes.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
Application Specific Module Tutorial Zoltán Farkas, Ákos Balaskó 03/27/
Advanced Task Engine Doing Cool Stuff with Cool stuff!
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.
12 Copyright © 2004, Oracle. All rights reserved. Using ADF Struts Components.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
Remote Api Tutorial How to call WS-PGRADE workflows from remote clients through the http protocol?
FHA Training Module 1 This document reflects current policy related to this topic. Its content is approved for use in all external and internal FHA-related.
Fab25 User Training Cerium Labs LabCollector - LIMS Lynette Ballast.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
1.Switch on the computer and wait for loading. 2.Select the Windows 7 OS at the end of the list. 3.Click on the link ‘Administrator’ 4.Enter the administrator.
DCI BRIDGE Introduction its Native Access Hands-On Akos Balasko
Convert generic gUSE Portal into a science gateway Akos Balasko.
Convert generic gUSE Portal into a science gateway Akos Balasko.
WS-PGRADE + ASM Basic hands-on Zoltán Farkas, MTA SZTAKI
Introduction to portlet development Carla Carrubba INFN Dpt. Of Catania Giuseppina Inserra
An Overview of Navigation Buttons and Teacher Features
Basic hands-on Zoltán Farkas, MTA SZTAKI
Create a Portlet Project in RAD
Presentation transcript:

Application Specific Module Tutorial Akos Balasko 02/07/2012 1

Outline Technical Session: Sample web-interface (JSP) Implement event-handler class Deploy it to Liferay-based gUSE Adjusting as a new component in gUSE 2

Overview Sample application: 3 Input file(inputval.txt) Output (internal file name: outputval.txt) Shell-script: Read and count numbers from input file and command line Command-line

Overview Button to create new Query List of created queries Each row is identified by the application id Status Date of creation Action Buttons 4

Information Transfer: Server  Client CLIENT CODE ${dev} SERVER CODE public void doView(RenderRequest req, RenderResponse res) throws PortletException { ArrayList developers = new ArrayList (); developers.add(„10168"); developers.add(„10169"); req.setAttribute(„ developers ",developers); PortletRequestDispatcher dispatcher; dispatcher = getPortletContext().getRequestDispatcher(nextJSP); dispatcher.include(req, res); } CLIENT BROWSER (developers=[„10168” ; „10169”] ) 5

Information Transfer : Client  Server CLIENT CODE ${dev} SERVER CODE public void processAction(ActionRequest request, ActionResponse response) throws PortletException { String action = ""; if ((request.getParameter("action") != null) && (!request.getParameter("action").equals(""))) { action = request.getParameter("action"); } if (action != null) { Method method = this.getClass().getMethod(action, new Class[]{ActionRequest.class, ActionResponse.class}); method.invoke(this, new Object[]{request, response}); } CLIENT BROWSER (action=„doHandleEvent; devs=„10168”) Call doHandleEvent 6

Information transfer : ActionHandler  Rendering ACTION HANDLER public void doHandleEvent(ActionRequest request, ActionResponse response) throws PortletException { String selected_dev = request.getParameter(„devs"); //(selected_dev = 10168) response.setRenderParameter(„goahead", selected_dev); } Call doHandleEvent RENDER (DOVIEW) public void doView(RenderRequest req, RenderResponse res) throws PortletException { if (req.getParameter(„goahead") != null) { String devid = req.getParameter(„goahead"); } (goahead=„10168”) 7

Create JSP file 8

How to make JSR-286 compliant portlet from a class? 1.Extend it from GenericPortlet class 2.Create processAction method 3.Create doView method 4.Create eventhandler methods with ActionRequest and ActionResponse parameters 9

1. Extend it from GenericPortlet class Open MyFirstASMInterface.java for editing and extend it from GenericPortlet class: public class MyFirstASMInterface extends GenericPortlet { } 10

2. Create ProcessAction method public void processAction(ActionRequest request, ActionResponse response) throws PortletException { String action = ""; // Checking if the call contains multipart content boolean isMultipart = PortletFileUpload.isMultipartContent(request); if (!isMultipart) { // if not, it's a simple calling, let's get the name of the function from „action” parameter and check the reference of it if ((request.getParameter("action") != null) && (!request.getParameter("action").equals(""))) { action = request.getParameter("action"); } if (action != null) { try { // it's not null, invoke this function from the event-handler class and handle the possible exceptions Method method = this.getClass().getMethod(action, new Class[]{ActionRequest.class, ActionResponse.class}); method.invoke(this, new Object[]{request, response}); } catch (NoSuchMethodException e) { System.out.println(" No such method"); } catch (IllegalAccessException e) { System.out.println(" Illegal access"); } catch (InvocationTargetException e) { System.out.println(" Invocation target Exception"); e.printStackTrace(); } } else { // it contains multipart content, call the upload function and handle the next steps there doUpload(request, response); } 11

3.Create doView method public void doView(RenderRequest req, RenderResponse res) throws PortletException { try { String nextJSP = (String) req.getParameter("nextJSP"); if (nextJSP == null){ nextJSP = DISPLAY_PAGE; } // generating the JSP page PortletRequestDispatcher dispatcher; dispatcher = getPortletContext().getRequestDispatcher(nextJSP); dispatcher.include(req, res); } catch (IOException ex) { Logger.getLogger(ASM_SamplePortlet.class.getName()).log(Leve l.SEVERE, null,ex); } 12

First step to connect to gUSE private String DISPLAY_PAGE = "/jsp/asm_sample/asmsample.jsp"; ASMService asm_service = null; public MyFirstASMInterface() { asm_service = ASMService.getInstance(); } 13

Create new application Browser Client code Eventhandler code public void doCreateNewWorkflow(ActionRequest request, ActionResponse response) throws PortletException { try { String userId = request.getRemoteUser(); // getting workflows for All workflow developers Vector developers = asm_service.getWorkflowDevelopers(RepositoryItemTypeConstants.Application); Vector workflows = new Vector (); for (String dev: developers){ workflows.addAll(asm_service.getWorkflowsFromRepository(dev, RepositoryItemTypeConstants.Application)); } …..

Create new application …. // Getting the current workflow exported by the workflow developer …. ….latestWorkflow =w.getId().toString(); …. Calendar cal = Calendar.getInstance(); SimpleDateFormat udf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); String workflowName = WorkflowPrefix + "_"+ udf.format(cal.getTime()); asm_service.ImportWorkflow(userId,workflowName, workflowDeveloper, RepositoryItemTypeConstants.Application, latestWorkflow); } catch (Exception ex) { ex.printStackTrace(); } Eventhandler code

Create a table for the workflows to be listed Query Creation Date And Time Status Actions Browser Client code

Iterate through the workflows,get name and status ${fn:split(datetime,"-")[0]}/${fn:split(datetime,"-")[1]}/${fn:split(datetime,"-")[2]} at ${fn:split(datetime,"-")[3]}:${fn:split(datetime,"-")[4]}:${fn:split(datetime,"-")[5]} ${workflows.statusbean.status} ….. Browser Client code

Iterate through the workflows,get name and status Browser Eventhandler code public void doView(RenderRequest req, RenderResponse res) throws PortletException { try { String userID = req.getRemoteUser(); try { req.setAttribute("asm_instances", asm_service.getASMWorkflows(userID)); } catch (Exception e) { e.printStackTrace(); // not found notify file } …..

Show imported applications 1/2 doView method : … // passing arguments back, list of workflow that are already imported using getASMWorkflows(String userID) method req.setAttribute("asm_instances", asm_service.getASMWorkflows(userID) ); It returns : List, where ASMWorkflow is 19

20

Set inputs and Submit … Type the first number: Type the second number: Browser Client code

Set inputs and Submit public void doSubmit(ActionRequest request, ActionResponse response) throws PortletException { try { String userID = (String) request.getRemoteUser(); String selected_wf = request.getParameter("user_selected_instance"); String input_numb = request.getParameter("input_numb"); String actual_command_line = request.getParameter("command_line"); asm_service.setCommandLineArg(userID, selected_wf, "add", actual_command_line); try{ asm_service.setInputText(userID, input_numb,selected_wf, "add", "0"); }catch(Exception ex){ Logger.getLogger(ASM_SimplePortlet.class.getName()).log(Level.SEVERE, null, ex); } asm_service.submit(userID, selected_wf); } catch (ClassNotFoundException ex) { Logger.getLogger(ASM_SimplePortlet.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(ASM_SimplePortlet.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(ASM_SimplePortlet.class.getName()).log(Level.SEVERE, null, ex); } Eventhandler code

Download method Browser Client code Eventhandler public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException { String userID = request.getRemoteUser(); Enumeration paramNames = request.getParameterNames(); String selected_wf = ""; while(paramNames.hasMoreElements()){ String act_param = (String)paramNames.nextElement(); if (act_param.startsWith(" download_ ")){ selected_wf = act_param.substring(9); }

Download method try { response.setContentType("application/zip"); response.setProperty("Content-Disposition", "inline; filename=\"" + selected_wf + "_enduser_outputs.zip\""); asm_service.getFileStream(userID, selected_wf, "add", "outputval.txt", response); } catch (Exception e) { e.printStackTrace(); } Eventhandler code

Delete method public void doDelete(ActionRequest request, ActionResponse response) throws PortletException { String userID = (String) request.getRemoteUser(); String selected_wf = request.getParameter("user_selected_instance"); asm_service.DeleteWorkflow(userID, selected_wf); } Browser Client code Eventhandler code

Deploy it to Liferay-based gUSE And set it as a new component in gUSE 26

Deploy it to Liferay-based gUSE Sign in as a user with admin roles (default username is : password is : test ) 27

Deploy it to Liferay-based gUSE Navigate to Plugin Installer panel by clicking Manage -> Control Panel, and by selecting Plugins Installation from the menu in the left hand-side, finally clicking install More Portlets button and upload File link. 28

Adjusting it as a new component (just once) As admin, please go to Settings menu and select Internal Services 29

Adjusting it as a new component (just once) Click to New button and set the followings: Type of Component: portal Service group: gUSE URL of Component: URL to initialize Component: Public URL of Component: State: active Then click to Save button! 30

Adjusting it as a new component (just once) Click to copy component Properties tab Set as Source component and as Destination one, then click to copyhttp://localhost:8080/wspgrade 31

Adjusting it as a new component Finally initialize the whole portal again by calling (in some cases portal restart required.) 32

Creating new menuitem for it (just once) 33

Adding the portlet under this menu (just once) Click to „Add” and select „more” The newly developed portlet should be available under undefined group. Finally click to „add” in the row of the portlet 34

Thank you for your attention! Questions? 35