Java tutorial
/* * Copyright 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.gwt.gdata.client.blogger; import com.google.gwt.gdata.client.GDataRequestParameters; import com.google.gwt.gdata.client.GoogleService; /** * Blogger service. */ public class BloggerService extends GoogleService { /** * Blogger service name. */ public static final String SERVICE_NAME = getConstant("SERVICE_NAME"); /** * Constructs a blogger service. * * @param applicationName Name of application (used for tracking). * @return A BloggerService object. */ public static native BloggerService newInstance(String applicationName) /*-{ return new $wnd.google.gdata.blogger.BloggerService(applicationName); }-*/; private static native String getConstant(String name) /*-{ return $wnd.google.gdata.blogger.BloggerService[name]; }-*/; protected BloggerService() { } /** * Retrieves the feed of a blog's comments. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getBlogCommentFeed(BlogCommentQuery query, BlogCommentFeedCallback callback) { this.getBlogCommentFeed(query, callback, null); } /** * Retrieves the feed of a blog's comments. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getBlogCommentFeed(BlogCommentQuery query, BlogCommentFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getBlogCommentFeed( query, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves the feed of a blog's comments. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getBlogCommentFeed(String uri, BlogCommentFeedCallback callback) { this.getBlogCommentFeed(uri, callback, null); } /** * Retrieves the feed of a blog's comments. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getBlogCommentFeed(String uri, BlogCommentFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getBlogCommentFeed( uri, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves a blog entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. */ public final void getBlogEntry(String uri, BlogEntryCallback callback) { this.getBlogEntry(uri, callback, null); } /** * Retrieves a blog entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getBlogEntry(String uri, BlogEntryCallback callback, GDataRequestParameters parameters) /*-{ this.getBlogEntry( uri, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.entry : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves the feed of a user's blogs. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getBlogFeed(BlogQuery query, BlogFeedCallback callback) { this.getBlogFeed(query, callback, null); } /** * Retrieves the feed of a user's blogs. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getBlogFeed(BlogQuery query, BlogFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getBlogFeed( query, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves the feed of a user's blogs. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getBlogFeed(String uri, BlogFeedCallback callback) { this.getBlogFeed(uri, callback, null); } /** * Retrieves the feed of a user's blogs. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getBlogFeed(String uri, BlogFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getBlogFeed( uri, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves the feed of a blog's posts. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getBlogPostFeed(BlogPostQuery query, BlogPostFeedCallback callback) { this.getBlogPostFeed(query, callback, null); } /** * Retrieves the feed of a blog's posts. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getBlogPostFeed(BlogPostQuery query, BlogPostFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getBlogPostFeed( query, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves the feed of a blog's posts. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getBlogPostFeed(String uri, BlogPostFeedCallback callback) { this.getBlogPostFeed(uri, callback, null); } /** * Retrieves the feed of a blog's posts. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getBlogPostFeed(String uri, BlogPostFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getBlogPostFeed( uri, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves a comment entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. */ public final void getCommentEntry(String uri, CommentEntryCallback callback) { this.getCommentEntry(uri, callback, null); } /** * Retrieves a comment entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getCommentEntry(String uri, CommentEntryCallback callback, GDataRequestParameters parameters) /*-{ this.getCommentEntry( uri, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.entry : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves the feed of a blog post's comments. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getPostCommentFeed(PostCommentQuery query, PostCommentFeedCallback callback) { this.getPostCommentFeed(query, callback, null); } /** * Retrieves the feed of a blog post's comments. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getPostCommentFeed(PostCommentQuery query, PostCommentFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getPostCommentFeed( query, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves the feed of a blog post's comments. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getPostCommentFeed(String uri, PostCommentFeedCallback callback) { this.getPostCommentFeed(uri, callback, null); } /** * Retrieves the feed of a blog post's comments. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getPostCommentFeed(String uri, PostCommentFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getPostCommentFeed( uri, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.feed : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; /** * Retrieves a post entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. */ public final void getPostEntry(String uri, PostEntryCallback callback) { this.getPostEntry(uri, callback, null); } /** * Retrieves a post entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getPostEntry(String uri, PostEntryCallback callback, GDataRequestParameters parameters) /*-{ this.getPostEntry( uri, function(result) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleSuccessCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/core/client/JavaScriptObject;)(callback, result ? result.entry : result); }, function(error) { @com.google.gwt.gdata.client.impl.CallbackHelper::handleFailureCallback(Lcom/google/gwt/gdata/client/impl/Callback;Lcom/google/gwt/gdata/client/Error;)(callback, error); }, parameters ); }-*/; }