Author: jbonofre
Date: Mon Aug 6 15:30:41 2012
New Revision: 1369864
URL: http://svn.apache.org/viewvc?rev=1369864&view=rev
Log:
[KARAF-1699] InstancesMBean now provides verbose for rename operation, and
wait/debug to the start operation
Modified:
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java
Modified:
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java
URL:
http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java?rev=1369864&r1=1369863&r2=1369864&view=diff
==============================================================================
---
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java
(original)
+++
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java
Mon Aug 6 15:30:41 2012
@@ -40,9 +40,12 @@ public interface InstancesMBean {
void changeRmiServerPort(String name, int port) throws Exception;
void changeJavaOpts(String name, String javaopts) throws Exception;
void destroyInstance(String name) throws Exception;
+ void startInstance(String name) throws Exception;
void startInstance(String name, String opts) throws Exception;
+ void startInstance(String name, String opts, boolean wait, boolean debug)
throws Exception;
void stopInstance(String name) throws Exception;
void renameInstance(String originalName, String newName) throws Exception;
+ void renameInstance(String originalName, String newName, boolean verbose)
throws Exception;
void cloneInstance(String name, String cloneName, int sshPort, int
rmiRegistryPort, int rmiServerPort, String location, String javaOpts) throws
Exception;
// Attributes
Modified:
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java
URL:
http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java?rev=1369864&r1=1369863&r2=1369864&view=diff
==============================================================================
---
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java
(original)
+++
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java
Mon Aug 6 15:30:41 2012
@@ -30,6 +30,9 @@ import org.apache.karaf.instance.core.In
public class Instances extends StandardMBean implements InstancesMBean {
+ static final String DEBUG_OPTS = " -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005";
+ static final String DEFAULT_OPTS = "-server -Xmx512M
-Dcom.sun.management.jmxremote";
+
private org.apache.karaf.instance.core.InstanceService instanceService;
public Instances(org.apache.karaf.instance.core.InstanceService
instanceService) throws NotCompliantMBeanException {
@@ -77,10 +80,42 @@ public class Instances extends StandardM
getExistingInstance(name).destroy();
}
+ public void startInstance(String name) throws Exception {
+ getExistingInstance(name).start(null);
+ }
+
public void startInstance(String name, String opts) throws Exception {
getExistingInstance(name).start(opts);
}
+ public void startInstance(String name, String opts, boolean wait, boolean
debug) throws Exception {
+ Instance child = getExistingInstance(name);
+ String options = opts;
+ if (options == null) {
+ options = child.getJavaOpts();
+ }
+ if (options == null) {
+ options = DEFAULT_OPTS;
+ }
+ if (debug) {
+ options += DEBUG_OPTS;
+ }
+ if (wait) {
+ String state = child.getState();
+ if (Instance.STOPPED.equals(state)) {
+ child.start(opts);
+ }
+ if (!Instance.STARTED.equals(state)) {
+ do {
+ Thread.sleep(500);
+ state = child.getState();
+ } while (Instance.STARTING.equals(state));
+ }
+ } else {
+ child.start(opts);
+ }
+ }
+
public void stopInstance(String name) throws Exception {
getExistingInstance(name).stop();
}
@@ -89,6 +124,10 @@ public class Instances extends StandardM
instanceService.renameInstance(originalName, newName, false);
}
+ public void renameInstance(String originalName, String newName, boolean
verbose) throws Exception {
+ instanceService.renameInstance(originalName, newName, verbose);
+ }
+
public void cloneInstance(String name, String cloneName, int sshPort, int
rmiRegistryPort, int rmiServerPort, String location, String javaOpts) throws
Exception {
if ("".equals(location)) {
location = null;