diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-11-22 14:16:22 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-23 12:56:33 +0000 |
commit | f5a70a8943ef8d4489d7435f71fcefbd5da49d2d (patch) | |
tree | 65f8c550d0c5e42358f2363d679bef4ff2c58792 /server | |
parent | db7fa23353f45e72346bb6e59ec445eed90679ad (diff) | |
download | vaadin-framework-f5a70a8943ef8d4489d7435f71fcefbd5da49d2d.tar.gz vaadin-framework-f5a70a8943ef8d4489d7435f71fcefbd5da49d2d.zip |
Remove server-side RpcManager interface (#10302)
Change-Id: Id693f49d68d4daa6bd8cbe6b1b1a6553fc988c75
Diffstat (limited to 'server')
6 files changed, 42 insertions, 73 deletions
diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index da4142ef96..70a4c342cc 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -58,7 +58,7 @@ public abstract class AbstractClientConnector implements ClientConnector, * A map from client to server RPC interface class name to the RPC call * manager that handles incoming RPC calls for that interface. */ - private Map<String, RpcManager> rpcManagerMap = new HashMap<String, RpcManager>(); + private Map<String, ServerRpcManager<?>> rpcManagerMap = new HashMap<String, ServerRpcManager<?>>(); /** * A map from server to client RPC interface class to the RPC proxy that @@ -388,7 +388,7 @@ public abstract class AbstractClientConnector implements ClientConnector, } @Override - public RpcManager getRpcManager(String rpcInterfaceName) { + public ServerRpcManager<?> getRpcManager(String rpcInterfaceName) { return rpcManagerMap.get(rpcInterfaceName); } @@ -984,6 +984,7 @@ public abstract class AbstractClientConnector implements ClientConnector, * * @see com.vaadin.server.ClientConnector#getErrorHandler() */ + @Override public ErrorHandler getErrorHandler() { return errorHandler; } @@ -994,6 +995,7 @@ public abstract class AbstractClientConnector implements ClientConnector, * @see com.vaadin.server.ClientConnector#setErrorHandler(com.vaadin.server. * ErrorHandler) */ + @Override public void setErrorHandler(ErrorHandler errorHandler) { this.errorHandler = errorHandler; } diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 4c5122c338..e514524545 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -65,7 +65,7 @@ import com.vaadin.annotations.PreserveOnRefresh; import com.vaadin.annotations.StyleSheet; import com.vaadin.server.ClientConnector.ConnectorErrorEvent; import com.vaadin.server.ComponentSizeValidator.InvalidLayout; -import com.vaadin.server.RpcManager.RpcInvocationException; +import com.vaadin.server.ServerRpcManager.RpcInvocationException; import com.vaadin.server.StreamVariable.StreamingEndEvent; import com.vaadin.server.StreamVariable.StreamingErrorEvent; import com.vaadin.shared.ApplicationConstants; @@ -1862,8 +1862,8 @@ public abstract class AbstractCommunicationManager implements Serializable { throws JSONException { ClientConnector connector = connectorTracker.getConnector(connectorId); - RpcManager rpcManager = connector.getRpcManager(interfaceName); - if (!(rpcManager instanceof ServerRpcManager)) { + ServerRpcManager<?> rpcManager = connector.getRpcManager(interfaceName); + if (rpcManager == null) { /* * Security: Don't even decode the json parameters if no RpcManager * corresponding to the received method invocation has been @@ -1879,8 +1879,7 @@ public abstract class AbstractCommunicationManager implements Serializable { // Use interface from RpcManager instead of loading the class based on // the string name to avoid problems with OSGi - Class<? extends ServerRpc> rpcInterface = ((ServerRpcManager<?>) rpcManager) - .getRpcInterface(); + Class<? extends ServerRpc> rpcInterface = rpcManager.getRpcInterface(); ServerRpcMethodInvocation invocation = new ServerRpcMethodInvocation( connectorId, rpcInterface, methodName, parametersJson.length()); diff --git a/server/src/com/vaadin/server/ClientConnector.java b/server/src/com/vaadin/server/ClientConnector.java index b51a1d6eec..a6821a4269 100644 --- a/server/src/com/vaadin/server/ClientConnector.java +++ b/server/src/com/vaadin/server/ClientConnector.java @@ -352,9 +352,9 @@ public interface ClientConnector extends Connector { * * @param rpcInterfaceName * name of the interface for which the call was made - * @return RpcManager or null if none found for the interface + * @return ServerRpcManager or null if none found for the interface */ - public RpcManager getRpcManager(String rpcInterfaceName); + public ServerRpcManager<?> getRpcManager(String rpcInterfaceName); /** * Gets the error handler for the connector. diff --git a/server/src/com/vaadin/server/DragAndDropService.java b/server/src/com/vaadin/server/DragAndDropService.java index 529cce670e..3eecd7448e 100644 --- a/server/src/com/vaadin/server/DragAndDropService.java +++ b/server/src/com/vaadin/server/DragAndDropService.java @@ -254,7 +254,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector { } @Override - public RpcManager getRpcManager(String interfaceName) { + public ServerRpcManager<?> getRpcManager(String interfaceName) { // TODO Use rpc for drag'n'drop return null; } diff --git a/server/src/com/vaadin/server/RpcManager.java b/server/src/com/vaadin/server/RpcManager.java deleted file mode 100644 index bb1c116388..0000000000 --- a/server/src/com/vaadin/server/RpcManager.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 Vaadin Ltd. - * - * 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.vaadin.server; - -import java.io.Serializable; - -/** - * Server side RPC manager that can invoke methods based on RPC calls received - * from the client. - * - * @since 7.0 - */ -public interface RpcManager extends Serializable { - public void applyInvocation(ServerRpcMethodInvocation invocation) - throws RpcInvocationException; - - /** - * Wrapper exception for exceptions which occur during invocation of an RPC - * call - * - * @author Vaadin Ltd - * @since 7.0 - * - */ - public static class RpcInvocationException extends Exception { - - public RpcInvocationException() { - super(); - } - - public RpcInvocationException(String message, Throwable cause) { - super(message, cause); - } - - public RpcInvocationException(String message) { - super(message); - } - - public RpcInvocationException(Throwable cause) { - super(cause); - } - - } - -} diff --git a/server/src/com/vaadin/server/ServerRpcManager.java b/server/src/com/vaadin/server/ServerRpcManager.java index c063761c7f..a3962ed949 100644 --- a/server/src/com/vaadin/server/ServerRpcManager.java +++ b/server/src/com/vaadin/server/ServerRpcManager.java @@ -35,11 +35,39 @@ import com.vaadin.shared.communication.ServerRpc; * * @since 7.0 */ -public class ServerRpcManager<T extends ServerRpc> implements RpcManager { +public class ServerRpcManager<T extends ServerRpc> { private final T implementation; private final Class<T> rpcInterface; + /** + * Wrapper exception for exceptions which occur during invocation of an RPC + * call + * + * @author Vaadin Ltd + * @since 7.0 + * + */ + public static class RpcInvocationException extends Exception { + + public RpcInvocationException() { + super(); + } + + public RpcInvocationException(String message, Throwable cause) { + super(message, cause); + } + + public RpcInvocationException(String message) { + super(message); + } + + public RpcInvocationException(Throwable cause) { + super(cause); + } + + } + private static final Map<Class<?>, Class<?>> boxedTypes = new HashMap<Class<?>, Class<?>>(); static { try { @@ -83,8 +111,8 @@ public class ServerRpcManager<T extends ServerRpc> implements RpcManager { */ public static void applyInvocation(ClientConnector target, ServerRpcMethodInvocation invocation) throws RpcInvocationException { - RpcManager manager = target - .getRpcManager(invocation.getInterfaceName()); + ServerRpcManager<?> manager = target.getRpcManager(invocation + .getInterfaceName()); if (manager != null) { manager.applyInvocation(invocation); } else { @@ -123,7 +151,6 @@ public class ServerRpcManager<T extends ServerRpc> implements RpcManager { * @param invocation * method invocation to perform */ - @Override public void applyInvocation(ServerRpcMethodInvocation invocation) throws RpcInvocationException { Method method = invocation.getMethod(); |