/** @param str The fully expanded URI */ protected void checkIdSymbol(Taint taintMe, AbsXMLContext ctxt, String str) throws SAXParseException { if (arp.idsUsed != null) { IRI uri = ctxt.uri; Map idsUsedForBase = (Map) idsUsed().get(uri); if (idsUsedForBase == null) { idsUsedForBase = new HashMap(); idsUsed().put(uri, idsUsedForBase); } Location prev = (Location) idsUsedForBase.get(str); if (prev != null) { arp.warning(taintMe, WARN_REDEFINITION_OF_ID, "Redefinition of ID: " + str); arp.warning( taintMe, WARN_REDEFINITION_OF_ID, prev, "Previous definition of '" + str + "'."); } else { idsUsedForBase.put(str, arp.location()); arp.idsUsedCount++; if (arp.idsUsedCount > 10000) { arp.idsUsed = null; arp.warning( taintMe, WARN_BIG_FILE, "Input is large. Switching off checking for illegal reuse of rdf:ID's."); } } } checkXMLName(taintMe, str); checkEncoding(taintMe, str); }
/** * This method parses the data from the BBC XML link, via the SAX Parser and XMLHandler class. * * @see XMLHandler */ private void getNews() { try { URL xmlUrl = new URL("http://feeds.bbci.co.uk/news/uk/rss.xml"); SAXParserFactory mySAXParserFactory = SAXParserFactory.newInstance(); SAXParser mySAXParser = mySAXParserFactory.newSAXParser(); XMLReader myXMLReader = mySAXParser.getXMLReader(); XMLHandler myXMLHandler = new XMLHandler(); myXMLReader.setContentHandler(myXMLHandler); InputSource myInputSource = new InputSource(xmlUrl.openStream()); myXMLReader.parse(myInputSource); myXMLFeed = myXMLHandler.getFeed(); } // catch a bunch of exceptions catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private XMLHandler getXMLHandler(Renderer renderer, List<XMLHandler> lst) { XMLHandler handler; if (lst != null) { for (int i = 0, c = lst.size(); i < c; i++) { // TODO Maybe add priorities later handler = lst.get(i); if (handler.supportsRenderer(renderer)) { return handler; } } } return null; // No handler found }
public static void main(String[] args) { // dialog.createMainDialog(); initializeOutputFile(); String pathFileIn = "", pathFileOut = ""; if (args != null) { if (args.length == 1) { pathFileIn = args[0]; Console.setStringWriter(true); } else if (args.length == 2) { pathFileIn = args[0]; pathFileOut = args[1]; Console.setStringWriter(true); } // else if (args.length == 3){ else { pathFileIn = args[0]; pathFileOut = args[1]; PrintStream fileStream; try { fileStream = new PrintStream(new FileOutputStream(args[2], true)); System.setOut(fileStream); System.setErr(fileStream); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Console.setStringWriter(false); } /* else{ Console.setStringWriter(true); Console.out("Path of the profiled XML:"); pathFileIn = Console.in(); Console.out("Name of the output file:"); String nameFileOut = Console.in(); pathFileOut = pathFileIn.substring(0, pathFileIn.lastIndexOf("/") + 1) + nameFileOut; }*/ } Date initialDate = new Date(); document = XMLHandler.openDocument(pathFileIn); profiler.execute(document); XMLHandler.saveDocument(pathFileOut, document); closeOutputFile(); Date finalDate = new Date(); Console.out( "Profiler duration (s) = " + ((finalDate.getTime() - initialDate.getTime()) / 1000)); }
public static void handlerDialog(int event) { if (event == EVENTBROWSE) { String path = dialog.openFileDialog(); document = XMLHandler.openDocument(path); dialog.pathField.setText(path); } if (event == EVENTEXECUTE) { if (document != null) { profiler.execute(document); String path = dialog.saveFileDialog(); XMLHandler.saveDocument(path, document); } dialog.pathField.setText("Write a valid path"); } if (event == EXIT) System.exit(0); }
@POST @Path("update") public String updateBasket(@FormParam("itemList") String itemList) { // Correct to some condition that checks login! if (session.getAttribute("id") == null || ((String) session.getAttribute("id")).equals("")) { return "Not logged in!"; } String res = ""; JSONArray jsonArray = new JSONArray(itemList); for (int i = 0; i < jsonArray.length(); i++) { JSONObject o = (JSONObject) jsonArray.get(i); String itemID = (String) o.get("itemID"); String amount = (String) o.get("amount"); String customerID = (String) session.getAttribute("id"); Document buydoc = XMLHandler.buyItem(itemID, amount, customerID); HttpURLConnection con = cloudHandler.connect(true, "/sellItems"); Document responseDoc = cloudHandler.getResponse( true, con, buydoc, XMLHandler.getOutputter(), XMLHandler.getSAXBuilder()); java.util.List<Element> children = responseDoc.getRootElement().getChildren(); if (children.get(0).getName().equals("ok")) { res += "Succæ ve' " + itemID + "\n"; } else if (children.get(0).getName().equals("itemSoldOut")) { res += "Der æ' fler tilbage a' " + itemID + " tilbage \n"; } else { res += "Dar sket' a fej wæ" + itemID + "\n"; } } return res; }
/** Discovers XMLHandler implementations through the classpath and dynamically registers them. */ private void discoverXMLHandlers() { // add mappings from available services Iterator<Object> providers = Service.providers(XMLHandler.class); if (providers != null) { while (providers.hasNext()) { XMLHandler handler = (XMLHandler) providers.next(); try { if (log.isDebugEnabled()) { log.debug("Dynamically adding XMLHandler: " + handler.getClass().getName()); } addXMLHandler(handler); } catch (IllegalArgumentException e) { log.error("Error while adding XMLHandler", e); } } } }
/** * Add an XML handler. The handler itself is inspected to find out what it supports. * * @param handler the XMLHandler instance */ public void addXMLHandler(XMLHandler handler) { String ns = handler.getNamespace(); if (ns == null) { setDefaultXMLHandler(handler); } else { addXMLHandler(ns, handler); } }
@Override public void endElement(String uri, String localName, String qName) { // handle all of the elements which have CDATA here if (NAME_ELEMENT.equals(qName)) { if (nameAttr == null) { nameAttr = new Attribute(NAME_ELEMENT, accumulator.toString().trim()); } else { nameAttr.addTranslation(language, accumulator.toString().trim()); } } else { super.endElement(uri, localName, qName); } }
public static void main(String[] args) { // Reads the item file Document item = null; if (args.length >= 1 && validFilename(args[0])) { item = XMLHandler.addDoc(args[0]); } if (item == null) { return; } // Gets the name of the item from the item file Element itemName = item.getRootElement().getChild("itemName", n).clone(); // Creates a createItem with a shopKey and the itemName from before Document createItem = XMLHandler.createItem(itemName); // Connects to the cloud HttpURLConnection con = handler.connect("/createItem"); // Sends the createItem to the cloud and gets the itemID Document itemID = handler.getResponse(con, createItem, XMLHandler.getOutputter(), XMLHandler.getSAXBuilder()); // Creates a modifyItem with most of the elements from the item + the // itemID Document modifyItem = XMLHandler.modifyItem(itemID.getRootElement().clone(), item.getRootElement().clone()); // Connects to the cloud con = handler.connect("/modifyItem"); // Sends the modifyItem to the cloud handler.getResponse(con, modifyItem, XMLHandler.getOutputter(), XMLHandler.getSAXBuilder()); // SUCCESS!!!! System.out.println("SUCCESS!!!!"); }
protected void getroot(String filename){ this.filename = filename; root = XMLHandler.openXML(filename); }
public static void main(String args[]) { Boolean doBook = true; Boolean doMovie = true; Boolean doMusic = true; if (args.length > 0) { String _args = ""; for (String arg : args) { _args += arg; } if (_args.contains("-book")) doBook = true; else doBook = false; if (_args.contains("-movie")) doMovie = true; else doMovie = false; if (_args.contains("-music")) doMusic = true; else doMusic = false; } AmazonParser ap = new AmazonParser(); FTPHandler ftpHandler = new FTPHandler( ap.getFtpHost(), ap.getFtpPort(), ap.getFtpUser(), ap.getFtpPassword(), true); ftpHandler.connect(); if (doBook) { System.out.println(". ..:: Loading Books ::.. ."); List<Book> books = new LinkedList<>(); ap.feedBook(books); System.out.println(". ..:: Books Loaded Successfully ::.. ."); ap.showBook(books); System.out.println(". ..:: Saving Books ::.. ."); XMLHandler hdBook = new XMLHandler(ap.getBookXmlFilename()); hdBook.buildBookXML(books); hdBook.saveXML(); System.out.println(". ..:: Books Saved Successfully ::.. ."); System.out.println(". ..:: Uploading Books ::.. ."); ftpHandler.setDirectory(ap.getFtpBookDirectory()); ftpHandler.upload(new File(ap.getBookXmlFilename())); System.out.println(". ..:: Books Uploaded Successfully ::.. ."); } if (doMovie) { System.out.println(". ..:: Loading Movies ::.. ."); List<Movie> movies = new LinkedList<>(); ap.feedMovie(movies); System.out.println(". ..:: Movies Loaded Successfully ::.. ."); ap.showMovie(movies); System.out.println(". ..:: Saving Movies ::.. ."); XMLHandler hdMovie = new XMLHandler(ap.getMovieXmlFilename()); hdMovie.buildMovieXML(movies); hdMovie.saveXML(); System.out.println(". ..:: Movies Saved Successfully ::.. ."); System.out.println(". ..:: Uploading Movies ::.. ."); ftpHandler.setDirectory(ap.getFtpMovieDirectory()); ftpHandler.upload(new File(ap.getMovieXmlFilename())); System.out.println(". ..:: Movies Uploaded Successfully ::.. ."); } if (doMusic) { System.out.println(". ..:: Loading Musics ::.. ."); List<Music> musics = new LinkedList<>(); ap.feedMusic(musics); System.out.println(". ..:: Musics Loaded Successfully ::.. ."); ap.showMusic(musics); System.out.println(". ..:: Saving Musics ::.. ."); XMLHandler hdMusic = new XMLHandler(ap.getMusicXmlFilename()); hdMusic.buildMusicXML(musics); hdMusic.saveXML(); System.out.println(". ..:: Musics Saved Successfully ::.. ."); System.out.println(". ..:: Uploading Musics ::.. ."); ftpHandler.setDirectory(ap.getFtpMusicDirectory()); ftpHandler.upload(new File(ap.getMusicXmlFilename())); System.out.println(". ..:: Musics Uploaded Successfully ::.. ."); } ftpHandler.disconnect(); }
protected boolean writeXML(){ return XMLHandler.writeXML(filename,root.getDocument()); }
protected void triple(ANode a, ANode b, ANode c) { arp.triple(a, b, c); }
/** * whether this is a warning or an error is determined later. * * @param i * @param msg */ protected void warning(Taint taintMe, int i, String msg) throws SAXParseException { arp.warning(taintMe, i, msg); }
@Override public void run() { while (listen) { try { String lobbyUrl = String.format( "http://%s.iggamecenter.com/api_handler.php?app_id=%s&app_code=%s&uid=%s&session_id=%s&sid=%s&lasteid=%s&cmd=REFRESH", URLEncoder.encode(server, "UTF-8"), NetGlobal.id, URLEncoder.encode(NetGlobal.passcode, "UTF-8"), uid, URLEncoder.encode(session_id, "UTF-8"), sid, lasteid); URL url = new URL(lobbyUrl); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser parser = spf.newSAXParser(); XMLReader reader = parser.getXMLReader(); XMLHandler xmlHandler = new XMLHandler(); reader.setContentHandler(xmlHandler); reader.parse(new InputSource(url.openStream())); final ParsedDataset parsedDataset = xmlHandler.getParsedData(); if (!parsedDataset.error) { if (lasteid != 0) { for (int i = 0; i < parsedDataset.messages.size(); i++) { WaitingRoomActivity.messages.add( parsedDataset.messages.get(i).name + ": " + parsedDataset.messages.get(i).msg); } } if (parsedDataset.lasteid != 0) { lasteid = parsedDataset.lasteid; NetGlobal.lasteid = parsedDataset.lasteid; } NetGlobal.members = parsedDataset.players; for (int i = 0; i < parsedDataset.players.size(); i++) { if (parsedDataset.players.get(i).place == 1) { game.player1.setTime(parsedDataset.players.get(i).timerLeft * 1000); } else if (parsedDataset.players.get(i).place == 2) { game.player2.setTime(parsedDataset.players.get(i).timerLeft * 1000); } } game.timer.totalTime = (game.player1.getTime() + game.player2.getTime()) / 2; game.timer.startTime = System.currentTimeMillis(); if (team == 1) { if (parsedDataset.p1moves != null) for (int i = 0; i < parsedDataset.p1moves.size(); i++) player.setMove(this, parsedDataset.p1moves.get(i)); if (!(game.player2 instanceof NetPlayerObject)) if (parsedDataset.p2moves != null) for (int i = 0; i < parsedDataset.p2moves.size(); i++) game.player2.setMove(this, parsedDataset.p2moves.get(i)); } else if (team == 2) { if (parsedDataset.p2moves != null) for (int i = 0; i < parsedDataset.p2moves.size(); i++) player.setMove(this, parsedDataset.p2moves.get(i)); if (!(game.player1 instanceof NetPlayerObject)) if (parsedDataset.p1moves != null) for (int i = 0; i < parsedDataset.p1moves.size(); i++) game.player1.setMove(this, parsedDataset.p1moves.get(i)); } if (parsedDataset.undoRequested) { try { String undoUrl = String.format( "http://%s.iggamecenter.com/api_handler.php?app_id=%s&app_code=%s&uid=%s&session_id=%s&sid=%s&cmd=UNDO&type=FORBID&lasteid=%s", URLEncoder.encode(server, "UTF-8"), NetGlobal.id, URLEncoder.encode(NetGlobal.passcode, "UTF-8"), uid, URLEncoder.encode(session_id, "UTF-8"), sid, NetGlobal.lasteid); new URL(undoUrl).openStream(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // new DialogBox(game.board.getContext(), // GameAction.insert(game.board.getContext().getString(R.string.LANUndo), // player.getName()), // new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, int which) { // switch (which){ // case DialogInterface.BUTTON_POSITIVE: // //Yes button clicked // NetGlobal.undoRequested = true; // GameAction.undo(NetGlobal.GAME_LOCATION,NetGlobal.game); // try { // String undoUrl = // String.format("http://%s.iggamecenter.com/api_handler.php?app_id=%s&app_code=%s&uid=%s&session_id=%s&sid=%s&cmd=UNDO&type=ACCEPT", URLEncoder.encode(server,"UTF-8"), NetGlobal.id, URLEncoder.encode(NetGlobal.passcode,"UTF-8"), uid, URLEncoder.encode(session_id,"UTF-8"), sid, lasteid); // new URL(undoUrl).openStream(); // } catch (MalformedURLException e) { // e.printStackTrace(); // } catch (IOException e) { // e.printStackTrace(); // } // break; // case DialogInterface.BUTTON_NEGATIVE: // //No button clicked // try { // String undoUrl = // String.format("http://%s.iggamecenter.com/api_handler.php?app_id=%s&app_code=%s&uid=%s&session_id=%s&sid=%s&cmd=UNDO&type=DENY", URLEncoder.encode(server,"UTF-8"), NetGlobal.id, URLEncoder.encode(NetGlobal.passcode,"UTF-8"), uid, URLEncoder.encode(session_id,"UTF-8"), sid, lasteid); // new URL(undoUrl).openStream(); // } catch (MalformedURLException e) { // e.printStackTrace(); // } catch (IOException e) { // e.printStackTrace(); // } // break; // } // } // }, // game.board.getContext().getString(R.string.yes), // game.board.getContext().getString(R.string.no)); } if (parsedDataset.undoAccepted) { // GameAction.undo(NetGlobal.GAME_LOCATION,NetGlobal.game); // new DialogBox(game.board.getContext(), // game.board.getContext().getString(R.string.LANundoAccepted), // null, // game.board.getContext().getString(R.string.okay)); } if (team == 1) { if (parsedDataset.p1GaveUp) { giveup = true; GameAction.getPlayer(game.currentPlayer, game).endMove(); } } else if (team == 2) { if (parsedDataset.p2GaveUp) { giveup = true; GameAction.getPlayer(game.currentPlayer, game).endMove(); } } if (parsedDataset.restart) { if (NetHexGame.justStart) { NetHexGame.justStart = false; NetGlobal.sid = parsedDataset.getSid(); handler.post(newgame); } else if (!dontAskTwice) { dontAskTwice = true; new DialogBox( game.board.getContext(), GameAction.insert( game.board.getContext().getString(R.string.newLANGame), player.getName()), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: // Yes button clicked NetGlobal.sid = parsedDataset.getSid(); handler.post(newgame); break; case DialogInterface.BUTTON_NEGATIVE: // No button clicked break; } } }, game.board.getContext().getString(R.string.yes), game.board.getContext().getString(R.string.no)); } } } else { System.out.println(parsedDataset.getErrorMessage()); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(8000); } catch (InterruptedException e) { e.printStackTrace(); } } }
public static String getSimplePieChart(Map dataSource, String objectName, HttpSession session) throws Throwable { DefaultPieDataset dataset = new DefaultPieDataset(); Element chartObject = XMLHandler.getElementByAttribute(getChartObjectList(), "name", objectName); String title = chartObject.getAttributeValue("title"); int width = Integer.parseInt(chartObject.getAttributeValue("width")); int height = Integer.parseInt(chartObject.getAttributeValue("height")); Element LabelKeys = chartObject.getChild("Labels"); Element ValueKeys = chartObject.getChild("Values"); String valueKey = ValueKeys.getText(); String valueType = ValueKeys.getAttributeValue("type"); List labelKeys = LabelKeys.getChildren("Label"); String labelKey = LabelKeys.getText(); if (valueType.equalsIgnoreCase("number")) { for (int i = 0; i < dataSource.size(); i++) { Map rec = (Map) dataSource.get("ROW" + i); Number value = (Number) rec.get(valueKey); String label; if (labelKeys.isEmpty()) { label = DataFilter.show(rec, labelKey); } else { label = ((Element) labelKeys.get(i)).getText(); } dataset.setValue(label, value); } } else { for (int i = 0; i < dataSource.size(); i++) { Map rec = (Map) dataSource.get("ROW" + i); double value = (Double) rec.get(valueKey); String label; if (labelKeys.isEmpty()) { label = DataFilter.show(rec, labelKey); } else { label = ((Element) labelKeys.get(i)).getText(); } dataset.setValue(label, value); } } JFreeChart chart = ChartFactory.createPieChart3D( title, dataset, chartObject.getAttribute("showLegend").getBooleanValue(), chartObject.getAttribute("showToolTips").getBooleanValue(), chartObject.getAttribute("urls").getBooleanValue()); PiePlot3D pie3dplot = (PiePlot3D) chart.getPlot(); float alpha = 0.7F; if (chartObject.getAttribute("alpha") != null) { alpha = chartObject.getAttribute("alpha").getFloatValue(); } pie3dplot.setForegroundAlpha(alpha); return ServletUtilities.saveChartAsPNG(chart, width, height, null, session); }
private static List getChartObjectList() { Element root = XMLHandler.openXML(CONFIGFILE); return root.getChildren("Object"); }
public static String getBarSeries(Map dataSource, String objectName, HttpSession session) throws Exception { DefaultKeyedValues barValues = new DefaultKeyedValues(); DefaultKeyedValues seriesValues = new DefaultKeyedValues(); Element chartObject = XMLHandler.getElementByAttribute(getChartObjectList(), "name", objectName); Element barField = chartObject.getChild("BarFields").getChild("Field"); Element seriesField = chartObject.getChild("SeriesFields").getChild("Field"); for (int i = 0; i < dataSource.size(); i++) { Map rec = (Map) dataSource.get("ROW" + i); barValues.addValue( DataFilter.show(rec, chartObject.getChildText("ColumnLabel")), Double.parseDouble(rec.get(barField.getAttributeValue("name")).toString())); seriesValues.addValue( DataFilter.show(rec, chartObject.getChildText("ColumnLabel")), Double.parseDouble(rec.get(seriesField.getAttributeValue("name")).toString())); } CategoryDataset dataset = DatasetUtilities.createCategoryDataset(barField.getAttributeValue("label"), barValues); PlotOrientation plotOrientation = chartObject.getAttributeValue("plotOrientation").equalsIgnoreCase("VERTICAL") ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL; JFreeChart chart = ChartFactory.createBarChart3D( chartObject.getAttributeValue("title"), chartObject.getAttributeValue("categoryAxisLabel"), chartObject.getAttributeValue("valueAxisLabel"), dataset, plotOrientation, chartObject.getAttribute("showLegend").getBooleanValue(), chartObject.getAttribute("showToolTips").getBooleanValue(), chartObject.getAttribute("urls").getBooleanValue()); CategoryPlot categoryplot = chart.getCategoryPlot(); LineRenderer3D lineRenderer = new LineRenderer3D(); CategoryDataset datasetSeries = DatasetUtilities.createCategoryDataset( seriesField.getAttributeValue("label"), seriesValues); categoryplot.setDataset(1, datasetSeries); categoryplot.setRangeAxis(1, new NumberAxis3D(seriesField.getAttributeValue("label"))); categoryplot.setRenderer(1, lineRenderer); categoryplot.mapDatasetToRangeAxis(1, 1); BarRenderer3D barrenderer = (BarRenderer3D) categoryplot.getRenderer(); barrenderer.setLabelGenerator(new StandardCategoryLabelGenerator()); barrenderer.setItemLabelsVisible(true); barrenderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BASELINE_CENTER)); // lineRenderer.setLabelGenerator(new StandardCategoryLabelGenerator()); // lineRenderer.setItemLabelsVisible(true); // lineRenderer.setPositiveItemLabelPosition( // new ItemLabelPosition(ItemLabelAnchor.OUTSIDE10, TextAnchor.CENTER)); float alpha = 0.7F; if (chartObject.getAttribute("alpha") != null) { alpha = chartObject.getAttribute("alpha").getFloatValue(); } categoryplot.setForegroundAlpha(alpha); int width, height; if (chartObject.getAttributeValue("width").equalsIgnoreCase("auto")) { width = (50 * dataSource.size()) + 100; } else { width = Integer.parseInt(chartObject.getAttributeValue("width")); } if (chartObject.getAttributeValue("height").equalsIgnoreCase("auto")) { height = (50 * dataSource.size()) + 100; } else { height = Integer.parseInt(chartObject.getAttributeValue("height")); } return ServletUtilities.saveChartAsPNG(chart, width, height, session); }
public static String getSimpleBarChart(Map dataSource, String objectName, HttpSession session) throws Throwable { Element chartObject = XMLHandler.getElementByAttribute(getChartObjectList(), "name", objectName); List invokeFields = chartObject.getChild("InvokeFields").getChildren("Field"); double[][] data = new double[invokeFields.size()][dataSource.size()]; String[] rowKeys = new String[invokeFields.size()]; String[] columnKeys = new String[dataSource.size()]; String columnLabel = chartObject.getChildText("ColumnLabel"); for (int i = 0; i < dataSource.size(); i++) { Map rec = (Map) dataSource.get("ROW" + i); columnKeys[i] = DataFilter.show(rec, columnLabel); for (int j = 0; j < invokeFields.size(); j++) { data[j][i] = Double.parseDouble( rec.get(((Element) invokeFields.get(j)).getAttributeValue("name")).toString()); } } for (int i = 0; i < invokeFields.size(); i++) { rowKeys[i] = ((Element) invokeFields.get(i)).getAttributeValue("label"); } CategoryDataset dataset = DatasetUtilities.createCategoryDataset(rowKeys, columnKeys, data); PlotOrientation plotOrientation = chartObject.getAttributeValue("plotOrientation").equalsIgnoreCase("VERTICAL") ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL; JFreeChart chart = ChartFactory.createBarChart3D( chartObject.getAttributeValue("title"), chartObject.getAttributeValue("categoryAxisLabel"), chartObject.getAttributeValue("valueAxisLabel"), dataset, plotOrientation, chartObject.getAttribute("showLegend").getBooleanValue(), chartObject.getAttribute("showToolTips").getBooleanValue(), chartObject.getAttribute("urls").getBooleanValue()); CategoryPlot C3dplot = (CategoryPlot) chart.getPlot(); if (chartObject.getAttribute("alpha") != null) { C3dplot.setForegroundAlpha(chartObject.getAttribute("alpha").getFloatValue()); } BarRenderer3D barrenderer = (BarRenderer3D) C3dplot.getRenderer(); barrenderer.setLabelGenerator(new StandardCategoryLabelGenerator()); barrenderer.setItemLabelsVisible(true); barrenderer.setPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BASELINE_CENTER)); int width, height; if (chartObject.getAttributeValue("width").equalsIgnoreCase("auto")) { width = (50 * dataSource.size()) * invokeFields.size() + 100; } else { width = Integer.parseInt(chartObject.getAttributeValue("width")); } if (chartObject.getAttributeValue("height").equalsIgnoreCase("auto")) { height = (50 * dataSource.size()) * invokeFields.size() + 100; } else { height = Integer.parseInt(chartObject.getAttributeValue("height")); } return ServletUtilities.saveChartAsPNG(chart, width, height, session); }