Get rid of the jars in bikeshed/war/WEB_INF/lib, and fix style of Storage
Desk review by amitmanjhi
No rietvled review due to upload script problemsb

Review by: amitmanjhi@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7689 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/bikeshed/.classpath b/bikeshed/.classpath
index c112364..3ea5207 100644
--- a/bikeshed/.classpath
+++ b/bikeshed/.classpath
@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="lib" path="war/WEB-INF/lib/com.springsource.javax.validation-1.0.0.GA.jar"/>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="test"/>
-	<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-servlet.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
-	<classpathentry kind="lib" path="war/WEB-INF/lib/json.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/redist/json/r2_20080312/json.jar"/>
+	<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
 	<classpathentry kind="output" path="war/WEB-INF/classes"/>
 </classpath>
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/domain/Currency.java b/bikeshed/src/com/google/gwt/sample/expenses/domain/Currency.java
index d6a4e38..06fc66c 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/domain/Currency.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/domain/Currency.java
@@ -20,10 +20,10 @@
  */
 // @javax.persistence.Entity
 public class Currency implements Entity {
-  @javax.validation.constraints.Size(min = 3, max = 3)
+//  @javax.validation.constraints.Size(min = 3, max = 3)
   private String code;
 
-  @javax.validation.constraints.Size(min = 2, max = 30)
+//  @javax.validation.constraints.Size(min = 2, max = 30)
   private String name;
 
   private final Long id;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/domain/Employee.java b/bikeshed/src/com/google/gwt/sample/expenses/domain/Employee.java
index e223ebf..8c211f7 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/domain/Employee.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/domain/Employee.java
@@ -34,10 +34,10 @@
 
   private final Integer version;
 
-  @javax.validation.constraints.Size(min = 2, max = 30)
+//  @javax.validation.constraints.Size(min = 2, max = 30)
   private String userName;
 
-  @javax.validation.constraints.Size(min = 2, max = 30)
+//  @javax.validation.constraints.Size(min = 2, max = 30)
   private String displayName;
   
   // @javax.persistence.ManyToOne(targetEntity =
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/domain/Report.java b/bikeshed/src/com/google/gwt/sample/expenses/domain/Report.java
index bf29abb..7bc96af 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/domain/Report.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/domain/Report.java
@@ -25,22 +25,22 @@
   private final Long id;
 
   private final Integer version;
-  @javax.validation.constraints.NotNull
-  @javax.validation.constraints.Past
+//  @javax.validation.constraints.NotNull
+//  @javax.validation.constraints.Past
   // @javax.persistence.Temporal(javax.persistence.TemporalType.TIMESTAMP)
   private java.util.Date created = new Date();
 
-  @javax.validation.constraints.NotNull
+//  @javax.validation.constraints.NotNull
   // @javax.persistence.Enumerated
   private Status status;
 
-  @javax.validation.constraints.NotNull
+//  @javax.validation.constraints.NotNull
   // @javax.persistence.ManyToOne(targetEntity =
   // com.google.io.expenses.server.domain.Employee.class)
   // @javax.persistence.JoinColumn
   private Employee reporter;
 
-  @javax.validation.constraints.Size(min = 3, max = 100)
+//  @javax.validation.constraints.Size(min = 3, max = 100)
   private String purpose;
 
   // @javax.persistence.ManyToOne(targetEntity =
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/domain/ReportItem.java b/bikeshed/src/com/google/gwt/sample/expenses/domain/ReportItem.java
index f75fe0f..313faa2 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/domain/ReportItem.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/domain/ReportItem.java
@@ -24,26 +24,26 @@
 
   private Integer version;
 
-  @javax.validation.constraints.NotNull
+//  @javax.validation.constraints.NotNull
   // @javax.persistence.ManyToOne(targetEntity = Report.class)
   // @javax.persistence.JoinColumn
   private Report report;
 
-  @javax.validation.constraints.NotNull
-  @javax.validation.constraints.Past
+//  @javax.validation.constraints.NotNull
+//  @javax.validation.constraints.Past
   // @javax.persistence.Temporal(javax.persistence.TemporalType.TIMESTAMP)
   private java.util.Date incurred;
 
-  @javax.validation.constraints.Size(min = 3, max = 100)
+//  @javax.validation.constraints.Size(min = 3, max = 100)
   private String purpose;
 
-  @javax.validation.constraints.NotNull
+//  @javax.validation.constraints.NotNull
   // @javax.persistence.ManyToOne(targetEntity = Currency.class)
   // @javax.persistence.JoinColumn
   private Currency currency;
 
-  @javax.validation.constraints.NotNull
-  @javax.validation.constraints.Min(0L)
+//  @javax.validation.constraints.NotNull
+//  @javax.validation.constraints.Min(0L)
   private Float amount;
 
   public ReportItem() {
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/domain/Storage.java b/bikeshed/src/com/google/gwt/sample/expenses/domain/Storage.java
index 11ef96b..8aa5a9c 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/domain/Storage.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/domain/Storage.java
@@ -25,6 +25,16 @@
  * frameworks do. For goodness sake don't imitate this for production code.
  */
 class Storage {
+  static final Storage INSTANCE;
+  static {
+    INSTANCE = new Storage();
+    fill(INSTANCE);
+  }
+
+  public static <E extends Entity> E edit(E v1) {
+    return v1.accept(new CreationVisitor<E>(v1));
+  }
+
   /**
    * @param storage to fill with demo entities
    */
@@ -46,29 +56,33 @@
     e2.setDisplayName("George H. Indigo");
     e2.setSupervisor(e);
     storage.persist(e2);
-}
+  }
 
   private final Map<Long, Entity> soup = new HashMap<Long, Entity>();
   private final Map<String, Long> employeeUserNameIndex = new HashMap<String, Long>();
+
   private long serial = 0;
 
-  static final Storage INSTANCE;
-  static {
-    INSTANCE = new Storage();
-    fill(INSTANCE);
+  synchronized List<Employee> findAllEmployees() {
+    List<Employee> rtn = new ArrayList<Employee>();
+    for (Map.Entry<String, Long> entry : employeeUserNameIndex.entrySet()) {
+      rtn.add((Employee) get(entry.getValue()));
+    }
+    return rtn;
   }
 
-  public static <E extends Entity> E edit(E v1) {
-    return v1.accept(new CreationVisitor<E>(v1));
+  synchronized Employee findEmployeeByUserName(String userName) {
+    Long id = employeeUserNameIndex.get(userName);
+    return (Employee) get(id);
   }
-  
-  @SuppressWarnings("unchecked") 
+
+  @SuppressWarnings("unchecked")
   // We make runtime checks that return type matches in type
   synchronized <E extends Entity> E get(final E entity) {
     Entity previous = soup.get(entity.getId());
     if (null == previous) {
-      throw new IllegalArgumentException(String.format(
-          "In %s, unknown id %d", entity, entity.getId()));
+      throw new IllegalArgumentException(String.format("In %s, unknown id %d",
+          entity, entity.getId()));
     }
     if (!previous.getClass().equals(entity.getClass())) {
       throw new IllegalArgumentException(String.format(
@@ -77,7 +91,7 @@
     return (E) previous;
   }
 
-  synchronized public <E extends Entity> E persist(final E delta) {
+  synchronized <E extends Entity> E persist(final E delta) {
     E next = null;
     E previous = null;
 
@@ -108,20 +122,7 @@
     return next;
   }
 
-  synchronized List<Employee> findAllEmployees() {
-    List<Employee> rtn = new ArrayList<Employee>();
-    for (Map.Entry<String, Long> entry : employeeUserNameIndex.entrySet()) {
-      rtn.add((Employee)get(entry.getValue()));
-    }
-    return rtn;
-  }
-
-  synchronized Employee findEmployeeByUserName(String userName) {
-    Long id = employeeUserNameIndex.get(userName);
-    return (Employee) get(id);
-  }
-
-  synchronized private Entity get(Long id) {
+  private synchronized Entity get(Long id) {
     return soup.get(id);
   }
 
@@ -132,7 +133,8 @@
       }
 
       public Void visit(Employee employee) {
-        if (null == employee.getUserName()) return null;
+        if (null == employee.getUserName())
+          return null;
         if (previous != null) {
           Employee prevEmployee = (Employee) previous;
           if (!prevEmployee.getUserName().equals(next)) {
diff --git a/bikeshed/war/WEB-INF/lib/com.springsource.javax.validation-1.0.0.GA.jar b/bikeshed/war/WEB-INF/lib/com.springsource.javax.validation-1.0.0.GA.jar
deleted file mode 100644
index 21c03d6..0000000
--- a/bikeshed/war/WEB-INF/lib/com.springsource.javax.validation-1.0.0.GA.jar
+++ /dev/null
Binary files differ
diff --git a/bikeshed/war/WEB-INF/lib/gwt-servlet.jar b/bikeshed/war/WEB-INF/lib/gwt-servlet.jar
deleted file mode 100644
index e457d03..0000000
--- a/bikeshed/war/WEB-INF/lib/gwt-servlet.jar
+++ /dev/null
Binary files differ
diff --git a/bikeshed/war/WEB-INF/lib/json.jar b/bikeshed/war/WEB-INF/lib/json.jar
deleted file mode 100644
index 82ad5fb..0000000
--- a/bikeshed/war/WEB-INF/lib/json.jar
+++ /dev/null
Binary files differ