Author: tolusha
Date: 2010-12-28 11:31:16 -0500 (Tue, 28 Dec 2010)
New Revision: 3747
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/RPCService.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/RPCServiceImpl.java
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/rpc/impl/TestRPCServiceImpl.java
Log:
EXOJCR-1128: revert: RPCService support execute command by identifier
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/RPCService.java
===================================================================
---
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/RPCService.java 2010-12-28
15:54:28 UTC (rev 3746)
+++
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/RPCService.java 2010-12-28
16:31:16 UTC (rev 3747)
@@ -106,76 +106,6 @@
SecurityException;
/**
- * Executes a command on all the cluster nodes. This method is equivalent to the other
method of the
- * same type but with the default timeout. The command must be registered first
otherwise an
- * {@link RPCException} will be thrown.
- *
- * @param commandId The commandId to execute on each cluster node
- * @param synchronous if true, sets group request mode to {@link
org.jgroups.blocks.GroupRequest#GET_ALL},
- * and if false sets it to {@link org.jgroups.blocks.GroupRequest#GET_NONE}.
- * @param args an array of {@link Serializable} objects corresponding to parameters of
the command
- * to execute remotely
- * @return a list of responses from all the members of the cluster. If we met an
exception on a given node,
- * the RPCException will be the corresponding response of this particular node
- * @throws RPCException in the event of problems.
- * @throws SecurityException if the {@link SecurityManager} is installed and the call
method
- * doesn't have the {@link RuntimePermission}
<code>ACCESS_RPC_SERVICE_PERMISSION</code>
- */
- List<Object> executeCommandOnAllNodes(String commandId, boolean synchronous,
Serializable... args)
- throws RPCException, SecurityException;
-
- /**
- * Executes a command synchronously on all the cluster nodes. The command must be
registered first otherwise an
- * {@link RPCException} will be thrown.
- *
- * @param commandId The commandId to execute on each cluster node
- * @param timeout a timeout after which to throw a replication exception.
- * @param args an array of {@link Serializable} objects corresponding to parameters of
the command
- * to execute remotely
- * @return a list of responses from all the members of the cluster. If we met an
exception on a given node,
- * the RPCException will be the corresponding response of this particular node
- * @throws RPCException in the event of problems.
- * @throws SecurityException if the {@link SecurityManager} is installed and the call
method
- * doesn't have the {@link RuntimePermission}
<code>ACCESS_RPC_SERVICE_PERMISSION</code>
- */
- List<Object> executeCommandOnAllNodes(String commandId, long timeout,
Serializable... args) throws RPCException,
- SecurityException;
-
- /**
- * Executes a command on the coordinator only. This method is equivalent to the other
method of the
- * same type but with the default timeout. The command must be registered first
otherwise an
- * {@link RPCException} will be thrown.
- *
- * @param commandId The commandId to execute on the coordinator node
- * @param synchronous if true, sets group request mode to {@link
org.jgroups.blocks.GroupRequest#GET_ALL},
- * and if false sets it to {@link org.jgroups.blocks.GroupRequest#GET_NONE}.
- * @param args an array of {@link Serializable} objects corresponding to parameters of
the command
- * to execute remotely
- * @return the response of the coordinator.
- * @throws RPCException in the event of problems.
- * @throws SecurityException if the {@link SecurityManager} is installed and the call
method
- * doesn't have the {@link RuntimePermission}
<code>ACCESS_RPC_SERVICE_PERMISSION</code>
- */
- Object executeCommandOnCoordinator(String commandId, boolean synchronous,
Serializable... args) throws RPCException,
- SecurityException;
-
- /**
- * Executes a command synchronously on the coordinator only. The command must be
registered first otherwise an
- * {@link RPCException} will be thrown.
- *
- * @param commandId The commandId to execute on the coordinator node
- * @param timeout a timeout after which to throw a replication exception.
- * @param args an array of {@link Serializable} objects corresponding to parameters of
the command
- * to execute remotely
- * @return the response of the coordinator.
- * @throws RPCException in the event of problems.
- * @throws SecurityException if the {@link SecurityManager} is installed and the call
method
- * doesn't have the {@link RuntimePermission}
<code>ACCESS_RPC_SERVICE_PERMISSION</code>
- */
- Object executeCommandOnCoordinator(String commandId, long timeout, Serializable...
args) throws RPCException,
- SecurityException;
-
- /**
* Register a new {@link RemoteCommand} instance, it will be mapped to its id. If a
command with the
* same Id has already been registered, a warning will be printed into the log file
and the new
* command will replace the old one.
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/RPCServiceImpl.java
===================================================================
---
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/RPCServiceImpl.java 2010-12-28
15:54:28 UTC (rev 3746)
+++
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/RPCServiceImpl.java 2010-12-28
16:31:16 UTC (rev 3747)
@@ -478,66 +478,6 @@
/**
* {@inheritDoc}
*/
- public List<Object> executeCommandOnAllNodes(String commandId, boolean
synchronous, Serializable... args)
- throws RPCException, SecurityException
- {
- RemoteCommand command = commands.get(commandId);
- if (command == null)
- {
- throw new RPCException("Command " + commandId + " unkown, please
register your command first");
- }
-
- return executeCommandOnAllNodes(command, synchronous, args);
- }
-
- /**
- * {@inheritDoc}
- */
- public List<Object> executeCommandOnAllNodes(String commandId, long timeout,
Serializable... args)
- throws RPCException, SecurityException
- {
- RemoteCommand command = commands.get(commandId);
- if (command == null)
- {
- throw new RPCException("Command " + commandId + " unkown, please
register your command first");
- }
-
- return executeCommandOnAllNodes(command, timeout, args);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object executeCommandOnCoordinator(String commandId, boolean synchronous,
Serializable... args)
- throws RPCException, SecurityException
- {
- RemoteCommand command = commands.get(commandId);
- if (command == null)
- {
- throw new RPCException("Command " + commandId + " unkown, please
register your command first");
- }
-
- return executeCommandOnCoordinator(command, synchronous, args);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object executeCommandOnCoordinator(String commandId, long timeout,
Serializable... args) throws RPCException,
- SecurityException
- {
- RemoteCommand command = commands.get(commandId);
- if (command == null)
- {
- throw new RPCException("Command " + commandId + " unkown, please
register your command first");
- }
-
- return executeCommandOnCoordinator(command, timeout, args);
- }
-
- /**
- * {@inheritDoc}
- */
public Object handle(Message msg)
{
String commandId = null;
@@ -1034,5 +974,4 @@
super(message);
}
}
-
}
Modified:
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/rpc/impl/TestRPCServiceImpl.java
===================================================================
---
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/rpc/impl/TestRPCServiceImpl.java 2010-12-28
15:54:28 UTC (rev 3746)
+++
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/rpc/impl/TestRPCServiceImpl.java 2010-12-28
16:31:16 UTC (rev 3747)
@@ -50,7 +50,6 @@
private PortalContainer container;
private ConfigurationManager configManager;
- @Override
public void setUp() throws Exception
{
container = PortalContainer.getInstance();
@@ -1064,58 +1063,6 @@
}
}
- public void testCallCommandsById() throws Exception
- {
- InitParams params = new InitParams();
- ValueParam paramConf = new ValueParam();
- paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
- paramConf.setValue("jar:/conf/portal/udp.xml");
- params.addParameter(paramConf);
- RPCServiceImpl service = null;
- try
- {
- service = new RPCServiceImpl(container.getContext(), params, configManager);
- RemoteCommand dummy = new RemoteCommand()
- {
-
- public String getId()
- {
- return "dummy";
- }
-
- public String execute(Serializable[] args) throws Throwable
- {
- return "OK";
- }
- };
- service.registerCommand(dummy);
- service.start();
-
- Object o = service.executeCommandOnCoordinator("dummy", true);
- assertEquals("OK", o);
-
- List<Object> result = service.executeCommandOnAllNodes("dummy",
true);
- assertNotNull(result);
- assertTrue(result.size() == 1);
- assertEquals(result.get(0), "OK");
-
- o = service.executeCommandOnCoordinator("dummy",
RPCServiceImpl.DEFAULT_TIMEOUT);
- assertEquals("OK", o);
-
- result = service.executeCommandOnAllNodes("dummy",
RPCServiceImpl.DEFAULT_TIMEOUT);
- assertNotNull(result);
- assertTrue(result.size() == 1);
- assertEquals(result.get(0), "OK");
- }
- finally
- {
- if (service != null)
- {
- service.stop();
- }
- }
- }
-
public static class MyService
{
private int value = 0;