Enhancing portlets with charts and secure directory service Tomasz Kuczyński Poznan Supercomputing and Networking Center.

Slides:



Advertisements
Similar presentations
W w w. h p c - e u r o p a. o r g HPC-Europa Portal: Uniform Access to European HPC Infrastructure Ariel Oleksiak Poznan Supercomputing.
Advertisements

Continents and Oceans Write On.
Struts Portlet Adding an Action Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
JLab Lattice Portal – Data Grid Web Service Ying Chen, Chip Watson Thomas Jefferson National Accelerator Facility.
A Blackboard Building Block™ Crash Course for Web Developers
CSCI 1411 FUNDAMENTALS OF COMPUTING LAB Lab Introduction 1 Shane Transue MSCS.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Starting with Gridsphere Albert Einstein Institute Gridsphere Installation.
Where in the World are You?
Hilary DeLuco. Content Area: Social Studies Grade Level: 3 rd Grade Summary: The purpose of this instructional PowerPoint is for students to learn, through.
Geography Challenge #1 Review the World / US – First 13.
The Seven Continents of Earth By Picture of Continents.
THE CONTINENTS OF THE WORLD Read the instructions carefully on each page and do as they tell you.
What are the Continents? North America South America Africa Europe Asia Australia Antarctica.
Continents and Oceans Grade 3.
Continents and Oceans Lisa Oberholtzer.
Continents, Oceans, Lakes, Hemispheres and Poles
Continents and Oceans By Scott Hudson
7 Continents and 4 Oceans.
NBCR Summer Institute 2006 GridSphere:Hands-on Installation and Development Jason Novotny
Unit 1 – Lesson 5 Continents and Oceans.
Continents and Oceans Introduction Grade 6R In this activity you will: Identify and name the seven continents Identify and name the four oceans Sketch.
1 ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1 Building Portlets with ColdFusion Pete Freitag Foundeo, Inc.
Click on the globe to begin learning about the World!
Learning Objectives Students will identify the seven continents and major bodies of water on a world map. Students will color and label the seven continents.
Continents of the World
Aim: How do maps help us navigate our way around the world?
Explore The World AIM: Why is it important to have map skills?
Continents & Oceans Test Review Test Date August 27, 2015 Printing directions are on the next slide.
World Geography. The Continents There are 7 Continents: 1.North America 2.South America 3.Europe 4.Africa 5.Asia 6.Antarctica 7.Australia.
Presented by: Miss Wilson (Images courtesy of Google Images)
Application Specific Module Tutorial Akos Balasko 02/07/
1 Creating Web Services from a existing tool Presented by Ashraf Memon Hands-on Ashraf Memon, Ghulam Memon.
A FIRST TOUCH ON NOSQL SERVERS: COUCHDB GENOVEVA VARGAS SOLAR, JAVIER ESPINOSA CNRS, LIG-LAFMIA, FRANCE
What’s the name of this continent? Africa Asia South America Europe North America Australia Antarctica NEXT.
1 Continent Let’s Fly Around the World and Learn the Names & Locations of the 7 Continents and the 4 Oceans. Ocean Continent Ocean.
1 Final Destinations Ancient Greece Ancient Rome Ancient Mali.
6 th grade social studies Continents and Oceans. The World!
Jeopardy Add/subtract polynomials Multiply poly/monomial s Foil/ factorDividing poly/monomials Hit or miss Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q.
World Geography Europe North America Asia Africa South America
Hiding Grid Complexity Behind SSH Session Server framework Tomasz Kuczyński (1,2) 1) Poznan Supercomputing and Networking Center.
Continents and Oceans.
Continents and Oceans In this activity you will: Identify and name the seven continents Identify and name the five oceans.
Continents, Oceans and Map Skills Review Game by Mr. Reece.
Short Course on Grid Computing Jornadas Chilenas de Computación 2010 INFONOR-CHILE 2010 November 15th - 19th, 2010 Antofagasta, Chile Dr. Barry Wilkinson.
Geography! Copyright © Clara Kim All rights reserved.
NBCR Summer Institute 2006 GridPortlets:Hands-on Installation and Development Jason Novotny
Do Now: Friday, August 28 th  Record in Agenda: Name interview due by the 2 nd class of the week, next week (we’ll talk more in class today about what.
Welcome to... A Game of X’s and O’s. Featuring your host….
Physical Setting Mapping Terms Part 1. Map A drawing of all or part of the earth’s surface seen as if you were looking down from above.
World Map Activity Instructions Label and color the following continents: – North America – Green – South America – Red – Europe – Purple – Africa – Yellow.
Convert generic gUSE Portal into a science gateway Akos Balasko.
One day, I will see the world! Asia South America North America Africa Australia Europe Antarctica Atlantic Ocean Pacific Ocean Indian Ocean Arctic.
Continents and Oceans Write On Grade 3.
Can you name all Seven Continents? What about the Oceans?
Continents of the World
What Is A Globe? 3.01 Understand how to use maps, globes, and other geographic representations, tools, and technologies to acquire, process and report.
Write On Grade 3 Created by JC School
Recognizing Continents and Oceans
Big letters are Continents
Catch and Landings statistics
Name that continent or Ocean!!
Catch and Landings statistics
The World's Continents and Oceans
Continents and Oceans.
Catch and Landings statistics
Wiley is somewhere on the map. Follow the clues to find him.
The Physical World Continents & Oceans.
The continents.
World map instructions
Presentation transcript:

Enhancing portlets with charts and secure directory service Tomasz Kuczyński Poznan Supercomputing and Networking Center

Goals of today’s tutorial Introduce your portlets enhancement possibilities with some core GridSphere services Write a portlet using the Secure Directory GridSphere service Learn charting with GridSphere services Have a great time !

Assumptions and requirements We assume that: You are familiar with GridSphere You are familiar with portlet development Require: You have GridSphere installed on your machine (please consult GridSphere development tutorial) sdcharttutorial from CVS You are ready for development session :-) cd gridsphere/; mkdir projects; cd projects cvs -d co sdcharttutorial

Secure Directory Service Providing secure, logical file systems: for each user of the portlet for other GridSphere services shared amongst portlet/portal users Sharing files of the portlet: with other portlet between portlet/portal users Easy utilization: methods corresponding to operations on standard file systems (copy, move, delete...) transparent access to files with HTTP protocol

Chart Service Providing JFreeChart wrapper for GridSphere 17 types of charts including: Pie, Pie3D Bar, Bar3D, StackedBar, StackedBar3D Area, Line, Gantt other Utilizing Secure Directory Service Easy utilization: transparent chart generation XML based dataset and chart settings representations transparent access to charts with HTTP protocol

Preparations Make sure your GridSphere is correctly installed Install tutorial Startup tomcat, log in to the portal, subscribe to and view sdcharttutorial group Check content of Secure Directory in your Tomcat Upload some file with Hello Secure Directory Portlet, and check content again cd gridsphere/projects/sdcharttutorial; ant install ls –laR $CATALINA_HOME/webapps/gridsphere/WEB-INF/secure

Hello Secure Directory - portlet

Hello Secure Directory - source Look at following portlet in src/org/gridlab/gridsphere/secdirtutorial/portlets/HelloSecDirPortlet. java package org.gridlab.gridsphere.secdirtutorial.portlets;... import org.gridlab.gridsphere.services.core.secdir.SecureDirectoryService; import org.gridlab.gridsphere.services.core.secdir.FileInfo; import org.gridlab.gridsphere.services.core.secdir.FileLocationID;... import org.apache.oro.text.perl.Perl5Util; public class HelloSecDirPortlet extends ActionPortlet{ private static final String VIEW_JSP = "secdir/view.jsp"; private static final String VIEW_ERROR_JSP = "secdir/error.jsp"; private SecureDirectoryService secureDirectoryService = null; public static final String ROOT_DIR = "secdirandcharttutorial"; public static final String ROOT_PATH = "/some/path/"; private Perl5Util util = new Perl5Util();

Hello Secure Directory - source public void init(javax.portlet.PortletConfig portletConfig) throws... javax.portlet.PortletException { super.init(portletConfig); try{ secureDirectoryService = (SecureDirectoryService)... createPortletService(SecureDirectoryService.class); DEFAULT_VIEW_PAGE = "showFile"; }catch(PortletServiceException e){ DEFAULT_VIEW_PAGE = VIEW_ERROR_JSP; } public void showFile(RenderFormEvent event) throws PortletException { String userID = (String) ((Map) event.getRenderRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); UserData userData = new UserData(); try { if (!secureDirectoryService.categoryExistsForUser(userID, ROOT_DIR)) secureDirectoryService.createCategoryForUser(userID, ROOT_DIR);

Hello Secure Directory - source FileInfo[] fileList = secureDirectoryService.getFileList(... secureDirectoryService.createFileLocationID(userID, ROOT_DIR, ROOT_PATH)); String[] fileURIs = null; if (fileList != null) { fileURIs = new String[fileList.length]; for (int i = 0; i < fileList.length; ++i) { if (!fileList[i].isDirectory()) { FileLocationID fileLocationID = secureDirectoryService.... createFileLocationID(userID, ROOT_DIR, ROOT_PATH + fileList[i].getResource()); fileURIs[i] = secureDirectoryService.getDownloadFileUrl... (fileLocationID, fileList[i].getResource(), null); } userData.setFileList(fileList); userData.setFileURIs(fileURIs); } catch (Exception e) { log.error("Secure service unavailable", e); } event.getRenderRequest().setAttribute("userData", userData); setNextState(event.getRenderRequest(), VIEW_JSP); }

Hello Secure Directory - source public void uploadFile(ActionFormEvent event) throws PortletException { String userID = (String) ((Map) event.getActionRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); try { FileInputBean fi = event.getFileInputBean("userfile"); String filename = fi.getFileName(); if (fi.getSize() < FileInputBean.MAX_UPLOAD_SIZE) { filename = util.substitute("s!\\\\!/!g", filename); if (util.match("m!/([^/]+)$!", filename)) { filename = util.group(1); } filename = util.substitute("s! !!g", filename); secureDirectoryService.addFile(secureDirectoryService.create... FileLocationID(userID, ROOT_DIR, ROOT_PATH + filename), fi.getInputStream()); } else log.error("Size of uploaded file is to big"); } catch (Exception ie) {} }

Hello Secure Directory - source package org.gridlab.gridsphere.secdirtutorial.portlets; import org.gridlab.gridsphere.services.core.secdir.FileInfo; public class UserData { private FileInfo[] fileList; private String[] fileURIs; public FileInfo[] getFileList() { return fileList; } public void setFileList(FileInfo[] fileList) { this.fileList = fileList; } public String[] getFileURIs() { return fileURIs; } public void setFileURIs(String[] fileURIs) { this.fileURIs = fileURIs; }

SecDir Service - summary Check also: webapp/jsp/secdir/view.jsp webapp/jsp/secdir/error.jsp More advanced examples: Commander, Banner and Web Clipping portlets in extras webapp (utilization of Secure Directory Service with portlets) Chart Service in GridSphere (utilization of Secure Directory Service with other service) cd gridsphere/; mkdir projects; cd projects cvs -d co extras

Hello Chart - portlets

Hello Chart 1 - source Look at following portlet in src/org/gridlab/gridsphere/charttutorial/portlets/HelloChartPortlet1.j ava package org.gridlab.gridsphere.charttutorial.portlets;... import org.gridlab.gridsphere.services.core.charts.*; import org.gridlab.gridsphere.services.core.secdir.FileLocationID;... public class HelloChartPortlet1 extends ActionPortlet{ private ChartService chartService = null; private static final String VIEW_JSP = "charts/view1.jsp"; private static final String VIEW_ERROR_JSP = "charts/error.jsp"; public void init(PortletConfig portletConfig) throws PortletException { super.init(portletConfig); try { chartService = (ChartService) createPortletService(ChartService.class); DEFAULT_VIEW_PAGE = "viewChart"; } catch (PortletServiceException e) { DEFAULT_VIEW_PAGE = VIEW_ERROR_JSP; }

Hello Chart 1 - source public void viewChart(RenderFormEvent event) throws PortletException { String userID = (String) ((Map) event.getRenderRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); FileLocationID chartLocationID = chartService.createChartLocationID(userID, HelloSecDirPortlet.ROOT_DIR, HelloSecDirPortlet.ROOT_PATH + "ChartTest1"); String chartURL = chartService.getChartUrl(chartLocationID); ImageBean imageBean = event.getImageBean("chart1"); if (chartURL != null) imageBean.setSrc(chartURL); setNextState(event.getRenderRequest(), VIEW_JSP); } public void createChart(ActionFormEvent event) throws PortletException { String userID = (String) ((Map) event.getActionRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); org.jfree.data.DefaultPieDataset dataset = new... org.jfree.data.DefaultPieDataset(); dataset.setValue("Pacific", ); dataset.setValue("Atlantic", ); dataset.setValue("Indian", 74917);

Hello Chart 1 - source try { FileLocationID chartLocationID = chartService.createChartLocationID(userID, HelloSecDirPortlet.ROOT_DIR, HelloSecDirPortlet.ROOT_PATH + "ChartTest1"); ChartDescriptor chartDescriptor = chartService.createPie3DChart... (chartLocationID, dataset); SeriesPaint seriesPaintPacific = new SeriesPaint(); SeriesPaint seriesPaintAtlantic = new SeriesPaint(); SeriesPaint seriesPaintIndian = new SeriesPaint(); Color blue = new Color(); blue.setBlue(255); Color white = new Color(); white.setBlue(255); white.setRed(255); white.setGreen(255); Color grey = new Color(); grey.setBlue(200); grey.setRed(200); grey.setGreen(200);

Hello Chart 1 - source seriesPaintPacific.setColor(blue); seriesPaintIndian.setColor(white); seriesPaintAtlantic.setColor(grey); chartDescriptor.getChartInfo().getPlot().addSeriesPaint(0,... seriesPaintPacific); chartDescriptor.getChartInfo().getPlot().addSeriesPaint(1,... seriesPaintAtlantic); chartDescriptor.getChartInfo().getPlot().addSeriesPaint(2,... seriesPaintIndian); chartDescriptor.getChartInfo().getPlot().setForegroundAlpha(0.5f); BackgroundPaint backgroundPaint = new BackgroundPaint(); Gradient background = new Gradient(); GradientPoint point1 = new GradientPoint(); point1.setColor(white); point1.setX(0); point1.setY(0); GradientPoint point2 = new GradientPoint(); point2.setColor(blue); point2.setX(400); point2.setY(300);

Hello Chart 1 - source background.addGradientPoint(point1); background.addGradientPoint(point2); backgroundPaint.setGradient(background); chartDescriptor.getChartInfo().getPlot().setBackgroundPaint... (backgroundPaint); chartDescriptor.getChartInfo().setLegend(false); chartDescriptor.getChartInfo().getPlot().getSettings().getPie().... setLabelGenerator("{0} Ocean is {2}"); chartService.setChartDescriptor(chartLocationID, chartDescriptor); chartService.setChartTitle(chartLocationID, "Area of oceans... [mln * km2]"); } catch (Exception ie) {} }

Hello Chart 2 - source Look at following portlet in src/org/gridlab/gridsphere/charttutorial/portlets/HelloChartPortlet2.j ava package org.gridlab.gridsphere.charttutorial.portlets;... import org.gridlab.gridsphere.services.core.charts.*; import org.gridlab.gridsphere.services.core.secdir.FileLocationID;... public class HelloChartPortlet2 extends ActionPortlet { private ChartService chartService = null; private static final String VIEW_JSP = "charts/view2.jsp"; private static final String VIEW_ERROR_JSP = "charts/error.jsp"; public void init(PortletConfig portletConfig) throws PortletException { super.init(portletConfig); try { chartService = (ChartService) createPortletService(ChartService.class); DEFAULT_VIEW_PAGE = "viewChart"; } catch (PortletServiceException e) { DEFAULT_VIEW_PAGE = VIEW_ERROR_JSP; }

Hello Chart 2 - source public void viewChart(RenderFormEvent event) throws PortletException { String userID = (String) ((Map) event.getRenderRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); FileLocationID chartLocationID = chartService.createChartLocationID(userID, HelloSecDirPortlet.ROOT_DIR, HelloSecDirPortlet.ROOT_PATH + "ChartTest2"); String chartURL = chartService.getChartUrl(chartLocationID); ImageBean imageBean = event.getImageBean("chart2"); if (chartURL != null) imageBean.setSrc(chartURL); setNextState(event.getRenderRequest(), VIEW_JSP); } public void createChart(ActionFormEvent event) throws PortletException { String userID = (String) ((Map) event.getActionRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); org.jfree.data.DefaultCategoryDataset dataset = new org.jfree.data.... DefaultCategoryDataset(); dataset.setValue(179700, "Pacific", "Ocean"); dataset.setValue(106463, "Atlantic", "Ocean"); dataset.setValue(74917, "Indian", "Ocean"); dataset.setValue(44406, "Asia", "Land"); dataset.setValue(29853, "Africa", "Land");

Hello Chart 2 - source dataset.setValue(24298, "North America", "Land"); dataset.setValue(17684, "South America", "Land"); dataset.setValue(13176, "Antarctic", "Land"); dataset.setValue(9763, "Europe", "Land"); dataset.setValue(8936, "Australia", "Land"); try { FileLocationID chartLocationID = chartService.createChartLocationID(userID, HelloSecDirPortlet.ROOT_DIR, HelloSecDirPortlet.ROOT_PATH + "ChartTest2"); ChartDescriptor chartDescriptor = chartService.... createStackedBar3DChart(chartLocationID, dataset); Category category = chartDescriptor.getChartInfo().getPlot().... getSettings().getCategory(); category.setRangeAxisLabel("area [mln * km2]"); category.setDomainAxisLabel(""); category.setPlotOrientation("PlotOrientation.HORIZONTAL"); SeriesPaint pacificPaint = new SeriesPaint(); Gradient pacificGradient = new Gradient(); GradientPoint point1 = new GradientPoint(); GradientPoint point2 = new GradientPoint();

Hello Chart 2 - source Color yellow = new Color(); yellow.setGreen(255); yellow.setRed(255); Color white = new Color(); white.setBlue(255); white.setRed(255); white.setGreen(255); point1.setColor(white); point1.setX(100); point1.setY(0); point2.setColor(yellow); point2.setX(200); point2.setY(0); pacificGradient.addGradientPoint(point1); pacificGradient.addGradientPoint(point2); pacificPaint.setGradient(pacificGradient); chartDescriptor.getChartInfo().getPlot().addSeriesPaint(pacificPaint); chartDescriptor.getFileInfo().getImage().setFilename(... HelloSecDirPortlet.ROOT_PATH + "Chart2Test_but_other_filename"); BackgroundPaint backgroundPaint = new BackgroundPaint();

Hello Chart 2 - source Color lgreen = new Color();... backgroundPaint.setColor(lgreen); chartDescriptor.getChartInfo().setBackgroundPaint(backgroundPaint); chartDescriptor.getChartInfo().getPlot().setForegroundAlpha(0.75f); chartService.setChartDescriptor(chartLocationID, chartDescriptor); chartService.setChartTitle(chartLocationID, "Area of Oceans... and Continents"); } catch (Exception ie) {} } public void createChartNoData(ActionFormEvent event) throws... PortletException { String userID = (String) ((Map) event.getActionRequest().getAttribute(... PortletRequest.USER_INFO)).get("user.id"); org.jfree.data.DefaultCategoryDataset dataset = new org.jfree.data.... DefaultCategoryDataset(); try { FileLocationID chartLocationID = chartService.createChartLocationID(userID, HelloSecDirPortlet.ROOT_DIR, HelloSecDirPortlet.ROOT_PATH + "ChartTest2"); chartService.createStackedBarChart(chartLocationID, dataset); } catch (Exception ie) {}...

Hello Chart - portlets

Hello Chart 3 - source Look at following portlet in src/org/gridlab/gridsphere/charttutorial/portlets/HelloChartPortlet3.j ava package org.gridlab.gridsphere.charttutorial.portlets;... import org.gridlab.gridsphere.services.core.charts.*; import org.gridlab.gridsphere.services.core.secdir.FileLocationID;... public class HelloChartPortlet3 extends ActionPortlet { private ChartService chartService = null; private static final String VIEW_JSP = "charts/view3.jsp"; private static final String VIEW_ERROR_JSP = "charts/error.jsp"; public void init(PortletConfig portletConfig) throws PortletException { super.init(portletConfig); try { chartService = (ChartService) createPortletService(ChartService.class); DEFAULT_VIEW_PAGE = "viewChart"; } catch (PortletServiceException e) { DEFAULT_VIEW_PAGE = VIEW_ERROR_JSP; }

Hello Chart 3 - source public void viewChart(RenderFormEvent event) throws PortletException { String userID = (String) ((Map) event.getRenderRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); FileLocationID chartLocationID = chartService.createChartLocationID(userID, HelloSecDirPortlet.ROOT_DIR, HelloSecDirPortlet.ROOT_PATH + "ChartTest3"); String chartURL = chartService.getChartUrl(chartLocationID); ImageBean imageBean = event.getImageBean("chart3"); if (chartURL != null) imageBean.setSrc(chartURL); setNextState(event.getRenderRequest(), VIEW_JSP); } public void createChart(ActionFormEvent event) throws PortletException { String userID = (String) ((Map) event.getActionRequest().getAttribute... (PortletRequest.USER_INFO)).get("user.id"); org.jfree.data.DefaultCategoryDataset dataset = new org.jfree.data.... DefaultCategoryDataset(); dataset.setValue(979, "South America", "Salto del Angel"); dataset.setValue(604, "Europe", "Giessbach"); dataset.setValue(580, "Oceania", "Sutherland"); dataset.setValue(491, "North America", "Ribbon"); dataset.setValue(422, "Europe", "Gavarnie");

Hello Chart 3 - source... try { FileLocationID chartLocationID = chartService.createChartLocationID(userID, HelloSecDirPortlet.ROOT_DIR, HelloSecDirPortlet.ROOT_PATH + "ChartTest3"); ChartDescriptor chartDescriptor = chartService.createBar3DChart(... chartLocationID, dataset); chartDescriptor.getChartInfo().getPlot().getSettings().getCategory().... setRangeAxisLabel("height [m]"); chartDescriptor.getChartInfo().getPlot().getSettings().getCategory().... setDomainAxisLabel("name"); Image image = chartDescriptor.getFileInfo().getImage(); image.setWidth(950); image.setHeight(400); image.setQuality(1.0f); image.setType("JPEG"); Subtitle subtitle = new Subtitle(); subtitle.setText("Obviously this is not full list ;-)"); chartDescriptor.getChartInfo().setSubtitle(subtitle); chartDescriptor.getChartInfo().getPlot().setForegroundAlpha(0.25f); chartService.setChartDescriptor(chartLocationID, chartDescriptor); chartService.setChartTitle(chartLocationID, "Waterfalls of the World"); } catch (Exception ie) {}...

Chart Service - summary Check also: webapp/jsp/charts/view1.jsp webapp/jsp/charts/view2.jsp webapp/jsp/charts/view3.jsp webapp/jsp/charts/error.jsp Datasets and chart descriptor are stored in SecDir as XML files, that are validated against XML Schemas (editing these files causes automatic chart regeneration when next getChartURL() is performed) More advanced examples: GridSphere Services of SSH Session Server Framework (more information on Open Grid Portals web site)

Questions ? For more information visit: GridSphere GridLab Open Grid Portals JFreeChart Thank you