Package com.google.gdata.data.webmastertools

Examples of com.google.gdata.data.webmastertools.SitesEntry


   * @throws ServiceException if the service is unable to handle the request.
   * @throws IOException if there was an error communicating with the server.
   */
  public static SitesEntry insertSite(WebmasterToolsService myService,
      String siteUrl) throws IOException, ServiceException {
    SitesEntry entry = new SitesEntry();
    OutOfLineContent content = new OutOfLineContent();
    content.setUri(siteUrl);
    entry.setContent(content);
    System.out.println("Site: " + siteUrl + " now being added.");
    return myService.insert(getSitesFeedUrl(), entry);
  }
View Full Code Here


  public static void listVerificationValues(WebmasterToolsService myService,
      String siteUrl) throws IOException, ServiceException {
    // Request the entry
    String siteId = URLEncoder.encode(siteUrl, "UTF-8");
    URL feedUrl = new URL(getSitesFeedUrl() + siteId);
    SitesEntry entry = myService.getEntry(feedUrl, SitesEntry.class);
   
    // Print verification options
    for (VerificationMethod method : entry.getVerificationMethods()) {
      System.out.println("Verification method: " + method.getMethodType());
      if (method.getMethodType() == VerificationMethod.MethodType.METATAG) {
        System.out.println("Meta verification tag value: " + method.getValue());
      } else if (
          method.getMethodType() == VerificationMethod.MethodType.HTMLPAGE) {
View Full Code Here

    method.setMethodType(VerificationMethod.MethodType.HTMLPAGE);
    // Or method.setMethodType(VerificationMethod.MethodType.METATAG);
    method.setInUse(true);

    // Create the new SitesEntry to be verified
    SitesEntry entry = new SitesEntry();
    entry.addVerificationMethod(method);
    String siteId = URLEncoder.encode(siteUrl, "UTF-8");
    System.out.println("Now verifying site: " + siteUrl);
    URL updateUrl = new URL(getSitesFeedUrl() + siteId);
    return myService.update(updateUrl, entry);
  }
View Full Code Here

    URL updateUrl = new URL(getSitesFeedUrl() + siteId);

    try {
      // Update geographic location
      System.out.println("Updating geographic location...");
      SitesEntry entryUpdate = new SitesEntry();
      entryUpdate.setGeolocation(SAMPLE_LOCATION);
      myService.update(updateUrl, entryUpdate);

      // Update desired crawl rate
      System.out.println("Updating desired crawl rate...");
      entryUpdate = new SitesEntry();
      entryUpdate.setCrawlRate(SAMPLE_RATE);
      myService.update(updateUrl, entryUpdate);

      // Update preferred domain
      System.out.println("Updating preferred domain...");
      entryUpdate = new SitesEntry();
      entryUpdate.setPreferredDomain(SAMPLE_PREFERRED_DOMAIN);
      myService.update(updateUrl, entryUpdate);

      // Update enhanced image search and return the last updated entry
      System.out.println("Updating enhanced image search...");
      entryUpdate = new SitesEntry();
      entryUpdate.setEnhancedImageSearch(SAMPLE_ENHANCED_IMAGE_SEARCH);
      return myService.update(updateUrl, entryUpdate);
    } catch (ServiceException e) {
      System.out.println("Please make sure that the site to update "
          + "contains a trailing forward slash");
      throw(e);
View Full Code Here

   */
  public static void deleteSite(WebmasterToolsService myService, String siteUrl)
      throws IOException, ServiceException {
    String siteId = URLEncoder.encode(siteUrl, "UTF-8");
    URL feedUrl = new URL(getSitesFeedUrl() + siteId);
    SitesEntry entry = myService.getEntry(feedUrl, SitesEntry.class);
    System.out.println("Now deleting site: " + siteUrl);
    entry.delete();
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.webmastertools.SitesEntry

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.