Reviewers: dev-remailer_shindig.apache.org,

Description:
This patch makes the following enhancements to
org.apache.shindig.gadgets.AbstractSpecFactory$Query:

1. Changes the visibility of all existing fields from private to
protected, for easier subclassing.

2. Adds a field of type GadgetContext, along with corresponding setter
and getter methods.

The latter would make it possible to embed the GadgetContext passed to
GadgetSpecFactory#getGadgetSpec into the Query object that is generated
as part of this call and passed to AbstractSpecFactory#getSpec(Query).

As a result of this, AbstractSpecFactory#parse(String, Query) would now
be able to retrieve the GadgetContext from the Query argument, and from
the GadgetContext, things like the Locale.


Please review this at http://codereview.appspot.com/1688043/show

Affected files:
java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java


Index: java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java
===================================================================
--- java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java (revision 954679) +++ java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java (working copy)
@@ -159,10 +159,11 @@
    * Holds information used to fetch a spec.
    */
   protected static class Query {
-    private Uri specUri = null;
-    private String container = ContainerConfig.DEFAULT_CONTAINER;
-    private Uri gadgetUri = null;
-    private boolean ignoreCache = false;
+    protected Uri specUri = null;
+    protected String container = ContainerConfig.DEFAULT_CONTAINER;
+    protected Uri gadgetUri = null;
+    protected boolean ignoreCache = false;
+    protected GadgetContext gadgetContext = null;

     public Query setSpecUri(Uri specUri) {
       this.specUri = specUri;
@@ -184,6 +185,11 @@
       return this;
     }

+    public Query setGadgetContext (GadgetContext gadgetContext) {
+      this.gadgetContext = gadgetContext;
+      return this;
+    }
+
     public Uri getSpecUri() {
       return specUri;
     }
@@ -199,6 +205,10 @@
     public boolean getIgnoreCache() {
       return ignoreCache;
     }
+
+    public GadgetContext getGadgetContext() {
+      return gadgetContext;
+    }
   }

   private class SpecUpdater implements Runnable {


Reply via email to