Examples of YahooWeatherServiceStatus


Examples of com.googlecode.mashups.services.yahoo.api.YahooWeatherServiceStatus

           
            parameters.add(new ServiceParameter(YahooWeatherServiceParameters.ZIP_CODE, locationCode));
            parameters.add(new ServiceParameter(YahooWeatherServiceParameters.TEMPERATURE_TYPE, temperatureType));
           
            try {
                YahooWeatherServiceStatus status = yahooWeatherService.getWeatherStatus(parameters);
                
                writer.write(status.toString());
            } catch (InvalidLocationException exception) {
                writer.write("");               
            } catch (Exception exception) {
                exception.printStackTrace();
                writer.write("Yahoo Weather Service Error: " + exception.getMessage());
View Full Code Here

Examples of com.googlecode.mashups.services.yahoo.api.YahooWeatherServiceStatus

        weatherStatusParameters.add(new ServiceParameter(YahooWeatherServiceParameters.TEMPERATURE_TYPE, "c"));
       
        YahooWeatherService yahooWeatherService = YahooServicesFactory.getYahooWeatherService();
       
        try {
            YahooWeatherServiceStatus status = yahooWeatherService.getWeatherStatus(weatherStatusParameters);
           
            System.out.println("Output: \n\r" + status);
        } catch (Exception e) {
            e.printStackTrace();
            fail("Unable to get the weather status ...");
View Full Code Here

Examples of com.googlecode.mashups.services.yahoo.api.YahooWeatherServiceStatus

        URL                       feedUrl              = new URL(YAHOO_WEATHER_SERVICE_URL
                                                       + "?"
                                                       + ServiceParametersUtility.toParametersString(parameters));
        SyndFeedInput             input                = new SyndFeedInput();
        SyndFeed                  feed                 = input.build(new InputStreamReader(feedUrl.openStream()));   
        YahooWeatherServiceStatus weatherServiceStatus = new YahooWeatherServiceStatus();
       
        if (feed.getEntries() != null && feed.getEntries().size() > 0) {
            SyndEntry entry = ((SyndEntry) feed.getEntries().get(0));
           
            String title = entry.getTitle();           
            String description = entry.getDescription().getValue();
           
            if (description.indexOf(RESPONSE_INVALID_KEYWORD) >= 0) {
                throw new InvalidLocationException(RESPONSE_INVALID_LOCATION);
            }
           
            weatherServiceStatus.setTitle(title);
            weatherServiceStatus.setDescription(description);
        }
       
        return weatherServiceStatus;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.