You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by ol...@apache.org on 2014/08/06 14:22:18 UTC

svn commit: r1616187 - in /incubator/sirona/trunk/server/reporting: reporting-api/ reporting-api/src/ reporting-api/src/main/ reporting-api/src/main/java/ reporting-api/src/main/java/org/ reporting-api/src/main/java/org/apache/ reporting-api/src/main/j...

Author: olamy
Date: Wed Aug  6 12:22:18 2014
New Revision: 1616187

URL: http://svn.apache.org/r1616187
Log:
start implementing jaxrs

Added:
    incubator/sirona/trunk/server/reporting/reporting-api/src/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/Graph.java   (with props)
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/
    incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java   (with props)
Modified:
    incubator/sirona/trunk/server/reporting/reporting-api/pom.xml
    incubator/sirona/trunk/server/reporting/reporting-ui/pom.xml

Modified: incubator/sirona/trunk/server/reporting/reporting-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/pom.xml?rev=1616187&r1=1616186&r2=1616187&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/pom.xml (original)
+++ incubator/sirona/trunk/server/reporting/reporting-api/pom.xml Wed Aug  6 12:22:18 2014
@@ -30,6 +30,10 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.apache.sirona</groupId>
+      <artifactId>sirona-core</artifactId>
+    </dependency>
+    <dependency>
       <groupId>javax.ws.rs</groupId>
       <artifactId>jsr311-api</artifactId>
     </dependency>

Added: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/Graph.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/Graph.java?rev=1616187&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/Graph.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/Graph.java Wed Aug  6 12:22:18 2014
@@ -0,0 +1,61 @@
+package org.apache.sirona.reporting.web;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ */
+public class Graph
+    implements Serializable
+{
+
+    public static final String DEFAULT_COLOR = "#317eac";
+
+    private String label;
+
+    private String color;
+
+    private Map<Long, Double> data;
+
+    public Graph()
+    {
+    }
+
+    public Graph( String label, String color, Map<Long, Double> data )
+    {
+        this.label = label;
+        this.color = color;
+        this.data = data;
+    }
+
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public void setLabel( String label )
+    {
+        this.label = label;
+    }
+
+    public String getColor()
+    {
+        return color;
+    }
+
+    public void setColor( String color )
+    {
+        this.color = color;
+    }
+
+    public Map<Long, Double> getData()
+    {
+        return data;
+    }
+
+    public void setData( Map<Long, Double> data )
+    {
+        this.data = data;
+    }
+}

Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/Graph.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/Graph.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java?rev=1616187&view=auto
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java (added)
+++ incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java Wed Aug  6 12:22:18 2014
@@ -0,0 +1,31 @@
+package org.apache.sirona.reporting.web.jvm;
+
+import org.apache.sirona.gauges.jvm.CPUGauge;
+import org.apache.sirona.reporting.web.Graph;
+import org.apache.sirona.repositories.Repository;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.SortedMap;
+
+/**
+ * @author Olivier Lamy
+ */
+@Path( "/jvmreports" )
+public class JvmReports
+{
+
+    @GET
+    @Path( "/cpu/{start}/{end}" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    public Graph cpu( @PathParam( "start" ) final long start, @PathParam( "end" ) final long end )
+    {
+        final SortedMap<Long, Double> gaugeValues = Repository.INSTANCE.getGaugeValues( start, end, CPUGauge.CPU );
+        return new Graph( "CPU Usage", Graph.DEFAULT_COLOR, gaugeValues );
+
+    }
+
+}

Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sirona/trunk/server/reporting/reporting-api/src/main/java/org/apache/sirona/reporting/web/jvm/JvmReports.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: incubator/sirona/trunk/server/reporting/reporting-ui/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/server/reporting/reporting-ui/pom.xml?rev=1616187&r1=1616186&r2=1616187&view=diff
==============================================================================
--- incubator/sirona/trunk/server/reporting/reporting-ui/pom.xml (original)
+++ incubator/sirona/trunk/server/reporting/reporting-ui/pom.xml Wed Aug  6 12:22:18 2014
@@ -26,7 +26,7 @@
 
   <artifactId>sirona-reporting-ui</artifactId>
   <name>Apache Sirona Incubator :: Server :: Reporting :: Ui</name>
-  <packaging>war</packaging>
+  <packaging>jar</packaging>
 
   <build>
     <pluginManagement>