Package com.google.gdata.client

Examples of com.google.gdata.client.GoogleService


    mUseEMail.setEnabled(mReminderCheckBox.isSelected());
    mReminderText.setEnabled(mReminderCheckBox.isSelected());
  }

  private void fetchCalendarList(CalendarExportSettings settings, String password) throws IOException, ServiceException {
    GoogleService myService = new GoogleService("cl", "tvbrowser-tvbrowsercalenderplugin-" + CalendarExportPlugin.getInstance().getInfo().getVersion().toString());
    myService.setUserCredentials(settings.getExporterProperty(GoogleExporter.USERNAME).trim(), password);

    // Send the request and print the response
    URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/owncalendars/full");
    CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);

    DefaultComboBoxModel model = (DefaultComboBoxModel) mCalendarChooser.getModel();
    model.removeAllElements();

    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
View Full Code Here


        if (!showCalendarSettings(settings)) {
          return false;
        }
      }

      GoogleService myService = new GoogleService("cl", "tvbrowser-tvbrowsercalenderplugin-" + CalendarExportPlugin.getInstance().getInfo().getVersion().toString());
      myService.setUserCredentials(settings.getExporterProperty(USERNAME).trim(), mPassword);

      URL postUrl =
              new URL("http://www.google.com/calendar/feeds/" + settings.getExporterProperty(SELECTED_CALENDAR) + "/private/full");

      SimpleDateFormat formatDay = new SimpleDateFormat("yyyy-MM-dd");
      formatDay.setTimeZone(TimeZone.getTimeZone("GMT"));
      SimpleDateFormat formatTime = new SimpleDateFormat("HH:mm:ss");
      formatTime.setTimeZone(TimeZone.getTimeZone("GMT"));

      ParamParser parser = new ParamParser();
      for (Program program : programs) {
        final String title = parser.analyse(formatting.getTitleValue(), program);

        // First step: search for event in calendar
        boolean createEvent = true;

        CalendarEventEntry entry = findEntryForProgram(myService, postUrl, title, program);

        if (entry != null) {
          int ret = JOptionPane.showConfirmDialog(null, mLocalizer.msg("alreadyAvailable", "already available", program.getTitle()), mLocalizer.msg("title", "Add event?"),  JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);

          if (ret != JOptionPane.YES_OPTION) {
            createEvent = false;
          }
        }

        // add event to calendar
        if (createEvent) {
          EventEntry myEntry = new EventEntry();

          myEntry.setTitle(new PlainTextConstruct(title));

          String desc = parser.analyse(formatting.getContentValue(), program);
          myEntry.setContent(new PlainTextConstruct(desc));

          Calendar c = CalendarToolbox.getStartAsCalendar(program);

          DateTime startTime = new DateTime(c.getTime(), c.getTimeZone());

          c = CalendarToolbox.getEndAsCalendar(program);

          DateTime endTime = new DateTime(c.getTime(), c.getTimeZone());

          When eventTimes = new When();

          eventTimes.setStartTime(startTime);
          eventTimes.setEndTime(endTime);

          myEntry.addTime(eventTimes);

          if (settings.getExporterProperty(REMINDER, false)) {
            int reminderMinutes = 0;

            try {
              reminderMinutes = settings.getExporterProperty(REMINDER_MINUTES, 0);
            } catch (NumberFormatException e) {
              e.printStackTrace();
            }

            if (settings.getExporterProperty(REMINDER_ALERT, false)) {
              addReminder(myEntry, reminderMinutes, Reminder.Method.ALERT);
            }

            if (settings.getExporterProperty(REMINDER_EMAIL, false)) {
              addReminder(myEntry, reminderMinutes, Reminder.Method.EMAIL);
            }

            if (settings.getExporterProperty(REMINDER_SMS, false)) {
              addReminder(myEntry, reminderMinutes, Reminder.Method.SMS);
            }

          }

          if (settings.isShowBusy()) {
              myEntry.setTransparency(BaseEventEntry.Transparency.OPAQUE);
          }
          else {
              myEntry.setTransparency(BaseEventEntry.Transparency.TRANSPARENT);
          }
          // Send the request and receive the response:
          myService.insert(postUrl, myEntry);
          uploadedItems = true;
        }
      }

      if (uploadedItems) {
View Full Code Here

    }

    service = new DocsService(applicationName);

    // Creating a spreadsheets service is necessary for downloading spreadsheets
    spreadsheetsService = new GoogleService(SPREADSHEETS_SERVICE_NAME, applicationName);

    this.host = host;
  }
View Full Code Here

      Map<String, List<String>> cookieHeaders =
        new HashMap<String, List<String>>();

      // Only service requests initiated by GData services with cookie
      // handling enabled.
      GoogleService service = activeService.get();
      if (service != null && service.handlesCookies()) {

        // Get the list of matching cookies and accumulate a buffer
        // containing the cookie name/value pairs.
        Set<GoogleCookie> cookies = service.getCookies();
        StringBuilder cookieBuf = new StringBuilder();
        for (GoogleCookie cookie : cookies) {
          if (cookie.matches(uri)) {
            if (cookieBuf.length() > 0) {
              cookieBuf.append("; ");
View Full Code Here

                    Map<String, List<String>> responseHeaders)
        throws IOException {

      // Only service requests initiated by GData services with cookie
      // handling enabled.
      GoogleService service = activeService.get();
      if (service != null && service.handlesCookies()) {
        List<String> setCookieList = responseHeaders.get("Set-Cookie");
        if (setCookieList != null && setCookieList.size() > 0) {
          for (String cookieValue : setCookieList) {
            GoogleCookie cookie = new GoogleCookie(uri, cookieValue);
            service.addCookie(cookie);
            logger.fine("Adding cookie:" + cookie);
          }
        }
      } else {
        if (nextHandler != null) {
View Full Code Here

     
      // Capture the version used to process the request
      String versionHeader =
        httpConn.getHeaderField(GDataProtocol.Header.VERSION);
      if (versionHeader != null) {
        GoogleService service = activeService.get();
        if (service != null) {
          responseVersion = new Version(service.getClass(), versionHeader);
        }
       
      }
    } finally {
      activeService.set(null);
View Full Code Here

        }

        public Downloader getDownloader(URI uri, String documentUrl) throws URISyntaxException, MalformedURLException  {
            Downloader downloader = new Downloader(uri, documentUrl, this);
            String path = uri.getPath();
            GoogleService service;
            if (path.indexOf("/feeds/download/spreadsheets")!=-1) {
                service = getSpreadsheetService();
            } else {
                service = getService();
            }
            HttpAuthToken authToken = (HttpAuthToken)service.getAuthTokenFactory().getAuthToken();
            downloader.setAuthToken(authToken);
            return downloader;
        }
View Full Code Here

            // We will be using HMAC-SHA1 signature. Google API has a class to do that
            OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();

            // Create a Google service. The name of the current application given here
            // Names are only for reference purpose
            GoogleService service = new GoogleService("oauthclient", "sampleapp");
            service.setOAuthCredentials(oauthParameters, signer);

            /**
             * We will be calling test service's echoString method. As parameter we are sending "Hello World"
             * The parameter name is "in".
             */
            String param = "HelloWorld";
            String baseString = ESB_SERVER + "services/OAuthProxy/echoString" + "?xoauth_requestor_id="
                    + USER_NAME + "&in=" + param;

            /**
             * Invoking the request. And writing the response output.
             */
            URL feedUrl = new URL(baseString);
            request = service.createFeedRequest(feedUrl);
            request.execute();
           
            System.out.println(convertStreamToString(request.getResponseStream()));
           
        catch (AxisFault e) {
View Full Code Here

      if (accessor == null) {
        return;
      }

      URL feedUrl = new URL("http://www.google.com/m8/feeds/contacts/default/thin");
      GoogleService service = new ContactsService("step2");

      GoogleOAuthParameters params = new GoogleOAuthParameters();
      params.setOAuthConsumerKey(accessor.consumer.consumerKey);
      params.setOAuthConsumerSecret(accessor.consumer.consumerSecret);
      params.setOAuthToken(accessor.accessToken);
      params.setOAuthTokenSecret(accessor.tokenSecret);

      OAuthSigner signer = new OAuthHmacSha1Signer();

      service.setOAuthCredentials(params, signer);

      ContactFeed resultFeed;
      try {
        resultFeed = service.getFeed(feedUrl, ContactFeed.class);
      } catch (NullPointerException e) {
        request.setAttribute("contacts", null);
        return;
      }
View Full Code Here

       
        //System.out.println("[Debug Info] binding.getServiceType()" + serviceType);
        //System.out.println("[Debug Info] binding.getName()" +usernane);
        //System.out.println("[Debug Info] binding.getPassword()" + password);   
       
        googleService = new GoogleService(serviceType, "");
        if(binding.getUsername().equals("admin") == false && binding.getPassword().equals("admin")==false){
            googleService.setUserCredentials(binding.getUsername(),binding.getPassword());    
        }

        // Create an HTTP client
View Full Code Here

TOP

Related Classes of com.google.gdata.client.GoogleService

Copyright © 2018 www.massapicom. 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.