* 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
}
@Override
- public RpcManager getRpcManager(String rpcInterfaceName) {
+ public ServerRpcManager<?> getRpcManager(String rpcInterfaceName) {
return rpcManagerMap.get(rpcInterfaceName);
}
*
* @see com.vaadin.server.ClientConnector#getErrorHandler()
*/
+ @Override
public ErrorHandler getErrorHandler() {
return errorHandler;
}
* @see com.vaadin.server.ClientConnector#setErrorHandler(com.vaadin.server.
* ErrorHandler)
*/
+ @Override
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
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;
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
// 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());
*
* @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.
}
@Override
- public RpcManager getRpcManager(String interfaceName) {
+ public ServerRpcManager<?> getRpcManager(String interfaceName) {
// TODO Use rpc for drag'n'drop
return null;
}
+++ /dev/null
-/*
- * 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);
- }
-
- }
-
-}
*
* @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 {
*/
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 {
* @param invocation
* method invocation to perform
*/
- @Override
public void applyInvocation(ServerRpcMethodInvocation invocation)
throws RpcInvocationException {
Method method = invocation.getMethod();
import com.vaadin.event.ListenerMethod.MethodException;\r
import com.vaadin.server.DefaultErrorHandler;\r
import com.vaadin.server.ErrorHandler;\r
-import com.vaadin.server.RpcManager.RpcInvocationException;\r
+import com.vaadin.server.ServerRpcManager.RpcInvocationException;\r
import com.vaadin.server.VaadinRequest;\r
import com.vaadin.tests.components.AbstractTestUI;\r
import com.vaadin.ui.Button;\r