[jbpm-commits] JBoss JBPM SVN: r5371 - in projects/gwt-console/branches/sam: common and 16 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 29 08:42:17 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-07-29 08:42:15 -0400 (Wed, 29 Jul 2009)
New Revision: 5371

Added:
   projects/gwt-console/branches/sam/common/
   projects/gwt-console/branches/sam/common/common.iml
   projects/gwt-console/branches/sam/common/pom.xml
   projects/gwt-console/branches/sam/common/src/
   projects/gwt-console/branches/sam/common/src/main/
   projects/gwt-console/branches/sam/common/src/main/java/
   projects/gwt-console/branches/sam/common/src/main/java/org/
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsComment.java
   projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java
   projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/InfoFacade.java
   projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/UserMgmtFacade.java
Removed:
   projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java
   projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java
   projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsComment.java
   projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java
Modified:
   projects/gwt-console/branches/sam/gwt-parent.iml
   projects/gwt-console/branches/sam/pom.xml
   projects/gwt-console/branches/sam/sam/sam-toplevel.iml
   projects/gwt-console/branches/sam/sam/server/pom.xml
   projects/gwt-console/branches/sam/sam/server/sam-server.iml
   projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/ConsoleServerApplication.java
   projects/gwt-console/branches/sam/server/server-core/pom.xml
Log:
Create common module

Added: projects/gwt-console/branches/sam/common/common.iml
===================================================================
--- projects/gwt-console/branches/sam/common/common.iml	                        (rev 0)
+++ projects/gwt-console/branches/sam/common/common.iml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+  <component name="ModuleRootManager" />
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library name="M2 Dep: org.slf4j:slf4j-simple:jar:1.5.2:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/slf4j/slf4j-simple/1.5.2/slf4j-simple-1.5.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: org.jboss.resteasy:resteasy-jaxrs:jar:1.0.2.GA:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/jboss/resteasy/resteasy-jaxrs/1.0.2.GA/resteasy-jaxrs-1.0.2.GA.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: javax.annotation:jsr250-api:jar:1.0:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: org.slf4j:slf4j-api:jar:1.5.2:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/slf4j/slf4j-api/1.5.2/slf4j-api-1.5.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: org.jboss.resteasy:jaxrs-api:jar:1.0.2.GA:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/jboss/resteasy/jaxrs-api/1.0.2.GA/jaxrs-api-1.0.2.GA.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: org.scannotation:scannotation:jar:1.0.2:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/scannotation/scannotation/1.0.2/scannotation-1.0.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: javassist:javassist:jar:3.6.0.GA:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/javassist/javassist/3.6.0.GA/javassist-3.6.0.GA.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="M2 Dep: com.google.code.gson:gson:jar:1.2.2:compile">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/com/google/code/gson/gson/1.2.2/gson-1.2.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntryProperties />
+  </component>
+</module>
+

Added: projects/gwt-console/branches/sam/common/pom.xml
===================================================================
--- projects/gwt-console/branches/sam/common/pom.xml	                        (rev 0)
+++ projects/gwt-console/branches/sam/common/pom.xml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,63 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  <name>JBoss BPM - GWT Console (Common)</name>
+  <groupId>org.jboss.bpm</groupId>
+  <artifactId>gwt-console-common</artifactId>
+  <packaging>jar</packaging>
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jboss.bpm</groupId>
+    <artifactId>gwt-console-parent</artifactId>
+    <version>1.0.1-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss.resteasy</groupId>
+      <artifactId>resteasy-jaxrs</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>servlet-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.activation</groupId>
+          <artifactId>activation</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-httpclient</groupId>
+          <artifactId>commons-httpclient</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.mail</groupId>
+          <artifactId>mail</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tjws</groupId>
+          <artifactId>webserver</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.xml.bind</groupId>
+          <artifactId>jaxb-impl</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.xml.bind</groupId>
+          <artifactId>jaxb-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.xml.stream</groupId>
+          <artifactId>stax-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+    </dependency>
+  </dependencies>
+</project>

Copied: projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java (from rev 5368, projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java)
===================================================================
--- projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java	                        (rev 0)
+++ projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.gson;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class GsonFactory
+{
+   public static Gson createInstance()
+   {
+      Gson gson = new GsonBuilder()
+        .setDateFormat("yyyy-MM-dd HH:mm:ss")
+        .registerTypeAdapter(java.sql.Timestamp.class, new SQLDateTypeAdapter()) 
+        .create();
+      return gson;
+   }
+}

Copied: projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java (from rev 5368, projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java)
===================================================================
--- projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java	                        (rev 0)
+++ projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.gson;
+
+import com.google.gson.*;
+
+import java.util.Date;
+import java.text.*;
+import java.lang.reflect.Type;
+
+
+/**
+ * A default type adapter for a {@link java.util.Date} object.<br>
+ * Create a GSON instance that can serialize/deserialize "java.util.Date" objects:
+ * <pre>
+ * Gson gson = new GsonBuilder()
+ * .registerTypeAdapter(new DateTypeAdapter())
+ * .create();
+ * </pre>
+ *
+ * @author Joel Leitch
+ */
+public class SQLDateTypeAdapter implements JsonSerializer<java.sql.Timestamp>, JsonDeserializer<Date>
+{
+   private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+   public JsonElement serialize(java.sql.Timestamp src, Type typeOfSrc, JsonSerializationContext context)
+   {
+      String dateFormatAsString = format.format(src);
+      return new JsonPrimitive(dateFormatAsString);
+   }
+
+   public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
+     throws JsonParseException
+   {
+      if (!(json instanceof JsonPrimitive)) {
+         throw new JsonParseException("The date should be a string value");
+      }
+
+      try
+      {
+         return format.parse(json.getAsString());
+      }
+      catch (ParseException e)
+      {
+         throw new JsonParseException(e);
+      }
+
+   }
+}

Added: projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsComment.java
===================================================================
--- projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsComment.java	                        (rev 0)
+++ projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsComment.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.util;
+
+ at java.lang.annotation.Target(value = {java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD}) @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
+public @interface RsComment {
+
+  java.lang.String title();
+  java.lang.String description();
+}
\ No newline at end of file

Added: projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java
===================================================================
--- projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java	                        (rev 0)
+++ projects/gwt-console/branches/sam/common/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.util;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Date;
+
+/**
+ * Creates HTML documention for JAX-RS resource classes.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class RsDocBuilder
+{
+  private String webContext;
+  private Class[] rootResources;
+
+  public RsDocBuilder(String webContext, Class[] rootResources)
+  {
+    this.rootResources = rootResources;
+    this.webContext = webContext.startsWith("/") ? webContext : "/"+webContext;
+  }
+
+  public String getWebContext()
+  {
+    return webContext;
+  }
+
+  public Class[] getRootResources()
+  {
+    return rootResources;
+  }
+
+  private StringBuffer build(Class root)
+  {
+    Path rootPath = (Path)root.getAnnotation(Path.class);
+    RsComment rootComment = (RsComment)root.getAnnotation(RsComment.class);
+
+    List<Representation> representations = new ArrayList<Representation>();
+
+    for(Method m : root.getDeclaredMethods())
+    {
+      Path resPath = m.getAnnotation(Path.class);
+      if(resPath!=null)
+      {
+        Representation r = new Representation();
+
+        r.path = resPath.value();
+        r.httpMethod = m.getAnnotation(GET.class)!=null ? "GET" : "POST"; // currently limited to those
+        r.consume = (m.getAnnotation(Consumes.class)!=null) ?
+            arrayToString(m.getAnnotation(Consumes.class).value()) : "*/*";
+        r.produce = (m.getAnnotation(Produces.class)!=null) ?
+            arrayToString(m.getAnnotation(Produces.class).value()) : "*/*";
+        representations.add(r);
+      }
+    }
+
+    StringBuffer sb = new StringBuffer();
+
+    if(rootComment!=null)
+    {
+      sb.append("<tr>");
+      sb.append("<td colspan=5 style='border-bottom:1px solid black;'>");
+      sb.append("<b>").append(rootComment.title()).append("</b>").append("<br>");
+      sb.append("<i>").append(rootComment.description()).append("</i>");
+      sb.append("</td>");
+      sb.append("</tr>");
+    }
+
+    for(Representation r : representations)
+    {
+      sb.append("<tr>");
+      sb.append("<td>").append(r.httpMethod.toUpperCase()).append("</td>");
+      sb.append("<td>").append(buildPath(rootPath.value(),r.path)).append("</td>");
+      sb.append("<td>").append("").append("</td>"); // description
+      sb.append("<td>").append(r.consume).append("</td>");
+      sb.append("<td>").append(r.produce).append("</td>");
+      sb.append("</tr>");      
+    }
+
+    sb.append("<tr><td colspan=5>&nbsp;</td></tr>");
+    
+    return sb;
+  }
+
+  private String arrayToString(String[] arr)
+  {
+    StringBuffer sb = new StringBuffer();
+    for(int i=0; i<arr.length; i++)
+    {
+      sb.append(arr[i]);
+      if(i<arr.length-1)
+        sb.append(",");
+    }
+    return sb.toString();
+  }
+
+  private String buildPath(String root, String resourcePath)
+  {
+    StringBuffer sb = new StringBuffer();
+    sb.append(webContext);
+    sb.append("/").append(root).append("/");
+    sb.append(resourcePath);
+    return sb.toString();
+  }
+
+  public StringBuffer build()
+  {
+    StringBuffer sb = new StringBuffer();
+    sb.append("<html>").append("<body style='font-family: sans-serif; font-size:10pt;'>");
+    sb.append("<!--").append(" generated by RsDoc at ").append( new Date() ).append(" -->");
+    sb.append("<table style='margin-top:10px;' width='100%'>");
+
+    sb.append("<tr>");
+    sb.append("<th>").append("Method").append("</th>");
+    sb.append("<th>").append("Path").append("</th>");
+    sb.append("<th>").append("Description").append("</th>"); // description
+    sb.append("<th>").append("Consumes").append("</th>");
+    sb.append("<th>").append("Produces").append("</th>");
+    sb.append("</tr>");
+    
+    for(Class c : rootResources)
+    {
+      sb.append(
+          build(c).toString()
+      );
+    }
+    sb.append("</table>");
+    sb.append("</body>").append("<html>");
+    return sb;
+
+  }
+
+  private class Representation
+  {
+    String description,title = "";
+    String consume,produce = "";
+    String path;
+    String httpMethod;
+  }
+}

Modified: projects/gwt-console/branches/sam/gwt-parent.iml
===================================================================
--- projects/gwt-console/branches/sam/gwt-parent.iml	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/gwt-parent.iml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -4,6 +4,7 @@
   <component name="NewModuleRootManager" inherit-compiler-output="true">
     <exclude-output />
     <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/common/src/main/java" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/gui/profiles/drools/src/main/java" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/gui/profiles/drools/src/main/resources" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/gui/profiles/jbpm/src/main/java" isTestSource="false" />

Modified: projects/gwt-console/branches/sam/pom.xml
===================================================================
--- projects/gwt-console/branches/sam/pom.xml	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/pom.xml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -42,6 +42,7 @@
     <module>server</module>
     <module>gui</module>
     <module>sam</module>
+    <module>common</module>
   </modules>
 
   <dependencyManagement>

Modified: projects/gwt-console/branches/sam/sam/sam-toplevel.iml
===================================================================
--- projects/gwt-console/branches/sam/sam/sam-toplevel.iml	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/sam/sam-toplevel.iml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -208,15 +208,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="M2 Dep: net.sf.ezmorph:ezmorph:jar:1.0.6:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="M2 Dep: org.slf4j:slf4j-api:jar:1.5.2:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/slf4j/slf4j-api/1.5.2/slf4j-api-1.5.2.jar!/" />
@@ -273,15 +264,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="M2 Dep: net.sf.json-lib:json-lib:jar:2.2.3:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/net/sf/json-lib/json-lib/2.2.3/json-lib-2.2.3.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="M2 Dep: javax.xml:jaxb-impl:jar:2.1:provided">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/javax/xml/jaxb-impl/2.1/jaxb-impl-2.1.jar!/" />
@@ -327,15 +309,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="M2 Dep: commons-collections:commons-collections:jar:3.2:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="M2 Dep: org.scannotation:scannotation:jar:1.0.2:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../.m2/repository/org/scannotation/scannotation/1.0.2/scannotation-1.0.2.jar!/" />

Modified: projects/gwt-console/branches/sam/sam/server/pom.xml
===================================================================
--- projects/gwt-console/branches/sam/sam/server/pom.xml	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/sam/server/pom.xml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -16,13 +16,25 @@
 
   <!-- Properties -->
   <properties>
-    <report.server.version>1.0.0-SNAPSHOT</report.server.version>
-    <json-lib.version>2.2.3</json-lib.version>
+    <report.server.version>1.0.0-SNAPSHOT</report.server.version>   
   </properties>
 
   <dependencies>
     <!-- Module -->
+    <dependency>
+      <groupId>org.jboss.bpm</groupId>
+      <artifactId>gwt-console-common</artifactId>
+      <version>${version}</version>
+      <scope>provided</scope>
+    </dependency>
 
+    <dependency>
+      <groupId>org.jboss.bpm</groupId>
+      <artifactId>gwt-console-rpc</artifactId>
+      <version>${version}</version>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- GWT related -->
     <dependency>
       <groupId>com.google.gwt</groupId>
@@ -131,13 +143,8 @@
       <groupId>com.google.code.gson</groupId>
       <artifactId>gson</artifactId>
     </dependency>
+    
     <dependency>
-      <groupId>net.sf.json-lib</groupId>
-      <artifactId>json-lib</artifactId>
-      <version>${json-lib.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>${junit.version}</version>
@@ -157,10 +164,10 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-        <groupId>javax.xml</groupId>
-        <artifactId>jaxb-impl</artifactId>
-        <scope>provided</scope>
-      </dependency>  
+      <groupId>javax.xml</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <scope>provided</scope>
+    </dependency>     
   </dependencies>
 
   <build>

Modified: projects/gwt-console/branches/sam/sam/server/sam-server.iml
===================================================================
--- projects/gwt-console/branches/sam/sam/server/sam-server.iml	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/sam/server/sam-server.iml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -9,6 +9,7 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="gwt-parent" />
     <orderEntry type="module-library">
       <library name="M2 Dep: commons-logging:commons-logging:jar:1.1.1:compile">
         <CLASSES>
@@ -55,15 +56,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="M2 Dep: net.sf.json-lib:json-lib:jar:2.2.3:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/net/sf/json-lib/json-lib/2.2.3/json-lib-2.2.3.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="M2 Dep: javax.xml.stream:stax-api:jar:1.0-2:provided">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar!/" />
@@ -91,17 +83,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="M2 Dep: commons-beanutils:commons-beanutils:jar:1.7.0:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0-sources.jar!/" />
-        </SOURCES>
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="M2 Dep: commons-fileupload:commons-fileupload:jar:1.2.1:compile">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/commons-fileupload/commons-fileupload/1.2.1/commons-fileupload-1.2.1.jar!/" />
@@ -167,24 +148,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="M2 Dep: net.sf.ezmorph:ezmorph:jar:1.0.6:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library name="M2 Dep: commons-lang:commons-lang:jar:2.4:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="M2 Dep: javax.ejb:ejb-api:jar:3.0:provided">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar!/" />
@@ -221,15 +184,6 @@
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="M2 Dep: commons-collections:commons-collections:jar:3.2:test">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
       <library name="M2 Dep: org.jboss.logging:jboss-logging-spi:jar:2.0.5.GA:provided">
         <CLASSES>
           <root url="jar://$MODULE_DIR$/../../../../../../../../.m2/repository/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar!/" />

Modified: projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/ConsoleServerApplication.java
===================================================================
--- projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/ConsoleServerApplication.java	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/ConsoleServerApplication.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -36,7 +36,9 @@
 
   public ConsoleServerApplication()
   {
-    
+    singletons.add(new InfoFacade());
+    singletons.add(new UserMgmtFacade());
+
   }
 
   @Override

Added: projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/InfoFacade.java
===================================================================
--- projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/InfoFacade.java	                        (rev 0)
+++ projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/InfoFacade.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.sam.console.server;
+
+import com.google.gson.Gson;
+
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.Path;
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.servlet.http.HttpServletRequest;
+import org.jboss.bpm.console.server.util.*;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+ at Path("server")
+ at RsComment(
+    title = "Server Info",
+    description = "General REST server information"
+)
+public class InfoFacade
+{
+  
+  @GET
+  @Path("resources")
+  @Produces("text/html")
+  public Response getPublishedUrls(
+      @Context
+      HttpServletRequest request
+  )
+  {
+    final Class[] rootResources = new Class[]
+        {
+            InfoFacade.class,
+            UserMgmtFacade.class            
+        };
+
+    RsDocBuilder rsDocBuilder = new RsDocBuilder(request.getContextPath(),rootResources);
+    StringBuffer sb = rsDocBuilder.build();
+    return Response.ok(sb.toString()).build();
+  }
+
+  private Response createJsonResponse(Object wrapper)
+  {
+    Gson gson = GsonFactory.createInstance();
+    String json = gson.toJson(wrapper);
+    return Response.ok(json).type("application/json").build();
+  }
+}
+

Added: projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/UserMgmtFacade.java
===================================================================
--- projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/UserMgmtFacade.java	                        (rev 0)
+++ projects/gwt-console/branches/sam/sam/server/src/main/java/org/jboss/sam/console/server/UserMgmtFacade.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.sam.console.server;
+
+import com.google.gson.Gson;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.client.model.RoleAssignmentRef;
+import org.jboss.bpm.console.client.model.RoleAssignmentRefWrapper;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.jboss.bpm.console.server.util.RsComment;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * REST server module for accessing user related data.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+ at Path("identity")
+ at RsComment(
+    title = "User management",
+    description = "Manage user and groups"
+)
+public class UserMgmtFacade
+{
+  private static final Log log = LogFactory.getLog(UserMgmtFacade.class);
+
+  @GET
+  @Path("user/roles")
+  @Produces("application/json")
+  public Response getRolesForJAASPrincipal(
+      @Context
+      HttpServletRequest request,
+      @QueryParam("roleCheck")
+      String roleCheck
+  )
+  {
+    List<RoleAssignmentRef> actualRoles = new ArrayList<RoleAssignmentRef>();
+
+    StringTokenizer tok = new StringTokenizer(roleCheck, ",");
+    while(tok.hasMoreTokens())
+    {
+      String possibleRole = tok.nextToken();
+      actualRoles.add( new RoleAssignmentRef(possibleRole, true));
+    }
+    return createJsonResponse( new RoleAssignmentRefWrapper(actualRoles));
+  }
+
+  private Response createJsonResponse(Object wrapper)
+  {
+    Gson gson = GsonFactory.createInstance();
+    String json = gson.toJson(wrapper);
+    return Response.ok(json).type("application/json").build();
+  }
+}

Modified: projects/gwt-console/branches/sam/server/server-core/pom.xml
===================================================================
--- projects/gwt-console/branches/sam/server/server-core/pom.xml	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/server/server-core/pom.xml	2009-07-29 12:42:15 UTC (rev 5371)
@@ -29,6 +29,13 @@
       <scope>provided</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.jboss.bpm</groupId>
+      <artifactId>gwt-console-common</artifactId>
+      <version>${version}</version>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- GWT related -->
     <dependency>
       <groupId>com.google.gwt</groupId>

Deleted: projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java
===================================================================
--- projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.gson;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class GsonFactory
-{
-   public static Gson createInstance()
-   {
-      Gson gson = new GsonBuilder()
-        .setDateFormat("yyyy-MM-dd HH:mm:ss")
-        .registerTypeAdapter(java.sql.Timestamp.class, new SQLDateTypeAdapter()) 
-        .create();
-      return gson;
-   }
-}

Deleted: projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java
===================================================================
--- projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.gson;
-
-import com.google.gson.*;
-
-import java.util.Date;
-import java.text.*;
-import java.lang.reflect.Type;
-
-
-/**
- * A default type adapter for a {@link java.util.Date} object.<br>
- * Create a GSON instance that can serialize/deserialize "java.util.Date" objects:
- * <pre>
- * Gson gson = new GsonBuilder()
- * .registerTypeAdapter(new DateTypeAdapter())
- * .create();
- * </pre>
- *
- * @author Joel Leitch
- */
-public class SQLDateTypeAdapter implements JsonSerializer<java.sql.Timestamp>, JsonDeserializer<Date>
-{
-   private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
-   public JsonElement serialize(java.sql.Timestamp src, Type typeOfSrc, JsonSerializationContext context)
-   {
-      String dateFormatAsString = format.format(src);
-      return new JsonPrimitive(dateFormatAsString);
-   }
-
-   public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
-     throws JsonParseException
-   {
-      if (!(json instanceof JsonPrimitive)) {
-         throw new JsonParseException("The date should be a string value");
-      }
-
-      try
-      {
-         return format.parse(json.getAsString());
-      }
-      catch (ParseException e)
-      {
-         throw new JsonParseException(e);
-      }
-
-   }
-}

Deleted: projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsComment.java
===================================================================
--- projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsComment.java	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsComment.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.util;
-
- at java.lang.annotation.Target(value = {java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD}) @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
-public @interface RsComment {
-
-  java.lang.String title();
-  java.lang.String description();
-}
\ No newline at end of file

Deleted: projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java
===================================================================
--- projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java	2009-07-29 12:08:11 UTC (rev 5370)
+++ projects/gwt-console/branches/sam/server/server-core/src/main/java/org/jboss/bpm/console/server/util/RsDocBuilder.java	2009-07-29 12:42:15 UTC (rev 5371)
@@ -1,180 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server.util;
-
-import org.jboss.bpm.console.server.ProcessMgmtFacade;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Date;
-
-/**
- * Creates HTML documention for JAX-RS resource classes.
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class RsDocBuilder
-{
-  private String webContext;
-  private Class[] rootResources;
-
-  public RsDocBuilder(String webContext, Class[] rootResources)
-  {
-    this.rootResources = rootResources;
-    this.webContext = webContext.startsWith("/") ? webContext : "/"+webContext;
-  }
-
-  public static void main(String[] args)
-  {
-    RsDocBuilder rsDocBuilder = new RsDocBuilder(
-        "gwt-console-server",
-        new Class[] {ProcessMgmtFacade.class}
-    );
-
-    StringBuffer sb = rsDocBuilder.build(rsDocBuilder.getRootResources()[0]);
-    System.out.println(sb.toString());
-  }
-
-
-  public String getWebContext()
-  {
-    return webContext;
-  }
-
-  public Class[] getRootResources()
-  {
-    return rootResources;
-  }
-
-  private StringBuffer build(Class root)
-  {
-    Path rootPath = (Path)root.getAnnotation(Path.class);
-    RsComment rootComment = (RsComment)root.getAnnotation(RsComment.class);
-
-    List<Representation> representations = new ArrayList<Representation>();
-
-    for(Method m : root.getDeclaredMethods())
-    {
-      Path resPath = m.getAnnotation(Path.class);
-      if(resPath!=null)
-      {
-        Representation r = new Representation();
-
-        r.path = resPath.value();
-        r.httpMethod = m.getAnnotation(GET.class)!=null ? "GET" : "POST"; // currently limited to those
-        r.consume = (m.getAnnotation(Consumes.class)!=null) ?
-            arrayToString(m.getAnnotation(Consumes.class).value()) : "*/*";
-        r.produce = (m.getAnnotation(Produces.class)!=null) ?
-            arrayToString(m.getAnnotation(Produces.class).value()) : "*/*";
-        representations.add(r);
-      }
-    }
-
-    StringBuffer sb = new StringBuffer();
-
-    if(rootComment!=null)
-    {
-      sb.append("<tr>");
-      sb.append("<td colspan=5 style='border-bottom:1px solid black;'>");
-      sb.append("<b>").append(rootComment.title()).append("</b>").append("<br>");
-      sb.append("<i>").append(rootComment.description()).append("</i>");
-      sb.append("</td>");
-      sb.append("</tr>");
-    }
-
-    for(Representation r : representations)
-    {
-      sb.append("<tr>");
-      sb.append("<td>").append(r.httpMethod.toUpperCase()).append("</td>");
-      sb.append("<td>").append(buildPath(rootPath.value(),r.path)).append("</td>");
-      sb.append("<td>").append("").append("</td>"); // description
-      sb.append("<td>").append(r.consume).append("</td>");
-      sb.append("<td>").append(r.produce).append("</td>");
-      sb.append("</tr>");      
-    }
-
-    sb.append("<tr><td colspan=5>&nbsp;</td></tr>");
-    
-    return sb;
-  }
-
-  private String arrayToString(String[] arr)
-  {
-    StringBuffer sb = new StringBuffer();
-    for(int i=0; i<arr.length; i++)
-    {
-      sb.append(arr[i]);
-      if(i<arr.length-1)
-        sb.append(",");
-    }
-    return sb.toString();
-  }
-
-  private String buildPath(String root, String resourcePath)
-  {
-    StringBuffer sb = new StringBuffer();
-    sb.append(webContext);
-    sb.append("/").append(root).append("/");
-    sb.append(resourcePath);
-    return sb.toString();
-  }
-
-  public StringBuffer build()
-  {
-    StringBuffer sb = new StringBuffer();
-    sb.append("<html>").append("<body style='font-family: sans-serif; font-size:10pt;'>");
-    sb.append("<!--").append(" generated by RsDoc at ").append( new Date() ).append(" -->");
-    sb.append("<table style='margin-top:10px;' width='100%'>");
-
-    sb.append("<tr>");
-    sb.append("<th>").append("Method").append("</th>");
-    sb.append("<th>").append("Path").append("</th>");
-    sb.append("<th>").append("Description").append("</th>"); // description
-    sb.append("<th>").append("Consumes").append("</th>");
-    sb.append("<th>").append("Produces").append("</th>");
-    sb.append("</tr>");
-    
-    for(Class c : rootResources)
-    {
-      sb.append(
-          build(c).toString()
-      );
-    }
-    sb.append("</table>");
-    sb.append("</body>").append("<html>");
-    return sb;
-
-  }
-
-  private class Representation
-  {
-    String description,title = "";
-    String consume,produce = "";
-    String path;
-    String httpMethod;
-  }
-}



More information about the jbpm-commits mailing list