Statistics
| Branch: | Revision:

root / extensions / gae / src / main / java / org / jclouds / gae / config / GoogleAppEngineConfigurationModule.java @ 35e7942d

History | View | Annotate | Download (2.5 kB)

1 35e7942d Michael Mayo
/**
2 35e7942d Michael Mayo
 *
3 35e7942d Michael Mayo
 * Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
4 35e7942d Michael Mayo
 *
5 35e7942d Michael Mayo
 * ====================================================================
6 35e7942d Michael Mayo
 * Licensed under the Apache License, Version 2.0 (the "License");
7 35e7942d Michael Mayo
 * you may not use this file except in compliance with the License.
8 35e7942d Michael Mayo
 * You may obtain a copy of the License at
9 35e7942d Michael Mayo
 *
10 35e7942d Michael Mayo
 * http://www.apache.org/licenses/LICENSE-2.0
11 35e7942d Michael Mayo
 *
12 35e7942d Michael Mayo
 * Unless required by applicable law or agreed to in writing, software
13 35e7942d Michael Mayo
 * distributed under the License is distributed on an "AS IS" BASIS,
14 35e7942d Michael Mayo
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 35e7942d Michael Mayo
 * See the License for the specific language governing permissions and
16 35e7942d Michael Mayo
 * limitations under the License.
17 35e7942d Michael Mayo
 * ====================================================================
18 35e7942d Michael Mayo
 */
19 35e7942d Michael Mayo
package org.jclouds.gae.config;
20 35e7942d Michael Mayo
21 35e7942d Michael Mayo
import org.jclouds.concurrent.SingleThreaded;
22 35e7942d Michael Mayo
import org.jclouds.concurrent.config.ConfiguresExecutorService;
23 35e7942d Michael Mayo
import org.jclouds.concurrent.config.ExecutorServiceModule;
24 35e7942d Michael Mayo
import org.jclouds.date.joda.config.JodaDateServiceModule;
25 35e7942d Michael Mayo
import org.jclouds.encryption.bouncycastle.config.BouncyCastleEncryptionServiceModule;
26 35e7942d Michael Mayo
import org.jclouds.gae.GaeHttpCommandExecutorService;
27 35e7942d Michael Mayo
import org.jclouds.http.HttpCommandExecutorService;
28 35e7942d Michael Mayo
import org.jclouds.http.TransformingHttpCommandExecutorService;
29 35e7942d Michael Mayo
import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl;
30 35e7942d Michael Mayo
import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
31 35e7942d Michael Mayo
32 35e7942d Michael Mayo
import com.google.appengine.api.urlfetch.URLFetchService;
33 35e7942d Michael Mayo
import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
34 35e7942d Michael Mayo
import com.google.common.util.concurrent.Executors;
35 35e7942d Michael Mayo
import com.google.inject.Provides;
36 35e7942d Michael Mayo
37 35e7942d Michael Mayo
/**
38 35e7942d Michael Mayo
 * Configures {@link GaeHttpCommandExecutorService}.
39 35e7942d Michael Mayo
 * 
40 35e7942d Michael Mayo
 * @author Adrian Cole
41 35e7942d Michael Mayo
 */
42 35e7942d Michael Mayo
@ConfiguresHttpCommandExecutorService
43 35e7942d Michael Mayo
@ConfiguresExecutorService
44 35e7942d Michael Mayo
@SingleThreaded
45 35e7942d Michael Mayo
public class GoogleAppEngineConfigurationModule extends ExecutorServiceModule {
46 35e7942d Michael Mayo
47 35e7942d Michael Mayo
   public GoogleAppEngineConfigurationModule() {
48 35e7942d Michael Mayo
      super(Executors.sameThreadExecutor(), Executors.sameThreadExecutor());
49 35e7942d Michael Mayo
   }
50 35e7942d Michael Mayo
51 35e7942d Michael Mayo
   @Override
52 35e7942d Michael Mayo
   protected void configure() {
53 35e7942d Michael Mayo
      super.configure();
54 35e7942d Michael Mayo
      install(new BouncyCastleEncryptionServiceModule());
55 35e7942d Michael Mayo
      install(new JodaDateServiceModule());
56 35e7942d Michael Mayo
      bind(HttpCommandExecutorService.class).to(GaeHttpCommandExecutorService.class);
57 35e7942d Michael Mayo
      bind(TransformingHttpCommandExecutorService.class).to(
58 35e7942d Michael Mayo
               TransformingHttpCommandExecutorServiceImpl.class);
59 35e7942d Michael Mayo
   }
60 35e7942d Michael Mayo
61 35e7942d Michael Mayo
   @Provides
62 35e7942d Michael Mayo
   URLFetchService provideURLFetchService() {
63 35e7942d Michael Mayo
      return URLFetchServiceFactory.getURLFetchService();
64 35e7942d Michael Mayo
   }
65 35e7942d Michael Mayo
}