From bb502c0711a9e6581e4bfe24cf1e25eb56f661d5 Mon Sep 17 00:00:00 2001 From: slewis Date: Thu, 26 Apr 2018 11:49:15 -0700 Subject: Update to rosgi to allow use of asm 6 and removed org.eclipse.ecf.remoteservice.rpc code (deprecated in preference to the github.com XmlRpcRemoteServiceProvider. Change-Id: I352d2e79e027c10eedf2c26e54b12193bec3d2b5 --- .../META-INF/MANIFEST.MF | 33 +----- .../org.eclipse.ecf.remoteservice.rpc/README.md | 5 + .../build.properties | 1 + .../ecf/internal/remoteservice/rpc/Activator.java | 100 ---------------- .../rpc/RpcClientContainerInstantiator.java | 66 ----------- .../ecf/remoteservice/rpc/RpcException.java | 29 ----- .../rpc/client/RpcClientContainer.java | 57 --------- .../remoteservice/rpc/client/RpcClientService.java | 131 --------------------- .../rpc/client/TrivialParameterServializer.java | 53 --------- .../ecf/remoteservice/rpc/identity/RpcId.java | 29 ----- .../remoteservice/rpc/identity/RpcNamespace.java | 96 --------------- .../rpc/server/RemoteServiceXmlRpcServlet.java | 42 ------- 12 files changed, 7 insertions(+), 635 deletions(-) create mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/README.md delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/RpcClientContainerInstantiator.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/RpcException.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientContainer.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientService.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcId.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java delete mode 100644 framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java (limited to 'framework') diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF index 652352a89..4411bdc72 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF +++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF @@ -3,43 +3,12 @@ Bundle-ManifestVersion: 2 Bundle-Name: %plugin.name Bundle-SymbolicName: org.eclipse.ecf.remoteservice.rpc;singleton:=true Automatic-Module-Name: org.eclipse.ecf.remoteservice.rpc -Bundle-Version: 1.2.100.qualifier -Bundle-Activator: org.eclipse.ecf.internal.remoteservice.rpc.Activator +Bundle-Version: 1.3.0.qualifier Bundle-Vendor: %plugin.provider Require-Bundle: org.eclipse.ecf, org.eclipse.equinox.common Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy -Import-Package: javax.servlet;version="2.6.0", - javax.servlet.http;version="2.6.0", - org.apache.commons.httpclient;version="3.1.0", - org.apache.commons.httpclient.auth;version="3.1.0", - org.apache.commons.httpclient.methods;version="3.1.0", - org.apache.commons.httpclient.params;version="3.1.0", - org.apache.commons.httpclient.util;version="3.1.0", - org.apache.xmlrpc, - org.apache.xmlrpc.client, - org.apache.xmlrpc.client.util, - org.apache.xmlrpc.common, - org.apache.xmlrpc.parser, - org.apache.xmlrpc.serializer, - org.apache.xmlrpc.server, - org.apache.xmlrpc.webserver, - org.eclipse.ecf.core;version="3.0.0", - org.eclipse.ecf.core.identity;version="3.0.0", - org.eclipse.ecf.core.provider, - org.eclipse.ecf.remoteservice;version="6.0.0", - org.eclipse.ecf.remoteservice.asyncproxy, - org.eclipse.ecf.remoteservice.client, - org.eclipse.equinox.concurrent.future;version="1.1.0", - org.osgi.framework, - org.osgi.service.log;version="1.3.0", - org.osgi.util.tracker -Export-Package: org.eclipse.ecf.internal.remoteservice.rpc;x-internal:=true, - org.eclipse.ecf.remoteservice.rpc;version="1.0.0", - org.eclipse.ecf.remoteservice.rpc.client;version="1.0.0", - org.eclipse.ecf.remoteservice.rpc.identity;version="1.0.0", - org.eclipse.ecf.remoteservice.rpc.server Bundle-Localization: plugin DynamicImport-Package: * Provide-Capability: osgi.remoteserviceadmin.distribution; configs:List="ecf.xmlrpc.client"; version:Version=1.1 diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/README.md b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/README.md new file mode 100644 index 000000000..018a80a5d --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/README.md @@ -0,0 +1,5 @@ +Note: This plugin has been deprecated in favor of the xmlrpc remote services provider available +here: + +https://github.com/ECF/XmlRpcProvider + diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/build.properties b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/build.properties index 16d547646..8c730610e 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/build.properties +++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/build.properties @@ -12,3 +12,4 @@ bin.includes = META-INF/,\ plugin.xml,\ plugin.properties jars.extra.classpath = platform:/plugin/org.eclipse.equinox.concurrent +jre.compilation.profile = J2SE-1.4 diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java deleted file mode 100644 index fb346dfaf..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.internal.remoteservice.rpc; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.ecf.core.ContainerTypeDescription; -import org.eclipse.ecf.core.identity.Namespace; -import org.eclipse.ecf.core.util.*; -import org.eclipse.ecf.remoteservice.rpc.identity.RpcNamespace; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.service.log.LogService; -import org.osgi.util.tracker.ServiceTracker; - -public class Activator implements BundleActivator { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.ecf.remoteservice.rpc"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - private static BundleContext context; - - private ServiceTracker logServiceTracker = null; - - private LogService logService = null; - - static BundleContext getContext() { - return context; - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(final BundleContext bundleContext) throws Exception { - plugin = this; - Activator.context = bundleContext; - SafeRunner.run(new ExtensionRegistryRunnable(bundleContext) { - protected void runWithoutRegistry() throws Exception { - bundleContext.registerService(Namespace.class, new RpcNamespace(), null); - bundleContext.registerService(ContainerTypeDescription.class, new ContainerTypeDescription( - "ecf.xmlrpc.client", new RpcClientContainerInstantiator(), "Rpc Client Container"), null); //$NON-NLS-1$ //$NON-NLS-2$ - } - }); - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext bundleContext) throws Exception { - if (logServiceTracker != null) { - logServiceTracker.close(); - logServiceTracker = null; - logService = null; - } - plugin = null; - Activator.context = null; - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static synchronized Activator getDefault() { - if (plugin == null) { - plugin = new Activator(); - } - return plugin; - } - - protected LogService getLogService() { - if (logServiceTracker == null) { - logServiceTracker = new ServiceTracker(Activator.context, LogService.class.getName(), null); - logServiceTracker.open(); - } - logService = (LogService) logServiceTracker.getService(); - if (logService == null) - logService = new SystemLogService(PLUGIN_ID); - return logService; - } - - public void log(IStatus status) { - if (logService == null) - logService = getLogService(); - if (logService != null) - logService.log(LogHelper.getLogCode(status), LogHelper.getLogMessage(status), status.getException()); - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/RpcClientContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/RpcClientContainerInstantiator.java deleted file mode 100644 index 248b63a74..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/RpcClientContainerInstantiator.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.internal.remoteservice.rpc; - -import java.util.*; -import org.eclipse.ecf.core.*; -import org.eclipse.ecf.core.identity.IDFactory; -import org.eclipse.ecf.core.provider.BaseContainerInstantiator; -import org.eclipse.ecf.core.provider.IRemoteServiceContainerInstantiator; -import org.eclipse.ecf.remoteservice.rpc.client.RpcClientContainer; -import org.eclipse.ecf.remoteservice.rpc.identity.RpcId; -import org.eclipse.ecf.remoteservice.rpc.identity.RpcNamespace; - -public class RpcClientContainerInstantiator extends BaseContainerInstantiator implements - IRemoteServiceContainerInstantiator { - - private static final String RPC_CONTAINER_TYPE = "ecf.xmlrpc.client"; //$NON-NLS-1$ - - public IContainer createInstance(ContainerTypeDescription description, Object[] parameters) - throws ContainerCreateException { - try { - RpcId ID = null; - if (parameters != null && parameters[0] instanceof RpcId) - ID = (RpcId) parameters[0]; - else - ID = (RpcId) IDFactory.getDefault().createID(RpcNamespace.NAME, parameters); - return new RpcClientContainer(ID); - } catch (Exception e) { - throw new ContainerCreateException("Could not create RPCClientContainer", e); //$NON-NLS-1$ - } - } - - public String[] getSupportedAdapterTypes(ContainerTypeDescription description) { - return getInterfacesAndAdaptersForClass(RpcClientContainer.class); - } - - public Class[][] getSupportedParameterTypes(ContainerTypeDescription description) { - RpcNamespace namespace = (RpcNamespace) IDFactory.getDefault().getNamespaceByName(RpcNamespace.NAME); - return namespace.getSupportedParameterTypes(); - } - - public String[] getImportedConfigs(ContainerTypeDescription description, String[] exporterSupportedConfigs) { - if (RPC_CONTAINER_TYPE.equals(description.getName())) { - List supportedConfigs = Arrays.asList(exporterSupportedConfigs); - if (supportedConfigs.contains(RPC_CONTAINER_TYPE)) - return new String[] {RPC_CONTAINER_TYPE}; - } - return null; - } - - public Dictionary getPropertiesForImportedConfigs(ContainerTypeDescription description, String[] importedConfigs, - Dictionary exportedProperties) { - return null; - } - - public String[] getSupportedConfigs(ContainerTypeDescription description) { - return new String[] {RPC_CONTAINER_TYPE}; - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/RpcException.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/RpcException.java deleted file mode 100644 index 1221a7abf..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/RpcException.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.remoteservice.rpc; - -import org.eclipse.ecf.core.util.ECFException; - -public class RpcException extends ECFException { - - private static final long serialVersionUID = 5822049943586453183L; - - public RpcException(Throwable cause) { - super(cause); - } - - public RpcException(Throwable cause, int errorCode) { - super(cause); - } - - public RpcException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientContainer.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientContainer.java deleted file mode 100644 index 344e486d0..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientContainer.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.remoteservice.rpc.client; - -import org.eclipse.ecf.core.identity.IDFactory; -import org.eclipse.ecf.core.identity.Namespace; -import org.eclipse.ecf.core.util.ECFException; -import org.eclipse.ecf.remoteservice.*; -import org.eclipse.ecf.remoteservice.client.*; -import org.eclipse.ecf.remoteservice.rpc.identity.RpcId; -import org.eclipse.ecf.remoteservice.rpc.identity.RpcNamespace; - -/** - * A container for XML-RPC services. - */ -// TODO add working with auth via header params (Cookies, see http://ws.apache.org/xmlrpc/server.html) -public class RpcClientContainer extends AbstractClientContainer implements IRemoteServiceClientContainerAdapter { - - public RpcClientContainer(RpcId id) { - super(id); - - setParameterSerializer(new TrivialParameterServializer()); - } - - public Namespace getConnectNamespace() { - return IDFactory.getDefault().getNamespaceByName(RpcNamespace.NAME); - } - - protected IRemoteService createRemoteService(RemoteServiceClientRegistration registration) { - IRemoteService service = null; - try { - service = new RpcClientService(this, registration); - } catch (ECFException e) { - logException(e.getMessage(), e); - } - - return service; - } - - protected String prepareEndpointAddress(IRemoteCall call, IRemoteCallable callable) { - // For XML-RPC, endpoint == resource.path - return callable.getResourcePath(); - } - - public boolean setRemoteServiceCallPolicy(IRemoteServiceCallPolicy policy) { - // By default, XML-RPC client cannot set the call policy, so - // return false - return false; - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientService.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientService.java deleted file mode 100644 index 308056ea2..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/RpcClientService.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.remoteservice.rpc.client; - -import java.io.NotSerializableException; -import java.net.MalformedURLException; -import org.apache.xmlrpc.client.*; -import org.apache.xmlrpc.client.util.ClientFactory; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.ecf.core.util.ECFException; -import org.eclipse.ecf.internal.remoteservice.rpc.Activator; -import org.eclipse.ecf.remoteservice.IRemoteCall; -import org.eclipse.ecf.remoteservice.client.*; -import org.eclipse.ecf.remoteservice.rpc.RpcException; -import org.eclipse.ecf.remoteservice.rpc.identity.RpcId; - -public class RpcClientService extends AbstractClientService { - - private XmlRpcClient client; - - public RpcClientService(RpcClientContainer container, RemoteServiceClientRegistration registration) - throws RpcException { - super(container, registration); - client = getXmlRpcClient(); - } - - protected XmlRpcClientConfig getXmlRpcClientConfig() throws RpcException { - try { - RpcId id = (RpcId) container.getID(); - - XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); - config.setServerURL(id.toURI().toURL()); - config.setEnabledForExtensions(true); - // Set default timeouts - config.setConnectionTimeout(60 * 1000); - config.setReplyTimeout(60 * 1000); - - return config; - } catch (MalformedURLException e) { - handleException(e.getMessage(), e); - return null; - } - } - - protected XmlRpcClient getXmlRpcClient() throws RpcException { - XmlRpcClient xmlRpcClient = new XmlRpcClient(); - xmlRpcClient.setConfig(getXmlRpcClientConfig()); - xmlRpcClient.setTransportFactory(new XmlRpcCommonsTransportFactory(xmlRpcClient)); - - return xmlRpcClient; - } - - /** - * Create a Dynamic Proxy for using XML-RPC servers, which builded on Apache XML-RPC. - */ - public Object createProxy(ClassLoader cl, Class[] classes) { - if (classes == null || classes.length < 1) - return null; - - ClientFactory factory = new ClientFactory(client); - return factory.newInstance(classes[0]); - } - - /** - * Create a Dynamic Proxy for using XML-RPC servers, which builded on Apache XML-RPC. - * See the Dynamic proxies section. - */ - protected Object createProxy(Class[] classes) { - if (classes == null || classes.length < 1) - return null; - - ClientFactory factory = new ClientFactory(client); - return factory.newInstance(classes[0]); - } - - /** - * Calls the XML-RPC Service with given operation of IRemoteCall. The returned value is - * the returned value from server - * - * @param call The remote call to make. Must not be null. - * @param callable The callable with default parameters to use to make the call. - * @return The XML-RPC Service's return value - */ - protected Object invokeRemoteCall(final IRemoteCall call, final IRemoteCallable callable) throws ECFException { - String operation = prepareEndpointAddress(call, callable); - Object result = null; - try { - result = client.execute(operation, toObjectsArray(operation, call, callable)); - } catch (Exception e) { - handleException("Exception while executing method:" + operation, e); //$NON-NLS-1$ - } - - return result; - } - - protected void handleException(String message, Throwable e) throws RpcException { - logException(message, e); - throw new RpcException(message, e); - } - - protected Object[] toObjectsArray(String uri, IRemoteCall call, IRemoteCallable callable) - throws NotSerializableException { - IRemoteCallParameter[] rpcParameters = prepareParameters(uri, call, callable); - Object[] result = new Object[rpcParameters.length]; - for (int i = 0; i < rpcParameters.length; i++) { - result[i] = rpcParameters[i].getValue(); - } - - return result; - } - - protected void logException(String string, Throwable e) { - Activator a = Activator.getDefault(); - if (a != null) - a.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, string, e)); - } - - protected void logWarning(String string, Throwable e) { - Activator a = Activator.getDefault(); - if (a != null) - a.log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, string)); - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java deleted file mode 100644 index 5258bc21b..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.remoteservice.rpc.client; - -import java.io.NotSerializableException; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.ecf.remoteservice.IRemoteCall; -import org.eclipse.ecf.remoteservice.client.*; - -/** - * Trivial parameter serializer - just copy a parameter value - * - * @author psamolisov - */ -public class TrivialParameterServializer implements IRemoteCallParameterSerializer { - - /** - * @throws NotSerializableException - */ - public IRemoteCallParameter[] serializeParameter(String endpoint, IRemoteCall call, IRemoteCallable callable, - IRemoteCallParameter[] currentParameters, Object[] paramToSerialize) throws NotSerializableException { - List results = new ArrayList(); - if (paramToSerialize != null) { - for (int i = 0; i < paramToSerialize.length; i++) { - IRemoteCallParameter p = new RemoteCallParameter(currentParameters[i].getName(), - paramToSerialize[i] == null ? currentParameters[i].getValue() : paramToSerialize[i]); - results.add(p); - } - } - return (IRemoteCallParameter[]) results.toArray(new IRemoteCallParameter[results.size()]); - } - - /** - * All parameters will be serialized in the Apache XML-RPC library. We shouldn't serialize any parameters - * by default. - * - * @return the parameter value - */ - public IRemoteCallParameter serializeParameter(String endpoint, IRemoteCall call, IRemoteCallable callable, - IRemoteCallParameter paramDefault, Object paramToSerialize) { - // Just return a parameter - return new RemoteCallParameter(paramDefault.getName(), paramToSerialize == null ? paramDefault.getValue() - : paramToSerialize); - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcId.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcId.java deleted file mode 100644 index 14b2c33be..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcId.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.remoteservice.rpc.identity; - -import java.net.URI; -import org.eclipse.ecf.core.identity.Namespace; -import org.eclipse.ecf.core.identity.URIID; - -public class RpcId extends URIID { - - private static final long serialVersionUID = -713344242499901489L; - - public RpcId(Namespace namespace, URI uri) { - super(namespace, uri); - } - - public String toString() { - StringBuffer sb = new StringBuffer("XmlRpcId["); //$NON-NLS-1$ - sb.append(getName()).append("]"); //$NON-NLS-1$ - return sb.toString(); - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java deleted file mode 100644 index a11199906..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pavel Samolisov - initial API and implementation - *******************************************************************************/ -package org.eclipse.ecf.remoteservice.rpc.identity; - -import java.net.URI; -import java.net.URL; -import java.util.*; -import org.eclipse.ecf.core.identity.*; -import org.eclipse.ecf.remoteservice.rpc.client.RpcClientContainer; - -/** - * This class represents a {@link Namespace} for {@link RpcClientContainer}s. - */ -public class RpcNamespace extends Namespace { - - private static final long serialVersionUID = -4255624538742281975L; - - /** - * The name of this namespace. - */ - public static final String NAME = "ecf.xmlrpc.namespace"; //$NON-NLS-1$ - - /** - * The scheme of this namespace. - */ - public static final String SCHEME = "xmlrpc"; //$NON-NLS-1$ - - public RpcNamespace() { - super(NAME, "Rpc Namespace"); //$NON-NLS-1$ - } - - public RpcNamespace(String name, String desc) { - super(name, desc); - } - - private String getInitFromExternalForm(Object[] args) { - if (args == null || args.length < 1 || args[0] == null) - return null; - if (args[0] instanceof String) { - final String arg = (String) args[0]; - if (arg.startsWith(getScheme() + Namespace.SCHEME_SEPARATOR)) { - final int index = arg.indexOf(Namespace.SCHEME_SEPARATOR); - if (index >= arg.length()) - return null; - return arg.substring(index + 1); - } - } - return null; - } - - /** - * Creates an instance of an {@link RPCD}. The parameters must contain specific information. - * - * @param parameters a collection of attributes to call the right constructor on {@link RpcId}. - * @return an instance of {@link RpcId}. Will not be null. - */ - public ID createInstance(Object[] parameters) throws IDCreateException { - URI uri = null; - try { - final String init = getInitFromExternalForm(parameters); - if (init != null) { - uri = URI.create(init); - return new RpcId(this, uri); - } - if (parameters != null) { - if (parameters[0] instanceof URI) - return new RpcId(this, (URI) parameters[0]); - else if (parameters[0] instanceof String) - return new RpcId(this, URI.create((String) parameters[0])); - else if (parameters[0] instanceof URL) - return new RpcId(this, URI.create(((URL) parameters[0]).toExternalForm())); - else if (parameters[0] instanceof RpcId) - return (ID) parameters[0]; - } - throw new IllegalArgumentException("Invalid parameters to RPCID creation"); //$NON-NLS-1$ - } catch (Exception e) { - throw new IDCreateException("Could not create RPC ID", e); //$NON-NLS-1$ - } - } - - public Class[][] getSupportedParameterTypes() { - return new Class[][] { {String.class}, {Integer.class}, {Boolean.class}, {Double.class}, {Date.class}, - {byte[].class}, {Object[].class}, {List.class}, {Map.class}}; - } - - public String getScheme() { - return SCHEME; - } -} diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java deleted file mode 100644 index 7d62f183b..000000000 --- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2011 Naumen. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Pavel Samolisov - initial API and implementation - ******************************************************************************/ -package org.eclipse.ecf.remoteservice.rpc.server; - -import javax.servlet.ServletConfig; -import org.apache.xmlrpc.XmlRpcException; -import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping; -import org.apache.xmlrpc.server.XmlRpcHandlerMapping; -import org.apache.xmlrpc.webserver.XmlRpcServlet; -import org.apache.xmlrpc.webserver.XmlRpcServletServer; - -public class RemoteServiceXmlRpcServlet extends XmlRpcServlet { - - private static final long serialVersionUID = 654171179838565650L; - - class RemoteServiceHandlerMapping extends AbstractReflectiveHandlerMapping { - - } - - private RemoteServiceHandlerMapping mapping; - - protected XmlRpcHandlerMapping newXmlRpcHandlerMapping() throws XmlRpcException { - return (mapping == null) ? super.newXmlRpcHandlerMapping() : mapping; - } - - class RemoteServiceXmlRpcServletServer extends XmlRpcServletServer { - - } - - private RemoteServiceXmlRpcServletServer server; - - protected XmlRpcServletServer newXmlRpcServer(ServletConfig pConfig) throws XmlRpcException { - return (server == null) ? super.newXmlRpcServer(pConfig) : server; - } - -} -- cgit v1.2.3