PHOENIX-3102 Remove jfreechart because it is LPGL licensed (Mujtaba)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4ac8e56e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4ac8e56e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4ac8e56e Branch: refs/heads/4.x-HBase-0.98 Commit: 4ac8e56ed67b2b1ccc3b6c39a600eaff1accdd1e Parents: 7073a69 Author: Josh Elser <els...@apache.org> Authored: Wed Jul 20 15:09:42 2016 -0400 Committer: Josh Elser <els...@apache.org> Committed: Thu Jul 21 15:47:29 2016 -0400 ---------------------------------------------------------------------- phoenix-pherf/pom.xml | 6 - .../phoenix/pherf/result/ResultManager.java | 11 +- .../pherf/result/impl/ImageResultHandler.java | 126 ------------------- 3 files changed, 3 insertions(+), 140 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4ac8e56e/phoenix-pherf/pom.xml ---------------------------------------------------------------------- diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml index 55afda0..bccdc6e 100644 --- a/phoenix-pherf/pom.xml +++ b/phoenix-pherf/pom.xml @@ -46,11 +46,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.jfree</groupId> - <artifactId>jfreechart</artifactId> - <version>1.0.19</version> - </dependency> - <dependency> <groupId>com.googlecode.java-diff-utils</groupId> <artifactId>diffutils</artifactId> <version>1.2.1</version> @@ -221,7 +216,6 @@ <artifactSet> <includes> <include>org.apache.phoenix:phoenix-pherf</include> - <include>org.jfree:*</include> <include>com.googlecode.java-diff-utils:diffutils</include> <include>org.apache.commons:commons-lang3</include> <include>org.apache.commons:commons-math3</include> http://git-wip-us.apache.org/repos/asf/phoenix/blob/4ac8e56e/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultManager.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultManager.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultManager.java index 4d4ca4a..5e0f242 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultManager.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/ResultManager.java @@ -21,7 +21,6 @@ package org.apache.phoenix.pherf.result; import org.apache.phoenix.pherf.PherfConstants; import org.apache.phoenix.pherf.result.file.ResultFileDetails; import org.apache.phoenix.pherf.result.impl.CSVFileResultHandler; -import org.apache.phoenix.pherf.result.impl.ImageResultHandler; import org.apache.phoenix.pherf.result.impl.XMLResultHandler; import org.apache.phoenix.util.InstanceResolver; import org.slf4j.Logger; @@ -44,10 +43,6 @@ public class ResultManager { xmlResultHandler.setResultFileDetails(ResultFileDetails.XML); defaultHandlers.add(xmlResultHandler); - ImageResultHandler imageResultHandler = new ImageResultHandler(); - imageResultHandler.setResultFileDetails(ResultFileDetails.IMAGE); - defaultHandlers.add(imageResultHandler); - ResultHandler handlerAgg = new CSVFileResultHandler(); handlerAgg.setResultFileDetails(ResultFileDetails.CSV_AGGREGATE_PERFORMANCE); defaultHandlers.add(handlerAgg); @@ -59,9 +54,9 @@ public class ResultManager { static { minimalHandlers = new ArrayList<>(); - ImageResultHandler imageResultHandler = new ImageResultHandler(); - imageResultHandler.setResultFileDetails(ResultFileDetails.IMAGE); - minimalHandlers.add(imageResultHandler); + ResultHandler cvsHandler = new CSVFileResultHandler(); + cvsHandler.setResultFileDetails(ResultFileDetails.CSV_AGGREGATE_PERFORMANCE); + minimalHandlers.add(cvsHandler); } public ResultManager(String fileNameSeed) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/4ac8e56e/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/ImageResultHandler.java ---------------------------------------------------------------------- diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/ImageResultHandler.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/ImageResultHandler.java deleted file mode 100644 index f25ce4e..0000000 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/result/impl/ImageResultHandler.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.phoenix.pherf.result.impl; - -import org.apache.phoenix.pherf.result.*; -import org.apache.phoenix.pherf.result.file.ResultFileDetails; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.ChartUtilities; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.renderer.xy.StandardXYItemRenderer; -import org.jfree.data.time.Millisecond; -import org.jfree.data.time.TimeSeries; -import org.jfree.data.time.TimeSeriesCollection; - -import java.awt.*; -import java.io.File; -import java.io.IOException; -import java.util.List; - -public class ImageResultHandler extends DefaultResultHandler{ - - public ImageResultHandler() { - super(); - } - - @Override - public synchronized void write(Result result) throws Exception { - TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection(); - int rowCount = 0; - int maxLegendCount = 20; - int chartDimension = 1100; - - ResultValue<DataModelResult> resultValue = result.getResultValues().get(0); - DataModelResult dataModelResult = resultValue.getResultValue(); - - for (ScenarioResult scenarioResult : dataModelResult.getScenarioResult()) { - for (QuerySetResult querySetResult : scenarioResult.getQuerySetResult()) { - for (QueryResult queryResult : querySetResult.getQueryResults()) { - for (ThreadTime tt : queryResult.getThreadTimes()) { - TimeSeries - timeSeries = - new TimeSeries( - queryResult.getStatement() + " :: " + tt.getThreadName()); - rowCount++; - synchronized (tt.getRunTimesInMs()) { - for (RunTime rt : tt.getRunTimesInMs()) { - if (rt.getStartTime() != null) { - timeSeries.add(new Millisecond(rt.getStartTime()), - rt.getElapsedDurationInMs()); - } - } - } - timeSeriesCollection.addSeries(timeSeries); - } - } - } - } - boolean legend = rowCount > maxLegendCount ? false : true; - JFreeChart - chart = - ChartFactory - .createTimeSeriesChart(dataModelResult.getName(), "Time", "Query Time (ms)", - timeSeriesCollection, legend, true, false); - StandardXYItemRenderer - renderer = - new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES); - chart.getXYPlot().setRenderer(renderer); - chart.getXYPlot().setBackgroundPaint(Color.WHITE); - chart.getXYPlot().setRangeGridlinePaint(Color.BLACK); - for (int i = 0; i < rowCount; i++) { - chart.getXYPlot().getRenderer().setSeriesStroke(i, new BasicStroke(3f)); - } - try { - ChartUtilities.saveChartAsJPEG(new File(resultFileName), chart, chartDimension, - chartDimension); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - @Override - public synchronized void flush() throws Exception { - - } - - @Override - public synchronized void close() throws Exception { - - } - - @Override - public List<Result> read() throws Exception { - return null; - } - - /** - * File is never left open. This impl always overwrites existing file. - * @return - */ - @Override - public boolean isClosed() { - return true; - } - - @Override - public void setResultFileDetails(ResultFileDetails details) { - super.setResultFileDetails(ResultFileDetails.IMAGE); - } -}