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.maps; import com.google.gwt.gdata.client.GDataRequestParameters; import com.google.gwt.gdata.client.GoogleService; import com.google.gwt.gdata.client.acl.AclEntryCallback; import com.google.gwt.gdata.client.acl.AclFeedCallback; /** * Maps service. */ public class MapsService extends GoogleService { /** * Maps service name. */ public static final String SERVICE_NAME = getConstant("SERVICE_NAME"); /** * Constructs a Maps service. * * @param applicationName Name of application (used for tracking). * @return A MapsService object. */ public static native MapsService newInstance(String applicationName) /*-{ return new $wnd.google.gdata.maps.MapsService(applicationName); }-*/; private static native String getConstant(String name) /*-{ return $wnd.google.gdata.maps.MapsService[name]; }-*/; protected MapsService() { } /** * Retrieves an ACL entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. */ public final void getAclEntry(String uri, AclEntryCallback callback) { this.getAclEntry(uri, callback, null); } /** * Retrieves an ACL 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 getAclEntry(String uri, AclEntryCallback callback, GDataRequestParameters parameters) /*-{ this.getAclEntry( 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 a feed of ACL entries. * * @param uri URI of feed. * @param callback Callback defining success and failure handlers for this * command. */ public final void getAclFeed(String uri, AclFeedCallback callback) { this.getAclFeed(uri, callback, null); } /** * Retrieves a feed of ACL entries. * * @param uri URI of feed. * @param callback Callback defining success and failure handlers for this * command. * @param parameters The request parameters. */ public final native void getAclFeed(String uri, AclFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getAclFeed( 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 feature entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. */ public final void getFeatureEntry(String uri, FeatureEntryCallback callback) { this.getFeatureEntry(uri, callback, null); } /** * Retrieves a feature 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 getFeatureEntry(String uri, FeatureEntryCallback callback, GDataRequestParameters parameters) /*-{ this.getFeatureEntry( 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 map features. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getFeatureFeed(FeatureQuery query, FeatureFeedCallback callback) { this.getFeatureFeed(query, callback, null); } /** * Retrieves the feed of map features. * * @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 getFeatureFeed(FeatureQuery query, FeatureFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getFeatureFeed( 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 map features. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getFeatureFeed(String uri, FeatureFeedCallback callback) { this.getFeatureFeed(uri, callback, null); } /** * Retrieves the feed of map features. * * @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 getFeatureFeed(String uri, FeatureFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getFeatureFeed( 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 map entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. */ public final void getMapEntry(String uri, MapEntryCallback callback) { this.getMapEntry(uri, callback, null); } /** * Retrieves a map 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 getMapEntry(String uri, MapEntryCallback callback, GDataRequestParameters parameters) /*-{ this.getMapEntry( 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 user-created maps. * * @param query URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getMapFeed(MapQuery query, MapFeedCallback callback) { this.getMapFeed(query, callback, null); } /** * Retrieves the feed of user-created maps. * * @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 getMapFeed(MapQuery query, MapFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getMapFeed( 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 user-created maps. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getMapFeed(String uri, MapFeedCallback callback) { this.getMapFeed(uri, callback, null); } /** * Retrieves the feed of user-created maps. * * @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 getMapFeed(String uri, MapFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getMapFeed( 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 version entry. * * @param uri URI of entry. * @param callback Callback defining success and failure handlers for this * command. */ public final void getVersionEntry(String uri, VersionEntryCallback callback) { this.getVersionEntry(uri, callback, null); } /** * Retrieves a version 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 getVersionEntry(String uri, VersionEntryCallback callback, GDataRequestParameters parameters) /*-{ this.getVersionEntry( 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 maps data api versions. * * @param uri URI of feed or query. * @param callback Callback defining success and failure handlers for this * command. */ public final void getVersionFeed(String uri, VersionFeedCallback callback) { this.getVersionFeed(uri, callback, null); } /** * Retrieves the feed of maps data api versions. * * @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 getVersionFeed(String uri, VersionFeedCallback callback, GDataRequestParameters parameters) /*-{ this.getVersionFeed( 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 ); }-*/; }