You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2012/04/11 10:12:02 UTC
svn commit: r1324618 - in /karaf/trunk: ./
assemblies/features/standard/src/main/feature/ instance/ instance/command/
instance/command/src/main/java/org/apache/karaf/instance/command/
instance/command/src/main/java/org/apache/karaf/instance/command/com...
Author: cschneider
Date: Wed Apr 11 08:12:00 2012
New Revision: 1324618
URL: http://svn.apache.org/viewvc?rev=1324618&view=rev
Log:
KARAF-1302 Use aries jmx for instance module, refactor package names to instance.core for core packages
Added:
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/Instance.java
- copied, changed from r1312014, karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/Instance.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceService.java
- copied, changed from r1312014, karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceService.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceSettings.java
- copied, changed from r1312014, karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceSettings.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java
- copied, changed from r1312014, karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/InstanceServiceMBean.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/
- copied from r1312014, karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/internal/
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceToTableMapper.java
- copied, changed from r1312014, karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/codec/JmxInstance.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java
- copied, changed from r1312014, karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/internal/InstanceServiceMBeanImpl.java
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java
- copied, changed from r1312014, karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/InstanceSettingsTest.java
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/internal/
- copied from r1312014, karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/internal/
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java
- copied, changed from r1312016, karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/internal/InstanceServiceImplTest.java
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/
- copied from r1312014, karaf/trunk/instance/management/src/test/java/org/apache/karaf/instance/management/internal/
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceToTableMapperTest.java
- copied, changed from r1312014, karaf/trunk/instance/management/src/test/java/org/apache/karaf/instance/management/codec/JmxInstanceTest.java
Removed:
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/Instance.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceService.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceSettings.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/internal/
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/InstanceSettingsTest.java
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/internal/
karaf/trunk/instance/management/
Modified:
karaf/trunk/assemblies/features/standard/src/main/feature/feature.xml
karaf/trunk/instance/command/pom.xml
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml
karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/command/CreateCommandTest.java
karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/main/ExecuteTest.java
karaf/trunk/instance/core/pom.xml
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java
karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
karaf/trunk/instance/core/src/main/resources/OSGI-INF/blueprint/instance-core.xml
karaf/trunk/instance/core/src/main/resources/OSGI-INF/bundle.info
karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java
karaf/trunk/instance/pom.xml
karaf/trunk/pom.xml
Modified: karaf/trunk/assemblies/features/standard/src/main/feature/feature.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assemblies/features/standard/src/main/feature/feature.xml?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/assemblies/features/standard/src/main/feature/feature.xml (original)
+++ karaf/trunk/assemblies/features/standard/src/main/feature/feature.xml Wed Apr 11 08:12:00 2012
@@ -24,7 +24,6 @@
<bundle start-level="30">mvn:org.apache.karaf.features/org.apache.karaf.features.command/${project.version}</bundle>
<bundle start-level="30">mvn:org.apache.karaf.instance/org.apache.karaf.instance.core/${project.version}</bundle>
<bundle start-level="30">mvn:org.apache.karaf.instance/org.apache.karaf.instance.command/${project.version}</bundle>
- <bundle start-level="30">mvn:org.apache.karaf.instance/org.apache.karaf.instance.management/${project.version}</bundle>
<bundle start-level="30">mvn:org.apache.karaf.jaas/org.apache.karaf.jaas.modules/${project.version}</bundle>
<bundle start-level="30">mvn:org.apache.karaf.jaas/org.apache.karaf.jaas.config/${project.version}</bundle>
<bundle start-level="30">mvn:org.apache.karaf.jaas/org.apache.karaf.jaas.command/${project.version}</bundle>
Modified: karaf/trunk/instance/command/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/pom.xml?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/pom.xml (original)
+++ karaf/trunk/instance/command/pom.xml Wed Apr 11 08:12:00 2012
@@ -102,21 +102,10 @@
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
- <Import-Package>
- !${project.artifactId}*,
- !org.apache.karaf.instance.internal,
- javax.management,
- javax.management.loading,
- org.apache.aries.blueprint,
- org.osgi.service.blueprint.container,
- org.osgi.service.blueprint.reflect,
- org.apache.felix.service.command,
- org.apache.karaf.shell.commands,
- org.apache.karaf.shell.console,
- *
- </Import-Package>
<Private-Package>
org.apache.karaf.instance.main
+ org.apache.karaf.instance.command,
+ org.apache.karaf.instance.command.completers,
</Private-Package>
</instructions>
</configuration>
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java Wed Apr 11 08:12:00 2012
@@ -19,7 +19,7 @@ package org.apache.karaf.instance.comman
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.instance.InstanceSettings;
+import org.apache.karaf.instance.core.InstanceSettings;
/**
* Clone an existing instance.
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java Wed Apr 11 08:12:00 2012
@@ -21,7 +21,7 @@ import java.util.List;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.instance.InstanceSettings;
+import org.apache.karaf.instance.core.InstanceSettings;
/**
* Creates a new instance.
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java Wed Apr 11 08:12:00 2012
@@ -16,8 +16,8 @@
*/
package org.apache.karaf.instance.command;
-import org.apache.karaf.instance.InstanceService;
-import org.apache.karaf.instance.Instance;
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.instance.core.InstanceService;
import org.apache.karaf.shell.console.OsgiCommandSupport;
public abstract class InstanceCommandSupport extends OsgiCommandSupport {
@@ -35,7 +35,7 @@ public abstract class InstanceCommandSup
protected Instance getExistingInstance(String name) {
Instance i = instanceService.getInstance(name);
if (i == null) {
- throw new IllegalArgumentException("Instance '" + name + "' does not exist");
+ throw new IllegalArgumentException("Instances '" + name + "' does not exist");
}
return i;
}
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java Wed Apr 11 08:12:00 2012
@@ -18,7 +18,7 @@ package org.apache.karaf.instance.comman
import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.instance.Instance;
+import org.apache.karaf.instance.core.Instance;
@Command(scope = "instance", name = "list", description = "Lists all existing container instances.")
public class ListCommand extends InstanceCommandSupport {
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java Wed Apr 11 08:12:00 2012
@@ -19,7 +19,7 @@ package org.apache.karaf.instance.comman
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.instance.Instance;
+import org.apache.karaf.instance.core.Instance;
@Command(scope = "instance", name = "start", description = "Start an existing container instance.")
public class StartCommand extends InstanceCommandSupport {
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java Wed Apr 11 08:12:00 2012
@@ -18,8 +18,8 @@ package org.apache.karaf.instance.comman
import java.util.List;
-import org.apache.karaf.instance.InstanceService;
-import org.apache.karaf.instance.Instance;
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.instance.core.InstanceService;
import org.apache.karaf.shell.console.completer.StringsCompleter;
import org.apache.karaf.shell.console.Completer;
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java Wed Apr 11 08:12:00 2012
@@ -28,7 +28,7 @@ import org.apache.karaf.shell.commands.A
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.basic.DefaultActionPreparator;
import org.apache.karaf.instance.command.ChangeSshPortCommand;
-import org.apache.karaf.instance.internal.InstanceServiceImpl;
+import org.apache.karaf.instance.core.internal.InstanceServiceImpl;
import org.fusesource.jansi.AnsiConsole;
public class Execute {
Modified: karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml (original)
+++ karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml Wed Apr 11 08:12:00 2012
@@ -127,7 +127,7 @@
</command>
</command-bundle>
- <reference id="instanceService" interface="org.apache.karaf.instance.InstanceService" />
+ <reference id="instanceService" interface="org.apache.karaf.instance.core.InstanceService" />
<reference id="featuresService" interface="org.apache.karaf.features.FeaturesService" />
<bean id="instanceCompleter" class="org.apache.karaf.instance.command.completers.InstanceCompleter">
Modified: karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/command/CreateCommandTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/command/CreateCommandTest.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/command/CreateCommandTest.java (original)
+++ karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/command/CreateCommandTest.java Wed Apr 11 08:12:00 2012
@@ -21,8 +21,8 @@ import java.util.Collections;
import junit.framework.TestCase;
-import org.apache.karaf.instance.InstanceService;
-import org.apache.karaf.instance.InstanceSettings;
+import org.apache.karaf.instance.core.InstanceService;
+import org.apache.karaf.instance.core.InstanceSettings;
import org.easymock.EasyMock;
public class CreateCommandTest extends TestCase {
Modified: karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/main/ExecuteTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/main/ExecuteTest.java?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/main/ExecuteTest.java (original)
+++ karaf/trunk/instance/command/src/test/java/org/apache/karaf/instance/main/ExecuteTest.java Wed Apr 11 08:12:00 2012
@@ -28,9 +28,9 @@ import java.util.Properties;
import junit.framework.TestCase;
-import org.apache.karaf.instance.InstanceService;
import org.apache.karaf.instance.command.InstanceCommandSupport;
-import org.apache.karaf.instance.internal.InstanceServiceImpl;
+import org.apache.karaf.instance.core.InstanceService;
+import org.apache.karaf.instance.core.internal.InstanceServiceImpl;
import org.easymock.IAnswer;
import org.easymock.classextension.EasyMock;
@@ -142,7 +142,7 @@ public class ExecuteTest extends TestCas
EasyMock.expect(mockCommand.execute(null)).andAnswer(new IAnswer<Object>() {
public Object answer() throws Throwable {
- // The Instance Service should be initialized at this point.
+ // The Instances Service should be initialized at this point.
// One way to find this out is by reading out the port number
InstanceServiceImpl instanceService = instanceServices.get(0);
Field sshField = InstanceServiceImpl.class.getDeclaredField("defaultSshPortStart");
Modified: karaf/trunk/instance/core/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/pom.xml?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/pom.xml (original)
+++ karaf/trunk/instance/core/pom.xml Wed Apr 11 08:12:00 2012
@@ -132,26 +132,12 @@
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.instance;version=${project.version},
- org.apache.karaf.jpm;version=${project.version}
+ org.apache.karaf.instance.core,
+ org.apache.karaf.jpm,
</Export-Package>
- <Import-Package>
- !org.apache.karaf.instance,
- !org.apache.karaf.jpm,
- javax.management,
- javax.management.loading,
- org.apache.aries.blueprint,
- org.osgi.service.blueprint.container,
- org.osgi.service.blueprint.reflect,
- org.apache.felix.service.command,
- org.apache.karaf.shell.commands,
- org.apache.karaf.shell.console,
- *
- </Import-Package>
<Private-Package>
org.apache.felix.utils.properties,
- org.apache.karaf.instance.resources*,
- org.apache.karaf.instance.internal,
+ org.apache.karaf.instance.core.internal,
org.apache.karaf.jpm.impl,
</Private-Package>
</instructions>
Copied: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/Instance.java (from r1312014, karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/Instance.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/Instance.java?p2=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/Instance.java&p1=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/Instance.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/Instance.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/Instance.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance;
+package org.apache.karaf.instance.core;
public interface Instance {
Copied: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceService.java (from r1312014, karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceService.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceService.java?p2=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceService.java&p1=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceService.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceService.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceService.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance;
+package org.apache.karaf.instance.core;
public interface InstanceService {
Copied: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceSettings.java (from r1312014, karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceSettings.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceSettings.java?p2=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceSettings.java&p1=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceSettings.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/InstanceSettings.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstanceSettings.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance;
+package org.apache.karaf.instance.core;
import java.util.List;
Copied: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java (from r1312014, karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/InstanceServiceMBean.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java?p2=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java&p1=karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/InstanceServiceMBean.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/InstanceServiceMBean.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/InstancesMBean.java Wed Apr 11 08:12:00 2012
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.management;
+package org.apache.karaf.instance.core;
import javax.management.openmbean.TabularData;
-public interface InstanceServiceMBean {
+public interface InstancesMBean {
String INSTANCE_PID = "Pid";
String INSTANCE_NAME = "Name";
Modified: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java?rev=1324618&r1=1312014&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceImpl.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.internal;
+package org.apache.karaf.instance.core.internal;
import java.io.BufferedReader;
import java.io.File;
@@ -31,7 +31,7 @@ import java.net.URL;
import java.net.UnknownHostException;
import org.apache.felix.utils.properties.Properties;
-import org.apache.karaf.instance.Instance;
+import org.apache.karaf.instance.core.Instance;
import org.apache.karaf.jpm.Process;
import org.apache.karaf.jpm.ProcessBuilderFactory;
import org.apache.karaf.jpm.impl.ScriptUtils;
@@ -71,7 +71,7 @@ public class InstanceImpl implements Ins
public void attach(int pid) throws IOException {
checkProcess();
if (this.process != null) {
- throw new IllegalStateException("Instance already started");
+ throw new IllegalStateException("Instances already started");
}
this.process = ProcessBuilderFactory.newInstance().newBuilder().attach(pid);
}
@@ -117,7 +117,7 @@ public class InstanceImpl implements Ins
public void changeSshPort(int port) throws Exception {
checkProcess();
if (this.process != null) {
- throw new IllegalStateException("Instance not stopped");
+ throw new IllegalStateException("Instances not stopped");
}
this.changeConfiguration(new File(location, "etc/org.apache.karaf.shell.cfg"),
"sshPort", Integer.toString(port));
@@ -135,7 +135,7 @@ public class InstanceImpl implements Ins
public void changeRmiRegistryPort(int port) throws Exception {
checkProcess();
if (this.process != null) {
- throw new IllegalStateException("Instance not stopped");
+ throw new IllegalStateException("Instances not stopped");
}
this.changeConfiguration(new File(location, "etc/org.apache.karaf.management.cfg"),
"rmiRegistryPort", Integer.toString(port));
@@ -153,7 +153,7 @@ public class InstanceImpl implements Ins
public void changeRmiServerPort(int port) throws Exception {
checkProcess();
if (this.process != null) {
- throw new IllegalStateException("Instance not stopped");
+ throw new IllegalStateException("Instances not stopped");
}
this.changeConfiguration(new File(location, "etc/org.apache.karaf.management.cfg"),
"rmiServerPort", Integer.toString(port));
@@ -209,7 +209,7 @@ public class InstanceImpl implements Ins
public synchronized void start(String javaOpts) throws Exception {
checkProcess();
if (this.process != null) {
- throw new IllegalStateException("Instance already started");
+ throw new IllegalStateException("Instances already started");
}
if (javaOpts == null || javaOpts.length() == 0) {
javaOpts = this.javaOpts;
@@ -255,7 +255,7 @@ public class InstanceImpl implements Ins
public synchronized void stop() throws Exception {
checkProcess();
if (this.process == null) {
- throw new IllegalStateException("Instance not started");
+ throw new IllegalStateException("Instances not started");
}
// Try a clean shutdown
cleanShutdown();
@@ -267,7 +267,7 @@ public class InstanceImpl implements Ins
public synchronized void destroy() throws Exception {
checkProcess();
if (this.process != null) {
- throw new IllegalStateException("Instance not stopped");
+ throw new IllegalStateException("Instances not stopped");
}
deleteFile(new File(location));
this.service.forget(name);
Modified: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java?rev=1324618&r1=1312014&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.internal;
+package org.apache.karaf.instance.core.internal;
import java.io.File;
import java.io.FileInputStream;
@@ -29,9 +29,9 @@ import java.util.Map;
import java.util.Properties;
import java.util.Scanner;
-import org.apache.karaf.instance.InstanceSettings;
-import org.apache.karaf.instance.InstanceService;
-import org.apache.karaf.instance.Instance;
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.instance.core.InstanceService;
+import org.apache.karaf.instance.core.InstanceSettings;
import org.fusesource.jansi.Ansi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -139,7 +139,7 @@ public class InstanceServiceImpl impleme
public synchronized Instance createInstance(String name, InstanceSettings settings, boolean printOutput) throws Exception {
if (instances.get(name) != null) {
- throw new IllegalArgumentException("Instance '" + name + "' already exists");
+ throw new IllegalArgumentException("Instances '" + name + "' already exists");
}
String loc = settings.getLocation() != null ? settings.getLocation() : name;
File karafBase = new File(loc);
@@ -260,17 +260,17 @@ public class InstanceServiceImpl impleme
public synchronized void renameInstance(String oldName, String newName, boolean printOutput) throws Exception {
if (instances.get(newName) != null) {
- throw new IllegalArgumentException("Instance " + newName + " already exists");
+ throw new IllegalArgumentException("Instances " + newName + " already exists");
}
Instance instance = instances.get(oldName);
if (instance == null) {
- throw new IllegalArgumentException("Instance " + oldName + " not found");
+ throw new IllegalArgumentException("Instances " + oldName + " not found");
}
if (instance.isRoot()) {
throw new IllegalArgumentException("Root instance cannot be renamed");
}
if (instance.getPid() != 0) {
- throw new IllegalStateException("Instance not stopped");
+ throw new IllegalStateException("Instances not stopped");
}
LOGGER.info("Renaming instance {} to {}", oldName, newName);
@@ -316,17 +316,17 @@ public class InstanceServiceImpl impleme
public synchronized Instance cloneInstance(String name, String cloneName, InstanceSettings settings, boolean printOutput) throws Exception {
if (instances.get(cloneName) != null) {
- throw new IllegalArgumentException("Instance " + cloneName + " already exists");
+ throw new IllegalArgumentException("Instances " + cloneName + " already exists");
}
Instance instance = instances.get(name);
if (instance == null) {
- throw new IllegalArgumentException("Instance " + name + " not found");
+ throw new IllegalArgumentException("Instances " + name + " not found");
}
if (instance.isRoot()) {
throw new IllegalArgumentException("Root instance cannot be cloned");
}
if (instance.getPid() != 0) {
- throw new IllegalStateException("Instance not stopped");
+ throw new IllegalStateException("Instances not stopped");
}
LOGGER.info("Cloning instance {} into {}", name, cloneName);
@@ -392,7 +392,7 @@ public class InstanceServiceImpl impleme
storage.setProperty("item." + i + ".pid", Integer.toString(data[i].getPid()));
storage.setProperty("item." + i + ".opts", data[i].getJavaOpts() != null ? data[i].getJavaOpts() : "");
}
- saveStorage(storage, new File(storageLocation, STORAGE_FILE), "Instance Service storage");
+ saveStorage(storage, new File(storageLocation, STORAGE_FILE), "Instances Service storage");
}
private void copyResourceToDir(File target, String resource, boolean text, boolean printOutput) throws Exception {
Copied: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceToTableMapper.java (from r1312014, karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/codec/JmxInstance.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceToTableMapper.java?p2=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceToTableMapper.java&p1=karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/codec/JmxInstance.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/codec/JmxInstance.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceToTableMapper.java Wed Apr 11 08:12:00 2012
@@ -14,11 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.management.codec;
+package org.apache.karaf.instance.core.internal;
import java.util.List;
-import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.CompositeType;
import javax.management.openmbean.OpenDataException;
@@ -28,104 +27,57 @@ import javax.management.openmbean.Tabula
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
-import org.apache.karaf.instance.management.InstanceServiceMBean;
-import org.apache.karaf.instance.Instance;
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.instance.core.InstancesMBean;
-public class JmxInstance {
-
- static final CompositeType INSTANCE;
- static final TabularType INSTANCE_TABLE;
-
- static {
- INSTANCE = createInstanceType();
- INSTANCE_TABLE = createInstanceTableType();
+public class InstanceToTableMapper {
+
+ private InstanceToTableMapper() {
}
- private final CompositeDataSupport data;
-
- private CompositeData asCompositeData() {
- return data;
- }
-
- public JmxInstance(Instance instance) {
+ private static CompositeDataSupport mapInstance(Instance instance, CompositeType comp) throws OpenDataException {
+ String state;
try {
- String[] itemNames = InstanceServiceMBean.INSTANCE;
- Object[] itemValues = new Object[itemNames.length];
- itemValues[0] = instance.getPid();
- itemValues[1] = instance.getName();
- itemValues[2] = instance.isRoot();
- itemValues[3] = instance.getSshPort();
- itemValues[4] = instance.getRmiRegistryPort();
- itemValues[5] = instance.getRmiServerPort();
- try {
- itemValues[6] = instance.getState();
- } catch (Exception e) {
- itemValues[6] = "Error";
- }
- itemValues[7] = instance.getLocation();
- itemValues[8] = instance.getJavaOpts();
-
- data = new CompositeDataSupport(INSTANCE, itemNames, itemValues);
- } catch (OpenDataException e) {
- throw new IllegalStateException("Cannot create instance open data", e);
+ state = instance.getState();
+ } catch (Exception e) {
+ state = "Error";
}
+ Object[] itemValues = new Object[] {instance.getPid(), instance.getName(), instance.isRoot(),
+ instance.getSshPort(), instance.getRmiRegistryPort(),
+ instance.getRmiServerPort(), state, instance.getLocation(),
+ instance.getJavaOpts()};
+ return new CompositeDataSupport(comp, InstancesMBean.INSTANCE, itemValues);
+ }
+
+ private static CompositeType createRowType() throws OpenDataException {
+ String desc = "This type describes Karaf instances";
+ OpenType<?>[] itemTypes = new OpenType[] {SimpleType.INTEGER, SimpleType.STRING, SimpleType.BOOLEAN,
+ SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER,
+ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING};
+ String[] descriptions = new String[] {"The Process ID of the instance or 0 if not running",
+ "The name of the instance", "Whether the instance is root",
+ "The SSH port that can be used to connect to the instance",
+ "The RMI registry port that can be used to manage the instance",
+ "The RMI server port that can be used to manage the instance",
+ "The state of the instance", "The location of the instance",
+ "The Java options of the instance"};
+ CompositeType comp = new CompositeType("Instances", desc, InstancesMBean.INSTANCE, descriptions, itemTypes);
+ return comp;
}
- private static CompositeType createInstanceType() {
+ public static TabularData tableFrom(List<Instance> instances) {
try {
- String desc = "This type describes Karaf instances";
- String[] itemNames = InstanceServiceMBean.INSTANCE;
- OpenType[] itemTypes = new OpenType[itemNames.length];
- String[] descriptions = new String[itemNames.length];
-
- itemTypes[0] = SimpleType.INTEGER;
- descriptions[0] = "The Process ID of the instance or 0 if not running.";
-
- itemTypes[1] = SimpleType.STRING;
- descriptions[1] = "The name of the instance.";
-
- itemTypes[2] = SimpleType.BOOLEAN;
- descriptions[2] = "Whether the instance is root.";
-
- itemTypes[3] = SimpleType.INTEGER;
- descriptions[3] = "The SSH port that can be used to connect to the instance.";
-
- itemTypes[4] = SimpleType.INTEGER;
- descriptions[4] = "The RMI registry port that can be used to manage the instance.";
-
- itemTypes[5] = SimpleType.INTEGER;
- descriptions[5] = "The RMI server port that can be used to manage the instance.";
-
- itemTypes[6] = SimpleType.STRING;
- descriptions[6] = "The state of the instance.";
-
- itemTypes[7] = SimpleType.STRING;
- descriptions[7] = "The location of the instance.";
-
- itemTypes[8] = SimpleType.STRING;
- descriptions[8] = "The Java options of the instance.";
-
- return new CompositeType("Instance", desc, itemNames, descriptions, itemTypes);
- } catch (OpenDataException e) {
- throw new IllegalStateException("Unable to build instance type", e);
- }
- }
-
- private static TabularType createInstanceTableType() {
- try {
- return new TabularType("Instances", "Table of all Karaf instances", INSTANCE,
- new String[] {InstanceServiceMBean.INSTANCE_NAME});
+ CompositeType rowType = createRowType();
+ TabularType tableType = new TabularType("Instances", "Table of all Karaf instances", rowType,
+ new String[] {InstancesMBean.INSTANCE_NAME});
+ TabularDataSupport table = new TabularDataSupport(tableType);
+ for (Instance instance : instances) {
+ CompositeDataSupport row = mapInstance(instance, rowType);
+ table.put(row);
+ }
+ return table;
} catch (OpenDataException e) {
- throw new IllegalStateException("Unable to build instance table type", e);
- }
- }
-
- public static TabularData tableFrom(List<JmxInstance> instances) {
- TabularDataSupport table = new TabularDataSupport(INSTANCE_TABLE);
- for (JmxInstance instance : instances) {
- table.put(instance.asCompositeData());
+ throw new IllegalStateException("Error building instance table", e);
}
- return table;
}
-
}
Copied: karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java (from r1312014, karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/internal/InstanceServiceMBeanImpl.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java?p2=karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java&p1=karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/internal/InstanceServiceMBeanImpl.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/management/src/main/java/org/apache/karaf/instance/management/internal/InstanceServiceMBeanImpl.java (original)
+++ karaf/trunk/instance/core/src/main/java/org/apache/karaf/instance/core/internal/Instances.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.management.internal;
+package org.apache.karaf.instance.core.internal;
import java.util.ArrayList;
import java.util.Arrays;
@@ -24,25 +24,16 @@ import javax.management.NotCompliantMBea
import javax.management.StandardMBean;
import javax.management.openmbean.TabularData;
-import org.apache.karaf.instance.management.InstanceServiceMBean;
-import org.apache.karaf.instance.InstanceService;
-import org.apache.karaf.instance.Instance;
-import org.apache.karaf.instance.InstanceSettings;
-import org.apache.karaf.instance.management.codec.JmxInstance;
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.instance.core.InstanceSettings;
+import org.apache.karaf.instance.core.InstancesMBean;
-public class InstanceServiceMBeanImpl extends StandardMBean implements InstanceServiceMBean {
+public class Instances extends StandardMBean implements InstancesMBean {
- private InstanceService instanceService;
+ private org.apache.karaf.instance.core.InstanceService instanceService;
- public InstanceServiceMBeanImpl() throws NotCompliantMBeanException {
- super(InstanceServiceMBean.class);
- }
-
- public InstanceService getInstanceService() {
- return instanceService;
- }
-
- public void setInstanceService(InstanceService instanceService) {
+ public Instances(org.apache.karaf.instance.core.InstanceService instanceService) throws NotCompliantMBeanException {
+ super(InstancesMBean.class);
this.instanceService = instanceService;
}
@@ -99,19 +90,15 @@ public class InstanceServiceMBeanImpl ex
}
public TabularData getInstances() throws Exception {
- List<Instance> allInstances = Arrays.asList(instanceService.getInstances());
- List<JmxInstance> instances = new ArrayList<JmxInstance>();
- for (Instance instance : allInstances) {
- instances.add(new JmxInstance(instance));
- }
- TabularData table = JmxInstance.tableFrom(instances);
+ 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");
+ throw new IllegalArgumentException("Instances '" + name + "' does not exist");
}
return i;
}
Modified: karaf/trunk/instance/core/src/main/resources/OSGI-INF/blueprint/instance-core.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/resources/OSGI-INF/blueprint/instance-core.xml?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/resources/OSGI-INF/blueprint/instance-core.xml (original)
+++ karaf/trunk/instance/core/src/main/resources/OSGI-INF/blueprint/instance-core.xml Wed Apr 11 08:12:00 2012
@@ -18,16 +18,25 @@
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
- default-activation="lazy">
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
- <bean id="instanceService" class="org.apache.karaf.instance.internal.InstanceServiceImpl" init-method="init">
+ <ext:property-placeholder />
+
+ <bean id="instanceService" class="org.apache.karaf.instance.core.internal.InstanceServiceImpl" init-method="init">
<property name="storageLocation" value="${karaf.instances}" />
</bean>
+
+ <service ref="instanceService" interface="org.apache.karaf.instance.core.InstanceService"/>
- <service ref="instanceService" interface="org.apache.karaf.instance.InstanceService" />
+ <bean id="mbeanImpl" class="org.apache.karaf.instance.core.internal.Instances">
+ <argument ref="instanceService" />
+ </bean>
- <!-- Allow the use of system properties -->
- <ext:property-placeholder />
+ <service ref="mbeanImpl" auto-export="interfaces">
+ <service-properties>
+ <entry key="jmx.objectname" value="org.apache.karaf:type=instance,name=${karaf.name}"/>
+ </service-properties>
+ </service>
</blueprint>
Modified: karaf/trunk/instance/core/src/main/resources/OSGI-INF/bundle.info
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/main/resources/OSGI-INF/bundle.info?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/main/resources/OSGI-INF/bundle.info (original)
+++ karaf/trunk/instance/core/src/main/resources/OSGI-INF/bundle.info Wed Apr 11 08:12:00 2012
@@ -15,6 +15,22 @@ Karaf instance allows you to manage Kara
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.
Copied: karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java (from r1312014, karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/InstanceSettingsTest.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java?p2=karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java&p1=karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/InstanceSettingsTest.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/InstanceSettingsTest.java (original)
+++ karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/InstanceSettingsTest.java Wed Apr 11 08:12:00 2012
@@ -14,13 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance;
+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 {
Copied: karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java (from r1312016, karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/internal/InstanceServiceImplTest.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java?p2=karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java&p1=karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/internal/InstanceServiceImplTest.java&r1=1312016&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/internal/InstanceServiceImplTest.java (original)
+++ karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/internal/InstanceServiceImplTest.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.internal;
+package org.apache.karaf.instance.core.internal;
import java.io.File;
import java.io.FileInputStream;
@@ -26,8 +26,10 @@ import java.util.Arrays;
import java.util.Properties;
import junit.framework.TestCase;
-import org.apache.karaf.instance.Instance;
-import org.apache.karaf.instance.InstanceSettings;
+
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.instance.core.InstanceSettings;
+import org.apache.karaf.instance.core.internal.InstanceServiceImpl;
public class InstanceServiceImplTest extends TestCase {
Modified: karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java?rev=1324618&r1=1312014&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java (original)
+++ karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceServiceMBeanImplTest.java Wed Apr 11 08:12:00 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.management.internal;
+package org.apache.karaf.instance.core.management.internal;
import java.util.Arrays;
import java.util.Collections;
@@ -23,9 +23,12 @@ import javax.management.openmbean.Compos
import javax.management.openmbean.TabularData;
import junit.framework.TestCase;
-import org.apache.karaf.instance.InstanceService;
-import org.apache.karaf.instance.Instance;
-import org.apache.karaf.instance.InstanceSettings;
+
+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.Instances;
import org.easymock.EasyMock;
import org.junit.Assert;
@@ -39,14 +42,11 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(inst.getPid()).andReturn(42);
EasyMock.replay(inst);
- InstanceService instanceService = EasyMock.createMock(InstanceService.class);
+ 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);
- InstanceServiceMBeanImpl ab = new InstanceServiceMBeanImpl();
- ab.setInstanceService(instanceService);
- Assert.assertSame(instanceService, ab.getInstanceService());
-
+ Instances ab = new Instances(instanceService);
assertEquals(42, ab.createInstance("t1", 123, 456, 789, "somewhere", "someopts", " webconsole, funfeat", ""));
}
@@ -58,10 +58,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.createInstance("t1", instanceSettings, false)).andReturn(null);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl ab = new InstanceServiceMBeanImpl();
- ab.setInstanceService(instanceService);
- Assert.assertSame(instanceService, ab.getInstanceService());
-
+ InstancesMBean ab = new Instances(instanceService);
assertEquals(-1, ab.createInstance("t1", 0, 0, 0, "", "", "", ""));
}
@@ -85,9 +82,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstances()).andReturn(new Instance[]{i1, i2});
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
-
+ Instances instanceServiceMBean = new Instances(instanceService);
TabularData tabularData = instanceServiceMBean.getInstances();
Assert.assertEquals(2, tabularData.size());
CompositeData cd1 = tabularData.get(new Object[]{"i1"});
@@ -115,9 +110,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.startInstance("test instance", "-x -y -z");
EasyMock.verify(instanceService);
@@ -134,9 +127,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.startInstance("test instance", null);
EasyMock.verify(instanceService);
@@ -153,9 +144,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.stopInstance("test instance");
EasyMock.verify(instanceService);
@@ -172,9 +161,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.destroyInstance("test instance");
EasyMock.verify(instanceService);
@@ -191,9 +178,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.changeSshPort("test instance", 7788);
EasyMock.verify(instanceService);
@@ -210,9 +195,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.changeRmiRegistryPort("test instance", 1123);
EasyMock.verify(instanceService);
@@ -229,9 +212,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.changeRmiServerPort("test instance", 44444);
EasyMock.verify(instanceService);
@@ -248,9 +229,7 @@ public class InstanceServiceMBeanImplTes
EasyMock.expect(instanceService.getInstance("test instance")).andReturn(inst);
EasyMock.replay(instanceService);
- InstanceServiceMBeanImpl instanceServiceMBean = new InstanceServiceMBeanImpl();
- instanceServiceMBean.setInstanceService(instanceService);
- Assert.assertSame(instanceService, instanceServiceMBean.getInstanceService());
+ InstancesMBean instanceServiceMBean = new Instances(instanceService);
instanceServiceMBean.changeJavaOpts("test instance", "new opts");
EasyMock.verify(instanceService);
Copied: karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceToTableMapperTest.java (from r1312014, karaf/trunk/instance/management/src/test/java/org/apache/karaf/instance/management/codec/JmxInstanceTest.java)
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceToTableMapperTest.java?p2=karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceToTableMapperTest.java&p1=karaf/trunk/instance/management/src/test/java/org/apache/karaf/instance/management/codec/JmxInstanceTest.java&r1=1312014&r2=1324618&rev=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/management/src/test/java/org/apache/karaf/instance/management/codec/JmxInstanceTest.java (original)
+++ karaf/trunk/instance/core/src/test/java/org/apache/karaf/instance/core/management/internal/InstanceToTableMapperTest.java Wed Apr 11 08:12:00 2012
@@ -14,50 +14,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.karaf.instance.management.codec;
+package org.apache.karaf.instance.core.management.internal;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeType;
import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularType;
import junit.framework.TestCase;
-import org.apache.karaf.instance.Instance;
-import org.apache.karaf.instance.management.InstanceServiceMBean;
+
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.instance.core.internal.InstanceToTableMapper;
import org.easymock.EasyMock;
import org.junit.Assert;
-public class JmxInstanceTest extends TestCase {
- public void testJMXInstanceStatics() {
- CompositeType it = JmxInstance.INSTANCE;
- Assert.assertEquals(
- new HashSet<String>(Arrays.asList(InstanceServiceMBean.INSTANCE)),
- it.keySet());
-
- TabularType tt = JmxInstance.INSTANCE_TABLE;
- Assert.assertEquals("Instances", tt.getTypeName());
- }
-
+public class InstanceToTableMapperTest extends TestCase {
public void testJMXInstance() throws Exception {
- Instance i = EasyMock.createMock(Instance.class);
- EasyMock.expect(i.getPid()).andReturn(1712);
- EasyMock.expect(i.getName()).andReturn("MyInstance");
- EasyMock.expect(i.isRoot()).andReturn(false);
- EasyMock.expect(i.getSshPort()).andReturn(0);
- EasyMock.expect(i.getRmiRegistryPort()).andReturn(0);
- EasyMock.expect(i.getRmiServerPort()).andReturn(0);
- EasyMock.expect(i.getState()).andThrow(new Exception("gotcha"));
- EasyMock.expect(i.getLocation()).andReturn("somewhere");
- EasyMock.expect(i.getJavaOpts()).andReturn("someopts");
- EasyMock.replay(i);
+ Instance instance = EasyMock.createMock(Instance.class);
+ EasyMock.expect(instance.getPid()).andReturn(1712);
+ EasyMock.expect(instance.getName()).andReturn("MyInstance");
+ EasyMock.expect(instance.isRoot()).andReturn(false);
+ EasyMock.expect(instance.getSshPort()).andReturn(0);
+ EasyMock.expect(instance.getRmiRegistryPort()).andReturn(0);
+ EasyMock.expect(instance.getRmiServerPort()).andReturn(0);
+ EasyMock.expect(instance.getState()).andThrow(new Exception("gotcha"));
+ EasyMock.expect(instance.getLocation()).andReturn("somewhere");
+ EasyMock.expect(instance.getJavaOpts()).andReturn("someopts");
+ EasyMock.replay(instance);
- JmxInstance ji = new JmxInstance(i);
- TabularData td = JmxInstance.tableFrom(Collections.singletonList(ji));
+ TabularData td = InstanceToTableMapper.tableFrom(Collections.singletonList(instance));
Collection<?> keys = (Collection<?>) td.keySet().iterator().next();
Assert.assertEquals("MyInstance", keys.iterator().next());
@@ -74,20 +60,19 @@ public class JmxInstanceTest extends Tes
}
public void testJMXInstance2() throws Exception {
- Instance i = EasyMock.createMock(Instance.class);
- EasyMock.expect(i.getPid()).andReturn(1712);
- EasyMock.expect(i.getName()).andReturn("MyInstance");
- EasyMock.expect(i.isRoot()).andReturn(true);
- EasyMock.expect(i.getSshPort()).andReturn(0);
- EasyMock.expect(i.getRmiRegistryPort()).andReturn(0);
- EasyMock.expect(i.getRmiServerPort()).andReturn(0);
- EasyMock.expect(i.getState()).andReturn("Started");
- EasyMock.expect(i.getLocation()).andReturn(null);
- EasyMock.expect(i.getJavaOpts()).andReturn(null);
- EasyMock.replay(i);
+ Instance instance = EasyMock.createMock(Instance.class);
+ EasyMock.expect(instance.getPid()).andReturn(1712);
+ EasyMock.expect(instance.getName()).andReturn("MyInstance");
+ EasyMock.expect(instance.isRoot()).andReturn(true);
+ EasyMock.expect(instance.getSshPort()).andReturn(0);
+ EasyMock.expect(instance.getRmiRegistryPort()).andReturn(0);
+ EasyMock.expect(instance.getRmiServerPort()).andReturn(0);
+ EasyMock.expect(instance.getState()).andReturn("Started");
+ EasyMock.expect(instance.getLocation()).andReturn(null);
+ EasyMock.expect(instance.getJavaOpts()).andReturn(null);
+ EasyMock.replay(instance);
- JmxInstance ji = new JmxInstance(i);
- TabularData td = JmxInstance.tableFrom(Collections.singletonList(ji));
+ TabularData td = InstanceToTableMapper.tableFrom(Collections.singletonList(instance));
Collection<?> keys = (Collection<?>) td.keySet().iterator().next();
Assert.assertEquals("MyInstance", keys.iterator().next());
Modified: karaf/trunk/instance/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/pom.xml?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/instance/pom.xml (original)
+++ karaf/trunk/instance/pom.xml Wed Apr 11 08:12:00 2012
@@ -36,7 +36,6 @@
<modules>
<module>core</module>
<module>command</module>
- <module>management</module>
</modules>
</project>
Modified: karaf/trunk/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/pom.xml?rev=1324618&r1=1324617&r2=1324618&view=diff
==============================================================================
--- karaf/trunk/pom.xml (original)
+++ karaf/trunk/pom.xml Wed Apr 11 08:12:00 2012
@@ -505,11 +505,6 @@
<artifactId>org.apache.karaf.instance.command</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.karaf.instance</groupId>
- <artifactId>org.apache.karaf.instance.management</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.karaf.system</groupId>