Enhancing portlets with charts and secure directory service Tomasz Kuczyński [email protected]...
-
Upload
lewis-montgomery -
Category
Documents
-
view
217 -
download
3
Transcript of Enhancing portlets with charts and secure directory service Tomasz Kuczyński [email protected]...
![Page 1: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/1.jpg)
Enhancing portlets with charts and secure directory service
Tomasz Kuczyński
Poznan Supercomputing and Networking Center
![Page 2: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/2.jpg)
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 !
![Page 3: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/3.jpg)
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 projectscvs -d :pserver:[email protected]:/home/repository co sdcharttutorial
![Page 4: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/4.jpg)
Secure Directory Service
Providing secure, logical file systems:for each user of the portletfor other GridSphere servicesshared amongst portlet/portal users
Sharing files of the portlet:with other portletbetween portlet/portal users
Easy utilization:methods corresponding to operations on standard file systems (copy, move, delete ...)transparent access to files with HTTP protocol
![Page 5: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/5.jpg)
Chart Service
Providing JFreeChart wrapper for GridSphere17 types of charts including:
Pie, Pie3DBar, Bar3D, StackedBar, StackedBar3DArea, Line, Ganttother
Utilizing Secure Directory ServiceEasy utilization:
transparent chart generationXML based dataset and chart settings representationstransparent access to charts with HTTP protocol
![Page 6: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/6.jpg)
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
![Page 7: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/7.jpg)
Hello Secure Directory - portlet
![Page 8: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/8.jpg)
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();
![Page 9: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/9.jpg)
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);
![Page 10: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/10.jpg)
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);}
![Page 11: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/11.jpg)
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) {} }}
![Page 12: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/12.jpg)
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; }}
![Page 13: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/13.jpg)
SecDir Service - summary
Check also:webapp/jsp/secdir/view.jspwebapp/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 projectscvs -d :pserver:[email protected]:/home/repository co extras
![Page 14: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/14.jpg)
Hello Chart - portlets
![Page 15: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/15.jpg)
Hello Chart 1 - source
Look at following portlet in src/org/gridlab/gridsphere/charttutorial/portlets/HelloChartPortlet1.javapackage 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; } }
![Page 16: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/16.jpg)
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", 179700); dataset.setValue("Atlantic", 106463); dataset.setValue("Indian", 74917);
![Page 17: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/17.jpg)
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);
![Page 18: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/18.jpg)
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);
![Page 19: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/19.jpg)
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) {} }}
![Page 20: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/20.jpg)
Hello Chart 2 - source
Look at following portlet in src/org/gridlab/gridsphere/charttutorial/portlets/HelloChartPortlet2.javapackage 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; } }
![Page 21: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/21.jpg)
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");
![Page 22: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/22.jpg)
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();
![Page 23: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/23.jpg)
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();
![Page 24: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/24.jpg)
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) {}...
![Page 25: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/25.jpg)
Hello Chart - portlets
![Page 26: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/26.jpg)
Hello Chart 3 - source
Look at following portlet in src/org/gridlab/gridsphere/charttutorial/portlets/HelloChartPortlet3.javapackage 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; } }
![Page 27: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/27.jpg)
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");
![Page 28: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/28.jpg)
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) {}...
![Page 29: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/29.jpg)
Chart Service - summary
Check also:webapp/jsp/charts/view1.jspwebapp/jsp/charts/view2.jspwebapp/jsp/charts/view3.jspwebapp/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)
![Page 30: Enhancing portlets with charts and secure directory service Tomasz Kuczyński docentt@man.poznan.pl Poznan Supercomputing and Networking Center.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649f115503460f94c23e4a/html5/thumbnails/30.jpg)
Questions ?
For more information visit:
GridSphere http://www.gridsphere.org
GridLab http://www.gridlab.org
Open Grid Portals http://www.opengridportals.com
JFreeChart http://www.jfree.org/jfreechart/
Thank you