001 /*
002 * Apache License
003 * Version 2.0, January 2004
004 * http://www.apache.org/licenses/
005 *
006 * Copyright 2008 by chenillekit.org
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 */
014
015 package org.chenillekit.google;
016
017 import org.apache.tapestry5.ioc.MappedConfiguration;
018 import org.apache.tapestry5.ioc.annotations.Inject;
019 import org.apache.tapestry5.ioc.annotations.Symbol;
020
021 import org.chenillekit.google.services.GoogleGeoCoder;
022 import org.chenillekit.google.services.impl.GoogleGeoCoderImpl;
023 import org.slf4j.Logger;
024
025 /**
026 * @version $Id: ChenilleKitGoogleModule.java 594 2009-12-05 15:17:26Z mlusetti $
027 */
028 public class ChenilleKitGoogleModule
029 {
030 /**
031 * Contributes factory defaults that may be overridden.
032 */
033 public static void contributeFactoryDefaults(MappedConfiguration<String, String> contribution)
034 {
035 contribution.add(ChenilleKitGoogleConstants.GOOGLE_KEY, "");
036 contribution.add(ChenilleKitGoogleConstants.GOOGLE_PROXY, "");
037 contribution.add(ChenilleKitGoogleConstants.GOOGLE_REFERER, "");
038 contribution.add(ChenilleKitGoogleConstants.GOOGLE_TIMEOUT, "30000");
039 }
040
041 public static GoogleGeoCoder buildGoogleGeoCoder(Logger logger,
042
043 @Inject @Symbol(ChenilleKitGoogleConstants.GOOGLE_KEY)
044 final String googleKey,
045
046 @Inject @Symbol(ChenilleKitGoogleConstants.GOOGLE_TIMEOUT)
047 final int timeout,
048
049 @Inject @Symbol(ChenilleKitGoogleConstants.GOOGLE_PROXY)
050 final String proxy,
051
052 @Inject @Symbol(ChenilleKitGoogleConstants.GOOGLE_REFERER)
053 final String referer)
054 {
055 return new GoogleGeoCoderImpl(logger, googleKey, timeout, referer, proxy);
056 }
057 }