/** * The execution function. Executes a server side command. * * @param command * The command to be executed. This command is a wrapper around the actual request object. * @param callback * A <code>CommandCallback</code> function to be executed when the command successfully returns. The * callbacks may implement CommunicationExceptionCallback or CommandExceptionCallback to allow error * handling. * @return deferred object which can be used to add extra callbacks */ public Deferred execute(final GwtCommand command, final CommandCallback... callback) { final Deferred deferred = new Deferred(); for (CommandCallback successCallback : callback) { try { deferred.addCallback(successCallback); } catch (Throwable t) { Log.logError("Command failed on success callback", t); } } return execute(command, deferred); }
public static void getRasterCapabilities(final Map<String, String> connectionProps, final DataCallback<List<RasterCapabilitiesInfo>> onFinish, final DataCallback<String> onError) { GetWmsCapabilitiesRequest request = new GetWmsCapabilitiesRequest(); request.setConnectionProperties(connectionProps); GwtCommand command = new GwtCommand(GetWmsCapabilitiesRequest.COMMAND); command.setCommandRequest(request); Deferred def = GwtCommandDispatcher.getInstance().execute(command, new CommandCallback<GetWmsCapabilitiesResponse>() { public void execute(GetWmsCapabilitiesResponse response) { if (onFinish != null) { onFinish.execute(response.getRasterCapabilities()); } } }); def.addCallback(new AbstractCommandCallback<CommandResponse>() { public void execute(CommandResponse response) { } public void onCommandException(CommandResponse response) { if (onError != null && response.getErrorMessages().size() > 0) { onError.execute(response.getErrorMessages().get(0)); } } }); }
public static void getVectorCapabilities(final Map<String, String> connectionProps, final DataCallback<List<VectorCapabilitiesInfo>> onFinish, final DataCallback<String> onError) { GetGeotoolsVectorCapabilitiesRequest request = new GetGeotoolsVectorCapabilitiesRequest(); request.setConnectionProperties(connectionProps); GwtCommand command = new GwtCommand(GetGeotoolsVectorCapabilitiesRequest.COMMAND); command.setCommandRequest(request); Deferred def = GwtCommandDispatcher.getInstance().execute(command, new CommandCallback<GetGeotoolsVectorCapabilitiesResponse>() { public void execute(GetGeotoolsVectorCapabilitiesResponse response) { if (onFinish != null) { onFinish.execute(response.getVectorCapabilities()); } } }); def.addCallback(new AbstractCommandCallback<CommandResponse>() { public void execute(CommandResponse response) { } public void onCommandException(CommandResponse response) { if (onError != null && response.getErrorMessages().size() > 0) { onError.execute(response.getErrorMessages().get(0)); } } }); }
public static void getVectorLayerConfiguration(final Map<String, String> connectionProps, String layerTypeName, final DataCallback<DynamicVectorLayerConfiguration> onFinish, final DataCallback<String> onError) { GetVectorLayerConfigRequest request = new GetVectorLayerConfigRequest(); request.setConnectionProperties(connectionProps); request.setLayerName(layerTypeName); GwtCommand command = new GwtCommand(GetVectorLayerConfigRequest.COMMAND); command.setCommandRequest(request); Deferred def = GwtCommandDispatcher.getInstance().execute(command, new CommandCallback<GetVectorLayerConfigResponse>() { public void execute(GetVectorLayerConfigResponse response) { if (onFinish != null) { onFinish.execute(response.getVectorLayerConfiguration()); } } }); def.addCallback(new AbstractCommandCallback<CommandResponse>() { public void execute(CommandResponse response) { } public void onCommandException(CommandResponse response) { if (onError != null && response.getErrorMessages().size() > 0) { onError.execute(response.getErrorMessages().get(0)); } } }); }
def.addCallback(new AbstractCommandCallback<CommandResponse>() {