Skip to content
Snippets Groups Projects
Commit 719d6cf8 authored by cramakri's avatar cramakri
Browse files

LMS-1527 Further refactorings and renamings in preparation for moving the name...

LMS-1527 Further refactorings and renamings in preparation for moving the name server to a more shared location.

SVN: 15864
parent 5d0ddb3a
No related merge requests found
Showing
with 48 additions and 38 deletions
......@@ -17,6 +17,7 @@
package ch.systemsx.cisd.openbis.dss.component.impl;
import java.io.InputStream;
import java.util.List;
import org.springframework.remoting.RemoteAccessException;
import org.springframework.remoting.RemoteConnectFailureException;
......@@ -301,7 +302,7 @@ class AuthenticatedState extends AbstractDssComponentState
private IDssServiceRpcGeneric basicGetDssServiceForUrl(String serverURL)
{
IDssServiceRpcGeneric dssService = null;
RpcServiceInterfaceDTO[] ifaces =
List<RpcServiceInterfaceDTO> ifaces =
dssServiceFactory.getSupportedInterfaces(serverURL, false);
for (RpcServiceInterfaceDTO iface : ifaces)
{
......
......@@ -84,14 +84,14 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssS
}
}
public int getMinClientVersion()
public int getMajorVersion()
{
return 1;
}
public int getVersion()
public int getMinorVersion()
{
return 1;
return 0;
}
/**
......
......@@ -17,6 +17,7 @@
package ch.systemsx.cisd.openbis.dss.generic.server;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
......@@ -43,20 +44,19 @@ public class DssServiceRpcNameServer implements IRpcServiceNameServer
supportedInterfaces = new ArrayList<RpcServiceInterfaceDTO>();
}
public RpcServiceInterfaceDTO[] getSupportedInterfaces()
public List<RpcServiceInterfaceDTO> getSupportedInterfaces()
{
RpcServiceInterfaceDTO[] ifaces = new RpcServiceInterfaceDTO[supportedInterfaces.size()];
return supportedInterfaces.toArray(ifaces);
return supportedInterfaces;
}
public int getMinClientVersion()
public int getMajorVersion()
{
return 1;
}
public int getVersion()
public int getMinorVersion()
{
return 1;
return 0;
}
/**
......
......@@ -22,6 +22,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.InetSocketAddress;
import java.util.List;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor;
......@@ -31,7 +32,7 @@ import com.marathon.util.spring.StreamSupportingHttpInvokerProxyFactoryBean;
import ch.systemsx.cisd.common.spring.HttpInvokerUtils;
import ch.systemsx.cisd.common.ssl.SslCertificateHelper;
import ch.systemsx.cisd.openbis.dss.rpc.shared.RpcServiceInterfaceDTO;
import ch.systemsx.cisd.openbis.dss.rpc.shared.IDssServiceRpc;
import ch.systemsx.cisd.openbis.dss.rpc.shared.IRpcService;
import ch.systemsx.cisd.openbis.dss.rpc.shared.IRpcServiceNameServer;
/**
......@@ -47,7 +48,7 @@ public class DssServiceRpcFactory implements IDssServiceRpcFactory
private static final String NAME_SERVER_SUFFIX = "/rpc";
public RpcServiceInterfaceDTO[] getSupportedInterfaces(String serverURL,
public List<RpcServiceInterfaceDTO> getSupportedInterfaces(String serverURL,
boolean getServerCertificateFromServer) throws IncompatibleAPIVersionsException
{
// We assume the location of the name server follows the convention
......@@ -64,7 +65,7 @@ public class DssServiceRpcFactory implements IDssServiceRpcFactory
return nameServer.getSupportedInterfaces();
}
public <T extends IDssServiceRpc> T getService(RpcServiceInterfaceDTO iface,
public <T extends IRpcService> T getService(RpcServiceInterfaceDTO iface,
Class<T> ifaceClazz, String serverURL, boolean getServerCertificateFromServer)
throws IncompatibleAPIVersionsException
{
......@@ -101,7 +102,7 @@ public class DssServiceRpcFactory implements IDssServiceRpcFactory
* @author Chandrasekhar Ramakrishnan
*/
@SuppressWarnings("unchecked")
class ServiceProxyBuilder<T extends IDssServiceRpc>
class ServiceProxyBuilder<T extends IRpcService>
{
private final String serviceURL;
......@@ -124,8 +125,8 @@ class ServiceProxyBuilder<T extends IDssServiceRpc>
{
T service = getRawServiceProxy();
service = wrapProxyInServiceInvocationHandler(service);
final int apiServerVersion = service.getVersion();
final int apiMinClientVersion = service.getMinClientVersion();
final int apiServerVersion = service.getMajorVersion();
final int apiMinClientVersion = service.getMinorVersion();
if (apiClientVersion < apiMinClientVersion || apiClientVersion > apiServerVersion)
{
throw new IncompatibleAPIVersionsException(apiClientVersion, apiServerVersion,
......@@ -135,7 +136,8 @@ class ServiceProxyBuilder<T extends IDssServiceRpc>
return service;
}
// TODO 2010-04-21, Tomasz Pylak: refactor to use HttpInvokerUtils.createStreamSupportingServiceStub()
// TODO 2010-04-21, Tomasz Pylak: refactor to use
// HttpInvokerUtils.createStreamSupportingServiceStub()
private T getRawServiceProxy()
{
final StreamSupportingHttpInvokerProxyFactoryBean httpInvokerProxy =
......@@ -171,9 +173,9 @@ class ServiceProxyBuilder<T extends IDssServiceRpc>
*/
private static final class ServiceInvocationHandler implements InvocationHandler
{
private final IDssServiceRpc service;
private final IRpcService service;
private ServiceInvocationHandler(IDssServiceRpc service)
private ServiceInvocationHandler(IRpcService service)
{
this.service = service;
}
......
......@@ -16,8 +16,10 @@
package ch.systemsx.cisd.openbis.dss.rpc.client;
import java.util.List;
import ch.systemsx.cisd.openbis.dss.rpc.shared.RpcServiceInterfaceDTO;
import ch.systemsx.cisd.openbis.dss.rpc.shared.IDssServiceRpc;
import ch.systemsx.cisd.openbis.dss.rpc.shared.IRpcService;
/**
* A factory for creating proxies to RPC services on a data store server.
......@@ -37,13 +39,13 @@ public interface IDssServiceRpcFactory
* shouldGetServerCertificateFromServer is true, the factory will retrieve the SSL
* certificate from the server.
*/
public abstract RpcServiceInterfaceDTO[] getSupportedInterfaces(String serverURL,
public abstract List<RpcServiceInterfaceDTO> getSupportedInterfaces(String serverURL,
boolean shouldGetServerCertificateFromServer) throws IncompatibleAPIVersionsException;
/**
* Get get RPC service interface specified by <code>iface</code>.
*/
public abstract <T extends IDssServiceRpc> T getService(RpcServiceInterfaceDTO iface,
public abstract <T extends IRpcService> T getService(RpcServiceInterfaceDTO iface,
Class<T> ifaceClazz, String serverURL, boolean getServerCertificateFromServer)
throws IncompatibleAPIVersionsException;
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked;
*
* @author Chandrasekhar Ramakrishnan
*/
public interface IDssServiceRpcGeneric extends IDssServiceRpc
public interface IDssServiceRpcGeneric extends IRpcService
{
/**
* Get an array of FileInfoDss objects that describe the file-system structure of the data set.
......
......@@ -17,26 +17,29 @@
package ch.systemsx.cisd.openbis.dss.rpc.shared;
/**
* The most generic interface for RPC invocations into DSS.
* The most generic interface for RPC invocations into openBIS.
* <p>
* This interface defines a minimal interface presented by DSS services. It lets clients determine
* This interface defines a minimal interface presented by RPC services. It lets clients determine
* which version of the interface the server supports. To do anything interesting, clients need to
* get a reference to a specific interface from the {@link IRpcServiceNameServer}.
* get a reference to a specific interface using the {@link IRpcServiceNameServer}.
*
* @author Chandrasekhar Ramakrishnan
*/
public interface IDssServiceRpc
public interface IRpcService
{
//
// Protocol versioning
//
/** Returns the version of the server side interface. */
public int getVersion();
/**
* Returns the major version of the server side interface. Different major versions are
* incompatible with one another.
*/
public int getMajorVersion();
/**
* Returns the minimal version that the client needs to have in order to be able to talk to this
* server.
* Returns the minor version of this server side interface. Different minor versions, within the
* same major version, are compatible with one another.
*/
public int getMinClientVersion();
public int getMinorVersion();
}
......@@ -16,12 +16,14 @@
package ch.systemsx.cisd.openbis.dss.rpc.shared;
import java.util.List;
/**
* An Interface for finding out about the DssServiceRpc interfaces supported by a server.
* An Interface for finding out about the IRpcService interfaces supported by a server.
*
* @author Chandrasekhar Ramakrishnan
*/
public interface IRpcServiceNameServer extends IDssServiceRpc
public interface IRpcServiceNameServer extends IRpcService
{
RpcServiceInterfaceDTO[] getSupportedInterfaces();
List<RpcServiceInterfaceDTO> getSupportedInterfaces();
}
......@@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.dss.rpc.shared;
import java.io.Serializable;
/**
* Describes an RPC interface supported by the data store server.
* Describes an RPC interface supported by the server.
*
* @author Chandrasekhar Ramakrishnan
*/
......@@ -57,7 +57,7 @@ public class RpcServiceInterfaceDTO implements Serializable
}
/**
* The suffix added to the DSS URL to produce the URL for this interface. Used by a service
* The suffix added to the server's URL to produce the URL for this interface. Used by a service
* factory to create a proxy to the service.
*/
public String getInterfaceUrlSuffix()
......
......@@ -73,7 +73,7 @@
<bean class="ch.systemsx.cisd.openbis.dss.generic.server.DssServiceRpcNameServer">
</bean>
</property>
<property name="serviceInterface" value="ch.systemsx.cisd.openbis.dss.rpc.shared.IDssServiceRpcNameServer" />
<property name="serviceInterface" value="ch.systemsx.cisd.openbis.dss.rpc.shared.IRpcServiceNameServer" />
</bean>
<bean id="session-token-manager" class="ch.systemsx.cisd.openbis.dss.generic.server.SessionTokenManager"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment