summaryrefslogtreecommitdiff
path: root/qpid/java/perftests/visualisation-jfc/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/perftests/visualisation-jfc/src/main')
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml50
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java25
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java46
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java160
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java56
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java54
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java112
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java96
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java41
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java34
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java51
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java66
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java52
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java53
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java63
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java35
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java114
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java70
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java59
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java119
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java51
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java104
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java143
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java75
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java65
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java37
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java157
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java81
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java41
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java98
-rw-r--r--qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java158
31 files changed, 0 insertions, 2366 deletions
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml b/qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml
deleted file mode 100644
index f6bc7137f8..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version='1.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.
-
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>bin</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <baseDirectory>qpid-perftests-visualisation-jfc/${project.version}</baseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/src/main/assembly/</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>README.txt</include>
- <include>NOTICE</include>
- <include>LICENSE</include>
- </includes>
- <fileMode>0644</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/lib</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- </dependencySet>
- </dependencySets>
-</assembly>
-
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java
deleted file mode 100644
index 5a77f22148..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java
+++ /dev/null
@@ -1,25 +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.qpid.disttest.charting;
-
-public enum ChartType
-{
- LINE, LINE3D, BAR, BAR3D, XYLINE, TIMELINE, STATISTICAL_BAR
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java
deleted file mode 100644
index 120a4dc750..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java
+++ /dev/null
@@ -1,46 +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.qpid.disttest.charting;
-
-public class ChartingException extends RuntimeException
-{
- private static final long serialVersionUID = 1L;
-
- public ChartingException()
- {
- super();
- }
-
- public ChartingException(String message)
- {
- super(message);
- }
-
- public ChartingException(Throwable cause)
- {
- super(cause);
- }
-
- public ChartingException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java
deleted file mode 100644
index 9401b77ab0..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java
+++ /dev/null
@@ -1,160 +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.qpid.disttest.charting;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.qpid.disttest.ArgumentParser;
-import org.apache.qpid.disttest.charting.chartbuilder.ChartBuilder;
-import org.apache.qpid.disttest.charting.chartbuilder.ChartBuilderFactory;
-import org.apache.qpid.disttest.charting.definition.ChartingDefinition;
-import org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator;
-import org.apache.qpid.disttest.charting.seriesbuilder.JdbcSeriesBuilder;
-import org.apache.qpid.disttest.charting.seriesbuilder.JdbcUrlGenerator;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.apache.qpid.disttest.charting.writer.ChartWriter;
-import org.jfree.chart.JFreeChart;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Draws charts for data drawn from CSV datasources using rules described in
- * charting definitions (.chartdef) files.
- * <p>
- * The following arguments are understood:
- * </p>
- * <ol>
- * <li>{@link #OUTPUT_DIR_PROP}</li>
- * <li>{@link #CHART_DEFINITIONS_PROP}</li>
- * <li>{@link #SUMMARY_TITLE_PROP}</li>
- * <li>{@link #JDBC_DRIVER_NAME_PROP}</li>
- * <li>{@link #JDBC_URL_PROP}</li>
- * </ol>
- * Default values are indicated by the similarly named constants in this class.
- */
-public class ChartingUtil
-{
- private static final Logger LOGGER = LoggerFactory.getLogger(ChartingUtil.class);
-
- /** directory in which to produce the PNGs */
- public static final String OUTPUT_DIR_PROP = "outputdir";
- public static final String OUTPUT_DIR_DEFAULT = ".";
-
- /** the path to the directory containing the chart definition files */
- public static final String CHART_DEFINITIONS_PROP = "chart-defs";
- public static final String CHART_DEFINITIONS_DEFAULT = ".";
-
- public static final String SUMMARY_TITLE_PROP = "summary-title";
- public static final String SUMMARY_TITLE_DEFAULT = "Performance Charts";
-
- /** the class name of the JDBC driver to use for reading the chart data */
- public static final String JDBC_DRIVER_NAME_PROP = "jdbcDriverClass";
- public static final String JDBC_DRIVER_NAME_DEFAULT = JdbcUrlGenerator.DEFAULT_JDBC_DRIVER_NAME;
-
- /** the JDBC URL of the data to be charted */
- public static final String JDBC_URL_PROP = "jdbcUrl";
- public static final String JDBC_URL_DEFAULT = null;
-
-
- private Map<String,String> _cliOptions = new HashMap<String, String>();
-
- {
- _cliOptions.put(OUTPUT_DIR_PROP, OUTPUT_DIR_DEFAULT);
- _cliOptions.put(CHART_DEFINITIONS_PROP, CHART_DEFINITIONS_DEFAULT);
- _cliOptions.put(SUMMARY_TITLE_PROP, SUMMARY_TITLE_DEFAULT);
- _cliOptions.put(JDBC_DRIVER_NAME_PROP, JDBC_DRIVER_NAME_DEFAULT);
- _cliOptions.put(JDBC_URL_PROP, JDBC_URL_DEFAULT);
- }
-
- public static void main(String[] args) throws Exception
- {
- try
- {
- LOGGER.info("Starting charting");
-
- ChartingUtil chartingUtil = new ChartingUtil();
- chartingUtil.parseArgumentsIntoConfig(args);
- chartingUtil.produceAllCharts();
- }
- finally
- {
- LOGGER.info("Charting complete");
- }
- }
-
- private void produceAllCharts()
- {
-
- final ChartWriter writer = new ChartWriter();
- writer.setOutputDirectory(new File(_cliOptions.get(OUTPUT_DIR_PROP)));
-
- SeriesBuilder seriesBuilder = new JdbcSeriesBuilder(
- _cliOptions.get(JDBC_DRIVER_NAME_PROP),
- _cliOptions.get(JDBC_URL_PROP));
-
- for (ChartingDefinition chartingDefinition : loadChartDefinitions())
- {
- try
- {
- ChartBuilder chartBuilder = ChartBuilderFactory.createChartBuilder(
- chartingDefinition.getChartType(),
- seriesBuilder);
-
- JFreeChart chart = chartBuilder.buildChart(chartingDefinition);
- writer.writeChartToFileSystem(chart, chartingDefinition);
- }
- catch (Exception e)
- {
- LOGGER.error("Couldn't produce chart " + chartingDefinition, e);
- }
- }
-
- final String summaryChartTitle = _cliOptions.get(SUMMARY_TITLE_PROP);
- writer.writeHtmlSummaryToFileSystem(summaryChartTitle);
- }
-
- private List<ChartingDefinition> loadChartDefinitions()
- {
- final String chartingDefsDir = _cliOptions.get(CHART_DEFINITIONS_PROP);
-
- LOGGER.info("Chart chartdef directory/file: {}", chartingDefsDir);
-
- List<ChartingDefinition> definitions = loadChartDefinitions(chartingDefsDir);
-
- LOGGER.info("There are {} chart(s) to produce", definitions.size());
- return definitions;
- }
-
- private List<ChartingDefinition> loadChartDefinitions(String chartingDefsDir)
- {
- ChartingDefinitionCreator chartingDefinitionLoader = new ChartingDefinitionCreator();
- return chartingDefinitionLoader.createFromFileOrDirectory(chartingDefsDir);
- }
-
- private void parseArgumentsIntoConfig(String[] args)
- {
- ArgumentParser argumentParser = new ArgumentParser();
- argumentParser.parseArgumentsIntoConfig(_cliOptions, args);
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java
deleted file mode 100644
index b10fd477ed..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java
+++ /dev/null
@@ -1,56 +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.qpid.disttest.charting.chartbuilder;
-
-
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.category.CategoryDataset;
-import org.jfree.data.general.Dataset;
-
-public class BarChart3DBuilder extends CategoryDataSetBasedChartBuilder
-{
-
- public BarChart3DBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected JFreeChart createCategoryChart(String title, String xAxisTitle,
- String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation,
- boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- JFreeChart chart = ChartFactory.createBarChart3D(title,
- xAxisTitle,
- yAxisTitle,
- (CategoryDataset)dataset,
- plotOrientation,
- showLegend,
- showToolTips,
- showUrls);
-
- return chart;
- }
-
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java
deleted file mode 100644
index 7705ef5d3a..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java
+++ /dev/null
@@ -1,54 +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.qpid.disttest.charting.chartbuilder;
-
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.category.CategoryDataset;
-import org.jfree.data.general.Dataset;
-
-public class BarChartBuilder extends CategoryDataSetBasedChartBuilder
-{
-
- public BarChartBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected JFreeChart createCategoryChart(String title, String xAxisTitle,
- String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation,
- boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- JFreeChart chart = ChartFactory.createBarChart(title,
- xAxisTitle,
- yAxisTitle,
- (CategoryDataset) dataset,
- plotOrientation,
- showLegend,
- showToolTips,
- showUrls);
- return chart;
- }
-
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java
deleted file mode 100644
index 9cadf0ec3c..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java
+++ /dev/null
@@ -1,112 +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.qpid.disttest.charting.chartbuilder;
-
-import java.awt.Color;
-import java.awt.GradientPaint;
-
-import org.apache.qpid.disttest.charting.definition.ChartingDefinition;
-import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.title.ShortTextTitle;
-import org.jfree.data.general.Dataset;
-
-public abstract class BaseChartBuilder implements ChartBuilder
-{
- static final GradientPaint BLUE_GRADIENT = new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue);
-
- private SeriesPainter _seriesPainter = new SeriesPainter();
-
- private final SeriesBuilder _seriesBuilder;
-
- protected BaseChartBuilder(SeriesBuilder seriesBuilder)
- {
- _seriesBuilder = seriesBuilder;
- }
-
- @Override
- public JFreeChart buildChart(ChartingDefinition chartingDefinition)
- {
- _seriesBuilder.setDatasetHolder(newDatasetHolder());
- Dataset dataset = _seriesBuilder.build(chartingDefinition.getSeriesDefinitions());
-
- JFreeChart chart = createChart(chartingDefinition, dataset);
- return chart;
- }
-
-
- /**
- * return a holder of an empty dataset suitable for use with the chart type
- * returned by {@link #createChartImpl(String, String, String, Dataset, PlotOrientation, boolean, boolean, boolean)}.
- */
- protected abstract DatasetHolder newDatasetHolder();
-
- /**
- * Create a chart with the supplied parameters.
- *
- * For ease of implementation, the signature is intentionally similar
- * to {@link ChartFactory}'s factory methods.
- */
- protected abstract JFreeChart createChartImpl(
- String title, String xAxisTitle, String yAxisTitle,
- final Dataset dataset,
- PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls);
-
- /**
- * Create a {@link SeriesStrokeAndPaintApplier} that will be used to format a chart
- */
- protected abstract SeriesStrokeAndPaintApplier newStrokeAndPaintApplier();
-
-
- private JFreeChart createChart(ChartingDefinition chartingDefinition, final Dataset dataset)
- {
- String title = chartingDefinition.getChartTitle();
- String xAxisTitle = chartingDefinition.getXAxisTitle();
- String yAxisTitle = chartingDefinition.getYAxisTitle();
-
- final JFreeChart chart = createChartImpl(
- title, xAxisTitle, yAxisTitle,
- dataset,
- PLOT_ORIENTATION, SHOW_LEGEND, SHOW_TOOL_TIPS, SHOW_URLS);
-
- addSubtitle(chart, chartingDefinition);
- chart.setBackgroundPaint(BLUE_GRADIENT);
- _seriesPainter.applySeriesAppearance(chart, chartingDefinition.getSeriesDefinitions(), newStrokeAndPaintApplier());
-
- return chart;
- }
-
- private void addSubtitle(JFreeChart chart, ChartingDefinition chartingDefinition)
- {
- if (chartingDefinition.getChartSubtitle() != null)
- {
- chart.addSubtitle(new ShortTextTitle(chartingDefinition.getChartSubtitle()));
- }
- }
-
- void setSeriesPainter(SeriesPainter seriesPainter)
- {
- _seriesPainter = seriesPainter;
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java
deleted file mode 100644
index 0d08fd8ad1..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java
+++ /dev/null
@@ -1,96 +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.qpid.disttest.charting.chartbuilder;
-
-
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-
-public abstract class CategoryDataSetBasedChartBuilder extends BaseChartBuilder
-{
- public CategoryDataSetBasedChartBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected DatasetHolder newDatasetHolder()
- {
- return new DatasetHolder()
- {
- final private DefaultCategoryDataset _dataset = new DefaultCategoryDataset();
-
- @Override
- public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row)
- {
- String x = row.dimensionAsString(0);
- double y = row.dimensionAsDouble(1);
- _dataset.addValue(y, seriesDefinition.getSeriesLegend(), x);
- }
-
- @Override
- public void beginSeries(SeriesDefinition seriesDefinition)
- {
- // unused
- }
-
- @Override
- public void endSeries(SeriesDefinition seriesDefinition)
- {
- // unused
- }
-
- @Override
- public int getNumberOfDimensions()
- {
- return 2;
- }
-
- @Override
- public Dataset getPopulatedDataset()
- {
- return _dataset;
- }
- };
- }
-
- @Override
- protected SeriesStrokeAndPaintApplier newStrokeAndPaintApplier()
- {
- return new CategoryStrokeAndPaintApplier();
- }
-
- @Override
- protected final JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- JFreeChart chart = createCategoryChart(title, xAxisTitle, yAxisTitle, dataset, plotOrientation, showLegend, showToolTips, showUrls);
- chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
- return chart;
- }
-
- protected abstract JFreeChart createCategoryChart(String title, String xAxisTitle, String yAxisTitle, Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls);
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java
deleted file mode 100644
index cbf5cbe515..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java
+++ /dev/null
@@ -1,41 +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.qpid.disttest.charting.chartbuilder;
-
-import java.awt.Color;
-import java.awt.Stroke;
-
-import org.jfree.chart.JFreeChart;
-
-class CategoryStrokeAndPaintApplier implements SeriesStrokeAndPaintApplier
-{
- @Override
- public void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart)
- {
- targetChart.getCategoryPlot().getRenderer().setSeriesStroke(seriesIndex, stroke);
- }
-
- @Override
- public void setSeriesPaint(int seriesIndex, Color colour, JFreeChart targetChart)
- {
- targetChart.getCategoryPlot().getRenderer().setSeriesPaint(seriesIndex, colour);
- }
-} \ No newline at end of file
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java
deleted file mode 100644
index 425b83596f..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java
+++ /dev/null
@@ -1,34 +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.qpid.disttest.charting.chartbuilder;
-
-import org.apache.qpid.disttest.charting.definition.ChartingDefinition;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-
-public interface ChartBuilder
-{
- public static final boolean SHOW_URLS = false;
- public static final boolean SHOW_TOOL_TIPS = false;
- public static final boolean SHOW_LEGEND = true;
- public static final PlotOrientation PLOT_ORIENTATION = PlotOrientation.VERTICAL;
-
- public JFreeChart buildChart(ChartingDefinition chartingDefinition);
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java
deleted file mode 100644
index 63a0573676..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java
+++ /dev/null
@@ -1,51 +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.qpid.disttest.charting.chartbuilder;
-
-import org.apache.qpid.disttest.charting.ChartType;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-
-public class ChartBuilderFactory
-{
-
- public static ChartBuilder createChartBuilder(ChartType chartType, SeriesBuilder seriesBuilder)
- {
- switch (chartType)
- {
- case LINE:
- return new LineChartBuilder(seriesBuilder);
- case LINE3D:
- return new LineChart3DBuilder(seriesBuilder);
- case BAR:
- return new BarChartBuilder(seriesBuilder);
- case BAR3D:
- return new BarChart3DBuilder(seriesBuilder);
- case XYLINE:
- return new XYLineChartBuilder(seriesBuilder);
- case TIMELINE:
- return new TimeSeriesLineChartBuilder(seriesBuilder);
- case STATISTICAL_BAR:
- return new StatisticalBarChartBuilder(seriesBuilder);
- default:
- throw new IllegalArgumentException("Unknown chart type " + chartType);
- }
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java
deleted file mode 100644
index 49d777c506..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java
+++ /dev/null
@@ -1,66 +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.qpid.disttest.charting.chartbuilder;
-
-import java.awt.Color;
-
-public class ColorFactory
-{
- /**
- * Converts a colour name known to the JDK into a {@link Color} instance. Additionally,
- * if the work dark_ is prepended to the colour, a darker shade of the same colour is
- * produced.
- *
- * @param colourName
- * @return colour instance
- */
- public static Color toColour(String colourName)
- {
- boolean darkVersion = false;
- if (colourName.toLowerCase().startsWith("dark_"))
- {
- colourName = colourName.replaceFirst("(?i)dark_", "");
- darkVersion = true;
- }
-
- Color colour = getColourFromStaticField(colourName);
- if (darkVersion)
- {
- return colour.darker();
- }
- else
- {
- return colour;
- }
- }
-
- private static Color getColourFromStaticField(String colourName)
- {
- try
- {
- return (Color) Color.class.getField(colourName.toLowerCase()).get(null);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Could not find colour for " + colourName, e);
- }
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java
deleted file mode 100644
index b92a25f5ac..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java
+++ /dev/null
@@ -1,52 +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.qpid.disttest.charting.chartbuilder;
-
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.category.CategoryDataset;
-import org.jfree.data.general.Dataset;
-
-public class LineChart3DBuilder extends CategoryDataSetBasedChartBuilder
-{
- public LineChart3DBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected JFreeChart createCategoryChart(String title, String xAxisTitle,
- String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation,
- boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- JFreeChart chart = ChartFactory.createLineChart3D(title,
- xAxisTitle,
- yAxisTitle,
- (CategoryDataset)dataset,
- plotOrientation,
- showLegend,
- showToolTips,
- showUrls);
- return chart;
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java
deleted file mode 100644
index 3f5b18acda..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java
+++ /dev/null
@@ -1,53 +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.qpid.disttest.charting.chartbuilder;
-
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.category.CategoryDataset;
-import org.jfree.data.general.Dataset;
-
-public class LineChartBuilder extends CategoryDataSetBasedChartBuilder
-{
-
- public LineChartBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected JFreeChart createCategoryChart(String title, String xAxisTitle,
- String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation,
- boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- JFreeChart chart = ChartFactory.createLineChart(title,
- xAxisTitle,
- yAxisTitle,
- (CategoryDataset)dataset,
- plotOrientation,
- showLegend,
- showToolTips,
- showUrls);
- return chart;
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java
deleted file mode 100644
index 854635dc87..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java
+++ /dev/null
@@ -1,63 +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.qpid.disttest.charting.chartbuilder;
-
-import java.awt.BasicStroke;
-import java.util.List;
-
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.jfree.chart.JFreeChart;
-
-public class SeriesPainter
-{
- public void applySeriesAppearance(JFreeChart chart, List<SeriesDefinition> seriesDefinitions, SeriesStrokeAndPaintApplier strokeAndPaintApplier)
- {
- for (int i = 0; i < seriesDefinitions.size(); i++)
- {
- SeriesDefinition seriesDefinition = seriesDefinitions.get(i);
- if (seriesDefinition.getSeriesColourName() != null)
- {
- strokeAndPaintApplier.setSeriesPaint(i, ColorFactory.toColour(seriesDefinition.getSeriesColourName()), chart);
- }
- if (seriesDefinition.getStrokeWidth() != null)
- {
- // Negative width used to signify dashed
- boolean dashed = seriesDefinition.getStrokeWidth() < 0;
- float width = Math.abs(seriesDefinition.getStrokeWidth());
- BasicStroke stroke = buildStrokeOfWidth(width, dashed);
- strokeAndPaintApplier.setSeriesStroke(i, stroke, chart);
- }
- }
- }
-
- private BasicStroke buildStrokeOfWidth(float width, boolean dashed)
- {
- final BasicStroke stroke;
- if (dashed)
- {
- stroke = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] {5.0f, 3.0f}, 0.0f);
- }
- else
- {
- stroke = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
- }
- return stroke;
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java
deleted file mode 100644
index 4d6c37a9f4..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java
+++ /dev/null
@@ -1,35 +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.qpid.disttest.charting.chartbuilder;
-
-import java.awt.Color;
-import java.awt.Stroke;
-
-import org.jfree.chart.JFreeChart;
-
-/**
- * Applies the supplied stroke and color to a series in the target chart.
- * Multiple implementations exist to because of the various chart types.
- */
-public interface SeriesStrokeAndPaintApplier
-{
- void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart);
- void setSeriesPaint(int seriesIndex, Color color, JFreeChart targetChart);
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java
deleted file mode 100644
index c5ad2d7dad..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java
+++ /dev/null
@@ -1,114 +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.qpid.disttest.charting.chartbuilder;
-
-import java.awt.Font;
-
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalBarRenderer;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-import org.jfree.data.statistics.StatisticalCategoryDataset;
-
-public class StatisticalBarChartBuilder extends BaseChartBuilder
-{
- public StatisticalBarChartBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected DatasetHolder newDatasetHolder()
- {
- return new DatasetHolder()
- {
- private final DefaultStatisticalCategoryDataset _dataset = new DefaultStatisticalCategoryDataset();
-
- @Override
- public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row)
- {
- String x = row.dimensionAsString(0);
- double mean = row.dimensionAsDouble(1);
- double stdDev = row.dimensionAsDouble(2);
- _dataset.add(mean, stdDev, seriesDefinition.getSeriesLegend(), x);
- }
-
- @Override
- public void beginSeries(SeriesDefinition seriesDefinition)
- {
- // unused
- }
-
- @Override
- public void endSeries(SeriesDefinition seriesDefinition)
- {
- // unused
- }
-
- @Override
- public int getNumberOfDimensions()
- {
- return 3;
- }
-
- @Override
- public Dataset getPopulatedDataset()
- {
- return _dataset;
- }
- };
- }
-
- @Override
- protected SeriesStrokeAndPaintApplier newStrokeAndPaintApplier()
- {
- return new CategoryStrokeAndPaintApplier();
- }
-
- @Override
- public JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, final Dataset dataset,
- PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- CategoryAxis xAxis = new CategoryAxis(xAxisTitle);
- ValueAxis yAxis = new NumberAxis(yAxisTitle);
- CategoryItemRenderer renderer = new StatisticalBarRenderer();
-
- CategoryPlot plot = new CategoryPlot((StatisticalCategoryDataset) dataset, xAxis, yAxis, renderer);
-
- JFreeChart chart = new JFreeChart(title, new Font("Arial", Font.PLAIN, 10), plot, true);
-
- chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
-
- return chart;
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java
deleted file mode 100644
index 803a098dfa..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java
+++ /dev/null
@@ -1,70 +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.qpid.disttest.charting.chartbuilder;
-
-import java.util.Date;
-
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.time.Millisecond;
-import org.jfree.data.time.RegularTimePeriod;
-import org.jfree.data.time.TimeSeries;
-import org.jfree.data.time.TimeSeriesCollection;
-
-class TimeSeriesHolder implements DatasetHolder
-{
- private final TimeSeriesCollection _timeSeriesCollection = new TimeSeriesCollection();
- private TimeSeries _timeSeries;
-
- @Override
- public void beginSeries(SeriesDefinition seriesDefinition)
- {
- _timeSeries = new TimeSeries(seriesDefinition.getSeriesLegend());
- }
-
- @Override
- public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row)
- {
- Date x = row.dimensionAsDate(0);
- double y = row.dimensionAsDouble(1);
- RegularTimePeriod jfreeChartDate = new Millisecond(x);
- _timeSeries.add(jfreeChartDate, y);
- }
-
- @Override
- public void endSeries(SeriesDefinition seriesDefinition)
- {
- _timeSeriesCollection.addSeries(_timeSeries);
- }
-
- @Override
- public int getNumberOfDimensions()
- {
- return 2;
- }
-
- @Override
- public Dataset getPopulatedDataset()
- {
- return _timeSeriesCollection;
- }
-} \ No newline at end of file
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java
deleted file mode 100644
index 7249ae6332..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java
+++ /dev/null
@@ -1,59 +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.qpid.disttest.charting.chartbuilder;
-
-import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.xy.XYDataset;
-
-public class TimeSeriesLineChartBuilder extends XYDataSetBasedChartBuilder
-{
- public TimeSeriesLineChartBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected DatasetHolder newDatasetHolder()
- {
- return new TimeSeriesHolder();
- }
-
- @Override
- public JFreeChart createChartImpl(String title, String xAxisTitle,
- String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation,
- boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- JFreeChart chart = ChartFactory.createTimeSeriesChart(
- title,
- xAxisTitle,
- yAxisTitle,
- (XYDataset)dataset,
- showLegend,
- showToolTips,
- showUrls);
-
- return chart;
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java
deleted file mode 100644
index 575712f06c..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java
+++ /dev/null
@@ -1,119 +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.qpid.disttest.charting.chartbuilder;
-
-import java.awt.Color;
-import java.awt.Stroke;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow;
-import org.jfree.chart.JFreeChart;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.xy.DefaultXYDataset;
-
-
-public abstract class XYDataSetBasedChartBuilder extends BaseChartBuilder
-{
- public XYDataSetBasedChartBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- protected DatasetHolder newDatasetHolder()
- {
- return new DatasetHolder()
- {
- private final DefaultXYDataset _dataset = new DefaultXYDataset();
- private List<Double[]> _xyPairs = null;
-
- @Override
- public void beginSeries(SeriesDefinition seriesDefinition)
- {
- _xyPairs = new ArrayList<Double[]>();
- }
-
- @Override
- public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row)
- {
- double x = row.dimensionAsDouble(0);
- double y = row.dimensionAsDouble(1);
- _xyPairs.add(new Double[] {x, y});
- }
-
- @Override
- public void endSeries(SeriesDefinition seriesDefinition)
- {
- double[][] seriesData = listToSeriesDataArray();
- _dataset.addSeries(seriesDefinition.getSeriesLegend(), seriesData);
- }
-
- @Override
- public int getNumberOfDimensions()
- {
- return 2;
- }
-
- private double[][] listToSeriesDataArray()
- {
- double[][] seriesData = new double[2][_xyPairs.size()];
- int i = 0;
- for (Iterator<Double[]> iterator = _xyPairs.iterator(); iterator.hasNext();)
- {
- Double[] xyPair = iterator.next();
- seriesData[0][i] = xyPair[0];
- seriesData[1][i] = xyPair[1];
- i++;
- }
- return seriesData;
- }
-
- @Override
- public Dataset getPopulatedDataset()
- {
- return _dataset;
- }
- };
- }
-
- @Override
- protected SeriesStrokeAndPaintApplier newStrokeAndPaintApplier()
- {
- return new SeriesStrokeAndPaintApplier()
- {
- @Override
- public void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart)
- {
- targetChart.getXYPlot().getRenderer().setSeriesStroke(seriesIndex, stroke);
- }
-
- @Override
- public void setSeriesPaint(int seriesIndex, Color colour, JFreeChart targetChart)
- {
- targetChart.getXYPlot().getRenderer().setSeriesPaint(seriesIndex, colour);
- }
- };
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java
deleted file mode 100644
index 48b02a7c60..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java
+++ /dev/null
@@ -1,51 +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.qpid.disttest.charting.chartbuilder;
-
-import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.xy.XYDataset;
-
-public class XYLineChartBuilder extends XYDataSetBasedChartBuilder
-{
- public XYLineChartBuilder(SeriesBuilder seriesBuilder)
- {
- super(seriesBuilder);
- }
-
- @Override
- public JFreeChart createChartImpl(String title, String xAxisTitle,
- String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation,
- boolean showLegend, boolean showToolTips, boolean showUrls)
- {
- JFreeChart chart = ChartFactory.createXYLineChart(title,
- xAxisTitle,
- yAxisTitle,
- (XYDataset)dataset,
- plotOrientation,
- showLegend,
- showToolTips,
- showUrls);
- return chart;
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java
deleted file mode 100644
index 5030c42e89..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java
+++ /dev/null
@@ -1,104 +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.qpid.disttest.charting.definition;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.qpid.disttest.charting.ChartType;
-
-public class ChartingDefinition
-{
- private final String _chartStemName;
- private final ChartType _chartType;
- private final String _chartTitle;
- private final String _chartSubtitle;
- private final String _chartDescription;
- private final String _xaxisTitle;
- private final String _yaxisTitle;
- private final List<SeriesDefinition> _seriesDefinitions;
-
-
- public ChartingDefinition(final String chartStemName,
- final ChartType chartType,
- final String chartTitle,
- final String chartSubtitle,
- final String chartDescription,
- final String xaxisTitle, final String yaxisTitle, List<SeriesDefinition> seriesDefinitions)
- {
- _chartStemName = chartStemName;
- _chartType = chartType;
- _chartTitle = chartTitle;
- _chartSubtitle = chartSubtitle;
- _chartDescription = chartDescription;
- _xaxisTitle = xaxisTitle;
- _yaxisTitle = yaxisTitle;
- _seriesDefinitions = seriesDefinitions;
- }
-
- public String getChartStemName()
- {
- return _chartStemName;
- }
-
- public String getChartTitle()
- {
- return _chartTitle;
- }
-
- public String getChartSubtitle()
- {
- return _chartSubtitle;
- }
-
- public String getChartDescription()
- {
- return _chartDescription;
- }
-
- public String getXAxisTitle()
- {
- return _xaxisTitle;
- }
-
-
- public String getYAxisTitle()
- {
- return _yaxisTitle;
- }
-
- public ChartType getChartType()
- {
- return _chartType;
- }
-
- public List<SeriesDefinition> getSeriesDefinitions()
- {
- return Collections.unmodifiableList(_seriesDefinitions);
- }
-
- @Override
- public String toString()
- {
- return new ToStringBuilder(this).append("chartTitle", _chartTitle).toString();
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java
deleted file mode 100644
index e0f43cb34a..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java
+++ /dev/null
@@ -1,143 +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.qpid.disttest.charting.definition;
-
-import static org.apache.commons.lang.text.StrSubstitutor.replaceSystemProperties;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.qpid.disttest.charting.ChartType;
-import org.apache.qpid.disttest.charting.ChartingException;
-
-public class ChartingDefinitionCreator
-{
- public static final String CHARTDEF_FILE_EXTENSION = ".chartdef";
-
- public static final String CHART_TYPE_KEY = "chartType";
- public static final String CHART_TITLE_KEY = "chartTitle";
- public static final String CHART_SUBTITLE_KEY = "chartSubtitle";
- public static final String CHART_DESCRIPTION_KEY = "chartDescription";
- public static final String XAXIS_TITLE_KEY = "xAxisTitle";
- public static final String YAXIS_TITLE_KEY = "yAxisTitle";
-
- private SeriesDefinitionCreator _seriesDefinitionCreator = new SeriesDefinitionCreator();
-
- public List<ChartingDefinition> createFromFileOrDirectory(String chartingDefinitionFileOrDirectory)
- {
- List<ChartingDefinition> definitions = new ArrayList<ChartingDefinition>();
-
- File fileOrDirectory = new File(chartingDefinitionFileOrDirectory);
- if (fileOrDirectory.isDirectory())
- {
- File[] matchingFiles = fileOrDirectory.listFiles(new CHARTDEF_FILE_FILTER());
-
- for (File file : matchingFiles)
- {
- final ChartingDefinition chartDefinition = createChartDefinition(file);
- definitions.add(chartDefinition);
- }
- }
- else
- {
- final ChartingDefinition chartDefinition = createChartDefinition(fileOrDirectory);
- definitions.add(chartDefinition);
- }
-
- return definitions;
- }
-
- private ChartingDefinition createChartDefinition(File file)
- {
- Reader reader = null;
- try
- {
- reader = new BufferedReader(new FileReader(file));
- Properties props = new Properties();
- props.load(reader);
-
- final String chartStemName = getStemNameFrom(file);
-
- final ChartType chartType = ChartType.valueOf(replaceSystemProperties(props.getProperty(CHART_TYPE_KEY)));
- final String chartTitle = replaceSystemProperties(props.getProperty(CHART_TITLE_KEY));
- final String chartSubtitle = replaceSystemProperties(props.getProperty(CHART_SUBTITLE_KEY));
- final String chartDescription = replaceSystemProperties(props.getProperty(CHART_DESCRIPTION_KEY));
- final String xAxisTitle = replaceSystemProperties(props.getProperty(XAXIS_TITLE_KEY));
- final String yAxisTitle = replaceSystemProperties(props.getProperty(YAXIS_TITLE_KEY));
-
- final List<SeriesDefinition> seriesDefinitions = createSeriesDefinitions(props);
-
- final ChartingDefinition chartDefinition = new ChartingDefinition(chartStemName,
- chartType,
- chartTitle,
- chartSubtitle,
- chartDescription,
- xAxisTitle, yAxisTitle, seriesDefinitions);
- return chartDefinition;
- }
- catch (IOException e)
- {
- throw new ChartingException("Unable to open file " + file, e);
- }
- finally
- {
- if (reader != null)
- {
- try
- {
- reader.close();
- }
- catch (IOException e)
- {
- throw new ChartingException(e);
- }
- }
- }
-
- }
-
- private String getStemNameFrom(File file)
- {
- final String nameWithExtension = file.getName();
- final String nameWithoutExtensionPart = nameWithExtension.replaceAll("\\.[^\\.]*$", "");
- return nameWithoutExtensionPart;
- }
-
- private List<SeriesDefinition> createSeriesDefinitions(Properties props)
- {
- return _seriesDefinitionCreator.createFromProperties(props);
- }
-
- private final class CHARTDEF_FILE_FILTER implements FileFilter
- {
- @Override
- public boolean accept(File pathname)
- {
- return pathname.isFile() && pathname.getName().endsWith(CHARTDEF_FILE_EXTENSION);
- }
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java
deleted file mode 100644
index d89ff855e2..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java
+++ /dev/null
@@ -1,75 +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.qpid.disttest.charting.definition;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-public class SeriesDefinition
-{
- private final String _seriesStatement;
- private final String _seriesLegend;
- private final String _seriesDirectory;
- private final String _seriesColourName;
- private final Integer _seriesStrokeWidth;
-
- public SeriesDefinition(String seriesStatement, String seriesLegend, String seriesDirectory, String seriesColourName, Integer seriesStrokeWidth)
- {
- _seriesStatement = seriesStatement;
- _seriesLegend = seriesLegend;
- _seriesDirectory = seriesDirectory;
- _seriesColourName = seriesColourName;
- _seriesStrokeWidth = seriesStrokeWidth;
- }
-
- public String getSeriesStatement()
- {
- return _seriesStatement;
- }
-
- public String getSeriesLegend()
- {
- return _seriesLegend;
- }
-
- public String getSeriesDirectory()
- {
- return _seriesDirectory;
- }
-
- public String getSeriesColourName()
- {
- return _seriesColourName;
- }
-
- public Integer getStrokeWidth()
- {
- return _seriesStrokeWidth;
- }
-
- @Override
- public String toString()
- {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("seriesLegend", _seriesLegend)
- .append("seriesStatement", _seriesStatement)
- .append("seriesDirectory", _seriesDirectory).toString();
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java
deleted file mode 100644
index e7d828bdcc..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java
+++ /dev/null
@@ -1,65 +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.qpid.disttest.charting.definition;
-
-import static org.apache.commons.lang.text.StrSubstitutor.replaceSystemProperties;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-public class SeriesDefinitionCreator
-{
- public static final String SERIES_STATEMENT_KEY_FORMAT = "series.%d.statement";
- public static final String SERIES_LEGEND_KEY_FORMAT = "series.%d.legend";
- public static final String SERIES_DIRECTORY_KEY_FORMAT = "series.%d.dir";
- public static final String SERIES_COLOUR_NAME_FORMAT = "series.%d.colourName";
- public static final String SERIES_STROKE_WIDTH_FORMAT = "series.%d.strokeWidth";
-
- public List<SeriesDefinition> createFromProperties(Properties properties)
- {
- final List<SeriesDefinition> seriesDefinitions = new ArrayList<SeriesDefinition>();
-
- int index = 1;
- boolean moreSeriesDefinitions = true;
- while(moreSeriesDefinitions)
- {
- String seriesStatement = replaceSystemProperties(properties.getProperty(String.format(SERIES_STATEMENT_KEY_FORMAT, index)));
- String seriesLegend = replaceSystemProperties(properties.getProperty(String.format(SERIES_LEGEND_KEY_FORMAT, index)));
- String seriesDir = replaceSystemProperties(properties.getProperty(String.format(SERIES_DIRECTORY_KEY_FORMAT, index)));
- String seriesColourName = replaceSystemProperties(properties.getProperty(String.format(SERIES_COLOUR_NAME_FORMAT, index)));
- Integer seriesStrokeWidth = properties.getProperty(String.format(SERIES_STROKE_WIDTH_FORMAT, index)) == null
- ? null : Integer.parseInt(properties.getProperty(String.format(SERIES_STROKE_WIDTH_FORMAT, index)));
-
- if (seriesStatement != null)
- {
- final SeriesDefinition seriesDefinition = new SeriesDefinition(seriesStatement, seriesLegend, seriesDir, seriesColourName, seriesStrokeWidth);
- seriesDefinitions.add(seriesDefinition);
- }
- else
- {
- moreSeriesDefinitions = false;
- }
- index++;
- }
- return seriesDefinitions;
- }
-
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java
deleted file mode 100644
index 14fd50facc..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java
+++ /dev/null
@@ -1,37 +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.qpid.disttest.charting.seriesbuilder;
-
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.jfree.data.general.Dataset;
-
-/**
- * Accepts data in the form of {@link SeriesDefinition}s and {@link SeriesRow}s,
- * and returns it as a {@link Dataset} for use by a JFreeChart chart.
- */
-public interface DatasetHolder
-{
- int getNumberOfDimensions();
- void beginSeries(SeriesDefinition seriesDefinition);
- void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row);
- void endSeries(SeriesDefinition seriesDefinition);
-
- Dataset getPopulatedDataset();
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java
deleted file mode 100644
index 180aa54c6d..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java
+++ /dev/null
@@ -1,157 +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.qpid.disttest.charting.seriesbuilder;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.apache.qpid.disttest.charting.ChartingException;
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.jfree.data.general.Dataset;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A {@link SeriesBuilder} that uses JDBC to read series data.
- * The actual JDBC URL used is determined by my {@link JdbcUrlGenerator}.
- */
-public class JdbcSeriesBuilder implements SeriesBuilder
-{
- private static final Logger LOGGER = LoggerFactory.getLogger(JdbcSeriesBuilder.class);
-
- private DatasetHolder _datasetHolder;
-
- private final JdbcUrlGenerator _jdbcUrlGenerator;
-
- /**
- * @param providedJdbcUrl the JDBC URL. Provide null if the value should be
- * inferred by {@link #_jdbcUrlGenerator}.
- */
- public JdbcSeriesBuilder(String jdbcDriverClass, String providedJdbcUrl)
- {
- registerDriver(jdbcDriverClass);
- _jdbcUrlGenerator = new JdbcUrlGenerator(providedJdbcUrl);
- LOGGER.info("Created: " + this);
- }
-
- @Override
- public void setDatasetHolder(DatasetHolder callback)
- {
- _datasetHolder = callback;
- }
-
- @Override
- public Dataset build(List<SeriesDefinition> seriesDefinitions)
- {
- for (Iterator<SeriesDefinition> iterator = seriesDefinitions.iterator(); iterator.hasNext();)
- {
- SeriesDefinition series = iterator.next();
- buildDataSetForSingleSeries(series);
- }
- return _datasetHolder.getPopulatedDataset();
- }
-
- private void buildDataSetForSingleSeries(SeriesDefinition seriesDefinition)
- {
- Connection conn = null;
- Statement stmt = null;
- try
- {
- String jdbcUrl = _jdbcUrlGenerator.getJdbcUrl(seriesDefinition);
- conn = DriverManager.getConnection(jdbcUrl);
-
- final String seriesStatement = seriesDefinition.getSeriesStatement();
-
- stmt = conn.createStatement();
- ResultSet results = stmt.executeQuery(seriesStatement);
- int columnCount = results.getMetaData().getColumnCount();
- _datasetHolder.beginSeries(seriesDefinition);
- while (results.next())
- {
- Object[] row = new Object[columnCount];
- for (int i = 0; i < row.length; i++)
- {
- row[i] = results.getObject(i+1);
- }
-
- SeriesRow seriesRow = SeriesRow.createValidSeriesRow(_datasetHolder.getNumberOfDimensions(), row);
- _datasetHolder.addDataPointToSeries(seriesDefinition, seriesRow);
- }
- _datasetHolder.endSeries(seriesDefinition);
- }
- catch (SQLException e)
- {
- throw new ChartingException("Failed to create chart dataset", e);
- }
- finally
- {
- if (stmt != null)
- {
- try
- {
- stmt.close();
- }
- catch (SQLException e)
- {
- throw new RuntimeException("Failed to close statement", e);
- }
- }
- if (conn != null)
- {
- try
- {
- conn.close();
- }
- catch (SQLException e)
- {
- throw new RuntimeException("Failed to close connection", e);
- }
- }
- }
- }
-
- private void registerDriver(String driverClassName) throws ExceptionInInitializerError
- {
- try
- {
- Class.forName(driverClassName);
- LOGGER.info("Loaded JDBC driver class " + driverClassName);
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException("Could not load JDBC driver " + driverClassName, e);
- }
- }
-
- @Override
- public String toString()
- {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("jdbcUrlGenerator", _jdbcUrlGenerator)
- .toString();
- }
-}
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java
deleted file mode 100644
index 77f367b0f1..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java
+++ /dev/null
@@ -1,81 +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.qpid.disttest.charting.seriesbuilder;
-
-import static org.apache.commons.lang.StringUtils.isBlank;
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-
-public class JdbcUrlGenerator
-{
- private String _providedJdbdUrl;
-
- public static final String DEFAULT_JDBC_DRIVER_NAME = "org.relique.jdbc.csv.CsvDriver";
-
- /**
- * Used to create the JDBC URL if one has not been passed in.
- */
- private static final String CSV_JDBC_URL_BASE = "jdbc:relique:csv:";
-
- /**
- * @param providedJdbcUrl the JDBC URL. Provide null if the value should be
- * inferred.
- */
- public JdbcUrlGenerator(String providedJdbcUrl)
- {
- _providedJdbdUrl = providedJdbcUrl;
- }
-
- /**
- * Returns either the provided value ({@link #_providedJdbdUrl})
- * or a CSV JDBC URL pointing at {@link SeriesDefinition#getSeriesDirectory()} value.
- */
- public String getJdbcUrl(SeriesDefinition seriesDefinition)
- {
- String seriesDir = seriesDefinition.getSeriesDirectory();
-
- if(_providedJdbdUrl == null)
- {
- if(isBlank(seriesDir))
- {
- throw new IllegalArgumentException("Neither a series directory nor a JDBC url have been specified. Series definition: " + seriesDefinition);
- }
- return CSV_JDBC_URL_BASE + seriesDir;
- }
- else
- {
- if(isNotBlank(seriesDir))
- {
- throw new IllegalArgumentException("Both a series directory '" + seriesDir + "' and a JDBC url have been specified. Series definition: " + seriesDefinition);
- }
- return _providedJdbdUrl;
- }
- }
-
- @Override
- public String toString()
- {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("providedJdbdUrl", _providedJdbdUrl)
- .toString();
- }
-} \ No newline at end of file
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java
deleted file mode 100644
index a865c838c6..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java
+++ /dev/null
@@ -1,41 +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.qpid.disttest.charting.seriesbuilder;
-
-import java.util.List;
-
-import org.apache.qpid.disttest.charting.definition.SeriesDefinition;
-import org.jfree.data.general.Dataset;
-
-public interface SeriesBuilder
-{
- /**
- * Uses the supplied {@link SeriesDefinition}s to read the series data
- * and pass it to the dataset holder set up in {@link #setDatasetHolder(DatasetHolder)}.
- *
- * @return the populated dataset
- */
- Dataset build(List<SeriesDefinition> seriesDefinitions);
-
- /**
- * Stores the supplied dataset holder so it can be populated in {@link #build(List)}.
- */
- void setDatasetHolder(DatasetHolder datasetHolder);
-} \ No newline at end of file
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java
deleted file mode 100644
index 9c16866939..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java
+++ /dev/null
@@ -1,98 +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.qpid.disttest.charting.seriesbuilder;
-
-import java.util.Arrays;
-import java.util.Date;
-
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-/**
- * A data point in a chart. Thinly wraps an array to provide a convenient place to validate the number of dimensions,
- * and to access dimensions in a typesafe manner.
- */
-public class SeriesRow
-{
- private final Object[] _dimensions;
-
- public static SeriesRow createValidSeriesRow(int expectedNumberOfDimensions, Object[] dimensions)
- {
- int actualNumberOfDimensions = dimensions.length;
- if(expectedNumberOfDimensions != actualNumberOfDimensions)
- {
- throw new IllegalArgumentException("Expected " + expectedNumberOfDimensions
- + " dimensions but found " + actualNumberOfDimensions
- + " in: " + Arrays.asList(dimensions));
- }
- return new SeriesRow(dimensions);
- }
-
- public SeriesRow(Object... dimensions)
- {
- _dimensions = dimensions;
- }
-
- public Object dimension(int dimension)
- {
- return _dimensions[dimension];
- }
-
- public String dimensionAsString(int dimension)
- {
- return String.valueOf(dimension(dimension));
- }
-
- public double dimensionAsDouble(int dimension)
- {
- return Double.parseDouble(dimensionAsString(dimension));
- }
-
- public Date dimensionAsDate(int dimension)
- {
- return (Date) dimension(dimension);
- }
-
- @Override
- public int hashCode()
- {
- return new HashCodeBuilder().append(_dimensions).toHashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == null)
- {
- return false;
- }
- if (obj == this)
- {
- return true;
- }
- if (obj.getClass() != getClass())
- {
- return false;
- }
- SeriesRow rhs = (SeriesRow) obj;
- return new EqualsBuilder().append(_dimensions, rhs._dimensions).isEquals();
- }
-
-
-} \ No newline at end of file
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java
deleted file mode 100644
index 341f01ccd1..0000000000
--- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java
+++ /dev/null
@@ -1,158 +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.qpid.disttest.charting.writer;
-
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.apache.qpid.disttest.charting.ChartingException;
-import org.apache.qpid.disttest.charting.definition.ChartingDefinition;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ChartWriter
-{
- private static final Logger LOGGER = LoggerFactory.getLogger(ChartWriter.class);
-
- static final String SUMMARY_FILE_NAME = "chart-summary.html";
-
- private File _chartDirectory = new File(".");
- private SortedMap<File,ChartingDefinition> _chartFilesToChartDef = new TreeMap<File, ChartingDefinition>();
-
- public void writeChartToFileSystem(JFreeChart chart, ChartingDefinition chartDef)
- {
- OutputStream pngOutputStream = null;
- try
- {
- File pngFile = new File(_chartDirectory, chartDef.getChartStemName() + ".png");
- pngOutputStream = new BufferedOutputStream(new FileOutputStream(pngFile));
- ChartUtilities.writeChartAsPNG(pngOutputStream, chart, 600, 400, true, 0);
- pngOutputStream.close();
-
- _chartFilesToChartDef.put(pngFile, chartDef);
-
- LOGGER.info("Written {} chart", pngFile);
- }
- catch (IOException e)
- {
- throw new ChartingException("Failed to create chart", e);
- }
- finally
- {
- if (pngOutputStream != null)
- {
- try
- {
- pngOutputStream.close();
- }
- catch (IOException e)
- {
- throw new ChartingException("Failed to create chart", e);
- }
- }
- }
- }
-
- public void writeHtmlSummaryToFileSystem(String summaryPageTitle)
- {
- if(_chartFilesToChartDef.size() < 2)
- {
- LOGGER.info("Only {} chart image(s) have been written so no HTML summary file will be produced", _chartFilesToChartDef.size());
- return;
- }
-
- String htmlHeader = String.format(
- "<html>\n" +
- " <head>\n" +
- " <title>%s</title>\n" +
- " <style type='text/css'>figure { float: left; display: table; width: 87px;}</style>\n" +
- " </head>\n" +
- " <body>\n", summaryPageTitle);
-
- String htmlFooter =
- " </body>\n" +
- "</html>";
-
- BufferedWriter writer = null;
- try
- {
- File summaryFile = new File(_chartDirectory, SUMMARY_FILE_NAME);
- LOGGER.debug("About to produce HTML summary file " + summaryFile.getAbsolutePath() + " from charts " + _chartFilesToChartDef);
-
- writer = new BufferedWriter(new FileWriter(summaryFile));
- writer.write(htmlHeader);
-
- writer.write(" <ul>\n");
- for (File chartFile : _chartFilesToChartDef.keySet())
- {
- writer.write(" <li><a href='#"+ chartFile.getName() +"'>" + chartFile.getName() + "</a></li>\n");
- }
- writer.write(" </ul>\n");
-
- for (File chartFile : _chartFilesToChartDef.keySet())
- {
- ChartingDefinition def = _chartFilesToChartDef.get(chartFile);
- writer.write(" <figure>\n");
- writer.write(" <a name='" + chartFile.getName() + "'/>\n");
- writer.write(" <img src='" + chartFile.getName() + "'/>\n");
- if (def.getChartDescription() != null)
- {
- writer.write(" <figcaption>" + def.getChartDescription() + "</figcaption>\n");
- }
- writer.write(" </figure>\n");
- }
- writer.write(htmlFooter);
- writer.close();
- }
- catch (Exception e)
- {
- throw new ChartingException("Failed to create HTML summary file", e);
- }
- finally
- {
- if(writer != null)
- {
- try
- {
- writer.close();
- }
- catch(IOException e)
- {
- throw new ChartingException("Failed to create HTML summary file", e);
- }
- }
- }
- }
-
- public void setOutputDirectory(final File chartDirectory)
- {
- _chartDirectory = chartDirectory;
- LOGGER.info("Set chart directory: {}", chartDirectory);
- }
-}