/** * Copyright (C) 2010 INRIA, University of Lille 1 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Contact: frascati@ow2.org * * Author: Christophe Demarey * * Contributor(s): * */ package com.programmez.sca.wunderground; import net.webservicex.GlobalWeatherSoap; import org.osoa.sca.annotations.Reference; /** * This component is used as a proxy. It provides a service compliant with the * www.webservicex.net/globalWeather service but uses another weather service provider: * http://api.wunderground.com. */ public class WundergroundProxy implements GlobalWeatherSoap { /** * Reference to the Weather Underground service. */ @Reference private Wunderground weatherBackUp; @Override public String getCitiesByCountry(String country) { // TODO Auto-generated method stub return null; } @Override public String getWeather(String city, String country) { StringBuilder sb = new StringBuilder().append(city).append(',').append(country); Forecast forecast = weatherBackUp.getWeather( sb.toString() ); return forecast.getTxt_forecast().getForecastdays().get(0).getFcttext(); } }