You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/04/10 16:15:50 UTC

[28/59] [abbrv] [KARAF-2852] Merge instance/core and instance/command

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java b/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java
deleted file mode 100644
index b95e4dc..0000000
--- a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstancesMBeanImpl.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.instance.core.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.management.MBeanException;
-import javax.management.NotCompliantMBeanException;
-import javax.management.StandardMBean;
-import javax.management.openmbean.TabularData;
-
-import org.apache.karaf.instance.core.Instance;
-import org.apache.karaf.instance.core.InstanceSettings;
-import org.apache.karaf.instance.core.InstancesMBean;
-
-public class InstancesMBeanImpl 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 InstancesMBeanImpl(org.apache.karaf.instance.core.InstanceService instanceService) throws NotCompliantMBeanException {
-        super(InstancesMBean.class);
-        this.instanceService = instanceService;
-    }
-
-    public int createInstance(String name, int sshPort, int rmiRegistryPort, int rmiServerPort, String location, String javaOpts, String features, String featureURLs)
-            throws MBeanException {
-        try {
-            if ("".equals(location)) {
-                location = null;
-            }
-            if ("".equals(javaOpts)) {
-                javaOpts = null;
-            }
-
-            InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts,
-                    parseStringList(featureURLs), parseStringList(features));
-
-            Instance inst = instanceService.createInstance(name, settings, false);
-            if (inst != null) {
-                return inst.getPid();
-            } else {
-                return -1;
-            }
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void changeSshPort(String name, int port) throws MBeanException {
-        try {
-            getExistingInstance(name).changeSshPort(port);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void changeRmiRegistryPort(String name, int port) throws MBeanException {
-        try {
-            getExistingInstance(name).changeRmiRegistryPort(port);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void changeRmiServerPort(String name, int port) throws MBeanException {
-        try {
-            getExistingInstance(name).changeRmiServerPort(port);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void changeJavaOpts(String name, String javaOpts) throws MBeanException {
-        try {
-            getExistingInstance(name).changeJavaOpts(javaOpts);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void destroyInstance(String name) throws MBeanException {
-        try {
-            getExistingInstance(name).destroy();
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void startInstance(String name) throws MBeanException {
-        try {
-            getExistingInstance(name).start(null);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void startInstance(String name, String opts) throws MBeanException {
-        try {
-            getExistingInstance(name).start(opts);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void startInstance(String name, String opts, boolean wait, boolean debug) throws MBeanException {
-        try {
-            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);
-            }
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void stopInstance(String name) throws MBeanException {
-        try {
-            getExistingInstance(name).stop();
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void renameInstance(String originalName, String newName) throws MBeanException {
-        try {
-            instanceService.renameInstance(originalName, newName, false);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void renameInstance(String originalName, String newName, boolean verbose) throws MBeanException {
-        try {
-            instanceService.renameInstance(originalName, newName, verbose);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public void cloneInstance(String name, String cloneName, int sshPort, int rmiRegistryPort, int rmiServerPort, String location, String javaOpts) throws MBeanException {
-        try {
-            if ("".equals(location)) {
-                location = null;
-            }
-            if ("".equals(javaOpts)) {
-                javaOpts = null;
-            }
-
-            InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, null, null);
-
-            instanceService.cloneInstance(name, cloneName, settings, false);
-        } catch (Exception e) {
-            throw new MBeanException(null, e.getMessage());
-        }
-    }
-
-    public TabularData getInstances() throws MBeanException {
-        List<Instance> instances = Arrays.asList(instanceService.getInstances());
-        TabularData table = InstanceToTableMapper.tableFrom(instances);
-        return table;
-    }
-
-    private Instance getExistingInstance(String name) {
-        Instance i = instanceService.getInstance(name);
-        if (i == null) {
-            throw new IllegalArgumentException("Instance '" + name + "' does not exist");
-        }
-        return i;
-    }
-
-    private List<String> parseStringList(String value) {
-        List<String> list = new ArrayList<String>();
-        if (value != null) {
-            for (String el : value.split(",")) {
-                String trimmed = el.trim();
-                if (trimmed.length() == 0) {
-                    continue;
-                }
-                list.add(trimmed);
-            }
-        }
-        return list;
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/instance/core/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/osgi/Activator.java b/instance/core/src/main/java/org/apache/karaf/instance/core/internal/osgi/Activator.java
deleted file mode 100644
index a50db46..0000000
--- a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/osgi/Activator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.instance.core.internal.osgi;
-
-import org.apache.karaf.instance.core.InstanceService;
-import org.apache.karaf.instance.core.internal.InstanceServiceImpl;
-import org.apache.karaf.instance.core.internal.InstancesMBeanImpl;
-import org.apache.karaf.util.tracker.BaseActivator;
-
-public class Activator extends BaseActivator {
-
-    @Override
-    protected void doStart() throws Exception {
-        InstanceService instanceService = new InstanceServiceImpl();
-        register(InstanceService.class, instanceService);
-
-        InstancesMBeanImpl mbean = new InstancesMBeanImpl(instanceService);
-        registerMBean(mbean, "type=instance");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/jpm/Process.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/jpm/Process.java b/instance/core/src/main/java/org/apache/karaf/jpm/Process.java
deleted file mode 100644
index 2bd3b36..0000000
--- a/instance/core/src/main/java/org/apache/karaf/jpm/Process.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.jpm;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * Interface representing a process
- */
-public interface Process extends Serializable {
-
-    /**
-     * Retrieves the PID of the process
-     * @return the pid
-     */
-    int getPid();
-
-    /**
-     * Check if this process is still running
-     * @return <code>true</code> if the process is running
-     * @throws IOException if an error occurs
-     */
-    boolean isRunning() throws IOException;
-
-    /**
-     * Destroy the process.
-     *
-     * @throws IOException
-     */
-    void destroy() throws IOException;
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilder.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilder.java b/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilder.java
deleted file mode 100644
index 2b6c612..0000000
--- a/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.jpm;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Interface used to create new processes.
- */
-public interface ProcessBuilder {
-
-    /**
-     * Specified the current directory to run the command from
-     *
-     * @param dir the directory to run the command from
-     * @return the ProcessBuilder instance
-     */
-    ProcessBuilder directory(File dir);
-
-    /**
-     * Set the command to execute
-     *
-     * @param command the command to execute
-     * @return the ProcessBuilder instance
-     */
-    ProcessBuilder command(String command);
-
-    /**
-     * Create and start the process
-     *
-     * @return the process that has been started
-     * @throws IOException if the process can not be created
-     */
-    org.apache.karaf.jpm.Process start() throws IOException;
-
-    /**
-     * Attach to an existing process
-     *
-     * @return the process that has been attached
-     * @throws IOException if the process can not be attached to
-     */
-    org.apache.karaf.jpm.Process attach(int pid) throws IOException;
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilderFactory.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilderFactory.java b/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilderFactory.java
deleted file mode 100644
index baa563b..0000000
--- a/instance/core/src/main/java/org/apache/karaf/jpm/ProcessBuilderFactory.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.jpm;
-
-
-/**
- * Factory for process builders.
- */
-public interface ProcessBuilderFactory {
-    ProcessBuilder newBuilder();
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderFactoryImpl.java b/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderFactoryImpl.java
deleted file mode 100644
index 12a6905..0000000
--- a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderFactoryImpl.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.jpm.impl;
-
-import org.apache.karaf.jpm.ProcessBuilder;
-import org.apache.karaf.jpm.ProcessBuilderFactory;
-
-public class ProcessBuilderFactoryImpl implements ProcessBuilderFactory {
-
-    public ProcessBuilder newBuilder() {
-        return new ProcessBuilderImpl();
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderImpl.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderImpl.java b/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderImpl.java
deleted file mode 100644
index 08f4407..0000000
--- a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessBuilderImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.jpm.impl;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.karaf.jpm.Process;
-import org.apache.karaf.jpm.ProcessBuilder;
-
-
-public class ProcessBuilderImpl implements ProcessBuilder {
-
-    private File dir;
-    private String command;
-
-    public ProcessBuilder directory(File dir) {
-        this.dir = dir;
-        return this;
-    }
-
-    public ProcessBuilder command(String command) {
-        this.command = command;
-        return this;
-    }
-
-    public Process start() throws IOException {
-        return ProcessImpl.create(dir, command);
-    }
-
-    public Process attach(int pid) throws IOException {
-        return ProcessImpl.attach(pid);
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessImpl.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessImpl.java b/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessImpl.java
deleted file mode 100644
index d831fb7..0000000
--- a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ProcessImpl.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.jpm.impl;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.InterruptedIOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.karaf.jpm.Process;
-
-public class ProcessImpl implements Process {
-
-    /**
-     * 
-     */
-    private static final long serialVersionUID = -8140632422386086507L;
-
-    private int pid;
-    //private File input;
-    //private File output;
-    //private File error;
-
-    public ProcessImpl(int pid/*, File input, File output, File error*/) {
-        this.pid = pid;
-        //this.input = input;
-        //this.output = output;
-        //this.error = error;
-    }
-
-    public int getPid() {
-        return pid;
-    }
-
-    public boolean isRunning() throws IOException {
-        if (ScriptUtils.isWindows()) {
-            Map<String, String> props = new HashMap<String, String>();
-            props.put("${pid}", Integer.toString(pid));
-            int ret = ScriptUtils.execute("running", props);
-            return ret == 0;
-        } else {
-            try {
-                java.lang.Process process = new java.lang.ProcessBuilder("ps", "-p", Integer.toString(pid)).start();
-                BufferedReader r = new BufferedReader(new InputStreamReader(process.getInputStream()));
-                r.readLine(); // skip headers
-                String s = r.readLine();
-                boolean running = s != null && s.length() > 0;
-                process.waitFor();
-                return running;
-            } catch (InterruptedException e) {
-                throw new InterruptedIOException();
-            }
-        }
-    }
-
-    public void destroy() throws IOException {
-        int ret;
-        if (ScriptUtils.isWindows()) {
-            Map<String, String> props = new HashMap<String, String>();
-            props.put("${pid}", Integer.toString(pid));
-            ret = ScriptUtils.execute("destroy", props);
-        } else {
-            ret = ScriptUtils.executeProcess(new java.lang.ProcessBuilder("kill", "-9", Integer.toString(pid)));
-        }
-        if (ret != 0) {
-            throw new IOException("Unable to destroy process, it may already be terminated");
-        }
-    }
-
-    /*
-    public OutputStream getInputStream() throws FileNotFoundException {
-        return new FileOutputStream(input);
-    }
-
-    public InputStream getOutputStream() throws FileNotFoundException {
-        return new FileInputStream(output);
-    }
-
-    public InputStream getErrorStream() throws FileNotFoundException {
-        return new FileInputStream(error);
-    }
-    */
-
-    public int waitFor() throws InterruptedException {
-        return 0;
-    }
-
-    public int exitValue() {
-        return 0;
-    }
-
-    public static Process create(File dir, String command) throws IOException {
-        //File input = File.createTempFile("jpm.", ".input");
-        //File output = File.createTempFile("jpm.", ".output");
-        //File error = File.createTempFile("jpm.", ".error");
-        File pidFile = File.createTempFile("jpm.", ".pid");
-        try {
-            Map<String, String> props = new HashMap<String, String>();
-            //props.put("${in.file}", input.getCanonicalPath());
-            //props.put("${out.file}", output.getCanonicalPath());
-            //props.put("${err.file}", error.getCanonicalPath());
-            props.put("${pid.file}", pidFile.getCanonicalPath());
-            props.put("${dir}", dir != null ? dir.getCanonicalPath() : "");
-            if (ScriptUtils.isWindows()) {
-                command = command.replaceAll("\"", "\"\"");
-            }
-            props.put("${command}", command);
-            int ret = ScriptUtils.execute("start", props);
-            if (ret != 0) {
-                throw new IOException("Unable to create process (error code: " + ret + ")");
-            }
-            int pid = readPid(pidFile);
-            return new ProcessImpl(pid/*, input, output, error*/);
-        } finally {
-            pidFile.delete();
-        }
-    }
-
-    public static Process attach(int pid) throws IOException {
-        return new ProcessImpl(pid);
-    }
-
-    private static int readPid(File pidFile) throws IOException {
-        InputStream is = new FileInputStream(pidFile);
-        try {
-            BufferedReader r = new BufferedReader(new InputStreamReader(is));
-            String pidString = r.readLine();
-            return Integer.valueOf(pidString);
-        } finally {
-            try {
-                is.close();
-            } catch (IOException e) {}
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/java/org/apache/karaf/jpm/impl/ScriptUtils.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ScriptUtils.java b/instance/core/src/main/java/org/apache/karaf/jpm/impl/ScriptUtils.java
deleted file mode 100644
index a96e28e..0000000
--- a/instance/core/src/main/java/org/apache/karaf/jpm/impl/ScriptUtils.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.jpm.impl;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.Map;
-import java.util.Scanner;
-
-public class ScriptUtils {
-
-    public static int execute(String name, Map<String, String> props) throws IOException {
-        File script = File.createTempFile("jpm.", ".script");
-        try {
-            if (isWindows()) {
-                String res = "windows/" + name + ".vbs";
-                ScriptUtils.copyFilteredResource(res, script, props);
-                return executeProcess(new java.lang.ProcessBuilder("cscript",
-                                                                   "/NOLOGO",
-                                                                   "//E:vbs",
-                                                                   script.getCanonicalPath()));
-            } else {
-                String res = "unix/" + name + ".sh";
-                ScriptUtils.copyFilteredResource(res, script, props);
-                return executeProcess(new java.lang.ProcessBuilder("/bin/sh",
-                                                                   script.getCanonicalPath()));
-            }
-        } finally {
-            script.delete();
-        }
-    }
-
-    public static int executeProcess(java.lang.ProcessBuilder builder) throws IOException {
-        try {
-            java.lang.Process process = builder.start();
-            return process.waitFor();
-        } catch (InterruptedException e) {
-            throw new InterruptedIOException();
-        }
-    }
-
-    public static void copyFilteredResource(String resource, File outFile, Map<String, String> props) throws IOException {
-        InputStream is = null;
-        try {
-            is = ScriptUtils.class.getResourceAsStream(resource);
-            // Read it line at a time so that we can use the platform line ending when we write it out.
-            PrintStream out = new PrintStream(new FileOutputStream(outFile));
-            try {
-                Scanner scanner = new Scanner(is);
-                while (scanner.hasNextLine() ) {
-                    String line = scanner.nextLine();
-                    line = filter(line, props);
-                    out.println(line);
-                }
-            } finally {
-                safeClose(out);
-            }
-        } finally {
-            safeClose(is);
-        }
-    }
-
-    private static void safeClose(InputStream is) throws IOException {
-        if (is == null) {
-            return;
-        }
-        try {
-            is.close();
-        } catch (Throwable ignore) {
-        }
-    }
-
-    private static void safeClose(OutputStream is) throws IOException {
-        if (is == null) {
-            return;
-        }
-        try {
-            is.close();
-        } catch (Throwable ignore) {
-        }
-    }
-
-    private static String filter(String line, Map<String, String> props) {
-        for (Map.Entry<String, String> i : props.entrySet()) {
-            int p1 = line.indexOf(i.getKey());
-            if( p1 >= 0 ) {
-                String l1 = line.substring(0, p1);
-                String l2 = line.substring(p1+i.getKey().length());
-                line = l1+i.getValue()+l2;
-            }
-        }
-        return line;
-    }
-
-    private static final boolean windows;
-
-    static {
-        windows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1;
-    }
-
-    public static boolean isWindows() {
-        return windows;
-    }
-
-    public static String getJavaCommandPath() throws IOException {
-        return new File(System.getProperty("java.home"), isWindows() ? "bin\\java.exe" : "bin/java").getCanonicalPath();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/OSGI-INF/bundle.info
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/OSGI-INF/bundle.info b/instance/core/src/main/resources/OSGI-INF/bundle.info
deleted file mode 100644
index 9d305c3..0000000
--- a/instance/core/src/main/resources/OSGI-INF/bundle.info
+++ /dev/null
@@ -1,36 +0,0 @@
-h1. Synopsis
-
-${project.name}
-
-${project.description}
-
-Maven URL:
-[mvn:${project.groupId}/${project.artifactId}/${project.version}]
-
-h1. Description
-
-This bundle is the core implementation of the Karaf instance feature.
-
-Karaf instance allows you to manage Karaf child instances.
-
-You can create new Karaf instances, configure attributes, rename instances, stop instances, etc.
-
-It also provides JMX MBeans related to the Karaf instance feature.
-
-In particular, an InstanceServiceMBean is provided that can be remotely administered using a JMX client (for instance
-JConsole).
-
-With this InstanceServiceMBean, you have the following operations available:
-* createInstance(name, sshPort, rmiPort, location, javaOpts, features, featureURLs) - Creates a new Karaf instance.
-* changeSshPort(name, port) - Changes the SSH port number of an existing Karaf instance.
-* changeRmiRegistryPort(name, port) - Changes the RMI registry port number of an existing Karaf instance.
-* changeRmiServerPort(name, port) - Changes the RMI server port number of an existing Karaf instance.
-* changeJavaOpts(name, javaopts) - Changes the Java options of an existing Karaf instance.
-* destroyInstance(name) - Destroys an existing Karaf instance.
-* startInstance(name) - Starts an existing Karaf instance.
-* stopInstance(name) - Stops an existing Karaf instance.
-* renameInstance(originalName, newName) - Renames an existing Karaf instance.
-
-h1. See also
-
-Managing child instances - of the Karaf User Guide.

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf b/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf
deleted file mode 100644
index 8967cea..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-KARAF_HOME=${SUBST-KARAF-HOME}
-KARAF_BASE=${SUBST-KARAF-BASE}
-
-export KARAF_BASE
-exec ${KARAF_HOME}/bin/karaf "$*"

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf.bat
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf.bat b/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf.bat
deleted file mode 100644
index e054d83..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/karaf.bat
+++ /dev/null
@@ -1,25 +0,0 @@
-@ECHO OFF
-REM =========================================================================
-REM
-REM Licensed to the Apache Software Foundation (ASF) under one or more
-REM contributor license agreements.  See the NOTICE file distributed with
-REM this work for additional information regarding copyright ownership.
-REM The ASF licenses this file to You under the Apache License, Version 2.0
-REM (the "License"); you may not use this file except in compliance with
-REM the License.  You may obtain a copy of the License at
-REM
-REM    http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing, software
-REM distributed under the License is distributed on an "AS IS" BASIS,
-REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-REM See the License for the specific language governing permissions and
-REM limitations under the License.
-REM
-REM =========================================================================
-
-SETLOCAL
-SET KARAF_HOME=${SUBST-KARAF-HOME}
-SET KARAF_BASE=${SUBST-KARAF-BASE}
-
-"%KARAF_HOME%\bin\karaf.bat" %*

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start b/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start
deleted file mode 100644
index d45d749..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-KARAF_HOME=${SUBST-KARAF-HOME}
-KARAF_NAME=${SUBST-KARAF-NAME}
-
-exec ${KARAF_HOME}/bin/instance start ${KARAF_NAME} "$@"
-

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start.bat
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start.bat b/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start.bat
deleted file mode 100644
index 0c530c8..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/start.bat
+++ /dev/null
@@ -1,24 +0,0 @@
-@ECHO OFF
-REM =========================================================================
-REM 
-REM Licensed to the Apache Software Foundation (ASF) under one or more
-REM contributor license agreements.  See the NOTICE file distributed with
-REM this work for additional information regarding copyright ownership.
-REM The ASF licenses this file to You under the Apache License, Version 2.0
-REM (the "License"); you may not use this file except in compliance with
-REM the License.  You may obtain a copy of the License at
-REM 
-REM    http://www.apache.org/licenses/LICENSE-2.0
-REM 
-REM Unless required by applicable law or agreed to in writing, software
-REM distributed under the License is distributed on an "AS IS" BASIS,
-REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-REM See the License for the specific language governing permissions and
-REM limitations under the License.
-REM 
-REM =========================================================================
-
-SET KARAF_HOME=${SUBST-KARAF-HOME}
-SET KARAF_NAME=${SUBST-KARAF-NAME}
-
-"%KARAF_HOME%\bin\instance.bat" start %KARAF_NAME%

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop b/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop
deleted file mode 100644
index fb91985..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-KARAF_HOME=${SUBST-KARAF-HOME}
-KARAF_NAME=${SUBST-KARAF-NAME}
-
-exec ${KARAF_HOME}/bin/instance stop ${KARAF_NAME} "$@"
-

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop.bat
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop.bat b/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop.bat
deleted file mode 100644
index 8520acb..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/bin/stop.bat
+++ /dev/null
@@ -1,24 +0,0 @@
-@ECHO OFF
-REM =========================================================================
-REM 
-REM Licensed to the Apache Software Foundation (ASF) under one or more
-REM contributor license agreements.  See the NOTICE file distributed with
-REM this work for additional information regarding copyright ownership.
-REM The ASF licenses this file to You under the Apache License, Version 2.0
-REM (the "License"); you may not use this file except in compliance with
-REM the License.  You may obtain a copy of the License at
-REM 
-REM    http://www.apache.org/licenses/LICENSE-2.0
-REM 
-REM Unless required by applicable law or agreed to in writing, software
-REM distributed under the License is distributed on an "AS IS" BASIS,
-REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-REM See the License for the specific language governing permissions and
-REM limitations under the License.
-REM 
-REM =========================================================================
-
-SET KARAF_HOME=${SUBST-KARAF-HOME}
-SET KARAF_NAME=${SUBST-KARAF-NAME}
-
-"%KARAF_HOME%\bin\instance.bat" stop %KARAF_NAME%

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.management.cfg
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.management.cfg b/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.management.cfg
deleted file mode 100644
index 57b2957..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.management.cfg
+++ /dev/null
@@ -1,63 +0,0 @@
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-#
-# The properties in this file define the configuration of Apache Karaf's JMX Management
-#
-
-#
-# Port number for RMI registry connection
-#
-rmiRegistryPort = ${SUBST-RMI-REGISTRY-PORT}
-
-#
-# Port number for RMI server connection
-#
-rmiServerPort = ${SUBST-RMI-SERVER-PORT}
-
-#
-# Name of the JAAS realm used for authentication
-#
-jmxRealm = karaf
-
-#
-# The service URL for the JMXConnectorServer
-#
-serviceUrl = service:jmx:rmi://0.0.0.0:${rmiServerPort}/jndi/rmi://0.0.0.0:${rmiRegistryPort}/karaf-${karaf.name}
-
-#
-# Whether any threads started for the JMXConnectorServer should be started as daemon threads
-#
-daemon = true
-
-#
-# Whether the JMXConnectorServer should be started in a separate thread
-#
-threaded = true
-
-#
-# The ObjectName used to register the JMXConnectorServer
-#
-objectName = connector:name=rmi
-
-#
-# Role name used for JMX access authorization
-# If not set, this defaults to the ${karaf.admin.role} configured in etc/system.properties
-#
-# jmxRole=admin

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg b/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg
deleted file mode 100644
index 077f5da..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg
+++ /dev/null
@@ -1,75 +0,0 @@
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-#
-# These properties are used to configure Karaf's ssh shell.
-#
-
-#
-# Via sshPort and sshHost you define the address you can login into Karaf.
-#
-sshPort = ${SUBST-SSH-PORT}
-sshHost = 0.0.0.0
-
-#
-# The sshIdleTimeout defines the inactivity timeout to logout the SSH session.
-# The sshIdleTimeout is in milliseconds, and the default is set to 30 minutes.
-#
-sshIdleTimeout = 1800000
-
-#
-# sshRealm defines which JAAS domain to use for password authentication.
-#
-sshRealm = karaf
-
-#
-# The location of the hostKey file defines where the private/public key of the server
-# is located. If no file is at the defined location it will be ignored.
-#
-hostKey = ${karaf.etc}/host.key
-
-#
-# Role name used for SSH access authorization
-# If not set, this defaults to the ${karaf.admin.role} configured in etc/system.properties
-#
-# sshRole = admin
-
-#
-# Self defined key size in 1024, 2048, 3072, or 4096
-# If not set, this defaults to 1024.
-#
-# keySize = 1024
-
-#
-# Specify host key algorithm, defaults to DSA
-#
-# algorithm = DSA
-
-#
-# Defines the completion mode on the Karaf shell console. The possible values are:
-# - GLOBAL: it's the same behavior as in previous Karaf releases. The completion displays all commands and all aliases
-#           ignoring if you are in a subshell or not.
-# - FIRST: the completion displays all commands and all aliases only when you are not in a subshell. When you are
-#          in a subshell, the completion displays only the commands local to the subshell.
-# - SUBSHELL: the completion displays only the subshells on the root level. When you are in a subshell, the completion
-#             displays only the commands local to the subshell.
-# This property define the default value when you use the Karaf shell console.
-# You can change the completion mode directly in the shell console, using shell:completion command.
-#
-completionMode = GLOBAL
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties b/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties
deleted file mode 100644
index a683a34..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/system.properties
+++ /dev/null
@@ -1,120 +0,0 @@
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-#
-# The properties defined in this file will be made available through system
-# properties at the very beginning of the Karaf's boot process.
-#
-
-
-# Log level when the pax-logging service is not available
-# This level will only be used while the pax-logging service bundle
-# is not fully available.
-# To change log levels, please refer to the org.ops4j.pax.logging.cfg file
-# instead.
-org.ops4j.pax.logging.DefaultServiceLog.level = ERROR
-
-#
-# Name of this Karaf instance.
-#
-karaf.name = ${SUBST-KARAF-NAME}
-
-#
-# Default repository where bundles will be loaded from before using
-# other Maven repositories.  For the full Maven configuration, see
-# the org.ops4j.pax.url.mvn.cfg file.
-#
-karaf.default.repository = system
-
-#
-# Location of a shell script that will be run when starting a shell
-# session.  This script can be used to create aliases and define
-# additional commands.
-#
-karaf.shell.init.script = ${karaf.etc}/shell.init.script
-
-#
-# Sets the maximum size of the shell command history. If not set,
-# defaults to 500 entries. Setting to 0 will disable history.
-#
-# karaf.shell.history.maxSize = 0
-
-#
-# Deletes the entire karaf.data directory at every start
-#
-karaf.clean.all = false
-
-#
-# Deletes the karaf.data/cache directory at every start
-#
-karaf.clean.cache = false
-
-#
-# Roles to use when logging into a local Karaf console.
-#
-# The syntax is the following:
-#   [classname:]principal
-# where classname is the class name of the principal object
-# (defaults to org.apache.karaf.jaas.modules.RolePrincipal)
-# and principal is the name of the principal of that class
-# (defaults to instance).
-#
-karaf.local.roles = admin,manager,viewer
-
-#
-# Set this empty property to avoid errors when validating xml documents.
-#
-xml.catalog.files =
-
-#
-# Suppress the bell in the console when hitting backspace too many times
-# for example
-#
-jline.nobell = true
-
-#
-# ServiceMix specs options
-#
-org.apache.servicemix.specs.debug = false
-org.apache.servicemix.specs.timeout = 100
-
-#
-# Settings for the OSGi 4.3 Weaving
-# By default, we will not weave any classes. Change this setting to include classes
-# that you application needs to have woven.
-#
-org.apache.aries.proxy.weaving.enabled = none
-# Classes not to weave - Aries default + Xerces which is known to have issues.
-org.apache.aries.proxy.weaving.disabled = org.objectweb.asm.*,org.slf4j.*,org.apache.log4j.*,javax.*,org.apache.xerces.*
-
-#
-# By default, only Karaf shell commands are secured, but additional services can be
-# secured by expanding this filter
-#
-karaf.secured.services = (&(osgi.command.scope=*)(osgi.command.function=*))
-
-#
-# Security properties
-#
-# To enable OSGi security, uncomment the properties below,
-# install the framework-security feature and restart.
-#
-#java.security.policy=${karaf.etc}/all.policy
-#org.osgi.framework.security=osgi
-#org.osgi.framework.trust.repositories=${karaf.etc}/trustStore.ks

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/jpm/impl/unix/start.sh
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/unix/start.sh b/instance/core/src/main/resources/org/apache/karaf/jpm/impl/unix/start.sh
deleted file mode 100644
index 1d1d720..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/unix/start.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-#exec 1>${out.file}
-#exec 2>${err.file}
-exec 1>/dev/null
-exec 2>/dev/null
-if [ "x${dir}" != "x" ]; then
-    cd ${dir}
-fi
-nohup ${command} &
-echo $! > ${pid.file}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/destroy.vbs
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/destroy.vbs b/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/destroy.vbs
deleted file mode 100644
index abd60eb..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/destroy.vbs
+++ /dev/null
@@ -1,27 +0,0 @@
-'===============================================================================
-'
-'    Licensed to the Apache Software Foundation (ASF) under one or more
-'    contributor license agreements.  See the NOTICE file distributed with
-'    this work for additional information regarding copyright ownership.
-'    The ASF licenses this file to You under the Apache License, Version 2.0
-'    (the "License"); you may not use this file except in compliance with
-'    the License.  You may obtain a copy of the License at
-'
-'       http://www.apache.org/licenses/LICENSE-2.0
-'
-'    Unless required by applicable law or agreed to in writing, software
-'    distributed under the License is distributed on an "AS IS" BASIS,
-'    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-'    See the License for the specific language governing permissions and
-'    limitations under the License.
-'
-'===============================================================================
-
-Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
-Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where ProcessId = ${pid}")
-intRetVal = 1
-For Each objProcess in colProcessList
-    objProcess.Terminate()
-    intRetVal = 0
-Next
-WScript.Quit(intRetVal)

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/running.vbs
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/running.vbs b/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/running.vbs
deleted file mode 100644
index 32c65c5..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/running.vbs
+++ /dev/null
@@ -1,26 +0,0 @@
-'===============================================================================
-'
-'    Licensed to the Apache Software Foundation (ASF) under one or more
-'    contributor license agreements.  See the NOTICE file distributed with
-'    this work for additional information regarding copyright ownership.
-'    The ASF licenses this file to You under the Apache License, Version 2.0
-'    (the "License"); you may not use this file except in compliance with
-'    the License.  You may obtain a copy of the License at
-'
-'       http://www.apache.org/licenses/LICENSE-2.0
-'
-'    Unless required by applicable law or agreed to in writing, software
-'    distributed under the License is distributed on an "AS IS" BASIS,
-'    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-'    See the License for the specific language governing permissions and
-'    limitations under the License.
-'
-'===============================================================================
-
-Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
-Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where ProcessId = ${pid}")
-intRetVal = 1
-For Each objProcess in colProcessList
-    intRetVal = 0
-Next
-WScript.Quit(intRetVal)

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/start.vbs
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/start.vbs b/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/start.vbs
deleted file mode 100644
index 6004c86..0000000
--- a/instance/core/src/main/resources/org/apache/karaf/jpm/impl/windows/start.vbs
+++ /dev/null
@@ -1,34 +0,0 @@
-'===============================================================================
-'
-'    Licensed to the Apache Software Foundation (ASF) under one or more
-'    contributor license agreements.  See the NOTICE file distributed with
-'    this work for additional information regarding copyright ownership.
-'    The ASF licenses this file to You under the Apache License, Version 2.0
-'    (the "License"); you may not use this file except in compliance with
-'    the License.  You may obtain a copy of the License at
-'
-'       http://www.apache.org/licenses/LICENSE-2.0
-'
-'    Unless required by applicable law or agreed to in writing, software
-'    distributed under the License is distributed on an "AS IS" BASIS,
-'    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-'    See the License for the specific language governing permissions and
-'    limitations under the License.
-'
-'===============================================================================
-
-Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
-Set objConfig = objWMIService.Get("Win32_ProcessStartup").SpawnInstance_
-objConfig.ShowWindow = SW_HIDE
-objConfig.CreateFlags = 8
-If Len("${dir}") > 0 Then
-    intReturn = objWMIService.Get("Win32_Process").Create("${command}", "${dir}", objConfig, intProcessID)
-Else
-    intReturn = objWMIService.Get("Win32_Process").Create("${command}", Null, objConfig, intProcessID)
-End If
-If intReturn = 0 Then
-    Set objOutputFile = CreateObject("Scripting.fileSystemObject").CreateTextFile("${pid.file}", TRUE)
-    objOutputFile.WriteLine(intProcessID)
-    objOutputFile.Close
-End If
-WScript.Quit(intReturn)

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
----------------------------------------------------------------------
diff --git a/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java b/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
deleted file mode 100644
index 264176b..0000000
--- a/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.instance.core;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.karaf.instance.core.InstanceSettings;
-import org.junit.Assert;
-
-public class InstanceSettingsTest extends TestCase {
-    public void testInstanceSettings() {
-        InstanceSettings is =
-            new InstanceSettings(1, 1, 1, null, null, Collections.<String>emptyList(), Arrays.asList("hi"));
-        assertEquals(1, is.getSshPort());
-        assertEquals(1, is.getRmiRegistryPort());
-        assertEquals(1, is.getRmiServerPort());
-        Assert.assertNull(is.getLocation());
-        assertEquals(Arrays.asList("hi"), is.getFeatures());
-        assertEquals(0, is.getFeatureURLs().size());
-    }
-    
-    public void testEqualsHashCode() {
-        testEqualsHashCode(1, 1, 1, "top", "foo", Collections.<String>emptyList(), Arrays.asList("hi"));
-        testEqualsHashCode(0, 0, 0, null, null, null, null);
-    }
-
-    private void testEqualsHashCode(int sshPort, int rmiRegistryPort, int rmiServerPort, String location, String javaOpts, List<String> featureURLs, List<String> features) {
-        InstanceSettings is = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, featureURLs, features);
-        InstanceSettings is2 = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, featureURLs, features);
-        assertEquals(is, is2);
-        assertEquals(is.hashCode(), is2.hashCode());
-    }
-    
-    public void testEqualsHashCode2() {
-        InstanceSettings is = new InstanceSettings(1, 1, 1, "top", "foo", Collections.<String>emptyList(), Arrays.asList("hi"));
-        Assert.assertFalse(is.equals(null));
-        Assert.assertFalse(is.equals(new Object()));
-        assertEquals(is, is);
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
----------------------------------------------------------------------
diff --git a/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java b/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
deleted file mode 100644
index 9c77934..0000000
--- a/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.instance.core.internal;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Properties;
-
-import org.apache.karaf.instance.core.Instance;
-import org.apache.karaf.instance.core.InstanceSettings;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class InstanceServiceImplTest {
-
-    @Rule
-    public TestName name = new TestName();
-
-    @Rule
-    public TemporaryFolder tempFolder = new TemporaryFolder();
-
-    @BeforeClass
-    public static void setUpClass() throws Exception {
-        String buildDirectory = ClassLoader.getSystemResource("etc/startup.properties").getFile()
-                .replace("startup.properties", "");
-        System.setProperty("karaf.etc", buildDirectory);
-    }
-
-    @Test
-    public void testHandleFeatures() throws Exception {
-        InstanceServiceImpl as = new InstanceServiceImpl();
-
-        File f = tempFolder.newFile(getName() + ".test");
-        Properties p = new Properties();
-        p.put("featuresBoot", "abc,def ");
-        p.put("featuresRepositories", "somescheme://xyz");
-        OutputStream os = new FileOutputStream(f);
-        try {
-            p.store(os, "Test comment");
-        } finally {
-            os.close();
-        }
-
-        InstanceSettings s = new InstanceSettings(8122, 1122, 44444, null, null, null, Arrays.asList("test"));
-        as.addFeaturesFromSettings(f, s);
-
-        Properties p2 = new Properties();
-        InputStream is = new FileInputStream(f);
-        try {
-            p2.load(is);
-        } finally {
-            is.close();
-        }
-        assertEquals(2, p2.size());
-        assertEquals("abc,def,test", p2.get("featuresBoot"));
-        assertEquals("somescheme://xyz", p2.get("featuresRepositories"));
-    }
-
-    @Test
-    public void testConfigurationFiles() throws Exception {
-        InstanceServiceImpl service = new InstanceServiceImpl();
-        service.setStorageLocation(tempFolder.newFolder("instances"));
-
-        InstanceSettings settings = new InstanceSettings(8122, 1122, 44444, getName(), null, null, null);
-        Instance instance = service.createInstance(getName(), settings, true);
-
-        assertFileExists(instance.getLocation(), "etc/config.properties");
-        assertFileExists(instance.getLocation(), "etc/users.properties");
-        assertFileExists(instance.getLocation(), "etc/startup.properties");
-
-        assertFileExists(instance.getLocation(), "etc/java.util.logging.properties");
-        assertFileExists(instance.getLocation(), "etc/org.apache.karaf.features.cfg");
-        assertFileExists(instance.getLocation(), "etc/org.apache.felix.fileinstall-deploy.cfg");
-        assertFileExists(instance.getLocation(), "etc/org.apache.karaf.log.cfg");
-        assertFileExists(instance.getLocation(), "etc/org.apache.karaf.management.cfg");
-        assertFileExists(instance.getLocation(), "etc/org.ops4j.pax.logging.cfg");
-        assertFileExists(instance.getLocation(), "etc/org.ops4j.pax.url.mvn.cfg");
-    }
-
-    /**
-     * <p>
-     * Test the renaming of an existing instance.
-     * </p>
-     */
-    @Test
-    public void testRenameInstance() throws Exception {
-        InstanceServiceImpl service = new InstanceServiceImpl();
-        service.setStorageLocation(tempFolder.newFolder("instances"));
-
-        InstanceSettings settings = new InstanceSettings(8122, 1122, 44444, getName(), null, null, null);
-        service.createInstance(getName(), settings, true);
-
-        service.renameInstance(getName(), getName() + "b", true);
-        assertNotNull(service.getInstance(getName() + "b"));
-    }
-
-    /**
-     * <p>
-     * Test the renaming of an existing instance.
-     * </p>
-     */
-    @Test
-    public void testToSimulateRenameInstanceByExternalProcess() throws Exception {
-        InstanceServiceImpl service = new InstanceServiceImpl();
-        File storageLocation = tempFolder.newFolder("instances");
-        service.setStorageLocation(storageLocation);
-
-        InstanceSettings settings = new InstanceSettings(8122, 1122, 44444, getName(), null, null, null);
-        service.createInstance(getName(), settings, true);
-        
-        //to simulate the scenario that the instance name get changed by 
-        //external process, likely the admin command CLI tool, which cause
-        //the instance storage file get updated, the AdminService should be 
-        //able to reload the storage file before check any status for the 
-        //instance
-        
-        File storageFile = new File(storageLocation, InstanceServiceImpl.STORAGE_FILE);
-        assertTrue(storageFile.isFile());
-        Properties storage = loadStorage(storageFile);
-        storage.setProperty("item.0.name", getName() + "b");
-        saveStorage(storage, storageFile, "testToSimulateRenameInstanceByExternalProcess");
-        
-        assertNotNull(service.getInstance(getName() + "b"));
-    }
-
-    private String getName() {
-        return name.getMethodName();
-    }
-
-    private void saveStorage(Properties props, File location, String comment) throws IOException {
-        OutputStream os = null;
-        try {
-            os = new FileOutputStream(location);
-            props.store(os, comment);
-        } finally {
-            if (os != null) {
-                os.close();
-            }
-        }
-    }
-    
-    private Properties loadStorage(File location) throws IOException {
-        InputStream is = null;
-        try {
-            is = new FileInputStream(location);
-            Properties props = new Properties();
-            props.load(is);
-            return props;
-        } finally {
-            if (is != null) {
-                is.close();
-            }
-        }
-    }
-
-    private void assertFileExists(String path, String name) throws IOException {
-        File file = new File(path, name);
-        assertTrue("Expected " + file.getCanonicalPath() + " to exist",
-                   file.exists());
-    }   
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/7c2db062/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java
----------------------------------------------------------------------
diff --git a/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java b/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java
deleted file mode 100644
index bb67041..0000000
--- a/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.instance.core.management.internal;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.TabularData;
-
-import junit.framework.TestCase;
-
-import org.apache.karaf.instance.core.Instance;
-import org.apache.karaf.instance.core.InstanceService;
-import org.apache.karaf.instance.core.InstanceSettings;
-import org.apache.karaf.instance.core.InstancesMBean;
-import org.apache.karaf.instance.core.internal.InstancesMBeanImpl;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-
-public class InstanceServiceMBeanImplTest extends TestCase {
-
-    public void testCreateInstance() throws Exception {
-        final InstanceSettings instanceSettings = new InstanceSettings(123, 456,789, "somewhere", "someopts",
-                Collections.<String>emptyList(), Arrays.asList("webconsole", "funfeat"));
-        
-        final Instance inst = EasyMock.createMock(Instance.class);
-        EasyMock.expect(inst.getPid()).andReturn(42);
-        EasyMock.replay(inst);
-
-        org.apache.karaf.instance.core.InstanceService instanceService = EasyMock.createMock(org.apache.karaf.instance.core.InstanceService.class);
-        EasyMock.expect(instanceService.createInstance("t1", instanceSettings, false)).andReturn(inst);
-        EasyMock.replay(instanceService);
-        
-        InstancesMBeanImpl ab = new InstancesMBeanImpl(instanceService);
-        assertEquals(42, ab.createInstance("t1", 123, 456, 789, "somewhere", "someopts", " webconsole,  funfeat", ""));
-    }
-    
-    public void testCreateInstance2() throws Exception {
-        final InstanceSettings instanceSettings = new InstanceSettings(0, 0, 0, null, null,
-                Collections.<String>emptyList(), Collections.<String>emptyList());
-        
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.createInstance("t1", instanceSettings, false)).andReturn(null);
-        EasyMock.replay(instanceService);
-        
-        InstancesMBean ab = new InstancesMBeanImpl(instanceService);
-        assertEquals(-1, ab.createInstance("t1", 0, 0, 0, "", "", "", ""));
-    }
-    
-    public void testGetInstances() throws Exception {       
-        Instance i1 = EasyMock.createMock(Instance.class);
-        EasyMock.expect(i1.getPid()).andReturn(1234);
-        EasyMock.expect(i1.getSshPort()).andReturn(8818);
-        EasyMock.expect(i1.getRmiRegistryPort()).andReturn(1122);
-        EasyMock.expect(i1.getRmiServerPort()).andReturn(44444);
-        EasyMock.expect(i1.getName()).andReturn("i1");
-        EasyMock.expect(i1.isRoot()).andReturn(true);
-        EasyMock.expect(i1.getLocation()).andReturn("somewhere");
-        EasyMock.expect(i1.getJavaOpts()).andReturn("someopts");
-        EasyMock.expect(i1.getState()).andReturn("Stopped");
-        EasyMock.replay(i1);
-        Instance i2 = EasyMock.createNiceMock(Instance.class);
-        EasyMock.expect(i2.getName()).andReturn("i2");
-        EasyMock.replay(i2);
-        
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstances()).andReturn(new Instance[]{i1, i2});
-        EasyMock.replay(instanceService);
-
-        InstancesMBeanImpl instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-        TabularData tabularData = instanceServiceMBean.getInstances();
-        Assert.assertEquals(2, tabularData.size());
-        CompositeData cd1 = tabularData.get(new Object[]{"i1"});
-        Assert.assertTrue(cd1.containsValue("i1"));
-        Assert.assertTrue(cd1.containsValue(true));
-        Assert.assertTrue(cd1.containsValue(1234));
-        Assert.assertTrue(cd1.containsValue(8818));
-        Assert.assertTrue(cd1.containsValue(1122));
-        Assert.assertTrue(cd1.containsValue(44444));
-        Assert.assertTrue(cd1.containsValue("somewhere"));
-        Assert.assertTrue(cd1.containsValue("someopts"));
-        Assert.assertTrue(cd1.containsValue("Stopped"));
-
-        CompositeData cd2 = tabularData.get(new Object [] {"i2"});
-        Assert.assertTrue(cd2.containsValue("i2"));
-    }
-    
-    public void testStartInstanceWithJavaOpts() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.start("-x -y -z");
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-
-        instanceServiceMBean.startInstance("test instance", "-x -y -z");
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-
-    public void testStartInstanceWithNoJavaOpts() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.start(null);
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-
-        instanceServiceMBean.startInstance("test instance", null);
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-
-    public void testStopInstance() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.stop();
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-        
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-
-        instanceServiceMBean.stopInstance("test instance");
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-
-    public void testDestroyInstance() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.destroy();
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-        
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-
-        instanceServiceMBean.destroyInstance("test instance");
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-
-    public void testSshChangePort() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.changeSshPort(7788);
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-        
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-
-        instanceServiceMBean.changeSshPort("test instance", 7788);
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-    
-    public void testRmiRegistryChangePort() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.changeRmiRegistryPort(1123);
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-        
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-        
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-        
-        instanceServiceMBean.changeRmiRegistryPort("test instance", 1123);
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-
-    public void testRmiServerChangePort() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.changeRmiServerPort(44444);
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-
-        instanceServiceMBean.changeRmiServerPort("test instance", 44444);
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-
-    public void testChangeOptions() throws Exception {
-        Instance inst = EasyMock.createMock(Instance.class);
-        inst.changeJavaOpts("new opts");
-        EasyMock.expectLastCall();
-        EasyMock.replay(inst);
-
-        InstanceService instanceService = EasyMock.createMock(InstanceService.class);
-        EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
-        EasyMock.replay(instanceService);
-
-        InstancesMBean instanceServiceMBean = new InstancesMBeanImpl(instanceService);
-
-        instanceServiceMBean.changeJavaOpts("test instance", "new opts");
-        EasyMock.verify(instanceService);
-        EasyMock.verify(inst);
-    }
-
-}