You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/06/23 08:23:59 UTC

svn commit: r957119 [2/6] - in /shindig/branches/2.0.x: ./ assembly/src/main/assembly/ config/ extras/src/main/java/org/apache/shindig/extras/as/sample/ extras/src/main/javascript/features-extras/ features/ features/src/main/javascript/features/ featur...

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/config/DynamicConfigProperty.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/config/DynamicConfigProperty.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/config/DynamicConfigProperty.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/config/DynamicConfigProperty.java Wed Jun 23 06:23:54 2010
@@ -34,7 +34,7 @@ import javax.el.ValueExpression;
  * Implements CharSequence strictly as a marker. Only toString is supported.
  */
 public class DynamicConfigProperty implements CharSequence {
-  private static final Logger logger = Logger.getLogger(DynamicConfigProperty.class.getName()); 
+  private static final Logger LOG = Logger.getLogger(DynamicConfigProperty.class.getName()); 
   private final ELContext context;
   private final ValueExpression expression;
 
@@ -48,7 +48,7 @@ public class DynamicConfigProperty imple
     try {
       return (String) expression.getValue(context);
     } catch (ELException e) {
-      logger.log(Level.WARNING, "Evaluation of " + expression.getExpressionString() + " failed", e);
+      LOG.log(Level.WARNING, "Evaluation of " + expression.getExpressionString() + " failed", e);
       return "";
     }
   }

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java Wed Jun 23 06:23:54 2010
@@ -48,7 +48,7 @@ import com.google.inject.name.Names;
  */
 public abstract class ApiServlet extends InjectedServlet {
 
-  private static final Logger logger = Logger.getLogger(ApiServlet.class.getName());
+  private static final Logger LOG = Logger.getLogger(ApiServlet.class.getName());
 
   protected static final String FORMAT_PARAM = "format";
   protected static final String JSON_FORMAT = "json";
@@ -140,10 +140,10 @@ public abstract class ApiServlet extends
   protected ResponseItem responseItemFromException(Throwable t) {
     if (t instanceof ProtocolException) {
       ProtocolException pe = (ProtocolException) t;
-      logger.log(Level.INFO, "Returning a response error as result of a protocol exception", pe);
+      LOG.log(Level.INFO, "Returning a response error as result of a protocol exception", pe);
       return new ResponseItem(pe.getCode(), pe.getMessage(), pe.getResponse());
     }
-    logger.log(Level.WARNING, "Returning a response error as result of an exception", t);
+    LOG.log(Level.WARNING, "Returning a response error as result of an exception", t);
     return new ResponseItem(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, t.getMessage());
   }
 

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java Wed Jun 23 06:23:54 2010
@@ -23,14 +23,12 @@ import org.apache.commons.lang.StringUti
 import com.google.common.collect.ImmutableSet;
 
 import java.util.Set;
-import java.util.logging.Logger;
 
 /**
  * Common mime content types and utilities
  */
 public final class ContentTypes {
   private ContentTypes() {}
-  private static final Logger logger = Logger.getLogger(ContentTypes.class.getName());
 
   /**
    * Allowed alternatives to application/json, including types listed

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java Wed Jun 23 06:23:54 2010
@@ -38,7 +38,7 @@ import java.util.logging.Logger;
 
 public class DataServiceServlet extends ApiServlet {
 
-  private static final Logger logger = Logger.getLogger(DataServiceServlet.class.getName());
+  private static final Logger LOG = Logger.getLogger(DataServiceServlet.class.getName());
 
   public static final Set<String> ALLOWED_CONTENT_TYPES =
       new ImmutableSet.Builder<String>().addAll(ContentTypes.ALLOWED_JSON_CONTENT_TYPES)
@@ -92,8 +92,8 @@ public class DataServiceServlet extends 
    */
   void executeRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
       throws IOException {
-    if (logger.isLoggable(Level.FINEST)) {
-      logger.finest("Handling restful request for " + servletRequest.getPathInfo());
+    if (LOG.isLoggable(Level.FINEST)) {
+      LOG.finest("Handling restful request for " + servletRequest.getPathInfo());
     }
 
     setCharacterEncodings(servletRequest, servletResponse);
@@ -176,7 +176,7 @@ public class DataServiceServlet extends 
       String callback =  (HttpUtil.isJSONP(servletRequest) && ContentTypes.OUTPUT_JSON_CONTENT_TYPE.equals(converter.getContentType())) ?
           servletRequest.getParameter("callback") : null;
 
-      if (callback != null) writer.write(callback + "(");
+      if (callback != null) writer.write(callback + '(');
       writer.write(converter.convertToString(response));
       if (callback != null) writer.write(");\n");
     } else {
@@ -207,16 +207,16 @@ public class DataServiceServlet extends 
       formatString = servletRequest.getParameter(FORMAT_PARAM);
     } catch (Throwable t) {
       // this happens while testing
-      if (logger.isLoggable(Level.FINE)) {
-        logger.fine("Unexpected error : format param is null " + t.toString());
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.fine("Unexpected error : format param is null " + t.toString());
       }
     }
     try {
       contentType = servletRequest.getContentType();
     } catch (Throwable t) {
       //this happens while testing
-      if (logger.isLoggable(Level.FINE)) {
-        logger.fine("Unexpected error : content type is null " + t.toString());
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.fine("Unexpected error : content type is null " + t.toString());
       }
     }
 

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/DefaultHandlerRegistry.java Wed Jun 23 06:23:54 2010
@@ -57,7 +57,7 @@ import javax.servlet.http.HttpServletRes
  */
 public class DefaultHandlerRegistry implements HandlerRegistry {
 
-  private static final Logger logger = Logger.getLogger(DefaultHandlerRegistry.class.getName());
+  private static final Logger LOG = Logger.getLogger(DefaultHandlerRegistry.class.getName());
 
   // Map service - > method -> { handler, ...}
   private final Map<String, Map<String, SortedSet<RestPath>>> serviceMethodPathMap =
@@ -215,7 +215,7 @@ public class DefaultHandlerRegistry impl
         }
       }
     } catch (NoSuchMethodException nme) {
-      logger.log(Level.INFO, "No REST binding for " + service.name() + '.' + m.getName());
+      LOG.log(Level.INFO, "No REST binding for " + service.name() + '.' + m.getName());
     }
 
   }
@@ -235,7 +235,7 @@ public class DefaultHandlerRegistry impl
               new ExecutionListenerWrapper(service.name(), opName, executionListener));
       rpcOperations.put(service.name() + '.' + opName, rpcHandler);
     } catch (NoSuchMethodException nme) {
-      logger.log(Level.INFO, "No RPC binding for " + service.name() + '.' + m.getName());
+      LOG.log(Level.INFO, "No RPC binding for " + service.name() + '.' + m.getName());
     }
   }
 
@@ -350,18 +350,26 @@ public class DefaultHandlerRegistry impl
 
     public Future<?> execute(Map<String, String[]> parameters, Reader body,
                              SecurityToken token, BeanConverter converter) {
+
+      RequestItem item;
       try {
         // bind the body contents if available
         if (body != null) {
           parameters.put(operation.bodyParam(), new String[]{IOUtils.toString(body)});
         }
-        RequestItem item = methodCaller.getRestRequestItem(parameters, token, converter,
+        item = methodCaller.getRestRequestItem(parameters, token, converter,
             beanJsonConverter);
-        listener.executing(item);
+        } catch (Exception e) {
+          return ImmediateFuture.errorInstance(e);
+        }
 
+      try {
+        listener.executing(item);
         return methodCaller.call(handlerProvider.get(), item);
       } catch (Exception e) {
         return ImmediateFuture.errorInstance(e);
+      } finally {
+          listener.executed(item);
       }
     }
   }

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanAtomConverter.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanAtomConverter.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanAtomConverter.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanAtomConverter.java Wed Jun 23 06:23:54 2010
@@ -33,7 +33,7 @@ import java.util.logging.Logger;
 
 // TODO: This does not produce valid atom sytnax yet
 public class BeanAtomConverter implements BeanConverter {
-  private static final Logger logger =
+  private static final Logger LOG =
       Logger.getLogger(BeanAtomConverter.class.getName());
 
 
@@ -72,19 +72,19 @@ public class BeanAtomConverter implement
     try {
       writer.write("response", obj);
       toReturn =toReturn+ outputWriter.toString();
-      if (logger.isLoggable(Level.FINEST)) logger.finest("XML is: " + toReturn + "\n **** \n\n");
+      if (LOG.isLoggable(Level.FINEST)) LOG.finest("XML is: " + toReturn + "\n **** \n\n");
 
     } catch (SAXException e) {
-      logger.log(Level.SEVERE, e.getMessage(), e);
+      LOG.log(Level.SEVERE, e.getMessage(), e);
     } catch (IOException e) {
-      logger.log(Level.SEVERE, e.getMessage(), e);
+      LOG.log(Level.SEVERE, e.getMessage(), e);
     } catch (IntrospectionException e) {
-      logger.log(Level.SEVERE, e.getMessage(), e);
+      LOG.log(Level.SEVERE, e.getMessage(), e);
     } finally {
       try {
         writer.close();
       } catch (IOException e) {
-        if (logger.isLoggable(Level.FINEST)) logger.log(Level.FINEST, e.getMessage(), e);
+        if (LOG.isLoggable(Level.FINEST)) LOG.log(Level.FINEST, e.getMessage(), e);
       }
     }
 

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanXmlConverter.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanXmlConverter.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanXmlConverter.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanXmlConverter.java Wed Jun 23 06:23:54 2010
@@ -32,7 +32,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 public class BeanXmlConverter implements BeanConverter {
-  private static final Logger logger =
+  private static final Logger LOG =
       Logger.getLogger(BeanXmlConverter.class.getName());
 
   public String getContentType() {
@@ -69,19 +69,19 @@ public class BeanXmlConverter implements
     try {
       writer.write("response", obj);
       toReturn = outputWriter.toString();
-      if (logger.isLoggable(Level.FINEST)) logger.finest("XML is: " + toReturn + "\n **** \n\n");
+      if (LOG.isLoggable(Level.FINEST)) LOG.finest("XML is: " + toReturn + "\n **** \n\n");
 
     } catch (SAXException e) {
-      logger.log(Level.SEVERE, e.getMessage(), e);
+      LOG.log(Level.SEVERE, e.getMessage(), e);
     } catch (IOException e) {
-      logger.log(Level.SEVERE, e.getMessage(), e);
+      LOG.log(Level.SEVERE, e.getMessage(), e);
     } catch (IntrospectionException e) {
-      logger.log(Level.SEVERE, e.getMessage(), e);
+      LOG.log(Level.SEVERE, e.getMessage(), e);
     } finally {
       try {
         writer.close();
       } catch (IOException e) {
-        if (logger.isLoggable(Level.FINEST)) logger.log(Level.FINEST, e.getMessage(), e);
+        if (LOG.isLoggable(Level.FINEST)) LOG.log(Level.FINEST, e.getMessage(), e);
       }
     }
 

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/InterfaceClassMapper.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/InterfaceClassMapper.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/InterfaceClassMapper.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/InterfaceClassMapper.java Wed Jun 23 06:23:54 2010
@@ -43,7 +43,7 @@ public class InterfaceClassMapper extend
   /**
    * A logger.
    */
-  private static final Logger log = Logger.getLogger(InterfaceClassMapper.class.getName());
+  private static final Logger LOG = Logger.getLogger(InterfaceClassMapper.class.getName());
   /**
    * A map of element names to classes.
    */
@@ -149,8 +149,8 @@ public class InterfaceClassMapper extend
         }
       }
       firstChild.set(clazz);
-      if (log.isLoggable(Level.FINE)) {
-        log.fine("First Child set to " + clazz);
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.fine("First Child set to " + clazz);
       }
     }
   }
@@ -187,13 +187,13 @@ public class InterfaceClassMapper extend
     if (Collection.class.isAssignableFrom(type) && firstChild.get() != null) {
       // empty list, if this is the first one, then we need to look at the
       // first child setup on startup.
-      if (log.isLoggable(Level.FINE)) {
-        log.fine("Converting Child to " + firstChild.get());
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.fine("Converting Child to " + firstChild.get());
       }
       type = firstChild.get();
       firstChild.set(null);
-      if (log.isLoggable(Level.FINE)) {
-        log.fine("serializedClass(" + type + ") is a collection member "
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.fine("serializedClass(" + type + ") is a collection member "
             + Collection.class.isAssignableFrom(type));
       }
       for (ClassFieldMapping cfm : listElementMappingList) {
@@ -205,13 +205,13 @@ public class InterfaceClassMapper extend
     } else {
       // but after we have been asked once, then clear
       firstChild.set(null);
-      if (log.isLoggable(Level.FINE)) {
-        log.fine("serializedClass(" + type + ')');
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.fine("serializedClass(" + type + ')');
       }
       for (ClassFieldMapping cfm : elementMappingList) {
         if (cfm.matches(parentElementName, type)) {
-          if (log.isLoggable(Level.FINE)) {
-            log.fine("From MAP serializedClass(" + type + ")  =="
+          if (LOG.isLoggable(Level.FINE)) {
+            LOG.fine("From MAP serializedClass(" + type + ")  =="
                 + cfm.getElementName());
           }
           return cfm.getElementName();
@@ -221,8 +221,8 @@ public class InterfaceClassMapper extend
     }
 
     String fieldName = super.serializedClass(type);
-    if (log.isLoggable(Level.FINE)) {
-      log.fine("--- From Super serializedClass(" + type + ")  ==" + fieldName);
+    if (LOG.isLoggable(Level.FINE)) {
+      LOG.fine("--- From Super serializedClass(" + type + ")  ==" + fieldName);
     }
     return fieldName;
 

Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/MapConverter.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/MapConverter.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/MapConverter.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/MapConverter.java Wed Jun 23 06:23:54 2010
@@ -35,11 +35,6 @@ import com.thoughtworks.xstream.mapper.M
 public class MapConverter extends AbstractCollectionConverter {
 
   /**
-   * If true will use a short form of xml serialization.
-   */
-  private final boolean shortform = false;
-
-  /**
    * Create a MapConverter that use use the supplied mapper.
    *
    * @param mapper
@@ -67,24 +62,15 @@ public class MapConverter extends Abstra
   public void marshal(Object source, HierarchicalStreamWriter writer,
       MarshallingContext context) {
     Map<?, ?> map = (Map<?, ?>) source;
-    if (shortform) {
-      for (Entry<?, ?> e : map.entrySet()) {
-        writer.startNode(String.valueOf(e.getKey()));
-        context.convertAnother(e.getValue());
-        writer.endNode();
-      }
-    } else {
-      for (Entry<?, ?> e : map.entrySet()) {
-        writer.startNode("entry");
-        writer.startNode("key");
-        writer.setValue(String.valueOf(e.getKey()));
-        writer.endNode();
-        writer.startNode("value");
-        context.convertAnother(e.getValue());
-        writer.endNode();
-        writer.endNode();
-      }
-
+    for (Entry<?, ?> e : map.entrySet()) {
+      writer.startNode("entry");
+      writer.startNode("key");
+      writer.setValue(String.valueOf(e.getKey()));
+      writer.endNode();
+      writer.startNode("value");
+      context.convertAnother(e.getValue());
+      writer.endNode();
+      writer.endNode();
     }
   }
 

Modified: shindig/branches/2.0.x/java/common/src/main/resources/org/apache/shindig/common/cache/ehcache/ehcacheConfig.xml
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/resources/org/apache/shindig/common/cache/ehcache/ehcacheConfig.xml?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/resources/org/apache/shindig/common/cache/ehcache/ehcacheConfig.xml (original)
+++ shindig/branches/2.0.x/java/common/src/main/resources/org/apache/shindig/common/cache/ehcache/ehcacheConfig.xml Wed Jun 23 06:23:54 2010
@@ -87,4 +87,14 @@ under the License.
     overflowToDisk="false"
     diskPersistent="false"
     memoryStoreEvictionPolicy="LFU"/>
+
+  <!-- Used to cache cajoled documents based on their content -->
+  <cache name="cajoledDocuments"
+    maxElementsInMemory="1000"
+    eternal="false"
+    timeToIdleSeconds="300"
+    timeToLiveSeconds="600"
+    overflowToDisk="false"
+    diskPersistent="false"
+    memoryStoreEvictionPolicy="LFU"/>
 </ehcache>

Modified: shindig/branches/2.0.x/java/common/src/test/java/org/apache/shindig/protocol/conversion/BeanXmlConverterTest.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/test/java/org/apache/shindig/protocol/conversion/BeanXmlConverterTest.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/test/java/org/apache/shindig/protocol/conversion/BeanXmlConverterTest.java (original)
+++ shindig/branches/2.0.x/java/common/src/test/java/org/apache/shindig/protocol/conversion/BeanXmlConverterTest.java Wed Jun 23 06:23:54 2010
@@ -58,8 +58,8 @@ public class BeanXmlConverterTest extend
   }
 
   @Test
-  @Ignore("unknown why this is disabled")
-  public void xxxtestMapsToXml() throws Exception {
+  //@Ignore("unknown why this is disabled")
+  public void testMapsToXml() throws Exception {
     // This is the structure our app data currently takes
     Map<String, Map<String, String>> map = Maps.newTreeMap();
     Map<String, String> item1Map = ImmutableMap.of("value","1");
@@ -76,7 +76,7 @@ public class BeanXmlConverterTest extend
     // TODO: I don't believe this is the output we are looking for for app
     // data... we will probably have to tweak this.
     String expectedXml =
-        "<treemap>" +
+        "<response>" +
         "<empty>false</empty>" +
         "<entry>" +
           "<key>item1</key>" +
@@ -98,7 +98,7 @@ public class BeanXmlConverterTest extend
             "</entry>" +
           "</value>" +
         "</entry>" +
-        "</treemap>";
+        "</response>";
     assertEquals(expectedXml, StringUtils.deleteWhitespace(xml));
   }
 

Modified: shindig/branches/2.0.x/java/gadgets/pom.xml
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/pom.xml?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/pom.xml (original)
+++ shindig/branches/2.0.x/java/gadgets/pom.xml Wed Jun 23 06:23:54 2010
@@ -105,6 +105,24 @@
     </resources>
   </build>
 
+  <profiles>
+    <profile>
+      <id>reporting</id>
+      <reporting>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>clirr-maven-plugin</artifactId>
+            <configuration>
+              <comparisonVersion>1.0.1</comparisonVersion>
+            </configuration>
+            <version>2.2.2</version>
+          </plugin>
+        </plugins>
+      </reporting>
+    </profile>
+  </profiles>
+
   <dependencies>
     <!-- project dependencies -->
     <dependency>
@@ -190,10 +208,6 @@
       <artifactId>nekohtml</artifactId>
     </dependency>
     <dependency>
-      <groupId>net.sourceforge.nekohtml</groupId>
-      <artifactId>nekohtml</artifactId>
-    </dependency>
-    <dependency>
       <groupId>xerces</groupId>
       <artifactId>xercesImpl</artifactId>
     </dependency>
@@ -234,11 +248,5 @@
       <artifactId>jetty</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.shindig</groupId>
-      <artifactId>shindig-common</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 </project>

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java Wed Jun 23 06:23:54 2010
@@ -38,7 +38,7 @@ import java.util.logging.Logger;
  * Automatically updates objects as needed asynchronously to provide optimal throughput.
  */
 public abstract class AbstractSpecFactory<T> {
-  private static final Logger logger = Logger.getLogger(AbstractSpecFactory.class.getName());
+  private static final Logger LOG = Logger.getLogger(AbstractSpecFactory.class.getName());
   private final Class<T> clazz;
   private final ExecutorService executor;
   private final RequestPipeline pipeline;
@@ -216,10 +216,10 @@ public abstract class AbstractSpecFactor
         cache.addElement(query.specUri, newSpec, refresh);
       } catch (GadgetException e) {
         if (old != null) {
-          logger.log(Level.INFO, "Failed to update {0}. Using cached version.", query.specUri);
+          LOG.log(Level.INFO, "Failed to update {0}. Using cached version.", query.specUri);
           cache.addElement(query.specUri, old, refresh);
         } else {
-          logger.log(Level.INFO, "Failed to update {0}. Applying negative cache.", query.specUri);
+          LOG.log(Level.INFO, "Failed to update {0}. Applying negative cache.", query.specUri);
           cache.addElement(query.specUri, e, refresh);
         }
       }

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java Wed Jun 23 06:23:54 2010
@@ -86,11 +86,12 @@ public class DefaultGadgetSpecFactory ex
     return super.getSpec(query);
   }
 
+  private static final String BOM_ENTITY = "&#xFEFF;";
+
   @Override
   protected GadgetSpec parse(String content, Query query) throws XmlException, GadgetException {
     // Allow BOM entity as first item on stream and ignore it:
-    final String BOM_ENTITY = "&#xFEFF;";
-    if (content.length() >= BOM_ENTITY.length() && 
+    if (content.length() >= BOM_ENTITY.length() &&
         content.substring(0, BOM_ENTITY.length()).equalsIgnoreCase(BOM_ENTITY)) {
       content = content.substring(BOM_ENTITY.length());
     }

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java Wed Jun 23 06:23:54 2010
@@ -23,12 +23,18 @@ import com.google.common.collect.Immutab
 import com.google.inject.AbstractModule;
 import com.google.inject.Provides;
 import com.google.inject.Singleton;
+import com.google.inject.multibindings.MapBinder;
 import com.google.inject.multibindings.Multibinder;
 import com.google.inject.name.Named;
 import com.google.inject.name.Names;
 
 import org.apache.commons.lang.StringUtils;
 
+import org.apache.shindig.gadgets.config.ConfigContributor;
+import org.apache.shindig.gadgets.config.CoreUtilConfigContributor;
+import org.apache.shindig.gadgets.config.OsapiServicesConfigContributor;
+import org.apache.shindig.gadgets.config.ShindigAuthConfigContributor;
+import org.apache.shindig.gadgets.config.XhrwrapperConfigContributor;
 import org.apache.shindig.gadgets.http.HttpResponse;
 import org.apache.shindig.gadgets.http.InvalidationHandler;
 import org.apache.shindig.gadgets.parse.ParseModule;
@@ -62,6 +68,7 @@ public class DefaultGuiceModule extends 
 
     final ExecutorService service = Executors.newCachedThreadPool(DAEMON_THREAD_FACTORY);
     bind(Executor.class).toInstance(service);
+    bind(Executor.class).annotatedWith(Names.named("shindig.concat.executor")).toInstance(service);
     bind(ExecutorService.class).toInstance(service);
     Runtime.getRuntime().addShutdownHook(new Thread() {
         public void run() {
@@ -83,6 +90,7 @@ public class DefaultGuiceModule extends 
     requestStaticInjection(HttpResponse.class);
 
     registerGadgetHandlers();
+    registerConfigContributors();
     registerFeatureHandlers();
   }
 
@@ -95,11 +103,20 @@ public class DefaultGuiceModule extends 
     handlerBinder.addBinding().to(HttpRequestHandler.class);
   }
 
+  protected void registerConfigContributors() {
+    MapBinder<String, ConfigContributor> configBinder = MapBinder.newMapBinder(binder(), String.class, ConfigContributor.class);
+    configBinder.addBinding("core.util").to(CoreUtilConfigContributor.class);
+    configBinder.addBinding("osapi").to(OsapiServicesConfigContributor.class);
+    configBinder.addBinding("shindig.auth").to(ShindigAuthConfigContributor.class);
+    configBinder.addBinding("shindig.xhrwrapper").to(XhrwrapperConfigContributor.class);
+
+  }
   /**
    * Sets up the multibinding for extended feature resources
    */
   protected void registerFeatureHandlers() {
-    Multibinder<String> featureBinder = Multibinder.newSetBinder(binder(), String.class, Names.named("org.apache.shindig.features-extended"));
+    /*Multibinder<String> featureBinder = */
+        Multibinder.newSetBinder(binder(), String.class, Names.named("org.apache.shindig.features-extended"));
   }
 
   /**
@@ -118,8 +135,10 @@ public class DefaultGuiceModule extends 
 
   public static final ThreadFactory DAEMON_THREAD_FACTORY =
     new ThreadFactory() {
+        private final ThreadFactory factory = Executors.defaultThreadFactory();
+	  
         public Thread newThread(Runnable r) {
-            Thread t = Executors.defaultThreadFactory().newThread(r);
+            Thread t = factory.newThread(r);
             t.setDaemon(true);
             return t;
         }

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java Wed Jun 23 06:23:54 2010
@@ -61,7 +61,7 @@ public class FeatureRegistry {
   public static final String RESOURCE_SCHEME = "res";
   public static final String FILE_SCHEME = "file";
   
-  private static final Logger logger
+  private static final Logger LOG
       = Logger.getLogger("org.apache.shindig.gadgets");
   
   // Map keyed by FeatureNode object created as a lookup for transitive feature deps.
@@ -131,7 +131,7 @@ public class FeatureRegistry {
             // Accommodate res:// URIs.
             location = location.substring(1);
           }
-          logger.info("Loading resources from: " + uriLoc.toString());
+          LOG.info("Loading resources from: " + uriLoc.toString());
           
           if (location.endsWith(".txt")) {
             // Text file contains a list of other resource files to load
@@ -150,7 +150,7 @@ public class FeatureRegistry {
           loadResources(resources, featureMapBuilder);
         } else {
           // Load files in directory structure.
-          logger.info("Loading files from: " + location);
+          LOG.info("Loading files from: " + location);
           
           loadFile(new File(uriLoc.getPath()), featureMapBuilder);
         }
@@ -394,8 +394,8 @@ public class FeatureRegistry {
   private void loadResources(List<String> resources, Map<String,FeatureNode> featureMapBuilder) throws GadgetException {
     try {
       for (String resource : resources) {
-        if (logger.isLoggable(Level.FINE)) {
-          logger.fine("Processing resource: " + resource);
+        if (LOG.isLoggable(Level.FINE)) {
+          LOG.fine("Processing resource: " + resource);
         }
         
         String content = getResourceContent(resource);
@@ -424,8 +424,8 @@ public class FeatureRegistry {
         Uri parent = Uri.fromJavaUri(featureFile.toURI());
         loadFeature(parent, content, featureMapBuilder);
       } else {
-        if (logger.isLoggable(Level.FINEST)) {
-          logger.finest(featureFile.getAbsolutePath() + " doesn't seem to be an XML file.");
+        if (LOG.isLoggable(Level.FINEST)) {
+          LOG.finest(featureFile.getAbsolutePath() + " doesn't seem to be an XML file.");
         }
       }
     }
@@ -443,8 +443,8 @@ public class FeatureRegistry {
     FeatureParser.ParsedFeature parsed = parser.parse(parent, xml);
     // Duplicate feature = OK, just indicate it's being overridden.
     if (featureMapBuilder.containsKey(parsed.getName())) {
-      if (logger.isLoggable(Level.WARNING)) {
-        logger.warning("Overriding feature: " + parsed.getName() + " with def at: " + parent);
+      if (LOG.isLoggable(Level.WARNING)) {
+        LOG.warning("Overriding feature: " + parsed.getName() + " with def at: " + parent);
       }
     }
     

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java Wed Jun 23 06:23:54 2010
@@ -18,9 +18,11 @@
 package org.apache.shindig.gadgets.features;
 
 import com.google.inject.Inject;
+import com.google.inject.name.Named;
 
 import org.apache.shindig.common.uri.Uri;
 import org.apache.shindig.common.util.ResourceLoader;
+import org.apache.shindig.common.util.TimeSource;
 import org.apache.shindig.gadgets.GadgetException;
 import org.apache.shindig.gadgets.http.HttpFetcher;
 import org.apache.shindig.gadgets.http.HttpRequest;
@@ -35,16 +37,29 @@ import java.util.logging.Logger;
  * Class that loads FeatureResource objects used to populate JS feature code.
  */
 public class FeatureResourceLoader {
-  private static final Logger logger
+  private static final Logger LOG
       = Logger.getLogger("org.apache.shindig.gadgets");
   
   private HttpFetcher fetcher;
+  private TimeSource timeSource = new TimeSource();
+  private int updateCheckFrequency = 0;  // <= 0 -> only load data once, don't check for updates.
 
   @Inject
   public void setHttpFetcher(HttpFetcher fetcher) {
     this.fetcher = fetcher;
   }
   
+  @Inject
+  public void setTimeSource(TimeSource timeSource) {
+    this.timeSource = timeSource;
+  }
+  
+  @Inject(optional = true)
+  public void setSupportFileUpdates(
+      @Named("shindig.features.loader.file-update-check-frequency-ms") int updateCheckFrequency) {
+    this.updateCheckFrequency = updateCheckFrequency;
+  }
+  
   /**
    * Primary, and only public, method of FeatureResourceLoader. Loads the resource
    * keyed at the given {@code uri}, which was decorated with the provided list of attributes.
@@ -74,8 +89,7 @@ public class FeatureResourceLoader {
   }
   
   protected FeatureResource loadFile(String path, Map<String, String> attribs) throws IOException {
-    return new DualModeStaticResource(path, getFileContent(new File(getOptPath(path))),
-        getFileContent(new File(path)));
+    return new DualModeFileResource(getOptPath(path), path);
   }
   
   protected String getFileContent(File file) {
@@ -114,6 +128,73 @@ public class FeatureResourceLoader {
     return orig;
   }
   
+  // Overridable for easier testing.
+  protected boolean fileHasChanged(File file, long lastModified) {
+    return file.lastModified() > lastModified;
+  }
+  
+  private class DualModeFileResource extends FeatureResource.Default {
+    private final FileContent optContent;
+    private final FileContent dbgContent;
+    
+    protected DualModeFileResource(String optFilePath, String dbgFilePath) {
+      this.optContent = new FileContent(optFilePath);
+      this.dbgContent = new FileContent(dbgFilePath);
+      if (optContent.get() == null && dbgContent.get() == null) {
+        throw new IllegalArgumentException("Problems reading resource: " + dbgFilePath);
+      }
+    }
+
+    public String getContent() {
+      String opt = optContent.get();
+      return opt != null ? opt : dbgContent.get();
+    }
+
+    public String getDebugContent() {
+      String dbg = dbgContent.get();
+      return dbg != null ? dbg : optContent.get();
+    }
+    
+    private class FileContent {
+      private final String filePath;
+      private long lastModified;
+      private long lastUpdateCheckTime;
+      private String content;
+      
+      private FileContent(String filePath) {
+        this.filePath = filePath;
+        this.lastModified = 0;
+        this.lastUpdateCheckTime = 0;
+      }
+      
+      private String get() {
+        long nowTime = timeSource.currentTimeMillis();
+        if (content == null ||
+            (updateCheckFrequency > 0 &&
+             (lastUpdateCheckTime + updateCheckFrequency) < nowTime)) {
+          // Only check for file updates at preconfigured intervals. This prevents
+          // overwhelming the file system while maintaining a reasonable update rate w/o
+          // implementing a full event-driven mechanism.
+          lastUpdateCheckTime = nowTime;
+          File file = new File(filePath);
+          if (fileHasChanged(file, lastModified)) {
+            // Only reload file content if it's changed (or if it's the first
+            // load, when this check will succeed).
+            String newContent = getFileContent(file);
+            if (newContent != null) {
+              content = newContent;
+              lastModified = file.lastModified();
+            } else if (content != null) {
+              // Content existed before, file removed - log error.
+              LOG.warning("File existed before but is now missing! Name: " + filePath);
+            }
+          }
+        }
+        return content;
+      }
+    }
+  }
+  
   private static class DualModeStaticResource extends FeatureResource.Default {
     private final String content;
     private final String debugContent;
@@ -172,10 +253,10 @@ public class FeatureResourceLoader {
           if (response.getHttpStatusCode() == HttpResponse.SC_OK) {
             content = response.getResponseAsString();
           } else {
-            logger.warning("Unable to retrieve remote library from " + uri);
+            LOG.warning("Unable to retrieve remote library from " + uri);
           }
         } catch (GadgetException e) {
-          logger.warning("Unable to retrieve remote library from " + uri);
+          LOG.warning("Unable to retrieve remote library from " + uri);
         }
       }
       

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java Wed Jun 23 06:23:54 2010
@@ -96,6 +96,11 @@ public abstract class AbstractHttpCache 
       // Caching was forced. Ignore what the response wants.
       return true;
     }
+    
+    if (response.getHttpStatusCode() == HttpResponse.SC_NOT_MODIFIED) {
+      // Shindig server will serve 304s. Do not cache 304s from the origin server.
+      return false;
+    }
 
     // If the HTTP response allows for it, we can cache.
     return !response.isStrictNoCache();

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java Wed Jun 23 06:23:54 2010
@@ -48,6 +48,7 @@ import org.apache.http.conn.ConnectionPo
 import org.apache.http.conn.HttpHostConnectException;
 import org.apache.http.conn.params.ConnManagerParams;
 import org.apache.http.conn.params.ConnPerRouteBean;
+import org.apache.http.conn.params.ConnRouteParams;
 import org.apache.http.conn.scheme.PlainSocketFactory;
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.scheme.SchemeRegistry;
@@ -113,9 +114,13 @@ public class BasicHttpFetcher implements
   /**
    * Creates a new fetcher using the default maximum object size and timeout --
    * no limit and 5 seconds.
+   * @param basicHttpFetcherProxy The http proxy to use.
    */
-  public BasicHttpFetcher() {
-    this(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
+  @Inject
+  public BasicHttpFetcher(@Named("org.apache.shindig.gadgets.http.basicHttpFetcherProxy")
+                          String basicHttpFetcherProxy) {
+    this(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS,
+         basicHttpFetcherProxy);
   }
 
   /**
@@ -126,8 +131,10 @@ public class BasicHttpFetcher implements
    * @param maxObjSize          Maximum size, in bytes, of the object we will fetch, 0 if no limit..
    * @param connectionTimeoutMs timeout, in milliseconds, for connecting to hosts.
    * @param readTimeoutMs       timeout, in millseconds, for unresponsive connections
+   * @param basicHttpFetcherProxy The http proxy to use.
    */
-  public BasicHttpFetcher(int maxObjSize, int connectionTimeoutMs, int readTimeoutMs) {
+  public BasicHttpFetcher(int maxObjSize, int connectionTimeoutMs, int readTimeoutMs,
+                          String basicHttpFetcherProxy) {
     // Create and initialize HTTP parameters
     setMaxObjectSizeBytes(maxObjSize);
     setSlowResponseWarning(DEFAULT_SLOW_RESPONSE_WARNING);
@@ -157,9 +164,15 @@ public class BasicHttpFetcher implements
     schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
 
     ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
-
     DefaultHttpClient client = new DefaultHttpClient(cm, params);
 
+    // Set proxy if set via guice.
+    if (!StringUtils.isEmpty(basicHttpFetcherProxy)) {
+      String[] splits = basicHttpFetcherProxy.split(":");
+      ConnRouteParams.setDefaultProxy(
+          client.getParams(), new HttpHost(splits[0], Integer.parseInt(splits[1]), "http"));
+    }
+
     // try resending the request once
     client.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(1, true));
 
@@ -198,11 +211,13 @@ public class BasicHttpFetcher implements
     });
     client.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler() );
 
-    // Use Java's built-in proxy logic
-    ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
-            client.getConnectionManager().getSchemeRegistry(),
-            ProxySelector.getDefault());
-    client.setRoutePlanner(routePlanner);
+    // Use Java's built-in proxy logic in case no proxy set via guice.
+    if (StringUtils.isEmpty(basicHttpFetcherProxy)) {
+      ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
+          client.getConnectionManager().getSchemeRegistry(),
+          ProxySelector.getDefault());
+      client.setRoutePlanner(routePlanner);
+    }
 
     FETCHER = client;
   }
@@ -282,12 +297,19 @@ public class BasicHttpFetcher implements
             HttpServletResponse.SC_BAD_REQUEST);
       }
     }
-    HttpHost host = new HttpHost(hostparts[0], port, uri.getScheme());   
+
     String requestUri = uri.getPath();
+    // Treat path as / if set as null.
+    if (uri.getPath() == null) {
+      requestUri = "/";
+    }
     if (uri.getQuery() != null) {
       requestUri += '?' + uri.getQuery();
     }
 
+    // Get the http host to connect to.
+    HttpHost host = new HttpHost(hostparts[0], port, uri.getScheme());
+
     try {
       if ("POST".equals(methodType) || "PUT".equals(methodType)) {
         HttpEntityEnclosingRequestBase enclosingMethod = ("POST".equals(methodType))
@@ -309,8 +331,10 @@ public class BasicHttpFetcher implements
         httpMethod.addHeader(entry.getKey(), StringUtils.join(entry.getValue(), ','));
       }
 
-      if (!request.getFollowRedirects())
+      // Disable following redirects.
+      if (!request.getFollowRedirects()) {
         httpMethod.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
+      }
 
       // HttpClient doesn't handle all cases when breaking url (specifically '_' in domain)
       // So lets pass it the url parsed:

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponseMetadataHelper.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponseMetadataHelper.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponseMetadataHelper.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponseMetadataHelper.java Wed Jun 23 06:23:54 2010
@@ -36,7 +36,7 @@ public class HttpResponseMetadataHelper 
   public static final String IMAGE_HEIGHT = "ImageHeight";
   public static final String IMAGE_WIDTH = "ImageWidth";
 
-  private static final Logger log =
+  private static final Logger LOG =
     Logger.getLogger(HttpResponseMetadataHelper.class.getName());
 
   /**
@@ -66,10 +66,10 @@ public class HttpResponseMetadataHelper 
       return new String(Base32.encodeBase32(md5val), "UTF-8");
     } catch (NoSuchAlgorithmException e) {
       // Should not happen
-      log.info("Error getting MD5 digest, ignored");
+      LOG.info("Error getting MD5 digest, ignored");
     } catch (UnsupportedEncodingException e) {
       // Should not happen
-      log.info("Error parsing MD5 string as UTF8");
+      LOG.info("Error parsing MD5 string as UTF8");
     }
     return null;
   }

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/GadgetOAuthCallbackGenerator.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/GadgetOAuthCallbackGenerator.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/GadgetOAuthCallbackGenerator.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/GadgetOAuthCallbackGenerator.java Wed Jun 23 06:23:54 2010
@@ -30,11 +30,11 @@ import org.apache.shindig.common.uri.Uri
 import org.apache.shindig.gadgets.Gadget;
 import org.apache.shindig.gadgets.GadgetContext;
 import org.apache.shindig.gadgets.LockedDomainService;
-import org.apache.shindig.gadgets.UrlGenerator;
 import org.apache.shindig.gadgets.http.HttpRequest;
 import org.apache.shindig.gadgets.process.ProcessingException;
 import org.apache.shindig.gadgets.process.Processor;
 import org.apache.shindig.gadgets.servlet.OAuthCallbackServlet;
+import org.apache.shindig.gadgets.uri.OAuthUriManager;
 
 /**
  * Generates callback URLs for gadgets using OAuth 1.0a.  There are three relevant callback URLs:
@@ -82,16 +82,16 @@ public class GadgetOAuthCallbackGenerato
 
   private final Processor processor;
   private final LockedDomainService lockedDomainService;
-  private final UrlGenerator urlGenerator;
+  private final OAuthUriManager oauthUriManager;
   private final BlobCrypter stateCrypter;
 
   @Inject
   public GadgetOAuthCallbackGenerator(Processor processor, LockedDomainService lockedDomainService,
-      UrlGenerator urlGenerator, @Named(OAuthFetcherConfig.OAUTH_STATE_CRYPTER)
+      OAuthUriManager oauthUriManager, @Named(OAuthFetcherConfig.OAUTH_STATE_CRYPTER)
       BlobCrypter stateCrypter) {
     this.processor = processor;
     this.lockedDomainService = lockedDomainService;
-    this.urlGenerator = urlGenerator;
+    this.oauthUriManager = oauthUriManager;
     this.stateCrypter = stateCrypter;
   }
   
@@ -128,14 +128,13 @@ public class GadgetOAuthCallbackGenerato
   }
 
   private String getGadgetDomainCallback(SecurityToken securityToken, Uri activeUrl) {
-    String baseCallback = urlGenerator.getGadgetDomainOAuthCallback(
+    Uri gadgetCallback = oauthUriManager.makeOAuthCallbackUri(
         securityToken.getContainer(), activeUrl.getAuthority());
-    if (baseCallback == null) {
+    if (gadgetCallback == null) {
       return null;
     }
-    UriBuilder gadgetCallback = UriBuilder.parse(baseCallback);
     if (StringUtils.isEmpty(gadgetCallback.getScheme())) {
-      gadgetCallback.setScheme(activeUrl.getScheme());
+      gadgetCallback = new UriBuilder(gadgetCallback).setScheme(activeUrl.getScheme()).toUri();
     }
     return gadgetCallback.toString();
   }

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthCommandLine.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthCommandLine.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthCommandLine.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthCommandLine.java Wed Jun 23 06:23:54 2010
@@ -59,6 +59,7 @@ import java.util.Map;
  *  --postFile <file path of post body contents>
  *  --paramLocation <URI_QUERY | POST_BODY | AUTH_HEADER>
  *  --bodySigning hash|legacy|none
+ *  --httpProxy=<http proxy to use for fetching>
  */
 public class OAuthCommandLine {
 
@@ -73,6 +74,7 @@ public class OAuthCommandLine {
     for (int i = 0; i < argv.length; i+=2) {
       params.put(argv[i], argv[i+1]);
     }
+    final String httpProxy = params.get("--httpProxy");
     final String consumerKey = params.get("--consumerKey");
     final String consumerSecret = params.get("--consumerSecret");
     final String xOauthRequestor = params.get("--requestorId");
@@ -162,7 +164,7 @@ public class OAuthCommandLine {
     }
     request.setMethod(method);
 
-    HttpFetcher fetcher = new BasicHttpFetcher();
+    HttpFetcher fetcher = new BasicHttpFetcher(httpProxy);
     HttpResponse response = fetcher.fetch(request);
 
     System.out.println("Request ------------------------------");

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthModule.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthModule.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthModule.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthModule.java Wed Jun 23 06:23:54 2010
@@ -44,7 +44,7 @@ import java.util.logging.Logger;
  */
 public class OAuthModule extends AbstractModule {
 
-  private static final Logger logger = Logger.getLogger(OAuthModule.class.getName());
+  private static final Logger LOG = Logger.getLogger(OAuthModule.class.getName());
 
   private static final String OAUTH_CONFIG = "config/oauth.json";
   private static final String OAUTH_SIGNING_KEY_FILE = "shindig.signing.key-file";
@@ -72,10 +72,10 @@ public class OAuthModule extends Abstrac
     public OAuthCrypterProvider(@Named("shindig.signing.state-key") String stateCrypterPath)
         throws IOException {
       if (StringUtils.isBlank(stateCrypterPath)) {
-        logger.info("Using random key for OAuth client-side state encryption");
+        LOG.info("Using random key for OAuth client-side state encryption");
         crypter = new BasicBlobCrypter(Crypto.getRandomBytes(BasicBlobCrypter.MASTER_KEY_MIN_LEN));
       } else {
-        logger.info("Using file " + stateCrypterPath + " for OAuth client-side state encryption");
+        LOG.info("Using file " + stateCrypterPath + " for OAuth client-side state encryption");
         crypter = new BasicBlobCrypter(new File(stateCrypterPath));
       }
     }
@@ -120,19 +120,19 @@ public class OAuthModule extends Abstrac
       BasicOAuthStoreConsumerKeyAndSecret key = null;
       if (!StringUtils.isBlank(signingKeyFile)) {
         try {
-          logger.info("Loading OAuth signing key from " + signingKeyFile);
+          LOG.info("Loading OAuth signing key from " + signingKeyFile);
           String privateKey = IOUtils.toString(ResourceLoader.open(signingKeyFile), "UTF-8");
           privateKey = BasicOAuthStore.convertFromOpenSsl(privateKey);
           key = new BasicOAuthStoreConsumerKeyAndSecret(null, privateKey, KeyType.RSA_PRIVATE,
               signingKeyName, null);
         } catch (Throwable t) {
-          logger.log(Level.WARNING, "Couldn't load key file " + signingKeyFile, t);
+          LOG.log(Level.WARNING, "Couldn't load key file " + signingKeyFile, t);
         }
       }
       if (key != null) {
         store.setDefaultKey(key);
       } else {
-        logger.log(Level.WARNING, "Couldn't load OAuth signing key.  To create a key, run:\n" +
+        LOG.log(Level.WARNING, "Couldn't load OAuth signing key.  To create a key, run:\n" +
             "  openssl req -newkey rsa:1024 -days 365 -nodes -x509 -keyout testkey.pem \\\n" +
             "     -out testkey.pem -subj '/CN=mytestkey'\n" +
             "  openssl pkcs8 -in testkey.pem -out oauthkey.pem -topk8 -nocrypt -outform PEM\n" +
@@ -148,7 +148,7 @@ public class OAuthModule extends Abstrac
         String oauthConfigString = ResourceLoader.getContent(OAUTH_CONFIG);
         store.initFromConfigString(oauthConfigString);
       } catch (Throwable t) {
-        logger.log(Level.WARNING, "Failed to initialize OAuth consumers from " + OAUTH_CONFIG, t);
+        LOG.log(Level.WARNING, "Failed to initialize OAuth consumers from " + OAUTH_CONFIG, t);
       }
     }
 

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java Wed Jun 23 06:23:54 2010
@@ -129,17 +129,17 @@ public class OAuthRequest {
    * the service provider, such as their URLs and the keys we use to access
    * those URLs.
    */
-  private AccessorInfo accessorInfo;
+  protected AccessorInfo accessorInfo;
 
   /**
    * The request the client really wants to make.
    */
-  private HttpRequest realRequest;
+  protected HttpRequest realRequest;
 
   /**
    * Data returned along with OAuth access token, null if this is not an access token request
    */
-  private Map<String, String> accessTokenData;
+  protected Map<String, String> accessTokenData;
 
   /**
    * @param fetcherConfig configuration options for the fetcher

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthResponseParams.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthResponseParams.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthResponseParams.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthResponseParams.java Wed Jun 23 06:23:54 2010
@@ -40,7 +40,7 @@ import java.util.regex.Pattern;
  * Container for OAuth specific data to include in the response to the client.
  */
 public class OAuthResponseParams {
-  private static final Logger logger = Logger.getLogger(OAuthResponseParams.class.getName());
+  private static final Logger LOG = Logger.getLogger(OAuthResponseParams.class.getName());
 
   // Finds the values of sensitive response params: oauth_token_secret and oauth_session_handle
   private static final Pattern REMOVE_SECRETS =
@@ -99,8 +99,8 @@ public class OAuthResponseParams {
    * Log a warning message that includes the details of the request.
    */
   public void logDetailedWarning(String note) {
-    if (logger.isLoggable(Level.WARNING)) {
-      logger.log(Level.WARNING, note + '\n' + getDetails(null));
+    if (LOG.isLoggable(Level.WARNING)) {
+      LOG.log(Level.WARNING, note + '\n' + getDetails(null));
     }
   }
 
@@ -108,14 +108,14 @@ public class OAuthResponseParams {
    * Log a warning message that includes the details of the request and the thrown exception.
    */
   public void logDetailedWarning(String note, Throwable e) {
-    if (logger.isLoggable(Level.WARNING)) {
-      logger.log(Level.WARNING, note + '\n' + getDetails(e), e);
+    if (LOG.isLoggable(Level.WARNING)) {
+      LOG.log(Level.WARNING, note + '\n' + getDetails(e), e);
     }
   }
   
   public void logDetailedInfo(String note, Throwable e) {
-    if (logger.isLoggable(Level.INFO)) {    
-      logger.log(Level.INFO, note + '\n' + getDetails(e), e);
+    if (LOG.isLoggable(Level.INFO)) {    
+      LOG.log(Level.INFO, note + '\n' + getDetails(e), e);
     }
   }
 

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java Wed Jun 23 06:23:54 2010
@@ -107,7 +107,7 @@ public class DefaultHtmlSerializer imple
    * type attribute on output
    */
   private Element substituteElement(Element elem) {
-    String scriptType = GadgetHtmlParser.SCRIPT_TYPE_TO_OSML_TAG.inverse().get(elem.getNodeName());
+    String scriptType = SocialDataTags.SCRIPT_TYPE_TO_OSML_TAG.inverse().get(elem.getNodeName());
     if (scriptType != null) {
       Element replacement = elem.getOwnerDocument().createElement("script");
       replacement.setAttribute("type", scriptType);

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/GadgetHtmlParser.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/GadgetHtmlParser.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/GadgetHtmlParser.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/GadgetHtmlParser.java Wed Jun 23 06:23:54 2010
@@ -17,8 +17,6 @@
  */
 package org.apache.shindig.gadgets.parse;
 
-import com.google.common.collect.BiMap;
-import com.google.common.collect.ImmutableBiMap;
 import com.google.common.collect.Lists;
 import com.google.inject.ImplementedBy;
 import com.google.inject.Inject;
@@ -54,18 +52,6 @@ public abstract class GadgetHtmlParser {
   private Provider<HtmlSerializer> serializerProvider = new DefaultSerializerProvider();
   protected final DOMImplementation documentFactory;
 
-  /**
-   * Allowed tag names for OpenSocial Data and template blocks.
-   */
-  public static final String OSML_DATA_TAG = "OSData";
-  public static final String OSML_TEMPLATE_TAG = "OSTemplate";
-
-  /**
-   * Bi-map of OpenSocial tags to their script type attribute values.
-   */
-  public static final BiMap<String, String> SCRIPT_TYPE_TO_OSML_TAG = ImmutableBiMap.of(
-      "text/os-data", OSML_DATA_TAG, "text/os-template", OSML_TEMPLATE_TAG);
-  
   protected GadgetHtmlParser(DOMImplementation documentFactory) {
     this.documentFactory = documentFactory;
   }
@@ -97,10 +83,10 @@ public abstract class GadgetHtmlParser {
     boolean shouldCache = shouldCache();
     if (shouldCache) {
       // TODO - Consider using the source if its under a certain size
-      key = HashUtil.rawChecksum(source.getBytes());
+      key = HashUtil.checksum(source.getBytes());
       document = documentCache.getElement(key);
     }
-    
+
     if (document == null) {
       try {
         document = parseDomImpl(source);
@@ -109,19 +95,19 @@ public abstract class GadgetHtmlParser {
       } catch (DOMException e) {
         // DOMException is a RuntimeException
         document = errorDom(e);
-        HtmlSerialization.attach(document, serializerProvider.get(), source);      
+        HtmlSerialization.attach(document, serializerProvider.get(), source);
         return document;
       }
 
       HtmlSerialization.attach(document, serializerProvider.get(), source);
 
       Node html = document.getDocumentElement();
-      
+
       Node head = null;
       Node body = null;
       LinkedList<Node> beforeHead = Lists.newLinkedList();
       LinkedList<Node> beforeBody = Lists.newLinkedList();
-      
+
       while (html.hasChildNodes()) {
         Node child = html.removeChild(html.getFirstChild());
         if (child.getNodeType() == Node.ELEMENT_NODE &&
@@ -149,14 +135,14 @@ public abstract class GadgetHtmlParser {
           body.appendChild(child);
         }
       }
-      
+
       // Ensure head tag exists
       if (head == null) {
         // beforeHead contains all elements that should be prepended to <body>. Switch them.
         LinkedList<Node> temp = beforeBody;
         beforeBody = beforeHead;
         beforeHead = temp;
-        
+
         // Add as first element
         head = document.createElement("head");
         html.insertBefore(head, html.getFirstChild());
@@ -164,7 +150,7 @@ public abstract class GadgetHtmlParser {
         // Re-append head node.
         html.appendChild(head);
       }
-      
+
       // Ensure body tag exists.
       if (body == null) {
         // Add immediately after head.
@@ -174,13 +160,13 @@ public abstract class GadgetHtmlParser {
         // Re-append body node.
         html.appendChild(body);
       }
-      
+
       // Leftovers: nodes before the first <head> node found and the first <body> node found.
       // Prepend beforeHead to the front of <head>, and beforeBody to beginning of <body>,
       // in the order they were found in the document.
       prependToNode(head, beforeHead);
       prependToNode(body, beforeBody);
-      
+
       // One exception. <style>/<link rel="stylesheet" nodes from <body> end up at the end of <head>,
       // since doing so is HTML compliant and can never break rendering due to ordering concerns.
       LinkedList<Node> styleNodes = Lists.newLinkedList();
@@ -192,20 +178,20 @@ public abstract class GadgetHtmlParser {
           styleNodes.add(bodyKid);
         }
       }
-      
+
       for (Node styleNode : styleNodes) {
         head.appendChild(body.removeChild(styleNode));
       }
-      
+
       // Finally, reprocess all script nodes for OpenSocial purposes, as these
       // may be interpreted (rightly, from the perspective of HTML) as containing text only.
       reprocessScriptForOpenSocial(html);
-      
+
       if (shouldCache) {
         documentCache.addElement(key, document);
       }
     }
-    
+
     if (shouldCache) {
       Document copy = (Document)document.cloneNode(true);
       HtmlSerialization.copySerializer(document, copy);
@@ -213,19 +199,19 @@ public abstract class GadgetHtmlParser {
     }
     return document;
   }
-  
+
   protected void transferChildren(Node to, Node from) {
     while (from.hasChildNodes()) {
       to.appendChild(from.removeChild(from.getFirstChild()));
     }
   }
-  
+
   protected void prependToNode(Node to, LinkedList<Node> from) {
     while (!from.isEmpty()) {
       to.insertBefore(from.removeLast(), to.getFirstChild());
     }
   }
-  
+
   private boolean isStyleElement(Element elem) {
     return "style".equalsIgnoreCase(elem.getNodeName()) ||
            ("link".equalsIgnoreCase(elem.getNodeName()) &&
@@ -234,25 +220,25 @@ public abstract class GadgetHtmlParser {
   }
 
   /**
-   * Parses a snippet of markup and appends the result as children to the 
+   * Parses a snippet of markup and appends the result as children to the
    * provided node.
-   * 
+   *
    * @param source markup to be parsed
    * @param result Node to append results to
    * @throws GadgetException
    */
   public void parseFragment(String source, Node result) throws GadgetException {
     boolean shouldCache = shouldCache();
-    String key = null;    
+    String key = null;
     if (shouldCache) {
-      key = HashUtil.rawChecksum(source.getBytes());
+      key = HashUtil.checksum(source.getBytes());
       DocumentFragment cachedFragment = fragmentCache.getElement(key);
       if (cachedFragment != null) {
         copyFragment(cachedFragment, result);
         return;
       }
     }
-    
+
     DocumentFragment fragment = null;
     try {
       fragment = parseFragmentImpl(source);
@@ -261,7 +247,7 @@ public abstract class GadgetHtmlParser {
       appendParseException(result, e);
       return;
     }
-    
+
     reprocessScriptForOpenSocial(fragment);
     if (shouldCache) {
       fragmentCache.addElement(key, fragment);
@@ -275,9 +261,9 @@ public abstract class GadgetHtmlParser {
     for (int i = 0; i < nodes.getLength(); i++) {
       Node clone = destDoc.importNode(nodes.item(i), true);
       dest.appendChild(clone);
-    }    
+    }
   }
-  
+
   protected Document errorDom(DOMException e) {
     // Create a bare-bones DOM whose body is just error text.
     // We do this to echo information to the developer that originally
@@ -293,16 +279,16 @@ public abstract class GadgetHtmlParser {
     doc.appendChild(html);
     return doc;
   }
-  
+
   private void appendParseException(Node node, DOMException e) {
     node.appendChild(node.getOwnerDocument().createTextNode(
         GadgetException.Code.HTML_PARSE_ERROR.toString() + ": " + e.toString()));
   }
-  
+
   protected boolean shouldCache() {
     return documentCache != null && documentCache.getCapacity() != 0;
   }
-  
+
   private void reprocessScriptForOpenSocial(Node root) throws GadgetException {
     LinkedList<Node> nodeQueue = Lists.newLinkedList();
     nodeQueue.add(root);
@@ -311,7 +297,8 @@ public abstract class GadgetHtmlParser {
       if (next.getNodeType() == Node.ELEMENT_NODE &&
           "script".equalsIgnoreCase(next.getNodeName())) {
         Attr typeAttr = (Attr)next.getAttributes().getNamedItem("type");
-        if (typeAttr != null && SCRIPT_TYPE_TO_OSML_TAG.get(typeAttr.getValue()) != null) {
+        if (typeAttr != null &&
+            SocialDataTags.SCRIPT_TYPE_TO_OSML_TAG.get(typeAttr.getValue()) != null) {
           // The underlying parser impl may have already parsed these.
           // Only re-parse with the coalesced text children if that's all there are.
           boolean parseOs = true;
@@ -340,7 +327,7 @@ public abstract class GadgetHtmlParser {
           }
         }
       }
-      
+
       // Enqueue children for inspection.
       NodeList children = next.getChildNodes();
       for (int i = 0; i < children.getLength(); ++i) {
@@ -348,7 +335,7 @@ public abstract class GadgetHtmlParser {
       }
     }
   }
-  
+
   /**
    * TODO: remove the need for parseDomImpl as a parsing method. Gadget HTML is
    * tag soup handled in custom fashion, or is a legitimate fragment. In either case,
@@ -365,7 +352,7 @@ public abstract class GadgetHtmlParser {
    * @return a DocumentFragment containing the parsed elements
    * @throws GadgetException
    */
-  protected abstract DocumentFragment parseFragmentImpl(String source) 
+  protected abstract DocumentFragment parseFragmentImpl(String source)
       throws GadgetException;
 
   private static class DefaultSerializerProvider implements Provider<HtmlSerializer> {

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssLexerParser.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssLexerParser.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssLexerParser.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssLexerParser.java Wed Jun 23 06:23:54 2010
@@ -69,7 +69,7 @@ public class CajaCssLexerParser {
     String key = null;
     if (shouldCache) {
       // TODO - Consider using the source if its under a certain size
-      key = HashUtil.rawChecksum(content.getBytes());
+      key = HashUtil.checksum(content.getBytes());
       parsedCss = parsedCssCache.getElement(key);
     }
     if (parsedCss == null) {
@@ -183,6 +183,7 @@ public class CajaCssLexerParser {
       this.uri = uri;
     }
 
+    @Override
     public String toString() {
       return "@import url('" + uri + "');\n";
     }
@@ -204,6 +205,7 @@ public class CajaCssLexerParser {
       this.uri = uri;
     }
 
+    @Override
     public String toString() {
       return "url('" + uri + "')";
     }

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssParser.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssParser.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssParser.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssParser.java Wed Jun 23 06:23:54 2010
@@ -77,7 +77,7 @@ public class CajaCssParser {
     String key = null;
     if (shouldCache) {
       // TODO - Consider using the source if its under a certain size
-      key = HashUtil.rawChecksum(content.getBytes());
+      key = HashUtil.checksum(content.getBytes());
       parsedCss = parsedCssCache.getElement(key);
     }
     if (parsedCss == null) {

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java Wed Jun 23 06:23:54 2010
@@ -51,7 +51,7 @@ import java.util.logging.Logger;
  */
 public class CajaCssSanitizer {
 
-  private static final Logger logger = Logger.getLogger(CajaCssSanitizer.class.getName());
+  private static final Logger LOG = Logger.getLogger(CajaCssSanitizer.class.getName());
 
   private static final Set<String> ALLOWED_URI_SCHEMES = ImmutableSet.of("http", "https");
 
@@ -81,7 +81,7 @@ public class CajaCssSanitizer {
       return parser.serialize(stylesheet);
     } catch (GadgetException ge) {
       // Failed to parse stylesheet so log and continue
-      logger.log(Level.INFO, "Failed to parse stylesheet", ge);
+      LOG.log(Level.INFO, "Failed to parse stylesheet", ge);
       return "";
     }
   }
@@ -103,7 +103,7 @@ public class CajaCssSanitizer {
       content = parser.serialize(stylesheet);
     } catch (GadgetException ge) {
       // Failed to parse stylesheet so log and continue
-      logger.log(Level.INFO, "Failed to parse stylesheet", ge);
+      LOG.log(Level.INFO, "Failed to parse stylesheet", ge);
     }
     if (StringUtils.isEmpty(content)) {
       // Remove the owning node
@@ -128,8 +128,8 @@ public class CajaCssSanitizer {
           if (!schema.isPropertyAllowed(((CssTree.Property) ancestorChain.node).
               getPropertyName())) {
             // Remove offending property
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing property "
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing property "
                   + ((CssTree.Property) ancestorChain.node).getPropertyName());
             }
             clean(ancestorChain);
@@ -137,8 +137,8 @@ public class CajaCssSanitizer {
         } else if (ancestorChain.node instanceof CssTree.FunctionCall) {
           if (!schema.isFunctionAllowed(((CssTree.FunctionCall)ancestorChain.node).getName())) {
             // Remove offending node
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing function "
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing function "
                   + ((CssTree.FunctionCall) ancestorChain.node).getName());
             }
             clean(ancestorChain);
@@ -152,8 +152,8 @@ public class CajaCssSanitizer {
                 rewriteUri(imageRewriter, uri, linkContext));
           } else {
             // Remove offending node
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing invalid URI " + uri);
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing invalid URI " + uri);
             }
             clean(ancestorChain);
           }
@@ -163,8 +163,8 @@ public class CajaCssSanitizer {
           if (isValidUri(uri)) {
             importDecl.getUri().setValue(rewriteUri(importRewriter, uri, linkContext));
           } else {
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing invalid URI " + uri);
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing invalid URI " + uri);
             }
             clean(ancestorChain);
           }
@@ -197,8 +197,8 @@ public class CajaCssSanitizer {
       return StringUtils.isEmpty(scheme) ||
           ALLOWED_URI_SCHEMES.contains(scheme.toLowerCase());
     } catch (RuntimeException re) {
-      if (logger.isLoggable(Level.FINE)) {
-        logger.log(Level.FINE, "Failed to parse URI in CSS " + uri, re);
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.log(Level.FINE, "Failed to parse URI in CSS " + uri, re);
       }
     }
     return false;

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaHtmlParser.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaHtmlParser.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaHtmlParser.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaHtmlParser.java Wed Jun 23 06:23:54 2010
@@ -141,9 +141,8 @@ public class CajaHtmlParser extends Gadg
     HtmlLexer lexer = new HtmlLexer(CharProducer.Factory.fromString(source, is));
     final Namespaces ns = Namespaces.HTML_DEFAULT;  // Includes OpenSocial
     final boolean needsDebugData = needsDebugData();
-    DomParser parser = new DomParser(lexer, is, ns, mq);
+    DomParser parser = new DomParser(lexer, /* wantsComments */ true, is, ns, mq);
     parser.setDomImpl(documentFactory);
-    parser.setWantsComments(true);
     parser.setNeedsDebugData(needsDebugData);
     return parser;
   }

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/old/CajaCssSanitizer.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/old/CajaCssSanitizer.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/old/CajaCssSanitizer.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/old/CajaCssSanitizer.java Wed Jun 23 06:23:54 2010
@@ -49,7 +49,7 @@ import java.util.logging.Logger;
  */
 public class CajaCssSanitizer {
 
-  private static final Logger logger = Logger.getLogger(CajaCssSanitizer.class.getName());
+  private static final Logger LOG = Logger.getLogger(CajaCssSanitizer.class.getName());
 
   private static final Set<String> ALLOWED_URI_SCHEMES = ImmutableSet.of("http", "https");
 
@@ -79,7 +79,7 @@ public class CajaCssSanitizer {
       return parser.serialize(stylesheet);
     } catch (GadgetException ge) {
       // Failed to parse stylesheet so log and continue
-      logger.log(Level.INFO, "Failed to parse stylesheet", ge);
+      LOG.log(Level.INFO, "Failed to parse stylesheet", ge);
       return "";
     }
   }
@@ -101,7 +101,7 @@ public class CajaCssSanitizer {
       content = parser.serialize(stylesheet);
     } catch (GadgetException ge) {
       // Failed to parse stylesheet so log and continue
-      logger.log(Level.INFO, "Failed to parse stylesheet", ge);
+      LOG.log(Level.INFO, "Failed to parse stylesheet", ge);
     }
     if (StringUtils.isEmpty(content)) {
       // Remove the owning node
@@ -126,8 +126,8 @@ public class CajaCssSanitizer {
           if (!schema.isPropertyAllowed(((CssTree.Property) ancestorChain.node).
               getPropertyName())) {
             // Remove offending property
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing property "
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing property "
                   + ((CssTree.Property) ancestorChain.node).getPropertyName());
             }
             clean(ancestorChain);
@@ -135,8 +135,8 @@ public class CajaCssSanitizer {
         } else if (ancestorChain.node instanceof CssTree.FunctionCall) {
           if (!schema.isFunctionAllowed(((CssTree.FunctionCall)ancestorChain.node).getName())) {
             // Remove offending node
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing function "
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing function "
                   + ((CssTree.FunctionCall) ancestorChain.node).getName());
             }
             clean(ancestorChain);
@@ -150,8 +150,8 @@ public class CajaCssSanitizer {
                 imageRewriter.rewrite(uri, linkContext));
           } else {
             // Remove offending node
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing invalid URI " + uri);
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing invalid URI " + uri);
             }
             clean(ancestorChain);
           }
@@ -161,8 +161,8 @@ public class CajaCssSanitizer {
           if (isValidUri(uri)) {
             importDecl.getUri().setValue(importRewriter.rewrite(uri, linkContext));
           } else {
-            if (logger.isLoggable(Level.FINE)) {
-              logger.log(Level.FINE, "Removing invalid URI " + uri);
+            if (LOG.isLoggable(Level.FINE)) {
+              LOG.log(Level.FINE, "Removing invalid URI " + uri);
             }
             clean(ancestorChain);
           }
@@ -178,8 +178,8 @@ public class CajaCssSanitizer {
       return StringUtils.isEmpty(scheme) ||
           ALLOWED_URI_SCHEMES.contains(scheme.toLowerCase());
     } catch (RuntimeException re) {
-      if (logger.isLoggable(Level.FINE)) {
-        logger.log(Level.FINE, "Failed to parse URI in CSS " + uri, re);
+      if (LOG.isLoggable(Level.FINE)) {
+        LOG.log(Level.FINE, "Failed to parse URI in CSS " + uri, re);
       }
     }
     return false;

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/nekohtml/NekoSimplifiedHtmlParser.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/nekohtml/NekoSimplifiedHtmlParser.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/nekohtml/NekoSimplifiedHtmlParser.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/nekohtml/NekoSimplifiedHtmlParser.java Wed Jun 23 06:23:54 2010
@@ -22,6 +22,7 @@ import org.apache.commons.lang.StringUti
 import org.apache.shindig.common.xml.DomUtil;
 import org.apache.shindig.gadgets.GadgetException;
 import org.apache.shindig.gadgets.parse.GadgetHtmlParser;
+import org.apache.shindig.gadgets.parse.SocialDataTags;
 import org.apache.xerces.xni.Augmentations;
 import org.apache.xerces.xni.NamespaceContext;
 import org.apache.xerces.xni.QName;
@@ -70,8 +71,8 @@ public class NekoSimplifiedHtmlParser ex
 
   static {
     HTMLElements.Element unknown = HTMLElements.getElement(HTMLElements.UNKNOWN);
-    OSML_TEMPLATE_ELEMENT = new HTMLElements.Element(unknown.code, OSML_TEMPLATE_TAG,
-        unknown.flags, HTMLElements.BODY, unknown.closes);
+    OSML_TEMPLATE_ELEMENT = new HTMLElements.Element(unknown.code,
+        SocialDataTags.OSML_TEMPLATE_TAG, unknown.flags, HTMLElements.BODY, unknown.closes);
     // Passing parent in constructor is ignored.
     // Only allow template tags in BODY
     OSML_TEMPLATE_ELEMENT.parent =
@@ -79,14 +80,15 @@ public class NekoSimplifiedHtmlParser ex
 
     // data tags are allowed in BODY only, since Neko disallows HEAD elements from
     // having child elements of their own.
-    OSML_DATA_ELEMENT = new HTMLElements.Element(unknown.code, OSML_TEMPLATE_TAG,
-        unknown.flags, HTMLElements.BODY, unknown.closes);
+    OSML_DATA_ELEMENT = new HTMLElements.Element(unknown.code,
+        SocialDataTags.OSML_TEMPLATE_TAG, unknown.flags, HTMLElements.BODY, unknown.closes);
     OSML_DATA_ELEMENT.parent = new HTMLElements.Element[]{
         HTMLElements.getElement(HTMLElements.BODY)};
   }
 
   private static final Map<String, HTMLElements.Element> OSML_ELEMENTS = ImmutableMap.of(
-      OSML_TEMPLATE_TAG, OSML_TEMPLATE_ELEMENT, OSML_DATA_TAG, OSML_DATA_ELEMENT);
+      SocialDataTags.OSML_TEMPLATE_TAG, OSML_TEMPLATE_ELEMENT,
+      SocialDataTags.OSML_DATA_TAG, OSML_DATA_ELEMENT);
 
   @Inject
   public NekoSimplifiedHtmlParser(DOMImplementation documentFactory) {
@@ -456,7 +458,7 @@ public class NekoSimplifiedHtmlParser ex
    * if the first parsed tags are allowed in a head tag.
    * See https://sourceforge.net/tracker/?func=detail&atid=952178&aid=2870180&group_id=195122
    */
-  private class NekoPatchTagBalancer extends NormalizingTagBalancer {
+  private static class NekoPatchTagBalancer extends NormalizingTagBalancer {
 
     /**
      * Override the document start to record whether HTML, HEAD or BODY have been seen
@@ -532,7 +534,7 @@ public class NekoSimplifiedHtmlParser ex
       // Convert script tags of an OSML type to OSTemplate/OSData tags
       if ("script".equalsIgnoreCase(elem.rawname)) {
         String value = attrs.getValue("type");
-        String osmlTagName = SCRIPT_TYPE_TO_OSML_TAG.get(value);
+        String osmlTagName = SocialDataTags.SCRIPT_TYPE_TO_OSML_TAG.get(value);
         if (osmlTagName != null) {
           if (currentOsmlTag != null) {
             throw new XNIException("Nested OpenSocial script elements");
@@ -551,7 +553,6 @@ public class NekoSimplifiedHtmlParser ex
       super.startElement(elem, attrs, augs);
     }
 
-
     @Override
     public void endElement(QName element, Augmentations augs) throws XNIException {
       if (currentOsmlTag != null && "script".equalsIgnoreCase(element.rawname)) {

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/PipelineExecutor.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/PipelineExecutor.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/PipelineExecutor.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/PipelineExecutor.java Wed Jun 23 06:23:54 2010
@@ -45,7 +45,7 @@ import com.google.inject.Inject;
 public class PipelineExecutor {
   // TODO: support configuration
   private static final int MAX_BATCH_COUNT = 3;
-  private static final Logger logger = Logger.getLogger(PipelineExecutor.class.getName());
+  private static final Logger LOG = Logger.getLogger(PipelineExecutor.class.getName());
 
   private PipelinedDataPreloader preloader;
   private PreloaderService preloaderService;
@@ -141,7 +141,7 @@ public class PipelineExecutor {
           }
         } catch (PreloadException pe) {
           // This will be thrown in the event of some unexpected exception. We can move on.
-          logger.log(Level.WARNING, "Unexpected error when preloading", pe);
+          LOG.log(Level.WARNING, "Unexpected error when preloading", pe);
         }
       }
 

Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/OpenSocialI18NGadgetRewriter.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/OpenSocialI18NGadgetRewriter.java?rev=957119&r1=957118&r2=957119&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/OpenSocialI18NGadgetRewriter.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/OpenSocialI18NGadgetRewriter.java Wed Jun 23 06:23:54 2010
@@ -109,7 +109,7 @@ public class OpenSocialI18NGadgetRewrite
     return localeName;
   }
 
-  private String attemptToLoadDateConstants(String localeName) throws IOException {
+  protected String attemptToLoadDateConstants(String localeName) throws IOException {
     return attemptToLoadResource("DateTimeConstants__" + localeName + ".js");
   }
   
@@ -121,4 +121,3 @@ public class OpenSocialI18NGadgetRewrite
     return ResourceLoader.getContent(resource);
   }
 }
-