Author: johnh
Date: Tue Nov 9 01:28:49 2010
New Revision: 1032801
URL: http://svn.apache.org/viewvc?rev=1032801&view=rev
Log:
Separate out ConfigContributor defaults into a new module.
Added:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/config/DefaultConfigContributorModule.java
Modified:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
Modified:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java?rev=1032801&r1=1032800&r2=1032801&view=diff
==============================================================================
---
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
(original)
+++
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
Tue Nov 9 01:28:49 2010
@@ -23,18 +23,13 @@ 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.config.DefaultConfigContributorModule;
import org.apache.shindig.gadgets.http.HttpResponse;
import org.apache.shindig.gadgets.http.InvalidationHandler;
import org.apache.shindig.gadgets.parse.ParseModule;
@@ -80,6 +75,7 @@ public class DefaultGuiceModule extends
}
});
+ install(new DefaultConfigContributorModule());
install(new ParseModule());
install(new PreloadModule());
install(new RenderModule());
@@ -94,7 +90,6 @@ public class DefaultGuiceModule extends
requestStaticInjection(HttpResponse.class);
registerGadgetHandlers();
- registerConfigContributors();
registerFeatureHandlers();
}
@@ -107,15 +102,7 @@ public class DefaultGuiceModule extends
handlerBinder.addBinding().to(HttpRequestHandler.class);
handlerBinder.addBinding().to(GadgetsHandler.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
*/
Added:
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/config/DefaultConfigContributorModule.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/config/DefaultConfigContributorModule.java?rev=1032801&view=auto
==============================================================================
---
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/config/DefaultConfigContributorModule.java
(added)
+++
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/config/DefaultConfigContributorModule.java
Tue Nov 9 01:28:49 2010
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shindig.gadgets.config;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.MapBinder;
+
+/**
+ * Registers base config contribution bindings.
+ */
+public class DefaultConfigContributorModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ registerConfigContributors();
+ }
+
+ 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);
+ }
+
+}