public int createInstance(String name, InstanceSettings settings) throws Exception { Instance inst = adminService.createInstance(name, settings); if (inst != null) { return inst.getPid(); } else { return -1; } }
public void renameInstance(String originalName, String newName) throws Exception { adminService.renameInstance(originalName, newName); }
public void cloneInstance(String name, String cloneName, InstanceSettings settings) throws Exception { adminService.cloneInstance(name, cloneName, settings); }
private boolean instanceStarted() { try { String state = adminService.getInstance(name).getState(); return Instance.STARTED.equals(state); } catch (Exception ex) { return false; } } }
protected Object doExecute() throws Exception { Map<String, URL> textResources = getResources(textResourceLocation); Map<String, URL> binaryResources = getResources(binaryResourceLocations); InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, featureURLs, features, textResources, binaryResources, address); getAdminService().createInstance(instance, settings); return null; } }
private boolean destroyInstance(String name) { try { Instance instance = adminService.getInstance(name); if (instance != null) { instance.destroy(); return true; } } catch (Exception ex) { Logger.getLogger(AdminPlugin.class.getName()).log(Level.SEVERE, null, ex); } return false; }
private boolean startInstance(String name, String javaOpts) { try { Instance instance = adminService.getInstance(name); if (instance != null) { instance.start(javaOpts); return true; } } catch (Exception ex) { Logger.getLogger(AdminPlugin.class.getName()).log(Level.SEVERE, null, ex); } return false; }
private boolean stopInstance(String name) { try { Instance instance = adminService.getInstance(name); if (instance != null) { instance.stop(); return true; } } catch (Exception ex) { Logger.getLogger(AdminPlugin.class.getName()).log(Level.SEVERE, null, ex); } return false; }
protected Object doExecute() throws Exception { Map<String, URL> textResources = getResources(textResourceLocation); Map<String, URL> binaryResources = getResources(binaryResourceLocations); InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, null, null, textResources, binaryResources); getAdminService().cloneInstance(name, cloneName, settings); return null; }
public int complete(String buffer, int cursor, List candidates) { StringsCompleter delegate = new StringsCompleter(); for (Instance instance : adminService.getInstances()) { if (acceptsInstance(instance)) { delegate.getStrings().add(instance.getName()); } } return delegate.complete(buffer, cursor, candidates); }
public void cloneInstance(String name, String cloneName, int sshPort, int rmiRegistryPort, int rmiServerPort, String location, String javaOpts) throws Exception { if ("".equals(location)) { location = null; } if ("".equals(javaOpts)) { javaOpts = null; } InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, null, null); adminService.cloneInstance(name, cloneName, settings); }
protected boolean acceptsInstance(Instance instance) { try { if (instance.getState().equals(Instance.STARTED)) { return true; } else { return false; } } catch (Exception e) { return false; } } }
protected Instance getExistingInstance(String name) { Instance i = adminService.getInstance(name); if (i == null) { throw new IllegalArgumentException("Instance '" + name + "' does not exist"); } return i; }
protected Object doExecute() throws Exception { getExistingInstance(instance).stop(); return null; } }
protected Object doExecute() throws Exception { getExistingInstance(instance).destroy(); return null; }
public void startInstance(String name) throws Exception { getExistingInstance(name).start(null); }
protected Object doExecute() throws Exception { getExistingInstance(instance).changeJavaOpts(javaOpts); return null; } }
protected Object doExecute() throws Exception { getExistingInstance(instance).changeSshHost(host); return null; } }
protected Object doExecute() throws Exception { getAdminService().renameInstance(instance, newName); return null; }
private boolean instanceStarted() { try { String state = adminService.getInstance(name).getState(); return Instance.STARTED.equals(state); } catch (Exception ex) { return false; } } }