Commit 8344c033 authored by yannick legoc's avatar yannick legoc
Browse files

refactored command box accessor proxy.

parent 5487902f
......@@ -31,24 +31,24 @@ import fr.ill.ics.nomadserver.commandzone.CommandBoxRequests;
import fr.ill.ics.nomadserver.common.Common;
import fr.ill.ics.nscclient.serverconnection.ServerInstance;
public class CommandBoxAccessorProxy {
public class CommandBoxAccessor {
private static final Logger LOGGER = Logger.getLogger(CommandBoxAccessorProxy.class.getName());
private static final Logger LOGGER = Logger.getLogger(CommandBoxAccessor.class.getName());
private String serverId;
private Application.Requester commandBoxRequester;
public enum ExecutionPhaseState {CONSTRUCTION, RUNNING, FINISHED, PAUSED};
private static Map<String, CommandBoxAccessorProxy> instances = new HashMap<String, CommandBoxAccessorProxy>();
private static Map<String, CommandBoxAccessor> instances = new HashMap<String, CommandBoxAccessor>();
private CommandBoxAccessorProxy(String serverId) {
private CommandBoxAccessor(String serverId) {
this.serverId = serverId;
}
public static CommandBoxAccessorProxy getInstance(String serverId) {
public static CommandBoxAccessor getInstance(String serverId) {
if (!instances.containsKey(serverId)) {
CommandBoxAccessorProxy instance = new CommandBoxAccessorProxy(serverId);
CommandBoxAccessor instance = new CommandBoxAccessor(serverId);
instances.put(serverId, instance);
}
return instances.get(serverId);
......
......@@ -18,7 +18,7 @@
package fr.ill.ics.nscclient.command;
import fr.ill.ics.nscclient.command.CommandBoxAccessorProxy.ExecutionPhaseState;
import fr.ill.ics.nscclient.command.CommandBoxAccessor.ExecutionPhaseState;
public abstract class ServerCommandBox {
......@@ -53,23 +53,23 @@ public abstract class ServerCommandBox {
}
public void toggleBackground() {
CommandBoxAccessorProxy.getInstance(serverId).toggleBackground(commandBoxId);
CommandBoxAccessor.getInstance(serverId).toggleBackground(commandBoxId);
}
public void toggleParallel() {
CommandBoxAccessorProxy.getInstance(serverId).toggleParallel(commandBoxId);
CommandBoxAccessor.getInstance(serverId).toggleParallel(commandBoxId);
}
public boolean isBackground() {
return CommandBoxAccessorProxy.getInstance(serverId).isBackground(commandBoxId);
return CommandBoxAccessor.getInstance(serverId).isBackground(commandBoxId);
}
public boolean isParallel() {
return CommandBoxAccessorProxy.getInstance(serverId).isParallel(commandBoxId);
return CommandBoxAccessor.getInstance(serverId).isParallel(commandBoxId);
}
public ExecutionPhaseState getExecutionState() {
return CommandBoxAccessorProxy.getInstance(serverId).getExecutionState(commandBoxId);
return CommandBoxAccessor.getInstance(serverId).getExecutionState(commandBoxId);
}
public boolean isRunning() {
......@@ -85,19 +85,19 @@ public abstract class ServerCommandBox {
}
public void setModifiable(boolean isModifiable) {
CommandBoxAccessorProxy.getInstance(serverId).setModifiable(commandBoxId, isModifiable);
CommandBoxAccessor.getInstance(serverId).setModifiable(commandBoxId, isModifiable);
}
public boolean isModifiable() {
return CommandBoxAccessorProxy.getInstance(serverId).isModifiable(commandBoxId);
return CommandBoxAccessor.getInstance(serverId).isModifiable(commandBoxId);
}
public void stop() {
CommandBoxAccessorProxy.getInstance(serverId).stop(commandBoxId);
CommandBoxAccessor.getInstance(serverId).stop(commandBoxId);
}
public int getProgression() {
return CommandBoxAccessorProxy.getInstance(serverId).getProgression(commandBoxId);
return CommandBoxAccessor.getInstance(serverId).getProgression(commandBoxId);
}
public abstract int getNumberOfCommandBoxes();
......
......@@ -26,7 +26,7 @@ import fr.ill.ics.bridge.ControllerManager;
import fr.ill.ics.bridge.DriverManager;
import fr.ill.ics.bridge.ResourceManager;
import fr.ill.ics.nscclient.command.AtomicCommandBoxAccessorProxy;
import fr.ill.ics.nscclient.command.CommandBoxAccessorProxy;
import fr.ill.ics.nscclient.command.CommandBoxAccessor;
import fr.ill.ics.nscclient.command.CommandZoneAccessorProxy;
import fr.ill.ics.nscclient.command.ControlCommandBoxAccessorProxy;
import fr.ill.ics.nscclient.command.ForLoopCommandBoxAccessorProxy;
......@@ -74,7 +74,7 @@ public class ServerSessionManager {
ServantManagerAccessor.getInstance(serverId).init();
CommandZoneAccessorProxy.getInstance(serverId).init();
CommandBoxAccessorProxy.getInstance(serverId).init();
CommandBoxAccessor.getInstance(serverId).init();
AtomicCommandBoxAccessorProxy.getInstance(serverId).init();
ScanCommandBoxAccessorProxy.getInstance(serverId).init();
ForLoopCommandBoxAccessorProxy.getInstance(serverId).init();
......@@ -162,7 +162,7 @@ public class ServerSessionManager {
ConditionManagerAccessor.getInstance(serverId).reset();
CommandBoxAccessorProxy.getInstance(serverId).reset();
CommandBoxAccessor.getInstance(serverId).reset();
currentSession.logout();
currentSession = null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment