Author: doll
Date: Fri Apr 18 05:29:54 2008
New Revision: 649495

URL: http://svn.apache.org/viewvc?rev=649495&view=rev
Log:
Added a new CommonGuiceModule. This contains all the guice bindings that will 
be the same for the social and gadgets servers. This enables the servers to run 
by themseleves and to run together (because in guice you can't bind something 
more than once)

Note: This class belongs in the java/common package. However, I can not put it 
there right now because it depends on gadgets packages. This can not be fixed 
until all of the social gadgets dependencies are refactored. It will be fixed 
in the future though.


Added:
    
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/common/
    
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/common/CommonGuiceModule.java
Modified:
    
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
    incubator/shindig/trunk/java/gadgets/src/main/webapp/WEB-INF/web.xml
    
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/SocialApiGuiceModule.java
    incubator/shindig/trunk/java/social-api/src/main/webapp/WEB-INF/web.xml

Added: 
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/common/CommonGuiceModule.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/common/CommonGuiceModule.java?rev=649495&view=auto
==============================================================================
--- 
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/common/CommonGuiceModule.java
 (added)
+++ 
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/common/CommonGuiceModule.java
 Fri Apr 18 05:29:54 2008
@@ -0,0 +1,23 @@
+package org.apache.shindig.common;
+
+import com.google.inject.AbstractModule;
+import org.apache.shindig.gadgets.BasicGadgetTokenDecoder;
+import org.apache.shindig.gadgets.BasicRemoteContentFetcher;
+import org.apache.shindig.gadgets.GadgetTokenDecoder;
+import org.apache.shindig.gadgets.RemoteContentFetcher;
+
+/**
+ * Provides social api component injection
+ */
+public class CommonGuiceModule extends AbstractModule {
+
+  /** [EMAIL PROTECTED] */
+  @Override
+  protected void configure() {
+    // TODO: These classes should be moved into the common package.
+    // Once that happens then this common guice module can also move to
+    // java/common.
+    bind(RemoteContentFetcher.class).to(BasicRemoteContentFetcher.class);
+    bind(GadgetTokenDecoder.class).to(BasicGadgetTokenDecoder.class);
+  }
+}

Modified: 
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java?rev=649495&r1=649494&r2=649495&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
 (original)
+++ 
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
 Fri Apr 18 05:29:54 2008
@@ -20,7 +20,6 @@
 
 import com.google.inject.AbstractModule;
 import com.google.inject.CreationException;
-import com.google.inject.Inject;
 import com.google.inject.Scopes;
 import com.google.inject.name.Names;
 import com.google.inject.spi.Message;
@@ -46,8 +45,6 @@
   protected void configure() {
     Names.bindProperties(this.binder(), properties);
 
-    bind(RemoteContentFetcher.class).to(BasicRemoteContentFetcher.class);
-
     bind(RemoteContentFetcher.class)
         .annotatedWith(GadgetSpecFetcher.class)
         .to(CachedContentFetcher.class);
@@ -56,7 +53,6 @@
         .to(CachedContentFetcher.class);
 
     bind(GadgetBlacklist.class).to(BasicGadgetBlacklist.class);
-    bind(GadgetTokenDecoder.class).to(BasicGadgetTokenDecoder.class);
     bind(SigningFetcherFactory.class);
     bind(OAuthFetcherFactory.class);
     bind(Executor.class).toInstance(Executors.newCachedThreadPool());

Modified: incubator/shindig/trunk/java/gadgets/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/webapp/WEB-INF/web.xml?rev=649495&r1=649494&r2=649495&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/webapp/WEB-INF/web.xml 
(original)
+++ incubator/shindig/trunk/java/gadgets/src/main/webapp/WEB-INF/web.xml Fri 
Apr 18 05:29:54 2008
@@ -26,7 +26,7 @@
   <!-- If you have your own Guice module(s), put them here as a 
colon-separated list. -->
   <context-param>
     <param-name>guice-modules</param-name>
-    <param-value>org.apache.shindig.gadgets.http.HttpGuiceModule</param-value>
+    
<param-value>org.apache.shindig.common.CommonGuiceModule:org.apache.shindig.gadgets.http.HttpGuiceModule</param-value>
   </context-param>
 
   <listener>

Modified: 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/SocialApiGuiceModule.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/SocialApiGuiceModule.java?rev=649495&r1=649494&r2=649495&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/SocialApiGuiceModule.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/SocialApiGuiceModule.java
 Fri Apr 18 05:29:54 2008
@@ -23,33 +23,25 @@
 import com.google.inject.Provider;
 import com.google.inject.TypeLiteral;
 import org.apache.shindig.social.opensocial.ActivitiesService;
-import org.apache.shindig.social.opensocial.PeopleService;
 import org.apache.shindig.social.opensocial.DataService;
 import org.apache.shindig.social.opensocial.OpenSocialDataHandler;
+import org.apache.shindig.social.opensocial.PeopleService;
 import org.apache.shindig.social.samplecontainer.BasicActivitiesService;
-import org.apache.shindig.social.samplecontainer.BasicPeopleService;
 import org.apache.shindig.social.samplecontainer.BasicDataService;
+import org.apache.shindig.social.samplecontainer.BasicPeopleService;
 import org.apache.shindig.social.samplecontainer.StateFileDataHandler;
-import org.apache.shindig.gadgets.RemoteContentFetcher;
-import org.apache.shindig.gadgets.BasicRemoteContentFetcher;
-import org.apache.shindig.gadgets.GadgetTokenDecoder;
-import org.apache.shindig.gadgets.BasicGadgetTokenDecoder;
 
-import java.util.Properties;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
- * Provides http component injection on top of existing components.
+ * Provides social api component injection
  */
 public class SocialApiGuiceModule extends AbstractModule {
 
   /** [EMAIL PROTECTED] */
   @Override
   protected void configure() {
-    bind(RemoteContentFetcher.class).to(BasicRemoteContentFetcher.class);
-    bind(GadgetTokenDecoder.class).to(BasicGadgetTokenDecoder.class);
-
     bind(PeopleService.class).to(BasicPeopleService.class);
     bind(DataService.class).to(BasicDataService.class);
     bind(ActivitiesService.class).to(BasicActivitiesService.class);

Modified: 
incubator/shindig/trunk/java/social-api/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/webapp/WEB-INF/web.xml?rev=649495&r1=649494&r2=649495&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/webapp/WEB-INF/web.xml 
(original)
+++ incubator/shindig/trunk/java/social-api/src/main/webapp/WEB-INF/web.xml Fri 
Apr 18 05:29:54 2008
@@ -26,7 +26,7 @@
   <!-- If you have your own Guice module(s), put them here as a 
colon-separated list. -->
   <context-param>
     <param-name>guice-modules</param-name>
-    <param-value>org.apache.shindig.social.SocialApiGuiceModule</param-value>
+    
<param-value>org.apache.shindig.common.CommonGuiceModule:org.apache.shindig.social.SocialApiGuiceModule</param-value>
   </context-param>
 
   <listener>


Reply via email to