[jboss-svn-commits] JBL Code SVN: r13213 - in labs/jbosslabs/trunk/stats-server: kosmos and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jul 7 11:39:26 EDT 2007
Author: wrzep
Date: 2007-07-07 11:39:26 -0400 (Sat, 07 Jul 2007)
New Revision: 13213
Added:
labs/jbosslabs/trunk/stats-server/kosmos/lib/
labs/jbosslabs/trunk/stats-server/kosmos/lib/kosmos.jar
labs/jbosslabs/trunk/stats-server/kosmos/project.properties
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/jira/
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/jira/AbstractJiraServiceImpl.java
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/util/
labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java
labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/Colors.java
labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/colors.properties
Removed:
labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/LabsCachedDataStore.java
labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/ShotokuCachedDataStore.java
Modified:
labs/jbosslabs/trunk/stats-server/build.properties.sample
labs/jbosslabs/trunk/stats-server/kosmos/maven.xml
labs/jbosslabs/trunk/stats-server/kosmos/project.xml
Log:
JBLAB-878 custom colors in charts
Modified: labs/jbosslabs/trunk/stats-server/build.properties.sample
===================================================================
--- labs/jbosslabs/trunk/stats-server/build.properties.sample 2007-07-07 14:31:45 UTC (rev 13212)
+++ labs/jbosslabs/trunk/stats-server/build.properties.sample 2007-07-07 15:39:26 UTC (rev 13213)
@@ -1,3 +1,6 @@
+# Path to stats-server directory
+stats.root.dir=
+
# Path to JBoss AS
local.server.dir=
Added: labs/jbosslabs/trunk/stats-server/kosmos/lib/kosmos.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbosslabs/trunk/stats-server/kosmos/lib/kosmos.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbosslabs/trunk/stats-server/kosmos/maven.xml
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/maven.xml 2007-07-07 14:31:45 UTC (rev 13212)
+++ labs/jbosslabs/trunk/stats-server/kosmos/maven.xml 2007-07-07 15:39:26 UTC (rev 13213)
@@ -18,6 +18,8 @@
<goal name="build">
+ <attainGoal name="java:compile" />
+
<ant:copy tofile="conf/server/classes/ehcache.xml" file="conf/server/classes/ehcache.template.xml" overwrite="true"/>
<ant:replace file="conf/server/classes/ehcache.xml" propertyFile="kosmos.properties">
<ant:replacefilter token="#{kosmos.cache.timeout.seconds}" property="kosmos.cache.timeout.seconds"/>
@@ -37,6 +39,19 @@
<goal name="deploy">
<ant:unzip src="to-copy/kosmos-server.war" dest="target/kosmos-server.war" overwrite="true" />
+ <!-- Copying changed kosmos classes -->
+ <ant:copy todir="target/kosmos-server.war/WEB-INF/classes" overwrite="true">
+ <ant:fileset dir="target/classes">
+ <ant:filename name="**/*" />
+ </ant:fileset>
+ </ant:copy>
+
+ <ant:copy todir="target/kosmos-server.war/WEB-INF/classes" overwrite="true">
+ <ant:fileset dir="src/java">
+ <ant:filename name="**/*.properties"/>
+ </ant:fileset>
+ </ant:copy>
+
<!-- Copying configuration files -->
<ant:copy todir="target/kosmos-server.war/WEB-INF" overwrite="true">
<ant:fileset dir="conf/server" excludes="**/*.template.xml">
Added: labs/jbosslabs/trunk/stats-server/kosmos/project.properties
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/project.properties (rev 0)
+++ labs/jbosslabs/trunk/stats-server/kosmos/project.properties 2007-07-07 15:39:26 UTC (rev 13213)
@@ -0,0 +1,14 @@
+maven.repo.remote=http://repo1.maven.org/maven
+maven.junit.fork=yes
+
+## Specify these properties if you are behind a proxy server
+##maven.proxy.host
+##maven.proxy.port
+##maven.proxy.username
+##maven.proxy.password
+##maven.proxy.ntlm.host
+##maven.proxy.ntlm.domain
+
+maven.jar.override=on
+
+maven.jar.kosmos=${stats.root.dir}/kosmos/lib/kosmos.jar
Modified: labs/jbosslabs/trunk/stats-server/kosmos/project.xml
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/project.xml 2007-07-07 14:31:45 UTC (rev 13212)
+++ labs/jbosslabs/trunk/stats-server/kosmos/project.xml 2007-07-07 15:39:26 UTC (rev 13213)
@@ -5,8 +5,30 @@
See terms of license at gnu.org.
-->
<project>
+ <pomVersion>3</pomVersion>
<id>kosmos-server</id>
<name>Kosmos Server</name>
<extend>../project.xml</extend>
<properties>kosmos.properties</properties>
+ <dependencies>
+ <dependency>
+ <groupId>kosmos</groupId>
+ <artifactId>kosmos</artifactId>
+ <version>1.0</version>
+ <jar>kosmos.jar</jar>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>jfreechart</groupId>
+ <artifactId>jfreechart</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ </build>
</project>
Added: labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/jira/AbstractJiraServiceImpl.java
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/jira/AbstractJiraServiceImpl.java (rev 0)
+++ labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/jira/AbstractJiraServiceImpl.java 2007-07-07 15:39:26 UTC (rev 13213)
@@ -0,0 +1,82 @@
+/*
+ * Kosmos.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package hu.midori.kosmos.server.jira;
+
+import hu.midori.kosmos.model.util.ZoomableImageLocator;
+import hu.midori.kosmos.server.AbstractKosmosService;
+import hu.midori.kosmos.server.util.ChartUtils;
+import hu.midori.kosmos.server.util.ColorCodedKey;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.kosmos.Colors;
+
+/**
+ * Encapsulates the common functionality of concrete
+ * JIRA service implemnetations.
+ *
+ * @author <a href="mailto:aron.gombas at midori.hu">Aron Gombas</a>
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ * @version $Id$
+ */
+public abstract class AbstractJiraServiceImpl extends AbstractKosmosService {
+ /** Generates issues-per-status chart. */
+ protected ZoomableImageLocator generateIssuePerStatusChart(String prefix, int openIssues, int codingInProgressIssues, int reopenedIssues, int resolvedIssues, int closedIssues) {
+ List<Map.Entry<ColorCodedKey, Integer>> issuesPerStatusMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>();
+ if(openIssues > 0)
+ issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.openIssues"),
+ Colors.getColor("jiraproject.openIssues.color")), openIssues).entrySet());
+ if(codingInProgressIssues > 0)
+ issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.codingInProgressIssues"),
+ Colors.getColor("jiraproject.codingInProgressIssues.color")), codingInProgressIssues).entrySet());
+ if(reopenedIssues > 0)
+ issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.reopenedIssues"),
+ Colors.getColor("jiraproject.reopenedIssues.color")), reopenedIssues).entrySet());
+ if(resolvedIssues > 0)
+ issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.resolvedIssues"),
+ Colors.getColor("jiraproject.resolvedIssues.color")), resolvedIssues).entrySet());
+ if(closedIssues > 0)
+ issuesPerStatusMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.closedIssues"),
+ Colors.getColor("jiraproject.closedIssues.color")), closedIssues).entrySet());
+
+ return storeChart(prefix + "_issues_per_status", ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(issuesPerStatusMap)));
+ }
+
+ /** Generates issues-per-priority chart. */
+ protected ZoomableImageLocator generateIssuePerPriorityChart(String prefix, int blockerOpenIssues, int criticalOpenIssues, int majorOpenIssues, int minorOpenIssues, int trivialOpenIssues, int optionalOpenIssues) {
+ List<Map.Entry<ColorCodedKey, Integer>> openIssuesPerPriorityMap = new ArrayList<Map.Entry<ColorCodedKey, Integer>>();
+ if(blockerOpenIssues > 0)
+ openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.blockerOpenIssues"),
+ Colors.getColor( "jiraproject.blockerOpenIssues.color")), blockerOpenIssues).entrySet());
+ if(criticalOpenIssues > 0)
+ openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.criticalOpenIssues"),
+ Colors.getColor( "jiraproject.criticalOpenIssues.color")), criticalOpenIssues).entrySet());
+ if(majorOpenIssues > 0)
+ openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.majorOpenIssues"),
+ Colors.getColor( "jiraproject.majorOpenIssues.color")), majorOpenIssues).entrySet());
+ if(minorOpenIssues > 0)
+ openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.minorOpenIssues"),
+ Colors.getColor( "jiraproject.minorOpenIssues.color")), minorOpenIssues).entrySet());
+ if(trivialOpenIssues > 0)
+ openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.trivialOpenIssues"),
+ Colors.getColor( "jiraproject.trivialOpenIssues.color")), trivialOpenIssues).entrySet());
+ if(optionalOpenIssues > 0)
+ openIssuesPerPriorityMap.addAll(Collections.singletonMap(new ColorCodedKey(getResourceString("hu.midori.kosmos.server.jira.jira_monitoring", "jiraproject.optionalOpenIssues"),
+ Colors.getColor( "jiraproject.optionalOpenIssues.color")), optionalOpenIssues).entrySet());
+
+ return storeChart(prefix + "_open_issues_per_priority", ChartUtils.generateColorCodedPieChart(ChartUtils.collectionToPieDataset(openIssuesPerPriorityMap)));
+ }
+
+ /** Generates open-issues-per-assignee chart. */
+ protected ZoomableImageLocator generateOpenIssuesPerAssigneeChart(String prefix, List<Map.Entry<String, Integer>> openIssuesPerAssignee) {
+ return storeChart(prefix + "_open_issues_per_assignee", ChartUtils.generatePieChart(ChartUtils.collectionToPieDataset(openIssuesPerAssignee, ChartUtils.MAX_ITEMS)));
+ }
+}
Added: labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java (rev 0)
+++ labs/jbosslabs/trunk/stats-server/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java 2007-07-07 15:39:26 UTC (rev 13213)
@@ -0,0 +1,181 @@
+/*
+ * Kosmos.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package hu.midori.kosmos.server.util;
+
+import java.awt.Color;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.kosmos.Colors;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PiePlot;
+import org.jfree.chart.renderer.xy.XYBarRenderer;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
+import org.jfree.data.general.DefaultPieDataset;
+import org.jfree.data.general.PieDataset;
+import org.jfree.data.time.TimeSeries;
+import org.jfree.data.time.TimeSeriesCollection;
+
+/**
+ * Utility methods for chart generation.
+ *
+ * @author <a href="mailto:aron.gombas at midori.hu">Aron Gombas</a>
+ * @version $Id$
+ */
+public class ChartUtils {
+ /**
+ * Max number of items in trimmed datasets.
+ * @see #collectionToPieDataset(Collection, int)
+ */
+ public static final int MAX_ITEMS = 8;
+
+ /** Transparent paint used as background in chart images. */
+ protected static final Color TRANSPARENT_COLOR = new Color(0, 0, 0, 0);
+ /** Shape for the timeseries-charts. */
+ protected static final Shape RECTANGLE_SHAPE = new Rectangle(-1, -1, 2, 2);
+
+ /** This class should never be instantiated. */
+ protected ChartUtils() { }
+
+ /** Returns the pie-chart generated from the passed data. */
+ public static JFreeChart generatePieChart(PieDataset dataset) {
+ // generate chart
+ JFreeChart chart = ChartFactory.createPieChart(null, dataset, false, false, false);
+ chart.setBackgroundPaint(TRANSPARENT_COLOR);
+
+ // apply color-codes
+ PiePlot plot = (PiePlot)chart.getPlot();
+ for(int i = 0; i < dataset.getItemCount(); i++)
+ plot.setSectionPaint(i, Colors.getPieColor(i));
+
+ return chart;
+ }
+
+ /**
+ * Returns the color-coded pie-chart generated from the passed data.
+ * The keys in the dataset are <code>ColorCodedKey</code> objects that
+ * specify both the pie section labels and the pie section colors.
+ */
+ public static JFreeChart generateColorCodedPieChart(PieDataset dataset) {
+ // generate chart
+ JFreeChart chart = ChartFactory.createPieChart(null, dataset, false, false, false);
+ chart.setBackgroundPaint(TRANSPARENT_COLOR);
+
+ // apply color-codes
+ PiePlot plot = (PiePlot)chart.getPlot();
+ for(int i = 0; i < dataset.getItemCount(); i++)
+ plot.setSectionPaint(i, ((ColorCodedKey)dataset.getKey(i)).getColor());
+
+ return chart;
+ }
+
+ /** Returns the time-chart generated from the passed data. */
+ public static JFreeChart generateTimeLineChart(TimeSeries dataset) {
+ // generate chart
+ JFreeChart chart = ChartFactory.createTimeSeriesChart(null, null, null, new TimeSeriesCollection(dataset), false, false, false);
+ chart.setBackgroundPaint(TRANSPARENT_COLOR);
+
+ // override renderer
+ XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)(chart.getXYPlot().getRenderer());
+ renderer.setShapesVisible(true);
+ renderer.setShape(RECTANGLE_SHAPE);
+
+ return chart;
+ }
+
+ /** Returns the time-barchart generated from the passed data. */
+ public static JFreeChart generateTimeBarChart(TimeSeries dataset) {
+ // generate chart
+ JFreeChart chart = generateTimeLineChart(dataset);
+
+ // override renderer with bar type
+ XYBarRenderer renderer = new XYBarRenderer(0.2);
+ renderer.setDrawBarOutline(false);
+ chart.getXYPlot().setRenderer(renderer);
+
+ return chart;
+ }
+
+ /** Writes the given chart to the output-stream in PNG image format. */
+ public static void writeChartAsPng(JFreeChart chart, OutputStream out, int width, int height) throws IOException {
+ ChartUtilities.writeChartAsPNG(out, chart, width, height, true, 0);
+ }
+
+ /**
+ * Returns the passed collection as untrimmed pie-dataset.
+ * @see #collectionToPieDataset(Collection, int)
+ */
+ public static PieDataset collectionToPieDataset(Collection items) {
+ return collectionToPieDataset(items, -1);
+ }
+
+ /**
+ * Returns the passed collection of <code>Map.Entry</code> objects as pie-dataset
+ * (equivalent key-value pairs), optionally trimmed to a maximum number of items
+ * to prevent unreadably busy charts.
+ * @param maxItems the maximum number of items in the returned pie-dataset or -1 if trimming is not needed.
+ */
+ @SuppressWarnings("unchecked")
+ public static PieDataset collectionToPieDataset(Collection items, int maxItems) {
+ DefaultPieDataset dataset = new DefaultPieDataset();
+
+ // generate dataset
+ int counter = 0;
+ for(Map.Entry<? extends Comparable, Integer> item : (Collection<Map.Entry<? extends Comparable, Integer>>)items) {
+ if((maxItems != -1) && (++counter > maxItems))
+ break;
+ dataset.setValue(item.getKey(), item.getValue());
+ }
+
+ return dataset;
+ }
+
+ /**
+ * Increments the counter (or starts that from 1 if not existing yet) in
+ * a <code>String</code> to <code>Integer</code> map.
+ */
+ public static void incrementCountMap(Map<String, Integer> map, String key) {
+ if(key == null)
+ return;
+
+ Integer count = map.get(key);
+ map.put(key, (count == null) ? 1 : count + 1);
+ }
+
+ /** Returns the list of the entries in the map sorted by their value (not by their key!) in descending order. */
+ @SuppressWarnings("unchecked")
+ public static List countMapToSortedList(Map map) {// TODO should be Map<?, Integer> and List<Map.Entry<?, Integer>>
+ List<Map.Entry> sorted = new ArrayList<Map.Entry>(map.entrySet());
+ Collections.sort(sorted, new Comparator() {// TODO should be Comparator<Map.Entry<?, Integer>>
+ public int compare(Object obj1, Object obj2) {
+ // revert-compare for descending order
+ Integer value1 = (Integer)((Map.Entry)obj1).getValue();
+ Integer value2 = (Integer)((Map.Entry)obj2).getValue();
+ int comparison = value2.compareTo(value1);
+ if(comparison != 0)
+ return comparison;
+
+ // compare keys in ascending order for identical-valued entries
+ String key1 = (String)((Map.Entry)obj1).getKey();
+ String key2 = (String)((Map.Entry)obj2).getKey();
+ return key1.compareTo(key2);
+ }
+ });
+
+ return sorted;
+ }
+}
Added: labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/Colors.java
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/Colors.java (rev 0)
+++ labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/Colors.java 2007-07-07 15:39:26 UTC (rev 13213)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.kosmos;
+
+import java.awt.Color;
+import java.util.ResourceBundle;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+public class Colors {
+
+ private static final String COLORS_RESOURCE = "org.jboss.kosmos.colors";
+
+ private static final String KEY_PREFIX = "pie.chart.color.";
+
+ private static ResourceBundle resources = null;
+
+ public static Color getColor(String key) {
+
+ if (resources == null) {
+ resources = ResourceBundle.getBundle(COLORS_RESOURCE);
+ }
+
+ return Color.decode(resources.getString(key));
+ }
+
+ public static Color getPieColor(int i) {
+
+ if (resources == null) {
+ resources = ResourceBundle.getBundle(COLORS_RESOURCE);
+ }
+
+ String key = KEY_PREFIX + Integer.toString(i);
+
+ return Color.decode(resources.getString(key));
+ }
+}
\ No newline at end of file
Deleted: labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/LabsCachedDataStore.java
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/LabsCachedDataStore.java 2007-07-07 14:31:45 UTC (rev 13212)
+++ labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/LabsCachedDataStore.java 2007-07-07 15:39:26 UTC (rev 13213)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.kosmos;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Date;
-
-import org.jboss.forge.common.ForgeHelper;
-import org.jboss.forge.common.TempFileDescriptor;
-import org.jboss.shotoku.tools.Tools;
-
-import hu.midori.kosmos.server.store.StaticContentStore;
-
-/**
- *
- * @author Tomasz Szyma??ski (tomasz.szymanski at jboss.com)
- * @author <a href="mailto:aron.gombas at midori.hu">Aron Gombas</a>
- */
-public class LabsCachedDataStore implements StaticContentStore {
-
- public String storeFile(String fileName, InputStream in) throws Exception {
-
- ForgeHelper.deleteTempFile(getCachedWildcard(fileName));
-
- TempFileDescriptor tfd = ForgeHelper.addTempFile(getCachedFileName(fileName), false);
-
- OutputStream out = tfd.getOut();
-
- Tools.transfer(in, out);
-
- /*int chr = 0;
-
- // write the file
- while ((chr = in.read()) != -1) {
- out.write(chr);
- }*/
-
- in.close();
- out.close();
-
- return tfd.getTempFileName();
- }
-
- /**
- * Returns the part of the filename for a cached item without the timestamp
- * prefix. This is used to found the previous versions of the same cache item.
- * @throws UnsupportedEncodingException
- */
- private static String getCachedWildcard(String filename)
- throws UnsupportedEncodingException {
- return encodeFilename("", filename);
- }
-
- /**
- * Returns the local filename for a cached item, by adding a timestamp prefix
- * so that browsers will not cache the item if it actually changes.
- * @throws UnsupportedEncodingException
- */
- private static String getCachedFileName(String filename)
- throws UnsupportedEncodingException {
- return encodeFilename(Long.toString(new Date().getTime()), filename);
- }
-
- /**
- * Encodes the local filename for a cached item.
- * @param filename can contain any character.
- * @return the filename which contain only file-system-compatible characters.
- * @throws UnsupportedEncodingException
- */
- private static String encodeFilename(String prefix, String filename)
- throws UnsupportedEncodingException {
- return URLEncoder.encode(String.format("%s_%s", prefix, filename),
- "utf-8");
- }
-
- /** Unimplemented methods from kosmos 0.1.7 - Pawel Wrzeszcz */
-
- public void begin() {};
-
- public void end() {};
-}
Deleted: labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/ShotokuCachedDataStore.java
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/ShotokuCachedDataStore.java 2007-07-07 14:31:45 UTC (rev 13212)
+++ labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/ShotokuCachedDataStore.java 2007-07-07 15:39:26 UTC (rev 13213)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.kosmos;
-
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Date;
-
-import org.jboss.shotoku.ContentManager;
-import org.jboss.shotoku.Directory;
-import org.jboss.shotoku.Node;
-import org.jboss.shotoku.exceptions.ResourceDoesNotExist;
-
-import hu.midori.kosmos.server.store.StaticContentStore;
-
-/**
- *
- * @author Adam Warski (adamw at aster.pl)
- * @author <a href="mailto:aron.gombas at midori.hu">Aron Gombas</a>
- */
-public class ShotokuCachedDataStore implements StaticContentStore {
- private String fileAccessUrl;
-
- private String prefix;
-
- private ContentManager cm;
-
- public String storeFile(String fileName, InputStream in) throws Exception {
- Node file;
- Directory cacheDir = cm.getRootDirectory();
-
- // Clearing old cache.
- String cachedWildcard = getCachedWildcard(fileName);
- for (Node cacheNode : cacheDir.getNodes()) {
- if (cacheNode.getName().endsWith(cachedWildcard)) {
- cacheNode.delete();
- }
- }
-
- // Saving the new file.
- String cachedFileName = getCachedFileName(fileName);
- try {
- file = cm.getNode(cachedFileName);
- } catch (ResourceDoesNotExist e) {
- file = cm.getRootDirectory().newNode(cachedFileName);
- }
-
- file.setContent(in);
- file.save("Kosmos");
-
- return fileAccessUrl + "/" + prefix + "/" + cachedFileName;
- }
-
- public void setFileAccessUrl(String fileAccessUrl) {
- this.fileAccessUrl = fileAccessUrl;
- }
-
- public void setPrefix(String prefix) {
- cm = ContentManager.getContentManager(prefix);
- this.prefix = prefix;
- }
-
- /**
- * Returns the part of the filename for a cached item without the timestamp
- * prefix. This is used to found the previous versions of the same cache item.
- * @throws UnsupportedEncodingException
- */
- private static String getCachedWildcard(String filename)
- throws UnsupportedEncodingException {
- return encodeFilename("", filename);
- }
-
- /**
- * Returns the local filename for a cached item, by adding a timestamp prefix
- * so that browsers will not cache the item if it actually changes.
- * @throws UnsupportedEncodingException
- */
- private static String getCachedFileName(String filename)
- throws UnsupportedEncodingException {
- return encodeFilename(Long.toString(new Date().getTime()), filename);
- }
-
- /**
- * Encodes the local filename for a cached item.
- * @param filename can contain any character.
- * @return the filename which contain only file-system-compatible characters.
- * @throws UnsupportedEncodingException
- */
- private static String encodeFilename(String prefix, String filename)
- throws UnsupportedEncodingException {
- return URLEncoder.encode(String.format("%s_%s", prefix, filename),
- "utf-8");
- }
-
- /** Unimplemented methods from kosmos 0.1.7 - Pawel Wrzeszcz */
-
- public void begin() {};
-
- public void end() {};
-}
Added: labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/colors.properties
===================================================================
--- labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/colors.properties (rev 0)
+++ labs/jbosslabs/trunk/stats-server/kosmos/src/java/org/jboss/kosmos/colors.properties 2007-07-07 15:39:26 UTC (rev 13213)
@@ -0,0 +1,24 @@
+# $Id$
+
+jiraproject.openIssues.color=0xFF0000
+jiraproject.codingInProgressIssues.color=0xFFFF00
+jiraproject.reopenedIssues.color=0xDD0000
+jiraproject.resolvedIssues.color=0x00FF00
+jiraproject.closedIssues.color=0xDDDDDD
+
+jiraproject.blockerOpenIssues.color=0xFF0000
+jiraproject.criticalOpenIssues.color=0xEE0000
+jiraproject.majorOpenIssues.color=0xDD0000
+jiraproject.minorOpenIssues.color=0xFFFF00
+jiraproject.optionalOpenIssues.color=0xEEEE00
+jiraproject.trivialOpenIssues.color=0xDDDDDD
+
+pie.chart.color.0=0xF0F0F0
+pie.chart.color.1=0xFFFF00
+pie.chart.color.2=0xFF0000
+pie.chart.color.3=0x00FF00
+pie.chart.color.4=0x0000FF
+pie.chart.color.5=0xFFFFFF
+pie.chart.color.6=0xFF0000
+pie.chart.color.7=0x00FF00
+pie.chart.color.8=0x0000FF
More information about the jboss-svn-commits
mailing list