Commit 9b9fa88b authored by Cristina Cocho's avatar Cristina Cocho

First commit of new branch (configura)

parent 3d86f12d
......@@ -30,13 +30,13 @@ public interface Controller {
public String getName();
public String getType();
public Set getCommandNames();
public Set<String> getCommandNames();
public String getControllerNameWithRole(String role);
public Map getPropertyNamesAndTypes();
public Map<String, String> getPropertyNamesAndTypes();
public String getPropertyType(String propertyName);
public Map getPropertyNamesAndValues();
public Map<String, String> getPropertyNamesAndValues();
public void addServerPropertyChangeListener(ServerPropertyChangeListener listener);
......
......@@ -18,8 +18,6 @@
package fr.ill.ics.bridge;
import java.util.Properties;
import fr.ill.ics.nscclient.servant.ConfigurationManager.LoadFailure;
import fr.ill.ics.nscclient.serverconnection.ServerConnection;
import fr.ill.ics.nscclient.sessionmanagement.ServerSessionManager;
......@@ -73,6 +71,10 @@ public class LoginManager {
public String getStatusMessage() {
return ServerConnection.getInstance("real").getStatusMessage();
}
public String getStatusMessage(String serverId) {
return ServerConnection.getInstance(serverId).getStatusMessage();
}
public boolean makeConnection(String serverId) {
return ServerConnection.getInstance(serverId).makeConnection();
......
......@@ -37,6 +37,7 @@ import fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient;
public class CommandZoneWrapper implements ICommandZoneEventListener {
public final static String SERVER_ID = "real";
public final static String CATALOGUE_PROVIDER_ID = "catalogue_provider";
public final static String EDITOR_ID = "editor";
private static int DATABASE_ID = 0;
......
......@@ -39,7 +39,7 @@ public abstract class CommandAction {
protected int progress = 0;
protected boolean isRunning = false;
private List commandListeners = new ArrayList();
private List<ICommandListener> commandListeners = new ArrayList<ICommandListener>();
private String commandName;
......@@ -86,9 +86,9 @@ public abstract class CommandAction {
protected void sendCommandTerminatedEvent() {
synchronized (commandListeners) {
// Iterate over listeners and send the notification
Iterator listenerIterator = commandListeners.iterator();
Iterator<ICommandListener> listenerIterator = commandListeners.iterator();
while (listenerIterator.hasNext()) {
((ICommandListener)(listenerIterator.next())).commandTerminated(this);
(listenerIterator.next()).commandTerminated(this);
}
}
}
......@@ -100,9 +100,9 @@ public abstract class CommandAction {
protected void sendCommandStartedEvent() {
synchronized (commandListeners) {
// Iterate over listeners and send the notification
Iterator listenerIterator = commandListeners.iterator();
Iterator<ICommandListener> listenerIterator = commandListeners.iterator();
while (listenerIterator.hasNext()) {
((ICommandListener)(listenerIterator.next())).commandStarted(this);
(listenerIterator.next()).commandStarted(this);
}
}
}
......@@ -114,9 +114,9 @@ public abstract class CommandAction {
protected void sendProgressChangedEvent() {
synchronized (commandListeners) {
// Iterate over listeners and send the notification
Iterator listenerIterator = commandListeners.iterator();
Iterator<ICommandListener> listenerIterator = commandListeners.iterator();
while (listenerIterator.hasNext()) {
((ICommandListener)(listenerIterator.next())).progressChanged(this);
(listenerIterator.next()).progressChanged(this);
}
}
}
......
......@@ -52,10 +52,10 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
protected PropertyFormat propertyFormat;
private UndoState undoState;
protected List conditions;
protected List<IPropertyCondition> conditions;
private Set<IPropertyChangeListener> propertyChangeListeners;
private List propertyErrorListeners;
private List lockListeners;
private List<IPropertyErrorListener> propertyErrorListeners;
private List<ILockChangedListener> lockListeners;
protected PropertyVerifyListener pVerifyListener;
private boolean isLocked = false;
......@@ -91,7 +91,7 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
// Set property change listeners initial size to 2
this.propertyChangeListeners = new HashSet<IPropertyChangeListener>(1);
this.propertyErrorListeners = new ArrayList(2);
this.propertyErrorListeners = new ArrayList<IPropertyErrorListener>(2);
this.undoState = new AutoApplyState(this);
......@@ -179,8 +179,8 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
isOk = false;
}
if (conditions != null) {
for (Iterator iter = this.conditions.iterator(); iter.hasNext();) {
condition = (IPropertyCondition) iter.next();
for (Iterator<IPropertyCondition> iter = this.conditions.iterator(); iter.hasNext();) {
condition = iter.next();
if (!condition.isOk(value)) {
setErrorMessageAndTitle(condition.getErrorMessage(getName()), "invalidValueTitle");
sendPropertyErrorEvent();
......@@ -222,7 +222,7 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
if (conditions == null) {
// For a load factor of 0.75 and a max size of 6, we need to set the capacity to 8
// There are 6 different types of conditions but in practice, two maximum for the same property
this.conditions = new ArrayList(2);
this.conditions = new ArrayList<IPropertyCondition>(2);
}
this.conditions.add(condition);
......@@ -348,9 +348,9 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
synchronized (propertyErrorListeners) {
// Iterate over listeners and send the notification of property error
Iterator listenerIterator = propertyErrorListeners.iterator();
Iterator<IPropertyErrorListener> listenerIterator = propertyErrorListeners.iterator();
while (listenerIterator.hasNext()) {
IPropertyErrorListener propertyErrorListener = (IPropertyErrorListener)(listenerIterator.next());
IPropertyErrorListener propertyErrorListener = listenerIterator.next();
if (propertyErrorListener.isVisible()) {
// H.ORTIZ 18 JUL 2016: here we have to check if the widget linked with current property is visible, because it can be
// in a hidden part of the screen (in a switchable composite)
......@@ -407,7 +407,7 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
public void addLockListener(ILockChangedListener lockListener) {
if (lockListeners == null) {
// Set lock listeners initial size to 2 (created at the same time as property changed listeners)
this.lockListeners = new ArrayList(2);
this.lockListeners = new ArrayList<ILockChangedListener>(2);
}
synchronized (lockListeners) {
......@@ -442,9 +442,9 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
public void sendLockChangedEvent() {
if (lockListeners != null) {
synchronized (lockListeners) {
Iterator listenerIterator = lockListeners.iterator();
Iterator<ILockChangedListener> listenerIterator = lockListeners.iterator();
while (listenerIterator.hasNext()) {
((ILockChangedListener) (listenerIterator.next())).lockChanged(new LockEvent(this, isLocked));
(listenerIterator.next()).lockChanged(new LockEvent(this, isLocked));
}
}
}
......@@ -669,12 +669,12 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
return containerId;
}
public List getConditions() {
public List<IPropertyCondition> getConditions() {
return conditions;
}
public void setConditions(ArrayList conditions) {
conditions = new ArrayList();
public void setConditions(ArrayList<IPropertyCondition> conditions) {
conditions = new ArrayList<IPropertyCondition>();
conditions.addAll(conditions);
}
......
......@@ -32,6 +32,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import fr.ill.ics.core.property.condition.GreaterThanPropertyCondition;
import fr.ill.ics.core.property.condition.IPropertyCondition;
import fr.ill.ics.core.property.condition.LowerThanPropertyCondition;
import fr.ill.ics.core.property.condition.PositivePropertyCondition;
import fr.ill.ics.core.property.condition.RangePropertyCondition;
......@@ -198,7 +199,7 @@ public class PropertyFactory {
* @param propertyDescriptors a map containing controller property names as keys and PropertyDescriptor instances as values
* @return a map containing controller property names as keys and Property instances as values
*/
public Map createPropertiesForController(int databaseId, int servantId, LinkedHashMap<String, XMLPropertyDescriptor> propertyDescriptors) {
public Map<String, Property> createPropertiesForController(int databaseId, int servantId, LinkedHashMap<String, XMLPropertyDescriptor> propertyDescriptors) {
Map<String, Property> properties = new LinkedHashMap<String, Property>();
Iterator<Entry<String, XMLPropertyDescriptor>> it = propertyDescriptors.entrySet().iterator();
while (it.hasNext()) {
......@@ -347,7 +348,7 @@ public class PropertyFactory {
// add conditions
if (property.getConditions() != null) {
clone.setConditions(new ArrayList(property.getConditions()));
clone.setConditions(new ArrayList<IPropertyCondition>(property.getConditions()));
}
return clone;
}
......
......@@ -246,13 +246,13 @@ public class PropertyManager {
if (!propertyParser.getDynamicProperties().isEmpty()) {
if (dynamicPropertiesByControllerType == null) {
dynamicPropertiesByControllerType = new HashMap(NB_CONTROLLER_TYPES);
dynamicPropertiesByControllerType = new HashMap<String, Map<String, XMLDynamicPropertyDescriptor>>(NB_CONTROLLER_TYPES);
}
Map<String, XMLDynamicPropertyDescriptor> dynamicPropertiesFromFile = new LinkedHashMap(propertyParser.getDynamicProperties().size());
Map<String, XMLDynamicPropertyDescriptor> dynamicPropertiesFromFile = new LinkedHashMap<String, XMLDynamicPropertyDescriptor>(propertyParser.getDynamicProperties().size());
dynamicPropertiesFromFile.putAll(propertyParser.getDynamicProperties());
dynamicPropertiesByControllerType.put(propertyParser.getControllerType(), dynamicPropertiesFromFile);
}
Map propertiesTypesFromFile = new LinkedHashMap(propertyParser.getProperties().size());
Map<String, String> propertiesTypesFromFile = new LinkedHashMap<String, String>(propertyParser.getProperties().size());
propertiesTypesFromFile.putAll(propertyParser.getPropertyTypes());
}
......@@ -264,7 +264,7 @@ public class PropertyManager {
* @param controller
*/
private void createPropertiesForController(Servant servant) {
Map properties = PropertyFactory.getInstance().createPropertiesForController(servant.getDatabaseId(), servant.getId(), propertiesByControllerType.get(servant.getType()));
Map<String, Property> properties = PropertyFactory.getInstance().createPropertiesForController(servant.getDatabaseId(), servant.getId(), propertiesByControllerType.get(servant.getType()));
propertyMap.put(servant.getId(), properties);
}
......@@ -379,7 +379,7 @@ public class PropertyManager {
if (!propertiesByControllerType.containsKey(servant.getType())) {
initialiseControllerTypeProperties(servant);
}
propertyMap.put(servant.getId(), new HashMap());
propertyMap.put(servant.getId(), new HashMap<String, Property>());
}
Property property = propertyMap.get(servant.getId()).get(propertyName);
......@@ -404,7 +404,7 @@ public class PropertyManager {
CommandBoxKey key = new CommandBoxKey(command.getServerId(), command.getId());
if (!this.commandBoxPropertyMap.containsKey(key)) {
commandBoxPropertyMap.put(key, new HashMap());
commandBoxPropertyMap.put(key, new HashMap<String, Property>());
}
Property property = commandBoxPropertyMap.get(key).get(propertyName);
......@@ -455,7 +455,7 @@ public class PropertyManager {
public void initialiseControllerTypeProperties(Servant servant) {
// create dynamically a list of properties and create a new xml file
Map propertyNamesAndTypes = servant.getPropertyNamesAndTypes();
Map<String, String> propertyNamesAndTypes = servant.getPropertyNamesAndTypes();
// Does controllerTypeProperties.xml file exist on client side ?
String fileName = ConfigManager.CONTROLLERS_DIRECTORY + servant.getType() + ConfigManager.FILE_SEPARATOR + servant.getType() + ConfigManager.PROPERTIES_PATTERN;
......@@ -479,7 +479,7 @@ public class PropertyManager {
propertiesFromFile.putAll(propertyParser.getProperties());
propertiesByControllerType.put(propertyParser.getControllerType(), propertiesFromFile);
Map propertiesTypesFromFile = new LinkedHashMap<String, String>(propertyParser.getPropertyTypes().size());
Map<String, String> propertiesTypesFromFile = new LinkedHashMap<String, String>(propertyParser.getPropertyTypes().size());
propertiesTypesFromFile.putAll(propertyParser.getPropertyTypes());
}
}
......@@ -529,13 +529,13 @@ public class PropertyManager {
if (!propertyParser.getDynamicProperties().isEmpty()) {
if (dynamicPropertiesByControllerType == null) {
dynamicPropertiesByControllerType = new HashMap(NB_CONTROLLER_TYPES);
dynamicPropertiesByControllerType = new HashMap<String, Map<String, XMLDynamicPropertyDescriptor>>(NB_CONTROLLER_TYPES);
}
Map<String, XMLDynamicPropertyDescriptor> dynamicPropertiesFromFile = new LinkedHashMap(propertyParser.getDynamicProperties().size());
Map<String, XMLDynamicPropertyDescriptor> dynamicPropertiesFromFile = new LinkedHashMap<String, XMLDynamicPropertyDescriptor>(propertyParser.getDynamicProperties().size());
dynamicPropertiesFromFile.putAll(propertyParser.getDynamicProperties());
dynamicPropertiesByControllerType.put(propertyParser.getControllerType(), dynamicPropertiesFromFile);
}
Map propertiesTypesFromFile = new LinkedHashMap<String, String>(propertyParser.getPropertyTypes().size());
Map<String, String> propertiesTypesFromFile = new LinkedHashMap<String, String>(propertyParser.getPropertyTypes().size());
propertiesTypesFromFile.putAll(propertyParser.getPropertyTypes());
}
......@@ -737,7 +737,7 @@ public class PropertyManager {
public void addPropertyDescriptor(String controllerType, XMLPropertyDescriptor propertyDescriptor) {
if (propertiesByControllerType.get(controllerType) != null) {
Map properties = propertiesByControllerType.get(controllerType);
Map<String, XMLPropertyDescriptor> properties = propertiesByControllerType.get(controllerType);
if (properties.get(propertyDescriptor.getPropertyName()) == null) {
properties.put(propertyDescriptor.getPropertyName(), propertyDescriptor);
}
......@@ -910,7 +910,7 @@ public class PropertyManager {
if (controller instanceof AtomicCommandWrapper) {
AtomicCommandWrapper command = (AtomicCommandWrapper)controller;
CommandBoxKey key = new CommandBoxKey(command.getServerId(), command.getId());
Map properties = commandBoxPropertyMap.get(key);
Map<String, Property> properties = commandBoxPropertyMap.get(key);
Property clone = property.cloneAsString(isTrueString);
clone.setServerId(command.getServerId());
properties.put(property.getName(), clone);
......@@ -928,7 +928,7 @@ public class PropertyManager {
if (controller instanceof AtomicCommandWrapper) {
AtomicCommandWrapper command = (AtomicCommandWrapper)controller;
CommandBoxKey key = new CommandBoxKey(command.getServerId(), command.getId());
Map properties = commandBoxDynamicPropertyMap.get(key);
Map<String, Property> properties = commandBoxDynamicPropertyMap.get(key);
Property clone = property.cloneAsString(isTrueString);
clone.setServerId(command.getServerId());
properties.put(property.getName(), clone);
......@@ -943,9 +943,9 @@ public class PropertyManager {
* @param controllerType controller type
* @return a set containing all property names for given controller type
*/
public Set getPropertiesForControllersType(String controllerType) {
public Set<String> getPropertiesForControllersType(String controllerType) {
SortedSet properties = new TreeSet();
SortedSet<String> properties = new TreeSet<String>();
if (propertiesByControllerType.get(controllerType) != null) {
properties.addAll(propertiesByControllerType.get(controllerType).keySet());
}
......@@ -1049,14 +1049,14 @@ public class PropertyManager {
*/
public boolean isDynamic(Controller controller, String propertyName) {
if (propertyMap.containsKey(((Servant)controller).getId())) {
Map map = propertyMap.get(((Servant)controller).getId());
Map<String, Property> map = propertyMap.get(((Servant)controller).getId());
if (map.containsKey(propertyName)) {
return false;
}
}
if (dynamicPropertyMap.containsKey(((Servant)controller).getId())) {
Map map = dynamicPropertyMap.get(((Servant)controller).getId());
Map<String, DynamicProperty> map = dynamicPropertyMap.get(((Servant)controller).getId());
if (propertyName.contains(".")) {
propertyName = propertyName.substring(0, propertyName.indexOf("."));
......@@ -1151,7 +1151,6 @@ public class PropertyManager {
public Collection<String> getChildrenOfAllDynamicProperties(String controllerName) {
Set<String> properties = new HashSet<String>();
Set<String> dynamicProperties = new HashSet<String>();
Iterator<String> it = PropertyManager.getInstance().getDynamicPropertiesForController(controllerName).iterator();
......
......@@ -79,14 +79,14 @@ public class PropertyParser extends GenericParser {
protected final static String ATTRIBUTE_SIZE_PROPERTY = "size_property";
protected String controllerType;
private Map properties; // KEY=property name VALUE=PropertyDescriptor instance
private Map propertyTypes; // KEY=property name VALUE=property type
private Map<String, XMLPropertyDescriptor> properties; // KEY=property name VALUE=PropertyDescriptor instance
private Map<String, String> propertyTypes; // KEY=property name VALUE=property type
private XMLPropertyDescriptor propertyDescriptor;
// For dynamic properties
private XMLDynamicPropertyDescriptor dynamicPropertyDescriptor;
private Map dynamicProperties; // KEY=dynamic property generic name VALUE=DynamicPropertyDescriptor instance
private Map<String, XMLDynamicPropertyDescriptor> dynamicProperties; // KEY=dynamic property generic name VALUE=DynamicPropertyDescriptor instance
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
......@@ -94,9 +94,9 @@ public class PropertyParser extends GenericParser {
if (qName.equals(TAG_CONTROLLER)) {
controllerType = getAttribute(attributes, ATTRIBUTE_CONTROLLER_TYPE);
properties = new LinkedHashMap();
dynamicProperties = new LinkedHashMap();
propertyTypes = new LinkedHashMap();
properties = new LinkedHashMap<String, XMLPropertyDescriptor>();
dynamicProperties = new LinkedHashMap<String, XMLDynamicPropertyDescriptor>();
propertyTypes = new LinkedHashMap<String, String>();
} else if (qName.equals(TAG_PROPERTY)) {
propertyDescriptor = new XMLPropertyDescriptor(getAttribute(attributes, ATTRIBUTE_PROPERTY_NAME), getAttribute(attributes, ATTRIBUTE_PROPERTY_TYPE));
......@@ -205,7 +205,7 @@ public class PropertyParser extends GenericParser {
* Create a new file
* @param type
*/
public String createPropertyFile(String controllerType, Map propertiesAndTypes) {
public String createPropertyFile(String controllerType, Map<String, String> propertiesAndTypes) {
String filename = controllerType + ConfigManager.PROPERTIES_PATTERN;
......@@ -217,15 +217,15 @@ public class PropertyParser extends GenericParser {
// Iterate over map of properties and create new entry for each
// It is more efficient to use an iterator on the entrySet of the map, to avoid the Map.get(key) lookup.
Iterator it = propertiesAndTypes.entrySet().iterator();
Entry entry;
Iterator<Entry<String, String>> it = propertiesAndTypes.entrySet().iterator();
Entry<String, String> entry;
String propertyTypeAttribute;
while (it.hasNext()) {
entry = (Entry)it.next();
entry = it.next();
// Get the type attribute from the config manager. if it doesn't exist
// then ignor the property
propertyTypeAttribute = (String)entry.getValue();
// then ignore the property
propertyTypeAttribute = entry.getValue();
if (!propertyTypeAttribute.equals("")) {
fileContent = fileContent + "\t<" + TAG_PROPERTY + " " + ATTRIBUTE_PROPERTY_NAME + "=\"" + entry.getKey() + "\" " + ATTRIBUTE_PROPERTY_TYPE + "=\"" + propertyTypeAttribute + "\">" + LINE_SEPARATOR;
fileContent = fileContent + "\t</" + TAG_PROPERTY + ">" + LINE_SEPARATOR;
......@@ -238,15 +238,15 @@ public class PropertyParser extends GenericParser {
}
public Map getProperties() {
public Map<String, XMLPropertyDescriptor> getProperties() {
return properties;
}
public Map getDynamicProperties() {
public Map<String, XMLDynamicPropertyDescriptor> getDynamicProperties() {
return dynamicProperties;
}
public Map getPropertyTypes() {
public Map<String, String> getPropertyTypes() {
return propertyTypes;
}
......
......@@ -64,7 +64,7 @@ public class CommandDatabase {
public void addCommandDescriptor(int servantId, ClientCommandDescriptor commandDescriptor) {
commands.put(commandDescriptor.getId(), commandDescriptor);
if (!commandsByServant.containsKey(servantId)) {
Set set = new HashSet<Integer>();
Set<Integer> set = new HashSet<Integer>();
commandsByServant.put(servantId, set);
}
commandsByServant.get(servantId).add(commandDescriptor.getId());
......@@ -99,7 +99,7 @@ public class CommandDatabase {
*
* @return
*/
public Set getCommandNames(int servantId) {
public Set<String> getCommandNames(int servantId) {
Set<String> names = new HashSet<String>();
if (commandsByServant.get(servantId) != null) {
Iterator<Integer> it = commandsByServant.get(servantId).iterator();
......@@ -118,7 +118,7 @@ public class CommandDatabase {
* @return
*/
public int getCommandIdForServant(int servantId, String commandName) {
Set commandIdsForServant = commandsByServant.get(servantId);
Set<Integer> commandIdsForServant = commandsByServant.get(servantId);
if (commandIdsForServant != null) {
Iterator<Integer> it = commandIdsForServant.iterator();
while (it.hasNext()) {
......@@ -151,7 +151,7 @@ public class CommandDatabase {
Iterator<Entry<Integer, Set<Integer>>> it = commandsByServant.entrySet().iterator();
while (it.hasNext()) {
Entry<Integer, Set<Integer>> entry = it.next();
Set commandIds = entry.getValue();
Set<Integer> commandIds = entry.getValue();
if (commandIds.contains(commandId)) {
return entry.getKey();
}
......
......@@ -171,11 +171,11 @@ public class ServantDatabase {
}
public Collection getControllers() {
public Collection<ClientServantDescriptor> getControllers() {
return controllers.values();
}
public Collection getDrivers() {
public Collection<ClientServantDescriptor> getDrivers() {
return drivers.values();
}
......
......@@ -33,7 +33,6 @@ import fr.ill.ics.nscclient.dataprovider.CommandDatabase;
import fr.ill.ics.nscclient.dataprovider.DataAccessor;
import fr.ill.ics.nscclient.dataprovider.DataAccessor.ClientCommandState;
import fr.ill.ics.nscclient.dataprovider.PropertyDatabase;
import fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
......@@ -91,11 +90,11 @@ public class Servant implements Controller {
return ControllerManager.getInstance().getControllerNameWithRole(this, role);
}
public Set getCommandNames() {
public Set<String> getCommandNames() {
return CommandDatabase.getInstance().getCommandNames(servantDescriptor.getId());
}
public Map getPropertyNamesAndTypes() {
public Map<String, String> getPropertyNamesAndTypes() {
return PropertyDatabase.getInstance().getPropertyNamesAndTypes(servantDescriptor.getId());
}
......
......@@ -44,22 +44,40 @@ public class ServerInstance {
// Do not connect to the same application if it is simulated.
if (!serverId.equals(CommandZoneWrapper.SERVER_ID)) {
try {
// Find the simulated instance.
List<Application.Instance> nomadApps = server.connectAll("nssim");
for (Application.Instance app : nomadApps) {
if (app.exists() && app.getId() == Integer.parseInt(serverId)) {
nomad = app;
break;
if (serverId.equals(CommandZoneWrapper.CATALOGUE_PROVIDER_ID)) {
// Find the real instance.
String[] nomadAppNames = { "catalogueprovider", "nsg_catalogueprovider"};
try {
for (String appName : nomadAppNames) {
nomad = server.connect(appName);
if (nomad.exists()) {
break;
}
}
} catch (ConnectionTimeout e) {
System.err.println("Timeout while connecting nomad server");
}
} catch (ConnectionTimeout e) {
System.err.println("Timeout while connecting nomad server");
} else {
try {
// Find the simulated instance.
List<Application.Instance> nomadApps = server.connectAll("nssim");
for (Application.Instance app : nomadApps) {
if (app.exists() && app.getId() == Integer.parseInt(serverId)) {
nomad = app;
break;
}
}
} catch (ConnectionTimeout e) {
System.err.println("Timeout while connecting nomad server");
}
}
} else {
// Find the real instance.
String[] nomadAppNames = { "ns", "nsd", "nsg", "nsv" };
String[] nomadAppNames = { "ns", "nsd", "nsg", "nsv"};
try {
for (String appName : nomadAppNames) {
nomad = server.connect(appName);
......
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