You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/08/26 07:40:30 UTC
[1/5] karaf-cellar git commit: [KARAF-3503] Complete refactoring to
remove blueprint dependency and full support of Karaf 4,
upgrade to Hazelcast 3.5.1
Repository: karaf-cellar
Updated Branches:
refs/heads/master cdfa9b827 -> 3e5e7c339
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerSupport.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerSupport.java b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerSupport.java
index a37bf96..89d2a30 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerSupport.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerSupport.java
@@ -18,7 +18,7 @@ import org.apache.karaf.cellar.core.control.ProducerSwitchCommand;
import org.apache.karaf.cellar.core.control.ProducerSwitchResult;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.shell.ClusterCommandSupport;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.HashSet;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/resources/OSGI-INF/blueprint/shell-cluster.xml
----------------------------------------------------------------------
diff --git a/shell/src/main/resources/OSGI-INF/blueprint/shell-cluster.xml b/shell/src/main/resources/OSGI-INF/blueprint/shell-cluster.xml
deleted file mode 100644
index b5b2991..0000000
--- a/shell/src/main/resources/OSGI-INF/blueprint/shell-cluster.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.apache.karaf.cellar.shell.NodesListCommand">
- <property name="clusterManager" ref="clusterManager"/>
- </action>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.NodePingCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.SyncCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.consumer.ConsumerStartCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.consumer.ConsumerStopCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.consumer.ConsumerStatusCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.producer.ProducerStartCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.producer.ProducerStopCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.producer.ProducerStatusCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.handler.HandlersStartCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.handler.HandlersStopCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.handler.HandlersStatusCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.group.GroupJoinCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.group.GroupQuitCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="localGroupCompleter"/>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.group.GroupSetCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="allNodesCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.group.GroupPickCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.group.GroupListCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.group.GroupCreateCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.shell.group.GroupDeleteCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- </command-bundle>
-
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager" availability="optional"/>
- <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager" availability="optional"/>
- <reference id="executionContext" interface="org.apache.karaf.cellar.core.command.ExecutionContext" availability="optional"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-
- <bean id="allNodesCompleter" class="org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter">
- <property name="clusterManager" ref="clusterManager"/>
- </bean>
- <bean id="allGroupsCompleter" class="org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter">
- <property name="groupManager" ref="groupManager"/>
- </bean>
- <bean id="localGroupCompleter" class="org.apache.karaf.cellar.core.shell.completer.LocalGroupsCompleter">
- <property name="groupManager" ref="groupManager"/>
- </bean>
- <bean id="otherGroupCompleter" class="org.apache.karaf.cellar.core.shell.completer.OtherGroupsCompleter">
- <property name="groupManager" ref="groupManager"/>
- </bean>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/utils/NOTICE
----------------------------------------------------------------------
diff --git a/utils/NOTICE b/utils/NOTICE
index addb35c..64cb235 100644
--- a/utils/NOTICE
+++ b/utils/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/utils/pom.xml
----------------------------------------------------------------------
diff --git a/utils/pom.xml b/utils/pom.xml
index 3c861bb..28d1d64 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -38,12 +38,22 @@
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
<!-- Logging Dependencies -->
<dependency>
@@ -56,17 +66,26 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.utils*;version="${project.version}"
+ !org.apache.karaf.cellar.utils.ping.internal,
+ org.apache.karaf.cellar.utils*
</Export-Package>
<Import-Package>
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.osgi*
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ *
</Import-Package>
+ <Private-Package>
+ org.apache.karaf.cellar.utils.ping.internal,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/utils/src/main/java/org/apache/karaf/cellar/utils/ping/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/org/apache/karaf/cellar/utils/ping/internal/osgi/Activator.java b/utils/src/main/java/org/apache/karaf/cellar/utils/ping/internal/osgi/Activator.java
new file mode 100644
index 0000000..a82dbc5
--- /dev/null
+++ b/utils/src/main/java/org/apache/karaf/cellar/utils/ping/internal/osgi/Activator.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed 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.cellar.utils.ping.internal.osgi;
+
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.command.CommandStore;
+import org.apache.karaf.cellar.core.event.EventHandler;
+import org.apache.karaf.cellar.core.event.EventProducer;
+import org.apache.karaf.cellar.utils.ping.PingHandler;
+import org.apache.karaf.cellar.utils.ping.PongHandler;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+@Services(
+ requires = { @RequireService(ClusterManager.class), @RequireService(CommandStore.class), @RequireService(EventProducer.class), @RequireService(ConfigurationAdmin.class)},
+ provides = { @ProvideService(EventHandler.class)}
+)
+public class Activator extends BaseActivator {
+
+ @Override
+ public void doStart() throws Exception {
+ // retrieving services
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ EventProducer eventProducer = getTrackedService(EventProducer.class);
+ CommandStore commandStore = getTrackedService(CommandStore.class);
+
+ // registering ping event handler
+ PingHandler pingHandler = new PingHandler();
+ pingHandler.setClusterManager(clusterManager);
+ pingHandler.setConfigurationAdmin(configurationAdmin);
+ pingHandler.setProducer(eventProducer);
+ register(EventHandler.class, pingHandler);
+
+ // registering pong event handler
+ PongHandler pongHandler = new PongHandler();
+ pongHandler.setCommandStore(commandStore);
+ register(EventHandler.class, pongHandler);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 85cfb16..0000000
--- a/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <!-- Handler for the cluster ping event -->
- <bean id="pingHandler" class="org.apache.karaf.cellar.utils.ping.PingHandler">
- <property name="producer" ref="producer"/>
- </bean>
- <service ref="pingHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handler for the cluster pong event -->
- <bean id="pongHandler" class="org.apache.karaf.cellar.utils.ping.PongHandler">
- <property name="commandStore" ref="commandStore"/>
- </bean>
- <service ref="pongHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager" availability="optional"/>
- <reference id="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore" availability="optional"/>
- <reference id="producer" interface="org.apache.karaf.cellar.core.event.EventProducer" filter="(!(type = group))" availability="optional"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/webconsole/NOTICE
----------------------------------------------------------------------
diff --git a/webconsole/NOTICE b/webconsole/NOTICE
index addb35c..64cb235 100644
--- a/webconsole/NOTICE
+++ b/webconsole/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/webconsole/pom.xml
----------------------------------------------------------------------
diff --git a/webconsole/pom.xml b/webconsole/pom.xml
index 6073a33..02a229d 100644
--- a/webconsole/pom.xml
+++ b/webconsole/pom.xml
@@ -40,6 +40,10 @@
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -96,21 +100,29 @@
</resources>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.webconsole*;version="${project.version}"
+ !org.apache.karaf.cellar.webconsole.internal.osgi,
+ org.apache.karaf.cellar.webconsole*
</Export-Package>
<Import-Package>
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.apache.felix.webconsole;version="[3,5)",
- org.osgi.framework,
- org.osgi.service.blueprint,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ javax.servlet*;version="[3,4)",
+ org.apache.felix.webconsole*;version="[3,5)",
+ *
</Import-Package>
<Embed-Dependency>json</Embed-Dependency>
+ <Private-Package>
+ org.apache.karaf.cellar.webconsole.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/internal/osgi/Activator.java b/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/internal/osgi/Activator.java
new file mode 100644
index 0000000..43c2d48
--- /dev/null
+++ b/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/internal/osgi/Activator.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed 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.cellar.webconsole.internal.osgi;
+
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.webconsole.CellarPlugin;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.Servlet;
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(Servlet.class)
+ },
+ requires = {
+ @RequireService(ClusterManager.class),
+ @RequireService(GroupManager.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private CellarPlugin plugin;
+
+ @Override
+ public void doStart() throws Exception {
+
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ GroupManager groupManager = getTrackedService(GroupManager.class);
+
+ LOGGER.debug("[CELLAR WEBCONSOLE] Init plugin");
+ plugin = new CellarPlugin();
+ plugin.setClusterManager(clusterManager);
+ plugin.setGroupManager(groupManager);
+ plugin.setBundleContext(bundleContext);
+ plugin.start();
+ Hashtable props = new Hashtable();
+ props.put("felix.webconsole.label", "cellar");
+ register(Servlet.class, plugin, props);
+
+ }
+
+ @Override
+ public void doStop() {
+ if (plugin != null) {
+ plugin.stop();
+ plugin = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml
----------------------------------------------------------------------
diff --git a/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml b/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml
deleted file mode 100644
index 6c60241..0000000
--- a/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
- <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
-
- <bean id="cellarPlugin" class="org.apache.karaf.cellar.webconsole.CellarPlugin" init-method="start"
- destroy-method="stop">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="clusterManager" ref="clusterManager"/>
- </bean>
- <service ref="cellarPlugin" interface="javax.servlet.Servlet">
- <service-properties>
- <entry key="felix.webconsole.label" value="cellar"/>
- </service-properties>
- </service>
-
-</blueprint>
[3/5] karaf-cellar git commit: [KARAF-3503] Complete refactoring to
remove blueprint dependency and full support of Karaf 4,
upgrade to Hazelcast 3.5.1
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/shell/ListFeaturesCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/ListFeaturesCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/ListFeaturesCommand.java
index f146360..aa67d34 100644
--- a/features/src/main/java/org/apache/karaf/cellar/features/shell/ListFeaturesCommand.java
+++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/ListFeaturesCommand.java
@@ -18,21 +18,27 @@ import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.features.Constants;
import org.apache.karaf.cellar.features.FeatureState;
import org.apache.karaf.features.Feature;
import org.apache.karaf.features.FeaturesService;
-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.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.*;
@Command(scope = "cluster", name = "feature-list", description = "List the features in a cluster group")
+@Service
public class ListFeaturesCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Option(name = "-i", aliases = { "--installed" }, description = "Display only installed features", required = false, multiValued = false)
@@ -53,6 +59,7 @@ public class ListFeaturesCommand extends CellarCommandSupport {
@Option(name = "--blocked", description = "Shows only blocked features", required = false, multiValued = false)
boolean onlyBlocked;
+ @Reference
private FeaturesService featuresService;
@Override
@@ -73,7 +80,7 @@ public class ListFeaturesCommand extends CellarCommandSupport {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
Map<String, ExtendedFeatureState> features = gatherFeatures();
-;
+
if (features != null && !features.isEmpty()) {
ShellTable table = new ShellTable();
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoAddCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoAddCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoAddCommand.java
index 0788087..0879da8 100644
--- a/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoAddCommand.java
+++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoAddCommand.java
@@ -18,6 +18,7 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.features.Constants;
import org.apache.karaf.cellar.features.FeatureState;
import org.apache.karaf.cellar.features.ClusterRepositoryEvent;
@@ -25,18 +26,23 @@ import org.apache.karaf.features.Feature;
import org.apache.karaf.features.FeaturesService;
import org.apache.karaf.features.Repository;
import org.apache.karaf.features.RepositoryEvent;
-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.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.net.URI;
import java.util.List;
import java.util.Map;
@Command(scope = "cluster", name = "feature-repo-add", description = "Add a features repository to a cluster group")
+@Service
public class RepoAddCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "urls", description = "URLs of the feature repositories separated by whitespaces", required = true, multiValued = true)
@@ -45,7 +51,10 @@ public class RepoAddCommand extends CellarCommandSupport {
@Option(name = "-i", aliases = { "--install" }, description = "Install all features contained in the features repository", required = false, multiValued = false)
boolean install;
+ @Reference
private EventProducer eventProducer;
+
+ @Reference
private FeaturesService featuresService;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoListCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoListCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoListCommand.java
index 5b6f55b..5794d10 100644
--- a/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoListCommand.java
+++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoListCommand.java
@@ -16,21 +16,27 @@ package org.apache.karaf.cellar.features.shell;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.features.Constants;
import org.apache.karaf.features.FeaturesService;
import org.apache.karaf.features.Repository;
-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.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.HashMap;
import java.util.Map;
@Command(scope = "cluster", name = "feature-repo-list", description = "List the features repositories in a cluster group")
+@Service
public class RepoListCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
@@ -42,6 +48,7 @@ public class RepoListCommand extends CellarCommandSupport {
@Option(name = "--cluster", description = "Shows only features repositories on the cluster", required = false, multiValued = false)
boolean onlyCluster;
+ @Reference
private FeaturesService featuresService;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoRemoveCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoRemoveCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoRemoveCommand.java
index 0d3c582..4f67060 100644
--- a/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoRemoveCommand.java
+++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/RepoRemoveCommand.java
@@ -18,6 +18,7 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.features.Constants;
import org.apache.karaf.cellar.features.FeatureState;
import org.apache.karaf.cellar.features.ClusterRepositoryEvent;
@@ -25,18 +26,23 @@ import org.apache.karaf.features.Feature;
import org.apache.karaf.features.FeaturesService;
import org.apache.karaf.features.Repository;
import org.apache.karaf.features.RepositoryEvent;
-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.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.net.URI;
import java.util.List;
import java.util.Map;
@Command(scope = "cluster", name = "feature-repo-remove", description = "Remove features repository URLs from a cluster group")
+@Service
public class RepoRemoveCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "urls", description = "The features repository URLs separated by whitespaces", required = true, multiValued = true)
@@ -45,7 +51,10 @@ public class RepoRemoveCommand extends CellarCommandSupport {
@Option(name = "-u", aliases = { "--uninstall-all" }, description = "Uninstall all features contained in the features repositories", required = false, multiValued = false)
boolean uninstall;
+ @Reference
private EventProducer eventProducer;
+
+ @Reference
private FeaturesService featuresService;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java
index 2dfff8c..d1f3dd1 100644
--- a/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java
+++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java
@@ -20,21 +20,27 @@ import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.features.ClusterFeaturesEvent;
import org.apache.karaf.cellar.features.Constants;
import org.apache.karaf.cellar.features.FeatureState;
import org.apache.karaf.features.FeatureEvent;
-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.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
import java.util.Map;
@Command(scope = "cluster", name = "feature-uninstall", description = "Uninstall a feature from a cluster group")
+@Service
public class UninstallFeatureCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "features", description = "The name and version of the features to uninstall. A feature id looks like name/version. The version is optional.", required = true, multiValued = true)
@@ -43,6 +49,7 @@ public class UninstallFeatureCommand extends CellarCommandSupport {
@Option(name = "-r", aliases = "--no-auto-refresh", description = "Do not automatically refresh bundles", required = false, multiValued = false)
boolean noRefresh;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 4f30536..0000000
--- a/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
- http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <!-- Local Features Listener -->
- <bean id="localListener" class="org.apache.karaf.cellar.features.LocalFeaturesListener" init-method="init"
- destroy-method="destroy">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="featuresService" ref="featuresService"/>
- </bean>
- <service ref="localListener" interface="org.apache.karaf.features.FeaturesListener"/>
-
- <!-- Features/Repositories Synchronizer -->
- <bean id="synchronizer" class="org.apache.karaf.cellar.features.FeaturesSynchronizer"
- init-method="init" destroy-method="destroy">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="featuresService" ref="featuresService"/>
- </bean>
- <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer">
- <service-properties>
- <entry key="resource" value="feature"/>
- </service-properties>
- </service>
-
- <!-- Cluster Features Event Handler -->
- <bean id="featuresEventHandler" class="org.apache.karaf.cellar.features.FeaturesEventHandler"
- init-method="init" destroy-method="destroy">
- <property name="featuresService" ref="featuresService"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="featuresEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
- <service-properties>
- <entry key="managed" value="true"/>
- </service-properties>
- </service>
-
- <!-- Cluster Features Repositories Event Handler -->
- <bean id="repositoryEventHandler" class="org.apache.karaf.cellar.features.RepositoryEventHandler"
- init-method="init" destroy-method="destroy">
- <property name="featuresService" ref="featuresService"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="repositoryEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
- <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
- <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
- <reference id="featuresService" interface="org.apache.karaf.features.FeaturesService"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/resources/OSGI-INF/blueprint/management.xml
----------------------------------------------------------------------
diff --git a/features/src/main/resources/OSGI-INF/blueprint/management.xml b/features/src/main/resources/OSGI-INF/blueprint/management.xml
deleted file mode 100644
index 2795c9a..0000000
--- a/features/src/main/resources/OSGI-INF/blueprint/management.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed 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.
- -->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
-
- <!-- system properties -->
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
-
- <!-- Cellar Features MBean -->
- <bean id="cellarFeaturesMBean" class="org.apache.karaf.cellar.features.management.internal.CellarFeaturesMBeanImpl">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="featuresService" ref="featuresService"/>
- </bean>
- <service ref="cellarFeaturesMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=feature,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/resources/OSGI-INF/blueprint/shell-features.xml
----------------------------------------------------------------------
diff --git a/features/src/main/resources/OSGI-INF/blueprint/shell-features.xml b/features/src/main/resources/OSGI-INF/blueprint/shell-features.xml
deleted file mode 100644
index 745fea6..0000000
--- a/features/src/main/resources/OSGI-INF/blueprint/shell-features.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
- <!-- Command Bundle -->
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.apache.karaf.cellar.features.shell.InstallFeatureCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="featuresService" ref="featuresService"/>
- <property name="eventProducer" ref="eventProducer"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <!-- <ref component-id="allFeaturesCompleter"/> -->
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.features.shell.UninstallFeatureCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="eventProducer" ref="eventProducer"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <!-- <ref component-id="allFeaturesCompleter"/> -->
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.features.shell.ListFeaturesCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="featuresService" ref="featuresService"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.features.shell.RepoListCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="featuresService" ref="featuresService"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.features.shell.RepoAddCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="featuresService" ref="featuresService"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.features.shell.RepoRemoveCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="featuresService" ref="featuresService"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.features.shell.BlockCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <!-- <ref component-id="allFeaturesCompleter"/> -->
- </completers>
- </command>
- </command-bundle>
-
- <bean id="allGroupsCompleter" class="org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter">
- <property name="groupManager" ref="groupManager"/>
- </bean>
-
- <!--
- <bean id="allFeaturesCompleter" class="org.apache.karaf.features.command.completers.AllFeatureCompleter">
- <property name="featuresService" ref="featuresService"/>
- </bean>
- -->
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/hazelcast/NOTICE
----------------------------------------------------------------------
diff --git a/hazelcast/NOTICE b/hazelcast/NOTICE
index addb35c..64cb235 100644
--- a/hazelcast/NOTICE
+++ b/hazelcast/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/hazelcast/pom.xml
----------------------------------------------------------------------
diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml
index 68648aa..5fb220e 100644
--- a/hazelcast/pom.xml
+++ b/hazelcast/pom.xml
@@ -34,17 +34,21 @@
<name>Apache Karaf :: Cellar :: Hazelcast</name>
<dependencies>
+ <!-- Core Dependencies -->
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-all</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.core</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.utils</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -56,6 +60,10 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
<!-- Logging Dependencies -->
<dependency>
@@ -75,25 +83,29 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.hazelcast*;version="${project.version}"
+ !org.apache.karaf.cellar.hazelcast.internal.osgi,
+ !org.apache.karaf.cellar.hazelcast.management.internal
+ org.apache.karaf.cellar.hazelcast*
</Export-Package>
<Import-Package>
- com.hazelcast*,
- javax.management*,
- org.apache.aries.proxy,
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.apache.karaf.cellar.utils.ping;version="${project.version}",
- org.apache.karaf.features;version="[3,5)",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ !org.apache.karaf.cellar.hazelcast*,
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ org.apache.karaf.shell*;resolution:=optional,
+ *
</Import-Package>
<Private-Package>
- org.apache.karaf.cellar.hazelcast.management.internal
+ org.apache.karaf.cellar.hazelcast.internal.osgi,
+ org.apache.karaf.cellar.hazelcast.management.internal,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
</Private-Package>
</instructions>
</configuration>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/internal/osgi/Activator.java b/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/internal/osgi/Activator.java
new file mode 100644
index 0000000..c0f2dfe
--- /dev/null
+++ b/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/internal/osgi/Activator.java
@@ -0,0 +1,380 @@
+/*
+ * Licensed 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.cellar.hazelcast.internal.osgi;
+
+import com.hazelcast.core.HazelcastInstance;
+import org.apache.aries.proxy.ProxyManager;
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.core.Node;
+import org.apache.karaf.cellar.core.Synchronizer;
+import org.apache.karaf.cellar.core.command.BasicCommandStore;
+import org.apache.karaf.cellar.core.command.ClusteredExecutionContext;
+import org.apache.karaf.cellar.core.command.CommandStore;
+import org.apache.karaf.cellar.core.command.ExecutionContext;
+import org.apache.karaf.cellar.core.control.*;
+import org.apache.karaf.cellar.core.discovery.Discovery;
+import org.apache.karaf.cellar.core.discovery.DiscoveryService;
+import org.apache.karaf.cellar.core.discovery.DiscoveryTask;
+import org.apache.karaf.cellar.core.event.*;
+import org.apache.karaf.cellar.core.utils.CombinedClassLoader;
+import org.apache.karaf.cellar.hazelcast.*;
+import org.apache.karaf.cellar.hazelcast.factory.HazelcastConfigurationManager;
+import org.apache.karaf.cellar.hazelcast.factory.HazelcastServiceFactory;
+import org.apache.karaf.cellar.hazelcast.management.internal.CellarGroupMBeanImpl;
+import org.apache.karaf.cellar.hazelcast.management.internal.CellarMBeanImpl;
+import org.apache.karaf.cellar.hazelcast.management.internal.CellarNodeMBeanImpl;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.Managed;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationListener;
+import org.osgi.service.cm.ManagedService;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+@Services(
+ provides = {
+ @ProvideService(HazelcastInstance.class),
+ @ProvideService(ClusterManager.class),
+ @ProvideService(GroupManager.class),
+ @ProvideService(EventTransportFactory.class),
+ @ProvideService(EventProducer.class),
+ @ProvideService(ExecutionContext.class),
+ @ProvideService(EventHandler.class),
+ @ProvideService(CommandStore.class)
+ },
+ requires = {
+ @RequireService(ConfigurationAdmin.class),
+ @RequireService(ProxyManager.class),
+ @RequireService(EventHandlerRegistry.class)
+ }
+)
+@Managed("org.apache.karaf.cellar.discovery")
+public class Activator extends BaseActivator implements ManagedService {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private CombinedClassLoader combinedClassLoader;
+ private HazelcastServiceFactory hazelcastServiceFactory;
+ private List<DiscoveryService> discoveryServices = new ArrayList<DiscoveryService>();
+ private List<Synchronizer> synchronizers = new ArrayList<Synchronizer>();
+ private HazelcastInstance hazelcastInstance;
+ private DiscoveryTask discoveryTask;
+ private CellarExtender extender;
+ private TopicProducer producer;
+ private TopicConsumer consumer;
+ private ServiceTracker<DiscoveryService, DiscoveryService> discoveryServiceTracker;
+ private ServiceTracker<Synchronizer, Synchronizer> synchronizerServiceTracker;
+
+ private volatile ServiceRegistration coreMBeanRegistration;
+ private volatile ServiceRegistration nodeMBeanRegistration;
+ private volatile ServiceRegistration groupMBeanRegistration;
+
+ @Override
+ public void doStart() throws Exception {
+
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+
+ LOGGER.debug("[CELLAR HAZELCAST] Init combined class loader");
+ combinedClassLoader = new CombinedClassLoader();
+ combinedClassLoader.init();
+
+ LOGGER.debug("[CELLAR HAZELCAST] Start the discovery service tracker");
+ discoveryServiceTracker = new ServiceTracker<DiscoveryService, DiscoveryService>(bundleContext, DiscoveryService.class, new ServiceTrackerCustomizer<DiscoveryService, DiscoveryService>() {
+ @Override
+ public DiscoveryService addingService(ServiceReference<DiscoveryService> serviceReference) {
+ DiscoveryService service = bundleContext.getService(serviceReference);
+ discoveryServices.add(service);
+ return service;
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<DiscoveryService> serviceReference, DiscoveryService discoveryService) {
+ // nothing to do
+ }
+
+ @Override
+ public void removedService(ServiceReference<DiscoveryService> serviceReference, DiscoveryService discoveryService) {
+ discoveryServices.remove(discoveryService);
+ bundleContext.ungetService(serviceReference);
+ }
+ });
+ discoveryServiceTracker.open();
+
+ LOGGER.debug("[CELLAR HAZELCAST] Start the synchronizer service tracker");
+ synchronizerServiceTracker = new ServiceTracker<Synchronizer, Synchronizer>(bundleContext, Synchronizer.class, new ServiceTrackerCustomizer<Synchronizer, Synchronizer>() {
+ @Override
+ public Synchronizer addingService(ServiceReference<Synchronizer> serviceReference) {
+ Synchronizer service = bundleContext.getService(serviceReference);
+ synchronizers.add(service);
+ return service;
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<Synchronizer> serviceReference, Synchronizer synchronizer) {
+ // nothing to do
+ }
+
+ @Override
+ public void removedService(ServiceReference<Synchronizer> serviceReference, Synchronizer synchronizer) {
+ synchronizers.remove(synchronizer);
+ bundleContext.ungetService(serviceReference);
+ }
+ });
+ synchronizerServiceTracker.open();
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Init dispatcher");
+ EventHandlerRegistryDispatcher dispatcher = new EventHandlerRegistryDispatcher();
+ dispatcher.setHandlerRegistry(getTrackedService(EventHandlerRegistry.class));
+ dispatcher.init();
+
+ LOGGER.debug("[CELLAR HAZELCAST] Create Hazelcast configuration manager");
+ HazelcastConfigurationManager hazelcastConfigurationManager = new HazelcastConfigurationManager();
+ hazelcastConfigurationManager.setDiscoveryServices(discoveryServices);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Init Hazelcast service factory");
+ hazelcastServiceFactory = new HazelcastServiceFactory();
+ hazelcastServiceFactory.setCombinedClassLoader(combinedClassLoader);
+ hazelcastServiceFactory.setConfigurationManager(hazelcastConfigurationManager);
+ hazelcastServiceFactory.setBundleContext(bundleContext);
+ hazelcastServiceFactory.init();
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register Hazelcast instance");
+ hazelcastInstance = hazelcastServiceFactory.getInstance();
+ register(HazelcastInstance.class, hazelcastInstance);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Init discovery task");
+ discoveryTask = new DiscoveryTask();
+ discoveryTask.setDiscoveryServices(discoveryServices);
+ discoveryTask.setConfigurationAdmin(configurationAdmin);
+ discoveryTask.init();
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register Hazelcast cluster manager");
+ HazelcastClusterManager clusterManager = new HazelcastClusterManager();
+ clusterManager.setInstance(hazelcastInstance);
+ clusterManager.setConfigurationAdmin(configurationAdmin);
+ clusterManager.setCombinedClassLoader(combinedClassLoader);
+ register(ClusterManager.class, clusterManager);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create Hazelcast event transport factory");
+ HazelcastEventTransportFactory eventTransportFactory = new HazelcastEventTransportFactory();
+ eventTransportFactory.setCombinedClassLoader(combinedClassLoader);
+ eventTransportFactory.setConfigurationAdmin(configurationAdmin);
+ eventTransportFactory.setInstance(hazelcastInstance);
+ eventTransportFactory.setDispatcher(dispatcher);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register Hazelcast group manager");
+ HazelcastGroupManager groupManager = new HazelcastGroupManager();
+ groupManager.setInstance(hazelcastInstance);
+ groupManager.setCombinedClassLoader(combinedClassLoader);
+ groupManager.setBundleContext(bundleContext);
+ groupManager.setConfigurationAdmin(configurationAdmin);
+ groupManager.setEventTransportFactory(eventTransportFactory);
+ register(new Class[]{GroupManager.class, ConfigurationListener.class}, groupManager);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create Cellar membership listener");
+ CellarMembershipListener membershipListener = new CellarMembershipListener(hazelcastInstance);
+ membershipListener.setSynchronizers(synchronizers);
+ membershipListener.setGroupManager(groupManager);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Init Cellar extender");
+ extender = new CellarExtender();
+ extender.setCombinedClassLoader(combinedClassLoader);
+ extender.setBundleContext(bundleContext);
+ extender.init();
+
+ Node node = clusterManager.getNode();
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Init topic consumer");
+ consumer = new TopicConsumer();
+ consumer.setInstance(hazelcastInstance);
+ consumer.setDispatcher(dispatcher);
+ consumer.setNode(node);
+ consumer.setConfigurationAdmin(configurationAdmin);
+ consumer.init();
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Init topic producer");
+ producer = new TopicProducer();
+ producer.setInstance(hazelcastInstance);
+ producer.setNode(node);
+ producer.setConfigurationAdmin(configurationAdmin);
+ producer.init();
+ register(EventProducer.class, producer);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register basic command store");
+ CommandStore commandStore = new BasicCommandStore();
+ register(CommandStore.class, commandStore);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register clustered execution context");
+ ClusteredExecutionContext executionContext = new ClusteredExecutionContext();
+ executionContext.setProducer(producer);
+ executionContext.setCommandStore(commandStore);
+ register(ExecutionContext.class, executionContext);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register producer switch command handler");
+ ProducerSwitchCommandHandler producerSwitchCommandHandler = new ProducerSwitchCommandHandler();
+ producerSwitchCommandHandler.setProducer(producer);
+ producerSwitchCommandHandler.setConfigurationAdmin(configurationAdmin);
+ register(EventHandler.class, producerSwitchCommandHandler);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register producer switch result handler");
+ ProducerSwitchResultHandler producerSwitchResultHandler = new ProducerSwitchResultHandler();
+ producerSwitchResultHandler.setCommandStore(commandStore);
+ register(EventHandler.class, producerSwitchResultHandler);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register consumer switch command handler");
+ ConsumerSwitchCommandHandler consumerSwitchCommandHandler = new ConsumerSwitchCommandHandler();
+ consumerSwitchCommandHandler.setProducer(producer);
+ consumerSwitchCommandHandler.setConsumer(consumer);
+ consumerSwitchCommandHandler.setConfigurationAdmin(configurationAdmin);
+ register(EventHandler.class, consumerSwitchCommandHandler);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register consumer switch result handler");
+ ConsumerSwitchResultHandler consumerSwitchResultHandler = new ConsumerSwitchResultHandler();
+ consumerSwitchResultHandler.setCommandStore(commandStore);
+ register(EventHandler.class, consumerSwitchResultHandler);
+
+ ProxyManager proxyManager = getTrackedService(ProxyManager.class);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register manage handlers command handler");
+ ManageHandlersCommandHandler manageHandlersCommandHandler = new ManageHandlersCommandHandler();
+ manageHandlersCommandHandler.setConfigurationAdmin(configurationAdmin);
+ manageHandlersCommandHandler.setProducer(producer);
+ manageHandlersCommandHandler.setProxyManager(proxyManager);
+ register(EventHandler.class, manageHandlersCommandHandler);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register manage handlers result handler");
+ ManageHandlersResultHandler manageHandlersResultHandler = new ManageHandlersResultHandler();
+ manageHandlersResultHandler.setCommandStore(commandStore);
+ register(EventHandler.class, manageHandlersResultHandler);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register manage group command handler");
+ ManageGroupCommandHandler manageGroupCommandHandler = new ManageGroupCommandHandler();
+ manageGroupCommandHandler.setProducer(producer);
+ manageGroupCommandHandler.setClusterManager(clusterManager);
+ manageGroupCommandHandler.setGroupManager(groupManager);
+ register(EventHandler.class, manageGroupCommandHandler);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register manage group result handler");
+ ManageGroupResultHandler manageGroupResultHandler = new ManageGroupResultHandler();
+ manageGroupResultHandler.setCommandStore(commandStore);
+ register(EventHandler.class, manageGroupResultHandler);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register Cellar Core MBean");
+ CellarMBeanImpl cellarMBean = new CellarMBeanImpl();
+ cellarMBean.setBundleContext(bundleContext);
+ cellarMBean.setClusterManager(clusterManager);
+ cellarMBean.setGroupManager(groupManager);
+ cellarMBean.setExecutionContext(executionContext);
+ Hashtable props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=core,name=" + System.getProperty("karaf.name"));
+ coreMBeanRegistration = bundleContext.registerService(getInterfaceNames(cellarMBean), cellarMBean, props);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register Cellar Node MBean");
+ CellarNodeMBeanImpl cellarNodeMBean = new CellarNodeMBeanImpl();
+ cellarNodeMBean.setClusterManager(clusterManager);
+ cellarNodeMBean.setExecutionContext(executionContext);
+ props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=node,name=" + System.getProperty("karaf.name"));
+ nodeMBeanRegistration = bundleContext.registerService(getInterfaceNames(cellarNodeMBean), cellarNodeMBean, props);
+
+ LOGGER.debug("[CELLAR HAZELCAST]Â Create and register Cellar Group MBean");
+ CellarGroupMBeanImpl cellarGroupMBean = new CellarGroupMBeanImpl();
+ cellarGroupMBean.setClusterManager(clusterManager);
+ cellarGroupMBean.setExecutionContext(executionContext);
+ cellarGroupMBean.setGroupManager(groupManager);
+ props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=group,name=" + System.getProperty("karaf.name"));
+ groupMBeanRegistration = bundleContext.registerService(getInterfaceNames(cellarGroupMBean), cellarGroupMBean, props);
+ }
+
+ @Override
+ public void doStop() {
+ if (groupMBeanRegistration != null) {
+ groupMBeanRegistration.unregister();
+ groupMBeanRegistration = null;
+ }
+ if (nodeMBeanRegistration != null) {
+ nodeMBeanRegistration.unregister();
+ nodeMBeanRegistration = null;
+ }
+ if (coreMBeanRegistration != null) {
+ coreMBeanRegistration.unregister();
+ coreMBeanRegistration = null;
+ }
+ if (hazelcastServiceFactory != null) {
+ hazelcastServiceFactory.destroy();
+ hazelcastServiceFactory = null;
+ }
+ if (hazelcastInstance != null) {
+ hazelcastInstance.shutdown();
+ hazelcastInstance = null;
+ }
+ if (discoveryTask != null) {
+ discoveryTask.destroy();
+ discoveryTask = null;
+ }
+ if (extender != null) {
+ extender.destroy();
+ extender = null;
+ }
+ if (producer != null) {
+ producer.destroy();
+ producer = null;
+ }
+ if (consumer != null) {
+ consumer.destroy();
+ consumer = null;
+ }
+ if (synchronizerServiceTracker != null) {
+ synchronizerServiceTracker.close();
+ synchronizerServiceTracker = null;
+ }
+ if (discoveryServiceTracker != null) {
+ discoveryServiceTracker.close();
+ discoveryServiceTracker = null;
+ }
+ if (combinedClassLoader != null) {
+ combinedClassLoader.destroy();
+ combinedClassLoader = null;
+ }
+ }
+
+ @Override
+ public void updated(Dictionary config) {
+ if (config == null) {
+ return;
+ }
+ HashMap map = new HashMap();
+ for (Enumeration keys = config.keys(); keys.hasMoreElements();) {
+ Object key = keys.nextElement();
+ map.put(key, config.get(key));
+ }
+ try {
+ hazelcastServiceFactory.update(map);
+ } catch (Exception e) {
+ LOGGER.error("Can't update Hazelcast service factory", e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 2cae5fe..0000000
--- a/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,197 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
-
- <bean id="hazelcast" class="com.hazelcast.core.Hazelcast" factory-ref="instanceFactory"
- factory-method="getInstance" destroy-method="shutdown"/>
- <service ref="hazelcast" interface="com.hazelcast.core.HazelcastInstance"/>
-
- <bean id="instanceFactory" class="org.apache.karaf.cellar.hazelcast.factory.HazelcastServiceFactory"
- init-method="init" destroy-method="destroy">
- <property name="combinedClassLoader" ref="combinedClassLoader"/>
- <property name="configurationManager" ref="hazelcastConfigurationManager"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <cm:managed-properties persistent-id="org.apache.karaf.cellar.discovery" update-strategy="component-managed"
- update-method="update"/>
- </bean>
-
- <bean id="hazelcastConfigurationManager" class="org.apache.karaf.cellar.hazelcast.factory.HazelcastConfigurationManager" >
- <property name="discoveryServices" ref="discoveryServices"/>
- </bean>
-
- <!-- Discovery Task -->
- <bean id="discoveryTask" class="org.apache.karaf.cellar.core.discovery.DiscoveryTask" init-method="init" destroy-method="destroy">
- <property name="discoveryServices" ref="discoveryServices"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
-
- <!-- Members Listener -->
- <bean id="membershipListener" class="org.apache.karaf.cellar.hazelcast.CellarMembershipListener">
- <argument index="0" ref="hazelcast"/>
- <property name="synchronizers" ref="synchronizers"/>
- <property name="groupManager" ref="groupManager"/>
- </bean>
-
- <!-- Cluster Manager -->
- <bean id="clusterManager" class="org.apache.karaf.cellar.hazelcast.HazelcastClusterManager">
- <property name="instance" ref="hazelcast"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="combinedClassLoader" ref="combinedClassLoader"/>
- </bean>
- <service ref="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
-
- <!-- Cluster Group Manager -->
- <bean id="groupManager" class="org.apache.karaf.cellar.hazelcast.HazelcastGroupManager" init-method="init" destroy-method="destroy">
- <property name="instance" ref="hazelcast"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="eventTransportFactory" ref="eventTransportFactory"/>
- <property name="combinedClassLoader" ref="combinedClassLoader"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
- <service ref="groupManager">
- <interfaces>
- <value>org.apache.karaf.cellar.core.GroupManager</value>
- <value>org.osgi.service.cm.ConfigurationListener</value>
- </interfaces>
- </service>
-
- <!-- Cluster Event Transport Factory -->
- <bean id="eventTransportFactory" class="org.apache.karaf.cellar.hazelcast.HazelcastEventTransportFactory">
- <property name="dispatcher" ref="dispatcher"/>
- <property name="instance" ref="hazelcast"/>
- <property name="combinedClassLoader" ref="combinedClassLoader"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
-
- <!-- Cellar Extender -->
- <bean id="cellarExtender" class="org.apache.karaf.cellar.hazelcast.CellarExtender" init-method="init" destroy-method="destroy">
- <property name="combinedClassLoader" ref="combinedClassLoader"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
-
- <!-- Bundle Combined ClassLoader -->
- <bean id="combinedClassLoader" class="org.apache.karaf.cellar.core.utils.CombinedClassLoader" init-method="init" destroy-method="destroy"/>
-
- <!-- Local Node -->
- <bean id="node" factory-ref="clusterManager" factory-method="getNode"/>
-
- <!-- Cluster Event Topic -->
- <bean id="eventTopic" factory-ref="hazelcast" factory-method="getTopic">
- <argument value="org.apache.karaf.cellar.event.topic"/>
- </bean>
-
- <!-- Cluster Event Consumer -->
- <bean id="consumer" class="org.apache.karaf.cellar.hazelcast.TopicConsumer" init-method="init"
- destroy-method="destroy">
- <property name="instance" ref="hazelcast"/>
- <property name="dispatcher" ref="dispatcher"/>
- <property name="node" ref="node"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
-
- <!-- Cluster Event Producer -->
- <bean id="producer" class="org.apache.karaf.cellar.hazelcast.TopicProducer" init-method="init">
- <property name="instance" ref="hazelcast"/>
- <property name="node" ref="node"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="producer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
-
- <!-- Execution Context -->
- <bean id="executionContext" class="org.apache.karaf.cellar.core.command.ClusteredExecutionContext">
- <property name="producer" ref="producer"/>
- <property name="commandStore" ref="commandStore"/>
- </bean>
- <service ref="executionContext" interface="org.apache.karaf.cellar.core.command.ExecutionContext"/>
-
- <!-- Handler For Cluster Producer Switch Command Event -->
- <bean id="producerSwitchCommandHandler" class="org.apache.karaf.cellar.core.control.ProducerSwitchCommandHandler">
- <property name="producer" ref="producer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="producerSwitchCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handler For Cluster Producer Switch Result Event -->
- <bean id="producerSwitchResultHandler" class="org.apache.karaf.cellar.core.control.ProducerSwitchResultHandler">
- <property name="commandStore" ref="commandStore"/>
- </bean>
- <service ref="producerSwitchResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handler For Cluster Consumer Switch Command Event -->
- <bean id="consumerSwitchCommandHandler" class="org.apache.karaf.cellar.core.control.ConsumerSwitchCommandHandler">
- <property name="producer" ref="producer"/>
- <property name="consumer" ref="consumer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="consumerSwitchCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handler For Cluster Consumer Switch Result Event -->
- <bean id="consumerSwitchResultHandler" class="org.apache.karaf.cellar.core.control.ConsumerSwitchResultHandler">
- <property name="commandStore" ref="commandStore"/>
- </bean>
- <service ref="consumerSwitchResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handler For Cluster Manage Handlers Command Event -->
- <bean id="manageHandlersCommandHandler" class="org.apache.karaf.cellar.core.control.ManageHandlersCommandHandler">
- <property name="producer" ref="producer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="proxyManager" ref="proxyManager"/>
- </bean>
- <service ref="manageHandlersCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handler For Cluster Manage Handlers Result Event -->
- <bean id="manageHandlersResultHandler" class="org.apache.karaf.cellar.core.control.ManageHandlersResultHandler">
- <property name="commandStore" ref="commandStore"/>
- </bean>
- <service ref="manageHandlersResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handler For Cluster Manager Group Command Event -->
- <bean id="manageGroupCommandHandler" class="org.apache.karaf.cellar.core.control.ManageGroupCommandHandler">
- <property name="producer" ref="producer"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- </bean>
- <service ref="manageGroupCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Handlers For Cluster Manager Group Result Event -->
- <bean id="manageGroupResultHandler" class="org.apache.karaf.cellar.core.control.ManageGroupResultHandler">
- <property name="commandStore" ref="commandStore"/>
- </bean>
- <service ref="manageGroupResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <!-- Command Store -->
- <bean id="commandStore" class="org.apache.karaf.cellar.core.command.BasicCommandStore"/>
- <service ref="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/>
-
- <!-- Cluster Event Dispatcher -->
- <bean id="dispatcher" class="org.apache.karaf.cellar.core.event.EventHandlerRegistryDispatcher" init-method="init">
- <property name="handlerRegistry" ref="registry"/>
- </bean>
-
- <reference id="registry" interface="org.apache.karaf.cellar.core.event.EventHandlerRegistry"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
- <reference id="proxyManager" interface="org.apache.aries.proxy.ProxyManager"/>
-
- <reference-list id="discoveryServices" availability="optional"
- interface="org.apache.karaf.cellar.core.discovery.DiscoveryService"/>
- <reference-list id="groupEventProducers" availability="optional" interface="org.apache.karaf.cellar.core.event.EventProducer"
- filter="(type = group)"/>
- <reference-list id="groupEventConsumers" availability="optional" interface="org.apache.karaf.cellar.core.event.EventConsumer"
- filter="(type = group)"/>
- <reference-list id="synchronizers" availability="optional" interface="org.apache.karaf.cellar.core.Synchronizer"/>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/hazelcast/src/main/resources/OSGI-INF/blueprint/management.xml
----------------------------------------------------------------------
diff --git a/hazelcast/src/main/resources/OSGI-INF/blueprint/management.xml b/hazelcast/src/main/resources/OSGI-INF/blueprint/management.xml
deleted file mode 100644
index 14562cf..0000000
--- a/hazelcast/src/main/resources/OSGI-INF/blueprint/management.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
-
- <!-- system properties -->
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
-
- <reference id="featuresService" interface="org.apache.karaf.features.FeaturesService"/>
-
- <!-- Core Cellar MBean -->
- <bean id="cellarMBean" class="org.apache.karaf.cellar.hazelcast.management.internal.CellarMBeanImpl">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="executionContext" ref="executionContext"/>
- </bean>
- <service ref="cellarMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=core,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
- <!-- Cellar Node MBean -->
- <bean id="cellarNodeMBean" class="org.apache.karaf.cellar.hazelcast.management.internal.CellarNodeMBeanImpl">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- </bean>
- <service ref="cellarNodeMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=node,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
- <!-- Cellar Cluster Group MBean -->
- <bean id="cellarGroupMBean" class="org.apache.karaf.cellar.hazelcast.management.internal.CellarGroupMBeanImpl">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="executionContext" ref="executionContext"/>
- <property name="groupManager" ref="groupManager"/>
- </bean>
- <service ref="cellarGroupMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=group,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 5b50599..8ee1062 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -40,6 +40,10 @@
<version>${karaf.version}</version>
<type>tar.gz</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
@@ -64,26 +68,14 @@
<!-- pax exam -->
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam</artifactId>
- <version>4.3.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
- <version>4.3.0</version>
+ <version>4.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-karaf</artifactId>
- <version>4.3.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-inject</artifactId>
- <version>4.3.0</version>
+ <version>4.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java b/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
index 9c7d0fe..918860a 100644
--- a/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
+++ b/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
@@ -22,21 +22,21 @@ import java.io.IOException;
import java.io.PrintStream;
import java.net.DatagramSocket;
import java.net.ServerSocket;
+import java.security.Principal;
+import java.security.PrivilegedExceptionAction;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.*;
+import java.util.concurrent.TimeoutException;
import javax.inject.Inject;
+import javax.security.auth.Subject;
-import org.apache.felix.service.command.CommandProcessor;
-import org.apache.felix.service.command.CommandSession;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.api.console.SessionFactory;
import org.ops4j.pax.exam.*;
import org.ops4j.pax.exam.karaf.options.*;
import org.osgi.framework.Bundle;
@@ -66,6 +66,10 @@ public class CellarTestSupport {
@Inject
protected BundleContext bundleContext;
+ @Inject
+ protected SessionFactory sessionFactory;
+
+
/**
* @param probe
* @return
@@ -94,7 +98,9 @@ public class CellarTestSupport {
String propsetCmd = membersBuilder.toString();
String updateCmd = "config:update";
- executeCommands(editCmd, propsetCmd, updateCmd);
+ executeCommand(editCmd);
+ executeCommand(propsetCmd);
+ executeCommand(updateCmd);
}
/**
@@ -192,98 +198,103 @@ public class CellarTestSupport {
return options;
}
- /**
- * Executes a shell command and returns output as a String.
- * Commands have a default timeout of 10 seconds.
- *
- * @param command
- * @return
- */
- protected String executeCommand(final String command) {
- return executeCommand(command, COMMAND_TIMEOUT, false);
+ protected String executeCommand(final String command, Principal ... principals) {
+ return executeCommand(command, COMMAND_TIMEOUT, false, principals);
}
- /**
- * Executes a shell command and returns output as a String.
- * Commands have a default timeout of 10 seconds.
- *
- * @param command The command to execute.
- * @param timeout The amount of time in millis to wait for the command to execute.
- * @param silent Specifies if the command should be displayed in the screen.
- * @return
- */
- protected String executeCommand(final String command, final Long timeout, final Boolean silent) {
+
+ protected String executeCommand(final String command, final Long timeout, final Boolean silent, final Principal... principals) {
+ waitForCommandService(command);
+
String response;
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final PrintStream printStream = new PrintStream(byteArrayOutputStream);
- final CommandProcessor commandProcessor = getOsgiService(CommandProcessor.class);
- final CommandSession commandSession = commandProcessor.createSession(System.in, printStream, System.err);
- FutureTask<String> commandFuture = new FutureTask<String>(
- new Callable<String>() {
- public String call() {
- try {
- if (!silent) {
- System.err.println(command);
- }
- commandSession.execute(command);
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- printStream.flush();
- return byteArrayOutputStream.toString();
+ final SessionFactory sessionFactory = getOsgiService(SessionFactory.class);
+ final Session session = sessionFactory.create(System.in, printStream, System.err);
+
+ final Callable<String> commandCallable = new Callable<String>() {
+ @Override
+ public String call() throws Exception {
+ try {
+ if (!silent) {
+ System.err.println(command);
}
- });
+ session.execute(command);
+ } catch (Exception e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ printStream.flush();
+ return byteArrayOutputStream.toString();
+ }
+ };
+
+ FutureTask<String> commandFuture;
+ if (principals.length == 0) {
+ commandFuture = new FutureTask<String>(commandCallable);
+ } else {
+ // If principals are defined, run the command callable via Subject.doAs()
+ commandFuture = new FutureTask<String>(new Callable<String>() {
+ @Override
+ public String call() throws Exception {
+ Subject subject = new Subject();
+ subject.getPrincipals().addAll(Arrays.asList(principals));
+ return Subject.doAs(subject, new PrivilegedExceptionAction<String>() {
+ @Override
+ public String run() throws Exception {
+ return commandCallable.call();
+ }
+ });
+ }
+ });
+ }
try {
executor.submit(commandFuture);
response = commandFuture.get(timeout, TimeUnit.MILLISECONDS);
- } catch (Exception e) {
+ } catch (TimeoutException e) {
e.printStackTrace(System.err);
response = "SHELL COMMAND TIMED OUT: ";
+ } catch (ExecutionException e) {
+ Throwable cause = e.getCause().getCause();
+ throw new RuntimeException(cause.getMessage(), cause);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e.getMessage(), e);
}
-
return response;
}
- /**
- * Executes multiple commands inside a Single Session.
- * Commands have a default timeout of 10 seconds.
- *
- * @param commands
- * @return
- */
- protected String executeCommands(final String... commands) {
- String response;
- final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- final PrintStream printStream = new PrintStream(byteArrayOutputStream);
- final CommandProcessor commandProcessor = getOsgiService(CommandProcessor.class);
- final CommandSession commandSession = commandProcessor.createSession(System.in, printStream, System.err);
- FutureTask<String> commandFuture = new FutureTask<String>(
- new Callable<String>() {
- public String call() {
- try {
- for (String command : commands) {
- System.err.println(command);
- commandSession.execute(command);
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- return byteArrayOutputStream.toString();
- }
- });
+ private void waitForCommandService(String command) {
+ // the commands are represented by services. Due to the asynchronous nature of services they may not be
+ // immediately available. This code waits the services to be available, in their secured form. It
+ // means that the code waits for the command service to appear with the roles defined.
+ if (command == null || command.length() == 0) {
+ return;
+ }
+
+ int spaceIdx = command.indexOf(' ');
+ if (spaceIdx > 0) {
+ command = command.substring(0, spaceIdx);
+ }
+ int colonIndx = command.indexOf(':');
+ String scope = (colonIndx > 0) ? command.substring(0, colonIndx) : "*";
+ String name = (colonIndx > 0) ? command.substring(colonIndx + 1) : command;
try {
- executor.submit(commandFuture);
- response = commandFuture.get(COMMAND_TIMEOUT, TimeUnit.MILLISECONDS);
+ long start = System.currentTimeMillis();
+ long cur = start;
+ while (cur - start < SERVICE_TIMEOUT) {
+ if (sessionFactory.getRegistry().getCommand(scope, name) != null) {
+ return;
+ }
+ Thread.sleep(100);
+ cur = System.currentTimeMillis();
+ }
} catch (Exception e) {
- e.printStackTrace(System.err);
- response = "SHELL COMMAND TIMED OUT: ";
+ throw new RuntimeException(e);
}
-
- return response;
}
+
protected Bundle getInstalledBundle(String symbolicName) {
for (Bundle b : bundleContext.getBundles()) {
if (b.getSymbolicName().equals(symbolicName)) {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/kubernetes/NOTICE
----------------------------------------------------------------------
diff --git a/kubernetes/NOTICE b/kubernetes/NOTICE
index addb35c..64cb235 100644
--- a/kubernetes/NOTICE
+++ b/kubernetes/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/kubernetes/pom.xml
----------------------------------------------------------------------
diff --git a/kubernetes/pom.xml b/kubernetes/pom.xml
index e6dcec7..74cf869 100644
--- a/kubernetes/pom.xml
+++ b/kubernetes/pom.xml
@@ -49,6 +49,10 @@
<!-- OSGi -->
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -64,21 +68,27 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.kubernetes.*;version="${project.version}"
+ !org.apache.karaf.cellar.kubernetes.internal.osgi,
+ org.apache.karaf.cellar.kubernetes.*
</Export-Package>
<Import-Package>
- io.fabric8.kubernetes.api;version="${fabric8.version}",
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ *
</Import-Package>
<DynamicImport-Package>io.fabric8.*</DynamicImport-Package>
- <Bundle-Activator>org.apache.karaf.cellar.kubernetes.Activator</Bundle-Activator>
+ <Private-Package>
+ org.apache.karaf.cellar.kubernetes.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java
----------------------------------------------------------------------
diff --git a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java
deleted file mode 100644
index c4dfbc2..0000000
--- a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed 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.cellar.kubernetes;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ManagedServiceFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Hashtable;
-
-public class Activator implements BundleActivator {
-
- private ServiceRegistration serviceRegistration;
-
- private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
-
- public void start(BundleContext bundleContext) throws Exception {
- Hashtable<String, Object> properties = new Hashtable<String, Object>();
- properties.put(Constants.SERVICE_PID, "org.apache.karaf.cellar.kubernetes");
- KubernetesDiscoveryServiceFactory kubernetesDiscoveryServiceFactory = new KubernetesDiscoveryServiceFactory(bundleContext);
- serviceRegistration = bundleContext.registerService(ManagedServiceFactory.class.getName(), kubernetesDiscoveryServiceFactory, properties);
- }
-
- public void stop(BundleContext bundleContext) throws Exception {
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- serviceRegistration = null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java
----------------------------------------------------------------------
diff --git a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java
index a42e2bf..d16656b 100644
--- a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java
+++ b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java
@@ -13,10 +13,10 @@
*/
package org.apache.karaf.cellar.kubernetes;
-import io.fabric8.kubernetes.api.KubernetesClient;
-import io.fabric8.kubernetes.api.KubernetesFactory;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodList;
+import io.fabric8.kubernetes.client.DefaultKubernetesClient;
+import io.fabric8.kubernetes.client.KubernetesClient;
import org.apache.karaf.cellar.core.discovery.DiscoveryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,7 +47,7 @@ public class KubernetesDiscoveryService implements DiscoveryService {
try {
String kubernetesUrl = "http://" + kubernetesHost + ":" + kubernetesPort;
LOGGER.debug("CELLAR KUBERNETES: query API at {} ...", kubernetesUrl);
- kubernetesClient = new KubernetesClient(new KubernetesFactory(kubernetesUrl));
+ kubernetesClient = new DefaultKubernetesClient(kubernetesUrl);
LOGGER.debug("CELLAR KUBERNETES: discovery service initialized");
} catch (Exception e) {
LOGGER.error("CELLAR KUBERNETES: can't init discovery service", e);
@@ -67,11 +67,11 @@ public class KubernetesDiscoveryService implements DiscoveryService {
LOGGER.debug("CELLAR KUBERNETES: query pods with labeled with [{}={}]", kubernetesPodLabelKey, kubernetesPodLabelValue);
Set<String> members = new HashSet<String>();
try {
- PodList podList = kubernetesClient.getPods();
+ PodList podList = kubernetesClient.pods().list();
for (Pod pod : podList.getItems()) {
- String value = pod.getLabels().get(kubernetesPodLabelKey);
+ String value = pod.getMetadata().getLabels().get(kubernetesPodLabelKey);
if (value != null && !value.isEmpty()) {
- members.add(pod.getCurrentState().getPodIP());
+ members.add(pod.getStatus().getPodIP());
}
}
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/internal/osgi/Activator.java b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/internal/osgi/Activator.java
new file mode 100644
index 0000000..8d19d34
--- /dev/null
+++ b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/internal/osgi/Activator.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed 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.cellar.kubernetes.internal.osgi;
+
+import org.apache.karaf.cellar.kubernetes.KubernetesDiscoveryServiceFactory;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.Constants;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(ManagedServiceFactory.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ @Override
+ public void doStart() throws Exception {
+ LOGGER.debug("[CELLAR KUBERNETES] Init discovery service factory");
+ Hashtable props = new Hashtable();
+ props.put(Constants.SERVICE_PID, "org.apache.karaf.cellar.kubernetes");
+ KubernetesDiscoveryServiceFactory factory = new KubernetesDiscoveryServiceFactory(bundleContext);
+ register(ManagedServiceFactory.class, factory, props);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/manual/NOTICE
----------------------------------------------------------------------
diff --git a/manual/NOTICE b/manual/NOTICE
index addb35c..64cb235 100644
--- a/manual/NOTICE
+++ b/manual/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/NOTICE
----------------------------------------------------------------------
diff --git a/obr/NOTICE b/obr/NOTICE
index addb35c..64cb235 100644
--- a/obr/NOTICE
+++ b/obr/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
[2/5] karaf-cellar git commit: [KARAF-3503] Complete refactoring to
remove blueprint dependency and full support of Karaf 4,
upgrade to Hazelcast 3.5.1
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/pom.xml
----------------------------------------------------------------------
diff --git a/obr/pom.xml b/obr/pom.xml
index 9866995..0fbbdae 100644
--- a/obr/pom.xml
+++ b/obr/pom.xml
@@ -40,8 +40,12 @@
<artifactId>org.apache.karaf.cellar.core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.table</artifactId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -64,32 +68,31 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.obr*;version="${project.version}"
+ !org.apache.karaf.cellar.obr.management.internal,
+ !org.apache.karaf.cellar.obr.internal.osgi,
+ org.apache.karaf.cellar.obr*
</Export-Package>
<Import-Package>
- org.apache.karaf.cellar.core*;version=${project.version},
- org.apache.felix.service.command,
- org.apache.felix.gogo.commands,
- org.apache.karaf.shell.console;version="[3,5)",
- org.apache.karaf.shell.console.commands;version="[3,5)",
- org.apache.karaf.shell.console.completer;version="[3,5)",
- org.apache.karaf.shell.commands;version="[3,5)",
- org.apache.karaf.shell.table;version="[3,5)",
- org.apache.karaf.management;version="[3,5)",
- javax.management*,
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ org.apache.karaf.shell*;resolution:=optional,
+ *
</Import-Package>
<DynamicImport-Package>
org.apache.felix.bundlerepository, org.osgi.service.obr
</DynamicImport-Package>
<Private-Package>
- org.apache.karaf.cellar.obr.management.internal
+ org.apache.karaf.cellar.obr.management.internal,
+ org.apache.karaf.cellar.obr.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
</Private-Package>
</instructions>
</configuration>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/java/org/apache/karaf/cellar/obr/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/internal/osgi/Activator.java b/obr/src/main/java/org/apache/karaf/cellar/obr/internal/osgi/Activator.java
new file mode 100644
index 0000000..c15cff8
--- /dev/null
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/internal/osgi/Activator.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed 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.cellar.obr.internal.osgi;
+
+import org.apache.felix.bundlerepository.RepositoryAdmin;
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.core.Synchronizer;
+import org.apache.karaf.cellar.core.event.EventHandler;
+import org.apache.karaf.cellar.core.event.EventProducer;
+import org.apache.karaf.cellar.obr.ObrBundleEventHandler;
+import org.apache.karaf.cellar.obr.ObrUrlEventHandler;
+import org.apache.karaf.cellar.obr.ObrUrlSynchronizer;
+import org.apache.karaf.cellar.obr.management.internal.CellarOBRMBeanImpl;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(EventHandler.class),
+ @ProvideService(Synchronizer.class)
+ },
+ requires = {
+ @RequireService(RepositoryAdmin.class),
+ @RequireService(ClusterManager.class),
+ @RequireService(GroupManager.class),
+ @RequireService(ConfigurationAdmin.class),
+ @RequireService(EventProducer.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private ObrUrlEventHandler urlEventHandler;
+ private ObrBundleEventHandler bundleEventHandler;
+ private ObrUrlSynchronizer urlSynchronizer;
+ private ServiceRegistration mbeanRegistration;
+
+ @Override
+ public void doStart() throws Exception {
+
+ RepositoryAdmin repositoryAdmin = getTrackedService(RepositoryAdmin.class);
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ GroupManager groupManager = getTrackedService(GroupManager.class);
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+ EventProducer eventProducer = getTrackedService(EventProducer.class);
+
+ LOGGER.debug("[CELLAR OBR] Init URL event handler");
+ urlEventHandler = new ObrUrlEventHandler();
+ urlEventHandler.setClusterManager(clusterManager);
+ urlEventHandler.setGroupManager(groupManager);
+ urlEventHandler.setConfigurationAdmin(configurationAdmin);
+ urlEventHandler.setObrService(repositoryAdmin);
+ urlEventHandler.init();
+ Hashtable props = new Hashtable();
+ props.put("managed", "true");
+ register(EventHandler.class, urlEventHandler, props);
+
+ LOGGER.debug("[CELLAR OBR] Init bundle event handler");
+ bundleEventHandler = new ObrBundleEventHandler();
+ bundleEventHandler.setObrService(repositoryAdmin);
+ bundleEventHandler.setClusterManager(clusterManager);
+ bundleEventHandler.setGroupManager(groupManager);
+ bundleEventHandler.setConfigurationAdmin(configurationAdmin);
+ bundleEventHandler.init();
+ register(EventHandler.class, bundleEventHandler, props);
+
+ LOGGER.debug("[CELLAR OBR] Init URL synchronizer");
+ urlSynchronizer = new ObrUrlSynchronizer();
+ urlSynchronizer.setObrService(repositoryAdmin);
+ urlSynchronizer.setClusterManager(clusterManager);
+ urlSynchronizer.setGroupManager(groupManager);
+ urlSynchronizer.setConfigurationAdmin(configurationAdmin);
+ urlSynchronizer.init();
+ props = new Hashtable();
+ props.put("resource", "obr.urls");
+ register(Synchronizer.class, urlSynchronizer, props);
+
+ LOGGER.debug("[CELLAR OBR] Register MBean");
+ CellarOBRMBeanImpl mbean = new CellarOBRMBeanImpl();
+ mbean.setClusterManager(clusterManager);
+ mbean.setGroupManager(groupManager);
+ mbean.setConfigurationAdmin(configurationAdmin);
+ mbean.setEventProducer(eventProducer);
+ props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=obr,name=" + System.getProperty("karaf.name"));
+ mbeanRegistration = bundleContext.registerService(getInterfaceNames(mbean), mbean, props);
+ }
+
+ @Override
+ public void doStop() {
+ if (mbeanRegistration != null) {
+ mbeanRegistration.unregister();
+ mbeanRegistration = null;
+ }
+ if (urlSynchronizer != null) {
+ urlSynchronizer.destroy();
+ urlEventHandler = null;
+ }
+ if (bundleEventHandler != null) {
+ bundleEventHandler.destroy();
+ bundleEventHandler = null;
+ }
+ if (urlEventHandler != null) {
+ urlEventHandler.destroy();
+ urlEventHandler = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
index d8fade4..46e7b61 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
@@ -20,23 +20,30 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.obr.ClusterObrUrlEvent;
import org.apache.karaf.cellar.obr.Constants;
import org.apache.karaf.cellar.obr.ObrBundleInfo;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Set;
@Command(scope = "cluster", name = "obr-add-url", description = "Add an OBR URL in a cluster group")
+@Service
public class ObrAddUrlCommand extends ObrCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "url", description = "The OBR URL.", required = true, multiValued = false)
String url;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
index 5c75ad8..e17903e 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
@@ -18,12 +18,14 @@ import org.apache.karaf.cellar.core.CellarSupport;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
/**
* Generic cluster OBR shell command support.
*/
public abstract class ObrCommandSupport extends CellarCommandSupport {
+ @Reference
protected RepositoryAdmin obrService;
public RepositoryAdmin getObrService() {
@@ -54,5 +56,4 @@ public abstract class ObrCommandSupport extends CellarCommandSupport {
@Override
public abstract Object doExecute() throws Exception;
-
}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
index 7c39b66..0f5de1a 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
@@ -17,16 +17,22 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.obr.ClusterObrBundleEvent;
import org.apache.karaf.cellar.obr.Constants;
-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.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
@Command(scope = "cluster", name = "obr-deploy", description = "Deploy an OBR bundle in a cluster group")
+@Service
public class ObrDeployCommand extends ObrCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name="bundleId", description = "The bundle ID (symbolicname,version in the OBR) to deploy", required = true, multiValued = false)
@@ -38,6 +44,7 @@ public class ObrDeployCommand extends ObrCommandSupport {
@Option(name = "-d", aliases = { "--deployOptional" }, description = "Deploy optional bundles", required = false, multiValued = false)
boolean deployOptional = false;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
index 848ade1..8b1941b 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
@@ -16,19 +16,24 @@ package org.apache.karaf.cellar.obr.shell;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.obr.Constants;
import org.apache.karaf.cellar.obr.ObrBundleInfo;
-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.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.Set;
@Command(scope = "cluster", name = "obr-list", description = "List the OBR bundles in a cluster group")
+@Service
public class ObrListCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
index b5c4031..e846e0f 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
@@ -16,16 +16,21 @@ package org.apache.karaf.cellar.obr.shell;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.obr.Constants;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Set;
@Command(scope = "cluster", name = "obr-list-url", description = "List the OBR URLs in a cluster group")
+@Service
public class ObrListUrlCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
index c7a2fe9..1c4e919 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
@@ -20,23 +20,30 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.obr.ClusterObrUrlEvent;
import org.apache.karaf.cellar.obr.Constants;
import org.apache.karaf.cellar.obr.ObrBundleInfo;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Set;
@Command(scope = "cluster", name = "obr-remove-url", description = "Remove a repository URL from the distributed OBR service.")
+@Service
public class ObrRemoveUrlCommand extends ObrCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name.", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "url", description = "The repository URL to remove from the OBR service.", required = true, multiValued = false)
String url;
+ @Reference
private EventProducer eventProducer;
public Object doExecute() throws Exception {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index e3a5881..0000000
--- a/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <!-- Cluster OBR Bundle Event Handler -->
- <bean id="obrBundleEventHandler" class="org.apache.karaf.cellar.obr.ObrBundleEventHandler"
- init-method="init" destroy-method="destroy">
- <property name="obrService" ref="repositoryAdmin"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="obrBundleEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
- <service-properties>
- <entry key="managed" value="true"/>
- </service-properties>
- </service>
-
- <!-- OBR URLs Synchronizer -->
- <bean id="obrUrlSynchronizer" class="org.apache.karaf.cellar.obr.ObrUrlSynchronizer"
- init-method="init" destroy-method="destroy">
- <property name="obrService" ref="repositoryAdmin"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="obrUrlSynchronizer" interface="org.apache.karaf.cellar.core.Synchronizer">
- <service-properties>
- <entry key="resource" value="obr.urls"/>
- </service-properties>
- </service>
-
- <!-- Cluster OBR URL Event Handler -->
- <bean id="obrUrlEventHandler" class="org.apache.karaf.cellar.obr.ObrUrlEventHandler"
- init-method="init" destroy-method="destroy">
- <property name="obrService" ref="repositoryAdmin"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="obrUrlEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
- <service-properties>
- <entry key="managed" value="true"/>
- </service-properties>
- </service>
-
- <reference id="repositoryAdmin" interface="org.apache.felix.bundlerepository.RepositoryAdmin"/>
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
- <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
- <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/resources/OSGI-INF/blueprint/management.xml
----------------------------------------------------------------------
diff --git a/obr/src/main/resources/OSGI-INF/blueprint/management.xml b/obr/src/main/resources/OSGI-INF/blueprint/management.xml
deleted file mode 100644
index eb1370e..0000000
--- a/obr/src/main/resources/OSGI-INF/blueprint/management.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <!-- Cellar OBR MBean -->
- <bean id="cellarOBRMBean" class="org.apache.karaf.cellar.obr.management.internal.CellarOBRMBeanImpl">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="cellarOBRMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=obr,name=${karaf.name}"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/obr/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
----------------------------------------------------------------------
diff --git a/obr/src/main/resources/OSGI-INF/blueprint/shell-commands.xml b/obr/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
deleted file mode 100644
index ac8fe4c..0000000
--- a/obr/src/main/resources/OSGI-INF/blueprint/shell-commands.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.apache.karaf.cellar.obr.shell.ObrListCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <null/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.obr.shell.ObrDeployCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <null/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.obr.shell.ObrListUrlCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <null/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.obr.shell.ObrAddUrlCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="obrService" ref="repositoryAdmin"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <null/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.obr.shell.ObrRemoveUrlCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="obrService" ref="repositoryAdmin"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <null/>
- </completers>
- </command>
- </command-bundle>
-
- <bean id="allGroupsCompleter" class="org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter">
- <property name="groupManager" ref="groupManager"/>
- </bean>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8696386..b13772e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,11 +36,11 @@
<properties>
<easymock.version>3.2</easymock.version>
- <fabric8.version>2.0.20</fabric8.version>
+ <fabric8.version>2.2.22</fabric8.version>
<felix.bundlerepository.version>2.0.4</felix.bundlerepository.version>
<felix.utils.version>1.8.0</felix.utils.version>
<felix.webconsole.version>4.2.8</felix.webconsole.version>
- <hazelcast.version>3.4.2</hazelcast.version>
+ <hazelcast.version>3.5.1</hazelcast.version>
<jclouds.version>1.8.1</jclouds.version>
<joda-time.version>2.5</joda-time.version>
<junit.version>4.11</junit.version>
@@ -48,6 +48,8 @@
<osgi.version>6.0.0</osgi.version>
<osgi.compendium.version>5.0.0</osgi.compendium.version>
<slf4j.version>1.7.7</slf4j.version>
+
+ <bnd.version.policy>[$(version;==;$(@)),$(version;+;$(@)))</bnd.version.policy>
</properties>
<modules>
@@ -213,23 +215,19 @@
<!-- Karaf -->
<dependency>
<groupId>org.apache.karaf.features</groupId>
- <artifactId>org.apache.karaf.features.command</artifactId>
- <version>${karaf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.karaf.features</groupId>
<artifactId>org.apache.karaf.features.core</artifactId>
<version>${karaf.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
<version>${karaf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.table</artifactId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
<version>${karaf.version}</version>
+ <optional>true</optional>
</dependency>
<dependency>
@@ -365,9 +363,34 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ <version>${karaf.version}</version>
+ <executions>
+ <execution>
+ <id>service-metadata-generate</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>service-metadata-generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>${karaf.version}</version>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>2.5.3</version>
+ <version>2.5.4</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
+ </instructions>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -490,32 +513,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>${project.artifactId}*;version=${project.version}</Export-Package>
- </instructions>
- <supportedProjectTypes>
- <supportedProjectType>jar</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- <supportedProjectType>bundle</supportedProjectType>
- </supportedProjectTypes>
- <unpackBundle>true</unpackBundle>
- </configuration>
- <executions>
- <execution>
- <id>bundle-manifest</id>
- <phase>process-classes</phase>
- <goals>
- <goal>manifest</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<!-- generate dependencies versions -->
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/camel-hazelcast-app/NOTICE
----------------------------------------------------------------------
diff --git a/samples/camel-hazelcast-app/NOTICE b/samples/camel-hazelcast-app/NOTICE
index addb35c..64cb235 100644
--- a/samples/camel-hazelcast-app/NOTICE
+++ b/samples/camel-hazelcast-app/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/dosgi-greeter/NOTICE
----------------------------------------------------------------------
diff --git a/samples/dosgi-greeter/NOTICE b/samples/dosgi-greeter/NOTICE
index addb35c..64cb235 100644
--- a/samples/dosgi-greeter/NOTICE
+++ b/samples/dosgi-greeter/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/dosgi-greeter/client/pom.xml
----------------------------------------------------------------------
diff --git a/samples/dosgi-greeter/client/pom.xml b/samples/dosgi-greeter/client/pom.xml
index 26fa213..30f6a8b 100644
--- a/samples/dosgi-greeter/client/pom.xml
+++ b/samples/dosgi-greeter/client/pom.xml
@@ -43,24 +43,27 @@
<artifactId>org.apache.karaf.cellar.samples.dosgi.greeter.api</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.samples.dosgi.greeter.client*;version="${project.version}"
+ org.apache.karaf.cellar.samples.dosgi.greeter.client*
</Export-Package>
- <Import-Package>
- org.apache.karaf.cellar.samples.dosgi.greeter.api,
- org.apache.karaf.shell.commands;version="[3,5)",
- org.apache.karaf.shell.console;version="[3,5)",
- org.osgi*
- </Import-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
----------------------------------------------------------------------
diff --git a/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java b/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
index cb0b2f1..09c8dad 100644
--- a/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
+++ b/samples/dosgi-greeter/client/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/client/GreetCommand.java
@@ -14,12 +14,14 @@
package org.apache.karaf.cellar.samples.dosgi.greeter.client;
import org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
@Command(scope = "dosgi-greeter", name = "greet", description = "Starts the greet client")
-public class GreetCommand extends OsgiCommandSupport {
+@Service
+public class GreetCommand {
@Argument(index = 0, name = "greetMessage", description = "The message that will be sent as the greeting.", required = true, multiValued = false)
String greetMessage;
@@ -27,6 +29,7 @@ public class GreetCommand extends OsgiCommandSupport {
@Argument(index = 1, name = "iterations", description = "The number of greet iterations to perform", required = false, multiValued = false)
Integer iterations = 10;
+ @Reference
private Greeter greeter;
protected Object doExecute() throws Exception {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml
----------------------------------------------------------------------
diff --git a/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml b/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml
deleted file mode 100644
index 4db1842..0000000
--- a/samples/dosgi-greeter/client/src/main/resources/OSGI-INF/blueprint/shell-greeter.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
-
- <reference id="greeter" interface="org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter"/>
-
- <!-- Command Bundle -->
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.apache.karaf.cellar.samples.dosgi.greeter.client.GreetCommand">
- <property name="greeter" ref="greeter"/>
- </action>
- </command>
- </command-bundle>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/dosgi-greeter/service/pom.xml
----------------------------------------------------------------------
diff --git a/samples/dosgi-greeter/service/pom.xml b/samples/dosgi-greeter/service/pom.xml
index 2557645..bd1d351 100644
--- a/samples/dosgi-greeter/service/pom.xml
+++ b/samples/dosgi-greeter/service/pom.xml
@@ -39,23 +39,35 @@
<artifactId>org.apache.karaf.cellar.samples.dosgi.greeter.api</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.cellar</groupId>
+ <artifactId>org.apache.karaf.cellar.core</artifactId>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.samples.dosgi.greeter.service*;version="${project.version}"
+ org.apache.karaf.cellar.samples.dosgi.greeter.service*
</Export-Package>
- <Import-Package>
- org.apache.karaf.cellar.samples.dosgi.greeter.api,
- org.apache.karaf.cellar.core,
- org.osgi*
- </Import-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/Activator.java
----------------------------------------------------------------------
diff --git a/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/Activator.java b/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/Activator.java
new file mode 100644
index 0000000..b092768
--- /dev/null
+++ b/samples/dosgi-greeter/service/src/main/java/org/apache/karaf/cellar/samples/dosgi/greeter/service/Activator.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed 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.cellar.samples.dosgi.greeter.service;
+
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(Greeter.class)
+ },
+ requires = {
+ @RequireService(ClusterManager.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ @Override
+ public void doStart() throws Exception {
+
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+
+ String nodeId = clusterManager.getNode().getId();
+ GreeterImpl greeter = new GreeterImpl(nodeId);
+ Hashtable props = new Hashtable();
+ props.put("service.exported.interfaces", "*");
+ register(Greeter.class, greeter, props);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 7c2a916..0000000
--- a/samples/dosgi-greeter/service/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
- -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <!-- Greeter Implementation -->
- <bean id="greeterImpl" class="org.apache.karaf.cellar.samples.dosgi.greeter.service.GreeterImpl">
- <!-- We want the greeter to display the origin of the greet, so we use the nodeId -->
- <argument ref="nodeId"/>
- </bean>
-
- <!-- The current Node -->
- <bean id="node" factory-ref="clusterManager" factory-method="getNode"/>
- <!-- The id of the current node -->
- <bean id="nodeId" factory-ref="node" factory-method="getId"/>
-
- <!-- OSGi Services & References -->
- <service ref="greeterImpl" interface="org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter">
- <service-properties>
- <!-- This property turn the Greeter service as a "cluster aware" service -->
- <entry key="service.exported.interfaces" value="*"/>
- </service-properties>
- </service>
-
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/hazelcast-app/NOTICE
----------------------------------------------------------------------
diff --git a/samples/hazelcast-app/NOTICE b/samples/hazelcast-app/NOTICE
index addb35c..64cb235 100644
--- a/samples/hazelcast-app/NOTICE
+++ b/samples/hazelcast-app/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/samples/hazelcast-app/pom.xml
----------------------------------------------------------------------
diff --git a/samples/hazelcast-app/pom.xml b/samples/hazelcast-app/pom.xml
index 234d6c3..47d2ab1 100644
--- a/samples/hazelcast-app/pom.xml
+++ b/samples/hazelcast-app/pom.xml
@@ -59,7 +59,7 @@
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.samples.hazelcast*;version="${project.version}"
+ org.apache.karaf.cellar.samples.hazelcast*
</Export-Package>
<Import-Package>
com.hazelcast.core,
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/NOTICE
----------------------------------------------------------------------
diff --git a/shell/NOTICE b/shell/NOTICE
index addb35c..64cb235 100644
--- a/shell/NOTICE
+++ b/shell/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/pom.xml
----------------------------------------------------------------------
diff --git a/shell/pom.xml b/shell/pom.xml
index 0a0eb85..ba55a29 100644
--- a/shell/pom.xml
+++ b/shell/pom.xml
@@ -46,6 +46,14 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.core</artifactId>
</dependency>
@@ -61,10 +69,6 @@
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.utils</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.table</artifactId>
- </dependency>
<!-- Logging Dependencies -->
<dependency>
@@ -77,25 +81,24 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.shell*;version="${project.version}"
+ org.apache.karaf.cellar.shell*
</Export-Package>
<Import-Package>
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.apache.karaf.cellar*;version="${project.version}",
- org.apache.felix.service.command,
- org.apache.felix.gogo.commands,
- org.apache.karaf.shell.console;version="[3,5)",
- org.apache.karaf.shell.console.commands;version="[3,5)",
- org.apache.karaf.shell.console.completer;version="[3,5)",
- org.apache.karaf.shell.commands;version="[3,5)",
- org.apache.karaf.shell.table;version="[3,5)",
- org.osgi*
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ *
</Import-Package>
+ <Private-Package>
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/ClusterCommandSupport.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/ClusterCommandSupport.java b/shell/src/main/java/org/apache/karaf/cellar/shell/ClusterCommandSupport.java
index 3ce20b4..f814503 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/ClusterCommandSupport.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/ClusterCommandSupport.java
@@ -15,12 +15,14 @@ package org.apache.karaf.cellar.shell;
import org.apache.karaf.cellar.core.command.ExecutionContext;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
/**
* Abstract cluster shell command.
*/
public abstract class ClusterCommandSupport extends CellarCommandSupport {
+ @Reference
protected ExecutionContext executionContext;
public ExecutionContext getExecutionContext() {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/NodePingCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/NodePingCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/NodePingCommand.java
index f26b52f..ebd3875 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/NodePingCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/NodePingCommand.java
@@ -14,19 +14,24 @@
package org.apache.karaf.cellar.shell;
import org.apache.karaf.cellar.core.Node;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
import org.apache.karaf.cellar.utils.ping.Ping;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Arrays;
import java.util.HashSet;
@Command(scope = "cluster", name = "node-ping", description = "Ping a cluster node")
+@Service
public class NodePingCommand extends ClusterCommandSupport {
private static Long TIMEOUT = 5000L;
@Argument(index = 0, name = "node", description = "The ID of the node to ping", required = true, multiValued = false)
+ @Completion(AllNodeCompleter.class)
String nodeId;
@Argument(index = 1, name = "iterations", description = "The number of iterations to perform", required = false, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/NodesListCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/NodesListCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/NodesListCommand.java
index d8559f8..44ee352 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/NodesListCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/NodesListCommand.java
@@ -14,15 +14,16 @@
package org.apache.karaf.cellar.shell;
import org.apache.karaf.cellar.core.Node;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.Set;
@Command(scope = "cluster", name = "node-list", description = "List the nodes in the cluster")
+@Service
public class NodesListCommand extends ClusterCommandSupport {
-
@Override
protected Object doExecute() throws Exception {
Set<Node> nodes = clusterManager.listNodes();
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/SyncCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/SyncCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/SyncCommand.java
index d6cd94c..aded14d 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/SyncCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/SyncCommand.java
@@ -16,9 +16,12 @@ package org.apache.karaf.cellar.shell;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.Synchronizer;
-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.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
@@ -29,6 +32,7 @@ import java.util.Properties;
import java.util.Set;
@Command(scope = "cluster", name = "sync", description = "Manipulate the synchronizers")
+@Service
public class SyncCommand extends ClusterCommandSupport {
@Option(name = "-g", aliases = { "--group" }, description = "The cluster group name", required = false, multiValued = false)
@@ -49,8 +53,12 @@ public class SyncCommand extends ClusterCommandSupport {
@Argument(name = "policy", description = "The definition of the sync policy for the given cluster resource", required = false, multiValued = false)
private String policy;
+ @Reference
private ConfigurationAdmin configurationAdmin;
+ @Reference
+ private BundleContext bundleContext;
+
@Override
protected Object doExecute() throws Exception {
boolean allResources = false;
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStartCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStartCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStartCommand.java
index 666613e..6a719e1 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStartCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStartCommand.java
@@ -14,15 +14,20 @@
package org.apache.karaf.cellar.shell.consumer;
import org.apache.karaf.cellar.core.control.SwitchStatus;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "consumer-start", description = "Start a cluster event consumer")
+@Service
public class ConsumerStartCommand extends ConsumerSupport {
@Argument(index = 0, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStatusCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStatusCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStatusCommand.java
index a3cd144..b436870 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStatusCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStatusCommand.java
@@ -13,15 +13,20 @@
*/
package org.apache.karaf.cellar.shell.consumer;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "consumer-status", description = "Status of a cluster event consumer")
+@Service
public class ConsumerStatusCommand extends ConsumerSupport {
@Argument(index = 0, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStopCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStopCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStopCommand.java
index 92ef7c0..992e5e0 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStopCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerStopCommand.java
@@ -14,15 +14,20 @@
package org.apache.karaf.cellar.shell.consumer;
import org.apache.karaf.cellar.core.control.SwitchStatus;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "consumer-stop", description = "Stop a cluster event consumer")
+@Service
public class ConsumerStopCommand extends ConsumerSupport {
@Argument(index = 0, name = "node", description = "The node(s) ID.", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerSupport.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerSupport.java b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerSupport.java
index daa80b0..4863491 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerSupport.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/consumer/ConsumerSupport.java
@@ -18,7 +18,7 @@ import org.apache.karaf.cellar.core.control.ConsumerSwitchCommand;
import org.apache.karaf.cellar.core.control.ConsumerSwitchResult;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.shell.ClusterCommandSupport;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.HashSet;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupCreateCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupCreateCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupCreateCommand.java
index 1f50a5a..d6b5089 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupCreateCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupCreateCommand.java
@@ -14,10 +14,12 @@
package org.apache.karaf.cellar.shell.group;
import org.apache.karaf.cellar.core.Group;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
@Command(scope = "cluster", name = "group-create", description = "Create a cluster group")
+@Service
public class GroupCreateCommand extends GroupSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java
index b587969..cb3f756 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java
@@ -14,13 +14,18 @@
package org.apache.karaf.cellar.shell.group;
import org.apache.karaf.cellar.core.Group;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
@Command(scope = "cluster", name = "group-delete", description = "Delete a cluster group")
+@Service
public class GroupDeleteCommand extends GroupSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupJoinCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupJoinCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupJoinCommand.java
index 5542ead..f1dab58 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupJoinCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupJoinCommand.java
@@ -15,18 +15,25 @@ package org.apache.karaf.cellar.shell.group;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.ManageGroupAction;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "group-join", description = "Join node(s) to a cluster group")
+@Service
public class GroupJoinCommand extends GroupSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupListCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupListCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupListCommand.java
index 6feb809..d346fb6 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupListCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupListCommand.java
@@ -14,15 +14,20 @@
package org.apache.karaf.cellar.shell.group;
import org.apache.karaf.cellar.core.control.ManageGroupAction;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "group-list", description = "List the cluster groups")
+@Service
public class GroupListCommand extends GroupSupport {
@Argument(index = 0, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
index 186cad3..7dff28e 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
@@ -16,8 +16,12 @@ package org.apache.karaf.cellar.shell.group;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.Node;
import org.apache.karaf.cellar.core.control.ManageGroupAction;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.cellar.core.shell.completer.LocalGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -25,12 +29,15 @@ import java.util.List;
import java.util.Set;
@Command(scope = "cluster", name = "group-pick", description = "Picks a number of nodes from one cluster group and moves them into another")
+@Service
public class GroupPickCommand extends GroupSupport {
@Argument(index = 0, name = "sourceGroupName", description = "The source cluster group name", required = true, multiValued = false)
+ @Completion(LocalGroupsCompleter.class)
String sourceGroupName;
@Argument(index = 1, name = "targetGroupName", description = "The destination cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String targetGroupName;
@Argument(index = 2, name = "count", description = "The number of nodes to transfer", required = false, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupQuitCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupQuitCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupQuitCommand.java
index 2272624..4bd3cb3 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupQuitCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupQuitCommand.java
@@ -15,18 +15,25 @@ package org.apache.karaf.cellar.shell.group;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.ManageGroupAction;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "group-quit", description = "Quit node(s) from a cluster group")
+@Service
public class GroupQuitCommand extends GroupSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSetCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSetCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSetCommand.java
index 1dbc9d0..e7362b8 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSetCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSetCommand.java
@@ -15,18 +15,25 @@ package org.apache.karaf.cellar.shell.group;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.ManageGroupAction;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "group-set", description = "Set the target nodes to a cluster group")
+@Service
public class GroupSetCommand extends GroupSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSupport.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSupport.java b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSupport.java
index 3f1605a..3bd4d49 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSupport.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupSupport.java
@@ -19,7 +19,7 @@ import org.apache.karaf.cellar.core.control.ManageGroupAction;
import org.apache.karaf.cellar.core.control.ManageGroupCommand;
import org.apache.karaf.cellar.core.control.ManageGroupResult;
import org.apache.karaf.cellar.shell.ClusterCommandSupport;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.Collection;
import java.util.HashSet;
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStartCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStartCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStartCommand.java
index 3603418..6618402 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStartCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStartCommand.java
@@ -13,18 +13,23 @@
*/
package org.apache.karaf.cellar.shell.handler;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "handler-start", description = "Start a cluster event handler")
+@Service
public class HandlersStartCommand extends HandlersSupport {
@Argument(index = 0, name = "handler", description = "The cluster event handler ID", required = true, multiValued = false)
String handler;
@Argument(index = 1, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStatusCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStatusCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStatusCommand.java
index d08c7f0..7717df6 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStatusCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStatusCommand.java
@@ -13,18 +13,23 @@
*/
package org.apache.karaf.cellar.shell.handler;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "handler-status", description = "Status of a cluster event handler")
+@Service
public class HandlersStatusCommand extends HandlersSupport {
@Argument(index = 0, name = "handler", description = "The cluster event handler", required = false, multiValued = false)
String handler;
@Argument(index = 1, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStopCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStopCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStopCommand.java
index d77e294..68b13f6 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStopCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersStopCommand.java
@@ -13,18 +13,23 @@
*/
package org.apache.karaf.cellar.shell.handler;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "handler-stop", description = "Stop a cluster event handler")
+@Service
public class HandlersStopCommand extends HandlersSupport {
@Argument(index = 0, name = "handler", description = "The event handler", required = true, multiValued = false)
String handler;
@Argument(index = 1, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersSupport.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersSupport.java b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersSupport.java
index e848dbd..b8dcd84 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersSupport.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/handler/HandlersSupport.java
@@ -17,7 +17,7 @@ import org.apache.karaf.cellar.core.Node;
import org.apache.karaf.cellar.core.control.ManageHandlersCommand;
import org.apache.karaf.cellar.core.control.ManageHandlersResult;
import org.apache.karaf.cellar.shell.ClusterCommandSupport;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.HashSet;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStartCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStartCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStartCommand.java
index 5c5f520..6ea606c 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStartCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStartCommand.java
@@ -14,15 +14,20 @@
package org.apache.karaf.cellar.shell.producer;
import org.apache.karaf.cellar.core.control.SwitchStatus;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "producer-start", description = "Start a cluster event producer")
+@Service
public class ProducerStartCommand extends ProducerSupport {
@Argument(index = 0, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStatusCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStatusCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStatusCommand.java
index 1dd2310..eb87744 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStatusCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStatusCommand.java
@@ -13,15 +13,20 @@
*/
package org.apache.karaf.cellar.shell.producer;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "producer-status", description = "Status of a cluster event producer")
+@Service
public class ProducerStatusCommand extends ProducerSupport {
@Argument(index = 0, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStopCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStopCommand.java b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStopCommand.java
index e79ad5e..bb1291e 100644
--- a/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStopCommand.java
+++ b/shell/src/main/java/org/apache/karaf/cellar/shell/producer/ProducerStopCommand.java
@@ -14,15 +14,20 @@
package org.apache.karaf.cellar.shell.producer;
import org.apache.karaf.cellar.core.control.SwitchStatus;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllNodeCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
@Command(scope = "cluster", name = "producer-stop", description = "Stop a cluster event producer")
+@Service
public class ProducerStopCommand extends ProducerSupport {
@Argument(index = 0, name = "node", description = "The node(s) ID", required = false, multiValued = true)
+ @Completion(AllNodeCompleter.class)
List<String> nodes;
@Override
[5/5] karaf-cellar git commit: [KARAF-3503] Complete refactoring to
remove blueprint dependency and full support of Karaf 4,
upgrade to Hazelcast 3.5.1
Posted by jb...@apache.org.
[KARAF-3503] Complete refactoring to remove blueprint dependency and full support of Karaf 4, upgrade to Hazelcast 3.5.1
Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/3e5e7c33
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/3e5e7c33
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/3e5e7c33
Branch: refs/heads/master
Commit: 3e5e7c339fd433be392127bb1cbeaa73f82369d5
Parents: cdfa9b8
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Wed Aug 26 07:39:53 2015 +0200
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Wed Aug 26 07:39:53 2015 +0200
----------------------------------------------------------------------
NOTICE | 2 +-
assembly/pom.xml | 87 +++--
assembly/src/main/resources/features.xml | 112 +++---
bundle/NOTICE | 2 +-
bundle/pom.xml | 41 +-
.../cellar/bundle/internal/osgi/Activator.java | 134 +++++++
.../karaf/cellar/bundle/shell/BlockCommand.java | 6 +-
.../bundle/shell/BundleCommandSupport.java | 10 +-
.../bundle/shell/InstallBundleCommand.java | 13 +-
.../cellar/bundle/shell/ListBundleCommand.java | 8 +-
.../cellar/bundle/shell/StartBundleCommand.java | 6 +-
.../cellar/bundle/shell/StopBundleCommand.java | 7 +-
.../bundle/shell/UninstallBundleCommand.java | 6 +-
.../completers/AllBundlesNameCompleter.java | 14 +-
.../completers/AllBundlesVersionCompleter.java | 14 +-
.../resources/OSGI-INF/blueprint/blueprint.xml | 67 ----
.../resources/OSGI-INF/blueprint/management.xml | 36 --
.../OSGI-INF/blueprint/shell-bundle.xml | 104 -----
cloud/NOTICE | 2 +-
cloud/pom.xml | 23 +-
.../apache/karaf/cellar/cloud/Activator.java | 46 ---
.../cellar/cloud/internal/osgi/Activator.java | 47 +++
config/NOTICE | 2 +-
config/pom.xml | 34 +-
.../cellar/config/internal/osgi/Activator.java | 135 +++++++
.../karaf/cellar/config/shell/BlockCommand.java | 13 +-
.../cellar/config/shell/DeleteCommand.java | 13 +-
.../karaf/cellar/config/shell/ListCommand.java | 11 +-
.../cellar/config/shell/PropAppendCommand.java | 13 +-
.../cellar/config/shell/PropDelCommand.java | 13 +-
.../config/shell/PropExcludedCommand.java | 9 +-
.../cellar/config/shell/PropListCommand.java | 11 +-
.../cellar/config/shell/PropSetCommand.java | 13 +-
.../completers/ClusterConfigCompleter.java | 16 +-
.../resources/OSGI-INF/blueprint/blueprint.xml | 81 ----
.../resources/OSGI-INF/blueprint/management.xml | 31 --
.../OSGI-INF/blueprint/shell-config.xml | 115 ------
core/NOTICE | 2 +-
core/pom.xml | 25 +-
.../cellar/core/internal/osgi/Activator.java | 76 ++++
.../cellar/core/shell/CellarCommandSupport.java | 17 +-
.../shell/completer/AllGroupsCompleter.java | 2 +
.../core/shell/completer/AllNodeCompleter.java | 2 +
.../shell/completer/GroupCompleterSupport.java | 12 +-
.../shell/completer/LocalGroupsCompleter.java | 2 +
.../shell/completer/NodeCompleterSupport.java | 12 +-
.../shell/completer/OtherGroupsCompleter.java | 2 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 27 --
dosgi/NOTICE | 2 +-
dosgi/pom.xml | 31 +-
.../cellar/dosgi/internal/osgi/Activator.java | 117 ++++++
.../shell/ListDistributedServicesCommand.java | 6 +-
.../resources/OSGI-INF/blueprint/blueprint.xml | 58 ---
.../resources/OSGI-INF/blueprint/management.xml | 32 --
.../OSGI-INF/blueprint/shell-dosgi.xml | 25 --
event/NOTICE | 2 +-
event/pom.xml | 25 +-
.../cellar/event/internal/osgi/Activator.java | 97 +++++
.../resources/OSGI-INF/blueprint/blueprint.xml | 60 ---
features/NOTICE | 2 +-
features/pom.xml | 37 +-
.../features/internal/osgi/Activator.java | 150 ++++++++
.../cellar/features/shell/BlockCommand.java | 11 +-
.../features/shell/InstallFeatureCommand.java | 15 +-
.../features/shell/ListFeaturesCommand.java | 17 +-
.../cellar/features/shell/RepoAddCommand.java | 15 +-
.../cellar/features/shell/RepoListCommand.java | 15 +-
.../features/shell/RepoRemoveCommand.java | 15 +-
.../features/shell/UninstallFeatureCommand.java | 13 +-
.../resources/OSGI-INF/blueprint/blueprint.xml | 75 ----
.../resources/OSGI-INF/blueprint/management.xml | 36 --
.../OSGI-INF/blueprint/shell-features.xml | 110 ------
hazelcast/NOTICE | 2 +-
hazelcast/pom.xml | 32 +-
.../hazelcast/internal/osgi/Activator.java | 380 +++++++++++++++++++
.../resources/OSGI-INF/blueprint/blueprint.xml | 197 ----------
.../resources/OSGI-INF/blueprint/management.xml | 59 ---
itests/pom.xml | 20 +-
.../karaf/cellar/itests/CellarTestSupport.java | 167 ++++----
kubernetes/NOTICE | 2 +-
kubernetes/pom.xml | 22 +-
.../karaf/cellar/kubernetes/Activator.java | 46 ---
.../kubernetes/KubernetesDiscoveryService.java | 12 +-
.../kubernetes/internal/osgi/Activator.java | 45 +++
manual/NOTICE | 2 +-
obr/NOTICE | 2 +-
obr/pom.xml | 33 +-
.../cellar/obr/internal/osgi/Activator.java | 130 +++++++
.../cellar/obr/shell/ObrAddUrlCommand.java | 11 +-
.../cellar/obr/shell/ObrCommandSupport.java | 3 +-
.../cellar/obr/shell/ObrDeployCommand.java | 13 +-
.../karaf/cellar/obr/shell/ObrListCommand.java | 13 +-
.../cellar/obr/shell/ObrListUrlCommand.java | 9 +-
.../cellar/obr/shell/ObrRemoveUrlCommand.java | 11 +-
.../resources/OSGI-INF/blueprint/blueprint.xml | 65 ----
.../resources/OSGI-INF/blueprint/management.xml | 30 --
.../OSGI-INF/blueprint/shell-commands.xml | 82 ----
pom.xml | 71 ++--
samples/camel-hazelcast-app/NOTICE | 2 +-
samples/dosgi-greeter/NOTICE | 2 +-
samples/dosgi-greeter/client/pom.xml | 17 +-
.../dosgi/greeter/client/GreetCommand.java | 11 +-
.../OSGI-INF/blueprint/shell-greeter.xml | 29 --
samples/dosgi-greeter/service/pom.xml | 24 +-
.../dosgi/greeter/service/Activator.java | 48 +++
.../resources/OSGI-INF/blueprint/blueprint.xml | 39 --
samples/hazelcast-app/NOTICE | 2 +-
samples/hazelcast-app/pom.xml | 2 +-
shell/NOTICE | 2 +-
shell/pom.xml | 33 +-
.../cellar/shell/ClusterCommandSupport.java | 2 +
.../karaf/cellar/shell/NodePingCommand.java | 9 +-
.../karaf/cellar/shell/NodesListCommand.java | 7 +-
.../apache/karaf/cellar/shell/SyncCommand.java | 14 +-
.../shell/consumer/ConsumerStartCommand.java | 9 +-
.../shell/consumer/ConsumerStatusCommand.java | 9 +-
.../shell/consumer/ConsumerStopCommand.java | 9 +-
.../cellar/shell/consumer/ConsumerSupport.java | 2 +-
.../cellar/shell/group/GroupCreateCommand.java | 6 +-
.../cellar/shell/group/GroupDeleteCommand.java | 9 +-
.../cellar/shell/group/GroupJoinCommand.java | 11 +-
.../cellar/shell/group/GroupListCommand.java | 9 +-
.../cellar/shell/group/GroupPickCommand.java | 11 +-
.../cellar/shell/group/GroupQuitCommand.java | 11 +-
.../cellar/shell/group/GroupSetCommand.java | 11 +-
.../karaf/cellar/shell/group/GroupSupport.java | 2 +-
.../shell/handler/HandlersStartCommand.java | 9 +-
.../shell/handler/HandlersStatusCommand.java | 9 +-
.../shell/handler/HandlersStopCommand.java | 9 +-
.../cellar/shell/handler/HandlersSupport.java | 2 +-
.../shell/producer/ProducerStartCommand.java | 9 +-
.../shell/producer/ProducerStatusCommand.java | 9 +-
.../shell/producer/ProducerStopCommand.java | 9 +-
.../cellar/shell/producer/ProducerSupport.java | 2 +-
.../OSGI-INF/blueprint/shell-cluster.xml | 208 ----------
utils/NOTICE | 2 +-
utils/pom.xml | 25 +-
.../utils/ping/internal/osgi/Activator.java | 55 +++
.../resources/OSGI-INF/blueprint/blueprint.xml | 35 --
webconsole/NOTICE | 2 +-
webconsole/pom.xml | 24 +-
.../webconsole/internal/osgi/Activator.java | 70 ++++
.../OSGI-INF/blueprint/webconsole-cellar.xml | 37 --
143 files changed, 2508 insertions(+), 2251 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index addb35c..64cb235 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/assembly/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/pom.xml b/assembly/pom.xml
index 703c3c8..13f1e6a 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -33,6 +33,25 @@
<packaging>pom</packaging>
<name>Apache Karaf :: Cellar :: Assembly</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>framework</artifactId>
+ <version>${karaf.version}</version>
+ <type>kar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>standard</artifactId>
+ <version>${karaf.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+
<build>
<resources>
<resource>
@@ -45,6 +64,45 @@
</resources>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>verify</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>mvn:org.apache.karaf.features/framework/${karaf.version}/xml/features</descriptor>
+ <descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>
+ <descriptor>file:${project.build.directory}/classes/features.xml</descriptor>
+ </descriptors>
+ <distribution>org.apache.karaf.features:framework</distribution>
+ <javase>1.7</javase>
+ <framework>
+ <feature>framework</feature>
+ </framework>
+ <features>
+ <feature>hazelcast</feature>
+ <feature>cellar-core</feature>
+ <feature>cellar-hazelcast</feature>
+ <feature>cellar-shell</feature>
+ <feature>cellar</feature>
+ <feature>cellar-dosgi</feature>
+ <feature>cellar-obr</feature>
+ <feature>cellar-eventadmin</feature>
+ <feature>cellar-cloud</feature>
+ <!-- <feature>cellar-kubernetes</feature> -->
+ <feature>cellar-webconsole</feature>
+ </features>
+ <verifyTransitive>false</verifyTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
@@ -136,35 +194,6 @@
</execution>
</executions>
</plugin>
- <!--
- <plugin>
- <groupId>org.apache.karaf.tooling</groupId>
- <artifactId>karaf-maven-plugin</artifactId>
- <version>${karaf.version}</version>
- <executions>
- <execution>
- <id>features-generate-descriptor</id>
- <phase>compile</phase>
- <goals>
- <goal>features-generate-descriptor</goal>
- </goals>
- <configuration>
- <addBundlesToPrimaryFeature>false</addBundlesToPrimaryFeature>
- </configuration>
- </execution>
- <execution>
- <id>features-create-kar</id>
- <phase>package</phase>
- <goals>
- <goal>features-create-kar</goal>
- </goals>
- <configuration>
- <featuresFile>target/classes/features.xml</featuresFile>
- </configuration>
- </execution>
- </executions>
- </plugin>
- -->
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/assembly/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/assembly/src/main/resources/features.xml b/assembly/src/main/resources/features.xml
index 076f306..df9fcc7 100644
--- a/assembly/src/main/resources/features.xml
+++ b/assembly/src/main/resources/features.xml
@@ -13,78 +13,95 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<features name="karaf-cellar-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+<features name="karaf-cellar-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">
<repository>mvn:org.apache.jclouds.karaf/jclouds-karaf/${jclouds.version}/xml/features</repository>
<repository>mvn:io.fabric8/karaf-features/${fabric8.version}/xml/features</repository>
- <feature name="cellar-core" description="Karaf clustering core" version="${project.version}" resolver="(obr)">
+ <feature name="cellar-core" description="Karaf clustering core" version="${project.version}">
+ <feature dependency="true">aries-proxy</feature>
<configfile finalname="/etc/org.apache.karaf.cellar.groups.cfg">mvn:org.apache.karaf.cellar/apache-karaf-cellar/${project.version}/cfg/groups</configfile>
<configfile finalname="/etc/org.apache.karaf.cellar.node.cfg">mvn:org.apache.karaf.cellar/apache-karaf-cellar/${project.version}/cfg/node</configfile>
- <bundle start-level="30">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.core/${project.version}</bundle>
- <bundle start-level="31">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.utils/${project.version}</bundle>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.core/${project.version}</bundle>
</feature>
- <feature name="hazelcast" description="In memory data grid" version="${hazelcast.version}" resolver="(obr)">
+ <feature name="hazelcast" description="In memory data grid" version="${hazelcast.version}">
<configfile finalname="/etc/hazelcast.xml">mvn:org.apache.karaf.cellar/apache-karaf-cellar/${project.version}/xml/hazelcast</configfile>
- <bundle start-level="30" dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
- <bundle start-level="30" dependency="true">mvn:com.eclipsesource.minimal-json/minimal-json/0.9.2</bundle>
- <bundle start-level="70">mvn:com.hazelcast/hazelcast-all/${hazelcast.version}</bundle>
+ <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
+ <bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.2</bundle>
+ <bundle>mvn:com.hazelcast/hazelcast-all/${hazelcast.version}</bundle>
</feature>
- <feature name="cellar-hazelcast" description="Cellar implementation based on Hazelcast" version="${project.version}" resolver="(obr)">
+ <feature name="cellar-hazelcast" description="Cellar implementation based on Hazelcast" version="${project.version}">
<feature version="${hazelcast.version}">hazelcast</feature>
<feature version="${project.version}">cellar-core</feature>
- <bundle start-level="70">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.hazelcast/${project.version}</bundle>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.hazelcast/${project.version}</bundle>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.utils/${project.version}</bundle>
</feature>
- <feature name="cellar-config" description="ConfigAdmin cluster support" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-core</feature>
- <bundle start-level="40">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.config/${project.version}</bundle>
+ <feature name="cellar-config" description="ConfigAdmin cluster support" version="${project.version}">
+ <conditional>
+ <condition>config</condition>
+ <feature>cellar-hazelcast</feature>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.config/${project.version}</bundle>
+ </conditional>
</feature>
- <feature name="cellar-features" description="Karaf features cluster support" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-core</feature>
- <bundle start-level="40">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.features/${project.version}</bundle>
+ <feature name="cellar-features" description="Karaf features cluster support" version="${project.version}">
+ <conditional>
+ <condition>feature</condition>
+ <feature>cellar-hazelcast</feature>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.features/${project.version}</bundle>
+ </conditional>
</feature>
- <feature name="cellar-bundle" description="Bundle cluster support" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-core</feature>
- <bundle start-level="40">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.bundle/${project.version}</bundle>
+ <feature name="cellar-bundle" description="Bundle cluster support" version="${project.version}">
+ <conditional>
+ <condition>bundle</condition>
+ <feature>cellar-hazelcast</feature>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.bundle/${project.version}</bundle>
+ </conditional>
</feature>
- <feature name="cellar-shell" description="Cellar shell support" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-core</feature>
- <bundle start-level="40">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.shell/${project.version}</bundle>
+ <feature name="cellar-shell" description="Cellar shell support" version="${project.version}">
+ <conditional>
+ <condition>shell</condition>
+ <feature>cellar-hazelcast</feature>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.shell/${project.version}</bundle>
+ </conditional>
</feature>
- <feature name="cellar" description="Karaf clustering" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-hazelcast</feature>
- <feature version="${project.version}">cellar-shell</feature>
- <feature version="${project.version}">cellar-config</feature>
- <feature version="${project.version}">cellar-bundle</feature>
- <feature version="${project.version}">cellar-features</feature>
+ <feature name="cellar" description="Karaf clustering" version="${project.version}">
+ <feature>cellar-hazelcast</feature>
+ <feature>cellar-shell</feature>
+ <feature>cellar-config</feature>
+ <feature>cellar-bundle</feature>
+ <feature>cellar-features</feature>
</feature>
- <feature name="cellar-dosgi" description="DOSGi support" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-core</feature>
+ <feature name="cellar-dosgi" description="DOSGi support" version="${project.version}">
+ <feature>cellar-hazelcast</feature>
<bundle start-level="40">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.dosgi/${project.version}</bundle>
</feature>
- <feature name="cellar-obr" description="OBR cluster support" version="${project.version}" resolver="(obr)">
- <feature>obr</feature>
- <feature version="${project.version}">cellar-core</feature>
- <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.obr/${project.version}</bundle>
+ <feature name="cellar-obr" description="OBR cluster support" version="${project.version}">
+ <conditional>
+ <condition>obr</condition>
+ <feature>cellar-hazelcast</feature>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.obr/${project.version}</bundle>
+ </conditional>
</feature>
- <feature name="cellar-eventadmin" description="OSGi events broadcasting in clusters" version="${project.version}" resolver="(obr)">
- <feature>eventadmin</feature>
- <feature version="${project.version}">cellar-core</feature>
- <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.event/${project.version}</bundle>
+ <feature name="cellar-eventadmin" description="OSGi events broadcasting in clusters" version="${project.version}">
+ <conditional>
+ <condition>eventadmin</condition>
+ <feature>cellar-hazelcast</feature>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.event/${project.version}</bundle>
+ </conditional>
</feature>
- <feature name="cellar-cloud" description="Cloud blobstore support in clusters" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-core</feature>
+ <feature name="cellar-cloud" description="Cloud blobstore support in clusters" version="${project.version}">
+ <feature>cellar-hazelcast</feature>
<feature version="${jclouds.version}">jclouds</feature>
<!-- Adding S3 as the default Blobstore -->
<feature>jclouds-aws-s3</feature>
@@ -92,16 +109,17 @@
<bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.cloud/${project.version}</bundle>
</feature>
- <feature name="cellar-kubernetes" description="Cellar kubernetes support in clusters" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar-core</feature>
+ <feature name="cellar-kubernetes" description="Cellar kubernetes support in clusters" version="${project.version}">
<feature>fabric8-kubernetes-api</feature>
- <bundle start-level="40">mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.kubernetes/${project.version}</bundle>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.kubernetes/${project.version}</bundle>
</feature>
- <feature name="cellar-webconsole" description="Cellar plugin for Karaf WebConsole" version="${project.version}" resolver="(obr)">
- <feature version="${project.version}">cellar</feature>
- <feature>webconsole</feature>
- <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.webconsole/${project.version}</bundle>
+ <feature name="cellar-webconsole" description="Cellar plugin for Karaf WebConsole" version="${project.version}">
+ <conditional>
+ <condition>webconsole</condition>
+ <feature>cellar-hazelcast</feature>
+ <bundle>mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.webconsole/${project.version}</bundle>
+ </conditional>
</feature>
</features>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/NOTICE
----------------------------------------------------------------------
diff --git a/bundle/NOTICE b/bundle/NOTICE
index addb35c..64cb235 100644
--- a/bundle/NOTICE
+++ b/bundle/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/pom.xml
----------------------------------------------------------------------
diff --git a/bundle/pom.xml b/bundle/pom.xml
index 0889b88..893578a 100644
--- a/bundle/pom.xml
+++ b/bundle/pom.xml
@@ -41,6 +41,14 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -58,12 +66,6 @@
<scope>provided</scope>
</dependency>
- <!-- Shell table -->
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.table</artifactId>
- </dependency>
-
<!-- Logging Dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
@@ -75,29 +77,28 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.bundle*;version="${project.version}"
+ !org.apache.karaf.cellar.bundle.management.internal,
+ !org.apache.karaf.cellar.bundle.internal.osgi,
+ org.apache.karaf.cellar.bundle*
</Export-Package>
<Import-Package>
- javax.management*,
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.apache.felix.service.command,
- org.apache.felix.gogo.commands,
- org.apache.karaf.shell.console;version="[3,5)",
- org.apache.karaf.shell.console.commands;version="[3,5)",
- org.apache.karaf.shell.console.completer;version="[3,5)",
- org.apache.karaf.shell.commands;version="[3,5)",
- org.apache.karaf.shell.table;version="[3,5)",
- org.apache.karaf.features;version="[3,5)",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ org.apache.karaf.shell*;resolution:=optional,
+ *
</Import-Package>
<Private-Package>
- org.apache.karaf.cellar.bundle.management.internal
+ org.apache.karaf.cellar.bundle.management.internal,
+ org.apache.karaf.cellar.bundle.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
</Private-Package>
</instructions>
</configuration>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/internal/osgi/Activator.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/internal/osgi/Activator.java
new file mode 100644
index 0000000..0dbb724
--- /dev/null
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/internal/osgi/Activator.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed 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.cellar.bundle.internal.osgi;
+
+import org.apache.karaf.cellar.bundle.BundleEventHandler;
+import org.apache.karaf.cellar.bundle.BundleSynchronizer;
+import org.apache.karaf.cellar.bundle.LocalBundleListener;
+import org.apache.karaf.cellar.bundle.management.internal.CellarBundleMBeanImpl;
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.core.Synchronizer;
+import org.apache.karaf.cellar.core.event.EventHandler;
+import org.apache.karaf.cellar.core.event.EventProducer;
+import org.apache.karaf.features.FeaturesService;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(EventHandler.class),
+ @ProvideService(Synchronizer.class)
+ },
+ requires = {
+ @RequireService(ClusterManager.class),
+ @RequireService(GroupManager.class),
+ @RequireService(ConfigurationAdmin.class),
+ @RequireService(EventProducer.class),
+ @RequireService(FeaturesService.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private LocalBundleListener localBundleListener;
+ private BundleSynchronizer synchronizer;
+ private BundleEventHandler eventHandler;
+ private ServiceRegistration mbeanRegistration;
+
+ @Override
+ public void doStart() throws Exception {
+
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ GroupManager groupManager = getTrackedService(GroupManager.class);
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+ EventProducer eventProducer = getTrackedService(EventProducer.class);
+ FeaturesService featuresService = getTrackedService(FeaturesService.class);
+
+ LOGGER.debug("[CELLAR BUNDLE] Init even handler");
+ eventHandler = new BundleEventHandler();
+ eventHandler.setConfigurationAdmin(configurationAdmin);
+ eventHandler.setClusterManager(clusterManager);
+ eventHandler.setGroupManager(groupManager);
+ eventHandler.setBundleContext(bundleContext);
+ eventHandler.setFeaturesService(featuresService);
+ eventHandler.init();
+ Hashtable props = new Hashtable();
+ props.put("managed", "true");
+ register(EventHandler.class, eventHandler, props);
+
+ LOGGER.debug("[CELLAR BUNDLE] Init local listener");
+ localBundleListener = new LocalBundleListener();
+ localBundleListener.setClusterManager(clusterManager);
+ localBundleListener.setGroupManager(groupManager);
+ localBundleListener.setConfigurationAdmin(configurationAdmin);
+ localBundleListener.setEventProducer(eventProducer);
+ localBundleListener.setFeaturesService(featuresService);
+ localBundleListener.setBundleContext(bundleContext);
+ localBundleListener.init();
+
+ LOGGER.debug("[CELLAR BUNDLE] Init synchronizer");
+ synchronizer = new BundleSynchronizer();
+ synchronizer.setConfigurationAdmin(configurationAdmin);
+ synchronizer.setGroupManager(groupManager);
+ synchronizer.setClusterManager(clusterManager);
+ synchronizer.setBundleContext(bundleContext);
+ synchronizer.init();
+ props = new Hashtable();
+ props.put("resource", "bundle");
+ register(Synchronizer.class, synchronizer, props);
+
+ LOGGER.debug("[CELLAR BUNDLE] Register MBean");
+ CellarBundleMBeanImpl mbean = new CellarBundleMBeanImpl();
+ mbean.setClusterManager(clusterManager);
+ mbean.setConfigurationAdmin(configurationAdmin);
+ mbean.setGroupManager(groupManager);
+ mbean.setEventProducer(eventProducer);
+ mbean.setBundleContext(bundleContext);
+ props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=bundle,name=" + System.getProperty("karaf.name"));
+ mbeanRegistration = bundleContext.registerService(getInterfaceNames(mbean), mbean, props);
+
+ }
+
+ @Override
+ public void doStop() {
+ if (mbeanRegistration != null) {
+ mbeanRegistration.unregister();
+ mbeanRegistration = null;
+ }
+ if (synchronizer != null) {
+ synchronizer.destroy();
+ synchronizer = null;
+ }
+ if (localBundleListener != null) {
+ localBundleListener.destroy();
+ localBundleListener = null;
+ }
+ if (eventHandler != null) {
+ eventHandler.destroy();
+ eventHandler = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BlockCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BlockCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BlockCommand.java
index 7ad11eb..199a13c 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BlockCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BlockCommand.java
@@ -18,12 +18,14 @@ import org.apache.karaf.cellar.core.CellarSupport;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.*;
@Command(scope = "cluster", name = "bundle-block", description = "Change the blocking policy for a bundle")
+@Service
public class BlockCommand extends BundleCommandSupport {
@Option(name = "-in", description = "Update the inbound direction", required = false, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
index 66a73e5..6937307 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
@@ -17,8 +17,12 @@ import org.apache.karaf.cellar.bundle.BundleState;
import org.apache.karaf.cellar.bundle.Constants;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
-import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import java.util.ArrayList;
@@ -31,11 +35,15 @@ import java.util.regex.Pattern;
public abstract class BundleCommandSupport extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "ids", description = "The list of bundle (identified by IDs or name or name/version) separated by whitespaces", required = false, multiValued = true)
List<String> ids;
+ @Reference
+ protected BundleContext bundleContext;
+
protected abstract Object doExecute() throws Exception;
/**
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
index 3f86aac..eee3cf9 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
@@ -23,9 +23,13 @@ import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
-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.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.osgi.framework.BundleEvent;
import java.net.URL;
@@ -35,9 +39,11 @@ import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
@Command(scope = "cluster", name = "bundle-install", description = "Install bundles in a cluster group")
+@Service
public class InstallBundleCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "urls", description = "Bundle URLs separated by whitespace", required = true, multiValued = true)
@@ -46,6 +52,7 @@ public class InstallBundleCommand extends CellarCommandSupport {
@Option(name = "-s", aliases = {"--start"}, description = "Start the bundle after installation", required = false, multiValued = false)
boolean start;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
index 165d5de..b935dd1 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
@@ -18,14 +18,16 @@ import org.apache.karaf.cellar.bundle.Constants;
import org.apache.karaf.cellar.core.CellarSupport;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.table.ShellTable;
import org.osgi.framework.BundleEvent;
import java.util.*;
@Command(scope = "cluster", name = "bundle-list", description = "List the bundles in a cluster group")
+@Service
public class ListBundleCommand extends BundleCommandSupport {
@Option(name = "-s", aliases = {}, description = "Shows the symbolic name", required = false, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
index 552d753..c1e773f 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
@@ -22,15 +22,19 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.osgi.framework.BundleEvent;
import java.util.List;
import java.util.Map;
@Command(scope = "cluster", name = "bundle-start", description = "Start bundles in a cluster group")
+@Service
public class StartBundleCommand extends BundleCommandSupport {
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
index d91aa9a..6f5968c 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
@@ -22,14 +22,19 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.osgi.framework.BundleEvent;
import java.util.List;
import java.util.Map;
@Command(scope = "cluster", name = "bundle-stop", description = "Stop a bundle in a cluster group")
+@Service
public class StopBundleCommand extends BundleCommandSupport {
+
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
index 760a58a..fd9f8d5 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
@@ -22,15 +22,19 @@ import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.osgi.framework.BundleEvent;
import java.util.List;
import java.util.Map;
@Command(scope = "cluster", name = "bundle-uninstall", description = "Uninstall a bundle from a cluster group")
+@Service
public class UninstallBundleCommand extends BundleCommandSupport {
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesNameCompleter.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesNameCompleter.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesNameCompleter.java
index 2da8af3..1719299 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesNameCompleter.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesNameCompleter.java
@@ -13,8 +13,12 @@
*/
package org.apache.karaf.cellar.bundle.shell.completers;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -23,16 +27,18 @@ import java.util.List;
/**
* Completer on all bundle symbolic name.
*/
+@Service
public class AllBundlesNameCompleter implements Completer {
+ @Reference
private BundleContext bundleContext;
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
for (Bundle bundle : bundleContext.getBundles()) {
delegate.getStrings().add(bundle.getSymbolicName());
}
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
public BundleContext getBundleContext() {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesVersionCompleter.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesVersionCompleter.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesVersionCompleter.java
index a547e5e..4c6a00c 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesVersionCompleter.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/completers/AllBundlesVersionCompleter.java
@@ -13,8 +13,12 @@
*/
package org.apache.karaf.cellar.bundle.shell.completers;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -23,16 +27,18 @@ import java.util.List;
/**
* Completer on all bundle version..
*/
+@Service
public class AllBundlesVersionCompleter implements Completer {
+ @Reference
private BundleContext bundleContext;
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
for (Bundle bundle : bundleContext.getBundles()) {
delegate.getStrings().add(bundle.getHeaders().get("Bundle-Version").toString());
}
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
public BundleContext getBundleContext() {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index ec986e7..0000000
--- a/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed 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.
- -->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
- http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <!-- Local Bundle Listener -->
- <bean id="localListener" class="org.apache.karaf.cellar.bundle.LocalBundleListener" init-method="init"
- destroy-method="destroy">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="featuresService" ref="featuresService"/>
- </bean>
-
- <!-- Bundle Synchronizer -->
- <bean id="synchronizer" class="org.apache.karaf.cellar.bundle.BundleSynchronizer"
- init-method="init" destroy-method="destroy" depends-on="eventHandler">
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
- <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer">
- <service-properties>
- <entry key="resource" value="bundle"/>
- </service-properties>
- </service>
-
- <!-- Cluster Bundle Event Handler -->
- <bean id="eventHandler" class="org.apache.karaf.cellar.bundle.BundleEventHandler"
- init-method="init" destroy-method="destroy">
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="featuresService" ref="featuresService"/>
- </bean>
- <service ref="eventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
- <service-properties>
- <entry key="managed" value="true"/>
- </service-properties>
- </service>
-
- <!-- Cluster Core Services -->
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
- <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager" />
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
- <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
- <reference id="featuresService" interface="org.apache.karaf.features.FeaturesService"/>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/resources/OSGI-INF/blueprint/management.xml
----------------------------------------------------------------------
diff --git a/bundle/src/main/resources/OSGI-INF/blueprint/management.xml b/bundle/src/main/resources/OSGI-INF/blueprint/management.xml
deleted file mode 100644
index 02ceeb7..0000000
--- a/bundle/src/main/resources/OSGI-INF/blueprint/management.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed 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.
- -->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
-
- <!-- system properties -->
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
-
- <!-- Cellar Bundle MBean -->
- <bean id="cellarBundleMBean" class="org.apache.karaf.cellar.bundle.management.internal.CellarBundleMBeanImpl">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
- <service ref="cellarBundleMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=bundle,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/bundle/src/main/resources/OSGI-INF/blueprint/shell-bundle.xml
----------------------------------------------------------------------
diff --git a/bundle/src/main/resources/OSGI-INF/blueprint/shell-bundle.xml b/bundle/src/main/resources/OSGI-INF/blueprint/shell-bundle.xml
deleted file mode 100644
index f8862e8..0000000
--- a/bundle/src/main/resources/OSGI-INF/blueprint/shell-bundle.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.apache.karaf.cellar.bundle.shell.ListBundleCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.bundle.shell.InstallBundleCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.bundle.shell.UninstallBundleCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="allBundlesNameCompleter"/>
- <ref component-id="allBundlesVersionCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.bundle.shell.StartBundleCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="allBundlesNameCompleter"/>
- <ref component-id="allBundlesVersionCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.bundle.shell.StopBundleCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="allBundlesNameCompleter"/>
- <ref component-id="allBundlesVersionCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.bundle.shell.BlockCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="allBundlesNameCompleter"/>
- <ref component-id="allBundlesVersionCompleter"/>
- </completers>
- </command>
- </command-bundle>
-
- <bean id="allGroupsCompleter" class="org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter">
- <property name="groupManager" ref="groupManager"/>
- </bean>
-
- <bean id="allBundlesNameCompleter" class="org.apache.karaf.cellar.bundle.shell.completers.AllBundlesNameCompleter">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
-
- <bean id="allBundlesVersionCompleter" class="org.apache.karaf.cellar.bundle.shell.completers.AllBundlesVersionCompleter">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/cloud/NOTICE
----------------------------------------------------------------------
diff --git a/cloud/NOTICE b/cloud/NOTICE
index addb35c..64cb235 100644
--- a/cloud/NOTICE
+++ b/cloud/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/cloud/pom.xml
----------------------------------------------------------------------
diff --git a/cloud/pom.xml b/cloud/pom.xml
index b47c5d0..3ad433e 100644
--- a/cloud/pom.xml
+++ b/cloud/pom.xml
@@ -40,6 +40,10 @@
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
<!-- JClouds Dependencies -->
<dependency>
@@ -89,22 +93,27 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.cloud*;version="${project.version}"
+ !org.apache.karaf.cellar.cloud.internal.osgi,
+ org.apache.karaf.cellar.cloud*
</Export-Package>
<Import-Package>
- org.joda.time;version="${joda-time.version}",
- org.joda.time.chrono;version="${joda-time.version}",
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ *
</Import-Package>
+ <Private-Package>
+ org.apache.karaf.cellar.cloud.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
<DynamicImport-Package>org.jclouds.*</DynamicImport-Package>
- <Bundle-Activator>org.apache.karaf.cellar.cloud.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/cloud/src/main/java/org/apache/karaf/cellar/cloud/Activator.java
----------------------------------------------------------------------
diff --git a/cloud/src/main/java/org/apache/karaf/cellar/cloud/Activator.java b/cloud/src/main/java/org/apache/karaf/cellar/cloud/Activator.java
deleted file mode 100644
index b8f253a..0000000
--- a/cloud/src/main/java/org/apache/karaf/cellar/cloud/Activator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed 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.cellar.cloud;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ManagedServiceFactory;
-
-import java.util.Hashtable;
-
-/**
- * Cloud bundle activator.
- */
-public class Activator implements BundleActivator {
-
- private ServiceRegistration serviceRegistration;
-
- @Override
- public void start(BundleContext context) throws Exception {
- Hashtable<String, Object> properties = new Hashtable<String, Object>();
- properties.put(Constants.SERVICE_PID, "org.apache.karaf.cellar.cloud");
- BlobStoreDiscoveryServiceFactory blobStoreDiscoveryServiceFactory = new BlobStoreDiscoveryServiceFactory(context);
- serviceRegistration = context.registerService(ManagedServiceFactory.class.getName(), blobStoreDiscoveryServiceFactory, properties);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/cloud/src/main/java/org/apache/karaf/cellar/cloud/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/cloud/src/main/java/org/apache/karaf/cellar/cloud/internal/osgi/Activator.java b/cloud/src/main/java/org/apache/karaf/cellar/cloud/internal/osgi/Activator.java
new file mode 100644
index 0000000..1c240b3
--- /dev/null
+++ b/cloud/src/main/java/org/apache/karaf/cellar/cloud/internal/osgi/Activator.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed 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.cellar.cloud.internal.osgi;
+
+import org.apache.karaf.cellar.cloud.BlobStoreDiscoveryServiceFactory;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.Constants;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Hashtable;
+
+/**
+ * Cloud bundle activator.
+ */
+@Services(
+ provides = {
+ @ProvideService(ManagedServiceFactory.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ public void doStart() throws Exception {
+ LOGGER.debug("[CELLAR CLOUD] Init discovery service factory");
+ Hashtable<String, Object> properties = new Hashtable<String, Object>();
+ properties.put(Constants.SERVICE_PID, "org.apache.karaf.cellar.cloud");
+ BlobStoreDiscoveryServiceFactory blobStoreDiscoveryServiceFactory = new BlobStoreDiscoveryServiceFactory(bundleContext);
+ register(ManagedServiceFactory.class, blobStoreDiscoveryServiceFactory, properties);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/NOTICE
----------------------------------------------------------------------
diff --git a/config/NOTICE b/config/NOTICE
index addb35c..64cb235 100644
--- a/config/NOTICE
+++ b/config/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/pom.xml
----------------------------------------------------------------------
diff --git a/config/pom.xml b/config/pom.xml
index ec925c8..0b90d17 100644
--- a/config/pom.xml
+++ b/config/pom.xml
@@ -42,6 +42,14 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.utils</artifactId>
</dependency>
@@ -67,29 +75,29 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.config*;version="${project.version}"
+ !org.apache.karaf.cellar.config.internal.osgi,
+ !org.apache.karaf.cellar.config.management.internal,
+ org.apache.karaf.cellar.config*
</Export-Package>
<Import-Package>
- javax.management*,
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.apache.felix.service.command,
- org.apache.felix.gogo.commands,
- org.apache.karaf.shell.console;version="[3,5)",
- org.apache.karaf.shell.console.completer;version="[3,5)",
- org.apache.karaf.shell.console.commands;version="[3,5)",
- org.apache.karaf.shell.commands;version="[3,5)",
- org.apache.karaf.shell.table;version="[3,5)",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ org.apache.karaf.shell*;resolution:=optional,
+ *
</Import-Package>
<Private-Package>
+ org.apache.karaf.cellar.config.internal.osgi,
org.apache.karaf.cellar.config.management.internal,
- org.apache.felix.utils*;-split-package:=merge-first
+ org.apache.felix.utils*;-split-package:=merge-first,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
</Private-Package>
</instructions>
</configuration>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/internal/osgi/Activator.java b/config/src/main/java/org/apache/karaf/cellar/config/internal/osgi/Activator.java
new file mode 100644
index 0000000..2bf5bfd
--- /dev/null
+++ b/config/src/main/java/org/apache/karaf/cellar/config/internal/osgi/Activator.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed 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.cellar.config.internal.osgi;
+
+import org.apache.karaf.cellar.config.ConfigurationEventHandler;
+import org.apache.karaf.cellar.config.ConfigurationSynchronizer;
+import org.apache.karaf.cellar.config.LocalConfigurationListener;
+import org.apache.karaf.cellar.config.management.internal.CellarConfigMBeanImpl;
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.core.Synchronizer;
+import org.apache.karaf.cellar.core.event.EventHandler;
+import org.apache.karaf.cellar.core.event.EventProducer;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.Managed;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationListener;
+import org.osgi.service.cm.ManagedService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Hashtable;
+
+@Services(
+ requires = {
+ @RequireService(ClusterManager.class),
+ @RequireService(GroupManager.class),
+ @RequireService(ConfigurationAdmin.class),
+ @RequireService(EventProducer.class)
+ },
+ provides = {
+ @ProvideService(ConfigurationListener.class),
+ @ProvideService(Synchronizer.class),
+ @ProvideService(EventHandler.class)
+ }
+)
+@Managed("org.apache.karaf.shell.config")
+public class Activator extends BaseActivator implements ManagedService {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private LocalConfigurationListener localConfigurationListener;
+ private ConfigurationSynchronizer configurationSynchronizer;
+ private ConfigurationEventHandler configurationEventHandler;
+ private ServiceRegistration cellarConfigMBeanRegistration;
+
+ @Override
+ public void doStart() throws Exception {
+
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ GroupManager groupManager = getTrackedService(GroupManager.class);
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+ EventProducer eventProducer = getTrackedService(EventProducer.class);
+
+ File storage = new File(getString("storage", System.getProperty("karaf.etc")));
+
+ LOGGER.debug("[CELLAR CONFIG] Init event handler");
+ configurationEventHandler = new ConfigurationEventHandler();
+ configurationEventHandler.setConfigurationAdmin(configurationAdmin);
+ configurationEventHandler.setGroupManager(groupManager);
+ configurationEventHandler.setClusterManager(clusterManager);
+ configurationEventHandler.setStorage(storage);
+ configurationEventHandler.init();
+ Hashtable props = new Hashtable();
+ props.put("managed", "true");
+ register(EventHandler.class, configurationEventHandler);
+
+ LOGGER.debug("[CELLAR CONFIG] Init local listener");
+ localConfigurationListener = new LocalConfigurationListener();
+ localConfigurationListener.setClusterManager(clusterManager);
+ localConfigurationListener.setGroupManager(groupManager);
+ localConfigurationListener.setConfigurationAdmin(configurationAdmin);
+ localConfigurationListener.setEventProducer(eventProducer);
+ localConfigurationListener.init();
+ register(ConfigurationListener.class, localConfigurationListener);
+
+ LOGGER.debug("[CELLAR CONFIG] Init synchronizer");
+ configurationSynchronizer = new ConfigurationSynchronizer();
+ configurationSynchronizer.setConfigurationAdmin(configurationAdmin);
+ configurationSynchronizer.setGroupManager(groupManager);
+ configurationSynchronizer.setClusterManager(clusterManager);
+ configurationSynchronizer.setStorage(storage);
+ configurationSynchronizer.init();
+ props = new Hashtable();
+ props.put("resource", "config");
+ register(Synchronizer.class, configurationSynchronizer, props);
+
+ LOGGER.debug("[CELLAR CONFIG] Register MBean");
+ CellarConfigMBeanImpl cellarConfigMBean = new CellarConfigMBeanImpl();
+ cellarConfigMBean.setClusterManager(clusterManager);
+ cellarConfigMBean.setGroupManager(groupManager);
+ cellarConfigMBean.setConfigurationAdmin(configurationAdmin);
+ cellarConfigMBean.setEventProducer(eventProducer);
+ props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=config,name=" + System.getProperty("karaf.name"));
+ cellarConfigMBeanRegistration = bundleContext.registerService(getInterfaceNames(cellarConfigMBean), cellarConfigMBean, props);
+ }
+
+ @Override
+ public void doStop() {
+ if (cellarConfigMBeanRegistration != null) {
+ cellarConfigMBeanRegistration.unregister();
+ cellarConfigMBeanRegistration = null;
+ }
+ if (configurationSynchronizer != null) {
+ configurationSynchronizer.destroy();
+ configurationSynchronizer = null;
+ }
+ if (localConfigurationListener != null) {
+ localConfigurationListener.destroy();
+ localConfigurationListener = null;
+ }
+ if (configurationEventHandler != null) {
+ configurationEventHandler.destroy();
+ configurationEventHandler = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/BlockCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/BlockCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/BlockCommand.java
index 977025e..4877d10 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/BlockCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/BlockCommand.java
@@ -14,24 +14,31 @@
package org.apache.karaf.cellar.config.shell;
import org.apache.karaf.cellar.config.Constants;
+import org.apache.karaf.cellar.config.shell.completers.ClusterConfigCompleter;
import org.apache.karaf.cellar.core.CellarSupport;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
-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.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Set;
@Command(scope = "cluster", name = "config-block", description = "Change the blocking policy for a bundle")
+@Service
public class BlockCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "pidPattern", description = "The configuration PID pattern", required = false, multiValued = false)
+ @Completion(ClusterConfigCompleter.class)
String pid;
@Option(name = "-in", description = "Update the inbound direction", required = false, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/DeleteCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/DeleteCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/DeleteCommand.java
index de66aa0..0ce9994 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/DeleteCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/DeleteCommand.java
@@ -15,27 +15,36 @@ package org.apache.karaf.cellar.config.shell;
import org.apache.karaf.cellar.config.ClusterConfigurationEvent;
import org.apache.karaf.cellar.config.Constants;
+import org.apache.karaf.cellar.config.shell.completers.ClusterConfigCompleter;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.cellar.core.event.EventType;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.osgi.service.cm.ConfigurationEvent;
import java.util.Map;
import java.util.Properties;
@Command(scope = "cluster", name = "config-delete", description = "Delete a configuration from a cluster group")
+@Service
public class DeleteCommand extends ConfigCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "pid", description = "The configuration PID", required = true, multiValued = false)
+ @Completion(ClusterConfigCompleter.class)
String pid;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
index 41ba78a..11740cb 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
@@ -18,9 +18,12 @@ import org.apache.karaf.cellar.config.Constants;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.event.EventType;
-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.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.osgi.service.cm.Configuration;
import java.util.Enumeration;
@@ -29,9 +32,11 @@ import java.util.Map;
import java.util.Properties;
@Command(scope = "cluster", name = "config-list", description = "List the configurations in a cluster group")
+@Service
public class ListCommand extends ConfigCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "pid", description = "The configuration PID to look for", required = false, multiValued = false)
[4/5] karaf-cellar git commit: [KARAF-3503] Complete refactoring to
remove blueprint dependency and full support of Karaf 4,
upgrade to Hazelcast 3.5.1
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/PropAppendCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropAppendCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropAppendCommand.java
index a4c6390..7728840 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropAppendCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropAppendCommand.java
@@ -15,24 +15,32 @@ package org.apache.karaf.cellar.config.shell;
import org.apache.karaf.cellar.config.ClusterConfigurationEvent;
import org.apache.karaf.cellar.config.Constants;
+import org.apache.karaf.cellar.config.shell.completers.ClusterConfigCompleter;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.cellar.core.event.EventType;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Map;
import java.util.Properties;
@Command(scope = "cluster", name = "config-property-append", description = "Append to the property value for a configuration PID in a cluster group")
+@Service
public class PropAppendCommand extends ConfigCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "pid", description = "The configuration PID", required = true, multiValued = false)
+ @Completion(ClusterConfigCompleter.class)
String pid;
@Argument(index = 2, name = "key", description = "The property key", required = true, multiValued = false)
@@ -41,6 +49,7 @@ public class PropAppendCommand extends ConfigCommandSupport {
@Argument(index = 3, name = "value", description = "The property value", required = true, multiValued = false)
String value;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/PropDelCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropDelCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropDelCommand.java
index 059a882..daa87f5 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropDelCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropDelCommand.java
@@ -13,31 +13,40 @@
*/
package org.apache.karaf.cellar.config.shell;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.cellar.config.Constants;
import org.apache.karaf.cellar.config.ClusterConfigurationEvent;
+import org.apache.karaf.cellar.config.shell.completers.ClusterConfigCompleter;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Map;
import java.util.Properties;
@Command(scope = "cluster", name = "config-property-delete", description = "Delete a property from a configuration in a cluster group")
+@Service
public class PropDelCommand extends ConfigCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "pid", description = "The configuration PID", required = true, multiValued = false)
+ @Completion(ClusterConfigCompleter.class)
String pid;
@Argument(index = 2, name = "key", description = "The property key to delete", required = true, multiValued = false)
String key;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/PropExcludedCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropExcludedCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropExcludedCommand.java
index 1065965..53b08dd 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropExcludedCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropExcludedCommand.java
@@ -15,8 +15,10 @@ package org.apache.karaf.cellar.config.shell;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
@@ -24,11 +26,13 @@ import java.util.Dictionary;
import java.util.Properties;
@Command(scope = "cluster", name = "config-property-excluded", description = "Display or set the config properties excluded from the cluster sync")
+@Service
public class PropExcludedCommand extends CellarCommandSupport {
@Argument(index = 0, name = "excluded-properties", description = "A list of comma separated properties excluded from the cluster sync", required = false, multiValued = false)
String excludedProperties;
+ @Reference
private ConfigurationAdmin configurationAdmin;
@Override
@@ -59,4 +63,5 @@ public class PropExcludedCommand extends CellarCommandSupport {
public void setConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
this.configurationAdmin = configurationAdmin;
}
+
}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
index f1bf513..23d99b1 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
@@ -14,22 +14,29 @@
package org.apache.karaf.cellar.config.shell;
import org.apache.karaf.cellar.config.Constants;
+import org.apache.karaf.cellar.config.shell.completers.ClusterConfigCompleter;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Map;
import java.util.Properties;
@Command(scope = "cluster", name = "config-property-list", description = "List the configurations in a cluster group")
+@Service
public class PropListCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "pid", description = "The configuration PID", required = true, multiValued = false)
+ @Completion(ClusterConfigCompleter.class)
String pid;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
index a8da140..ac25f9c 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
@@ -15,24 +15,32 @@ package org.apache.karaf.cellar.config.shell;
import org.apache.karaf.cellar.config.ClusterConfigurationEvent;
import org.apache.karaf.cellar.config.Constants;
+import org.apache.karaf.cellar.config.shell.completers.ClusterConfigCompleter;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.cellar.core.event.EventType;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Map;
import java.util.Properties;
@Command(scope = "cluster", name = "config-property-set", description = "Set a property value for a configuration in a cluster group")
+@Service
public class PropSetCommand extends ConfigCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "pid", description = "The configuration PID", required = true, multiValued = false)
+ @Completion(ClusterConfigCompleter.class)
String pid;
@Argument(index = 2, name = "key", description = "The property key", required = true, multiValued = false)
@@ -41,6 +49,7 @@ public class PropSetCommand extends ConfigCommandSupport {
@Argument(index = 3, name = "value", description = "The property value", required = true, multiValued = false)
String value;
+ @Reference
private EventProducer eventProducer;
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/java/org/apache/karaf/cellar/config/shell/completers/ClusterConfigCompleter.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/shell/completers/ClusterConfigCompleter.java b/config/src/main/java/org/apache/karaf/cellar/config/shell/completers/ClusterConfigCompleter.java
index 6481149..ee549a4 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/shell/completers/ClusterConfigCompleter.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/shell/completers/ClusterConfigCompleter.java
@@ -18,8 +18,12 @@ import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.GroupManager;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
import java.util.Map;
@@ -28,13 +32,17 @@ import java.util.Properties;
/**
* Command completer for the configuration from the cluster.
*/
+@Service
public class ClusterConfigCompleter implements Completer {
+ @Reference
protected ClusterManager clusterManager;
+
+ @Reference
protected GroupManager groupManager;
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
Map<String, Group> groups = groupManager.listGroups();
@@ -54,7 +62,7 @@ public class ClusterConfigCompleter implements Completer {
} catch (Exception e) {
// nothing to do
}
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
public ClusterManager getClusterManager() {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 1baf760..0000000
--- a/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
- -->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
- xsi:schemaLocation="
- http://www.osgi.org/xmlns/blueprint/v1.0.0
- http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
- http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
- http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
- http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0
- http://aries.apache.org/schemas/blueprint-ext/blueprint-ext.xsd
- ">
-
- <!-- Local Configuration Listener -->
- <bean id="localListener" class="org.apache.karaf.cellar.config.LocalConfigurationListener" init-method="init"
- destroy-method="destroy">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="eventProducer" ref="eventProducer"/>
- </bean>
- <service ref="localListener" interface="org.osgi.service.cm.ConfigurationListener"/>
-
- <!-- Configuration Synchronizer -->
- <bean id="synchronizer" class="org.apache.karaf.cellar.config.ConfigurationSynchronizer"
- init-method="init" destroy-method="destroy" depends-on="eventHandler">
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="storage" value="${storage}"/>
- </bean>
- <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer">
- <service-properties>
- <entry key="resource" value="config"/>
- </service-properties>
- </service>
-
- <!-- Cluster Event Handler -->
- <bean id="eventHandler" class="org.apache.karaf.cellar.config.ConfigurationEventHandler"
- init-method="init" destroy-method="destroy">
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="storage" value="${storage}"/>
- </bean>
- <service ref="eventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
- <service-properties>
- <entry key="managed" value="true"/>
- </service-properties>
- </service>
-
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
- <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
- <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
-
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
-
- <cm:property-placeholder persistent-id="org.apache.karaf.shell.config">
- <cm:default-properties>
- <cm:property name="storage" value="$[karaf.base]/etc/"/>
- </cm:default-properties>
- </cm:property-placeholder>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/resources/OSGI-INF/blueprint/management.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/OSGI-INF/blueprint/management.xml b/config/src/main/resources/OSGI-INF/blueprint/management.xml
deleted file mode 100644
index 2888a32..0000000
--- a/config/src/main/resources/OSGI-INF/blueprint/management.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed 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.
- -->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <!-- Cellar Config MBean -->
- <bean id="cellarConfigMBean" class="org.apache.karaf.cellar.config.management.internal.CellarConfigMBeanImpl">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </bean>
- <service ref="cellarConfigMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=config,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/config/src/main/resources/OSGI-INF/blueprint/shell-config.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/config/src/main/resources/OSGI-INF/blueprint/shell-config.xml
deleted file mode 100644
index 82ad3c3..0000000
--- a/config/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
- -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
- <!-- Command Bundle -->
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.apache.karaf.cellar.config.shell.ListCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.config.shell.PropListCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="clusterConfigCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.config.shell.PropSetCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="clusterConfigCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.config.shell.PropAppendCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="clusterConfigCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.config.shell.PropDelCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="clusterConfigCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.config.shell.DeleteCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="eventProducer" ref="eventProducer"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="clusterConfigCompleter"/>
- </completers>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.config.shell.PropExcludedCommand">
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- </command>
- <command>
- <action class="org.apache.karaf.cellar.config.shell.BlockCommand">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- </action>
- <completers>
- <ref component-id="allGroupsCompleter"/>
- <ref component-id="clusterConfigCompleter"/>
- </completers>
- </command>
- </command-bundle>
-
- <bean id="allGroupsCompleter" class="org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter">
- <property name="groupManager" ref="groupManager"/>
- </bean>
-
- <bean id="clusterConfigCompleter" class="org.apache.karaf.cellar.config.shell.completers.ClusterConfigCompleter">
- <property name="groupManager" ref="groupManager"/>
- <property name="clusterManager" ref="clusterManager"/>
- </bean>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/NOTICE
----------------------------------------------------------------------
diff --git a/core/NOTICE b/core/NOTICE
index addb35c..64cb235 100644
--- a/core/NOTICE
+++ b/core/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 499d543..acb9cb2 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -49,13 +49,16 @@
<!-- Core dependencies -->
<dependency>
<groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
</dependency>
<dependency>
<groupId>org.apache.aries.proxy</groupId>
<artifactId>org.apache.aries.proxy.api</artifactId>
<version>1.0.1</version>
- <scope>provided</scope>
</dependency>
<!-- Logging Dependencies -->
@@ -86,19 +89,27 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.core*;version="${project.version}"
+ !org.apache.karaf.cellar.core.internal.osgi,
+ org.apache.karaf.cellar.core*
</Export-Package>
<Import-Package>
- org.apache.aries.proxy,
- org.apache.karaf.shell.console*;version="[3,5)",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ org.apache.karaf.shell*;resolution:=optional,
+ *
</Import-Package>
+ <Private-Package>
+ org.apache.karaf.cellar.core.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/internal/osgi/Activator.java b/core/src/main/java/org/apache/karaf/cellar/core/internal/osgi/Activator.java
new file mode 100644
index 0000000..7514c66
--- /dev/null
+++ b/core/src/main/java/org/apache/karaf/cellar/core/internal/osgi/Activator.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed 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.cellar.core.internal.osgi;
+
+import org.apache.karaf.cellar.core.event.EventHandler;
+import org.apache.karaf.cellar.core.event.EventHandlerRegistry;
+import org.apache.karaf.cellar.core.event.EventHandlerServiceRegistry;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Services(
+ provides = { @ProvideService(EventHandlerRegistry.class) }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private EventHandlerServiceRegistry registry;
+ private ServiceTracker<EventHandler, EventHandler> eventHandlerServiceTracker;
+
+ @Override
+ public void doStart() throws Exception {
+
+ LOGGER.debug("[CELLAR CORE] Registering event handler service registry");
+ registry = new EventHandlerServiceRegistry();
+ register(EventHandlerRegistry.class, registry);
+
+ LOGGER.debug("[CELLAR CORE] Starting event handler service tracker");
+ eventHandlerServiceTracker = new ServiceTracker<EventHandler, EventHandler>(bundleContext, EventHandler.class, new ServiceTrackerCustomizer<EventHandler, EventHandler>() {
+ @Override
+ public EventHandler addingService(ServiceReference<EventHandler> serviceReference) {
+ EventHandler eventHandler = bundleContext.getService(serviceReference);
+ registry.bind(eventHandler);
+ return eventHandler;
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<EventHandler> serviceReference, EventHandler eventHandler) {
+ // nothing to do
+ }
+
+ @Override
+ public void removedService(ServiceReference<EventHandler> serviceReference, EventHandler eventHandler) {
+ registry.unbind(eventHandler);
+ bundleContext.ungetService(serviceReference);
+ }
+ });
+ eventHandlerServiceTracker.open();
+ }
+
+ @Override
+ public void doStop() {
+ if (eventHandlerServiceTracker != null) {
+ eventHandlerServiceTracker.close();
+ eventHandlerServiceTracker = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java b/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java
index 6ff9191..9341334 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java
@@ -15,16 +15,22 @@ package org.apache.karaf.cellar.core.shell;
import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.GroupManager;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
import org.osgi.service.cm.ConfigurationAdmin;
/**
* Abstract Cellar command.
*/
-public abstract class CellarCommandSupport extends OsgiCommandSupport {
+public abstract class CellarCommandSupport implements Action {
+ @Reference
protected ClusterManager clusterManager;
+
+ @Reference
protected GroupManager groupManager;
+
+ @Reference
protected ConfigurationAdmin configurationAdmin;
public ClusterManager getClusterManager() {
@@ -51,4 +57,11 @@ public abstract class CellarCommandSupport extends OsgiCommandSupport {
this.configurationAdmin = configurationAdmin;
}
+ @Override
+ public Object execute() throws Exception {
+ return doExecute();
+ }
+
+ protected abstract Object doExecute() throws Exception;
+
}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java
index b5e776c..d8d4f5b 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java
@@ -14,10 +14,12 @@
package org.apache.karaf.cellar.core.shell.completer;
import org.apache.karaf.cellar.core.Group;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
/**
* Completer for all cluster groups.
*/
+@Service
public class AllGroupsCompleter extends GroupCompleterSupport {
/**
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllNodeCompleter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllNodeCompleter.java b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllNodeCompleter.java
index be7f26f..a2b85a5 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllNodeCompleter.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllNodeCompleter.java
@@ -14,10 +14,12 @@
package org.apache.karaf.cellar.core.shell.completer;
import org.apache.karaf.cellar.core.Node;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
/**
* A completer which includes all nodes.
*/
+@Service
public class AllNodeCompleter extends NodeCompleterSupport {
/**
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java
index bd172ef..058f1e8 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java
@@ -15,8 +15,11 @@ package org.apache.karaf.cellar.core.shell.completer;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.GroupManager;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
@@ -25,6 +28,7 @@ import java.util.List;
*/
public abstract class GroupCompleterSupport implements Completer {
+ @Reference
protected GroupManager groupManager;
/**
@@ -36,7 +40,7 @@ public abstract class GroupCompleterSupport implements Completer {
protected abstract boolean acceptsGroup(Group group);
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
for (Group group : groupManager.listAllGroups()) {
@@ -50,7 +54,7 @@ public abstract class GroupCompleterSupport implements Completer {
} catch (Exception e) {
// ignore
}
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
public GroupManager getGroupManager() {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java
index 16b42d5..61dd223 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java
@@ -15,10 +15,12 @@ package org.apache.karaf.cellar.core.shell.completer;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.Node;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
/**
* Local cluster groups completer.
*/
+@Service
public class LocalGroupsCompleter extends GroupCompleterSupport {
/**
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/NodeCompleterSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/NodeCompleterSupport.java b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/NodeCompleterSupport.java
index 815a658..2269315 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/NodeCompleterSupport.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/NodeCompleterSupport.java
@@ -15,8 +15,11 @@ package org.apache.karaf.cellar.core.shell.completer;
import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.Node;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
@@ -25,10 +28,11 @@ import java.util.List;
*/
public abstract class NodeCompleterSupport implements Completer {
+ @Reference
private ClusterManager clusterManager;
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
for (Node node : clusterManager.listNodes()) {
@@ -42,7 +46,7 @@ public abstract class NodeCompleterSupport implements Completer {
} catch (Exception e) {
// Ignore
}
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
protected abstract boolean acceptsNode(Node node);
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java
index 1098bea..dd9c495 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java
@@ -15,10 +15,12 @@ package org.apache.karaf.cellar.core.shell.completer;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.Node;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
/**
* Other groups completer.
*/
+@Service
public class OtherGroupsCompleter extends GroupCompleterSupport {
/**
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 851da4e..0000000
--- a/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <!-- Handlers Registry -->
- <bean id="registry" class="org.apache.karaf.cellar.core.event.EventHandlerServiceRegistry"/>
- <service ref="registry" interface="org.apache.karaf.cellar.core.event.EventHandlerRegistry"/>
-
- <reference-list id="eventHandlers" interface="org.apache.karaf.cellar.core.event.EventHandler" availability="optional">
- <reference-listener bind-method="bind" unbind-method="unbind">
- <ref component-id="registry"/>
- </reference-listener>
- </reference-list>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/dosgi/NOTICE
----------------------------------------------------------------------
diff --git a/dosgi/NOTICE b/dosgi/NOTICE
index addb35c..64cb235 100644
--- a/dosgi/NOTICE
+++ b/dosgi/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/dosgi/pom.xml
----------------------------------------------------------------------
diff --git a/dosgi/pom.xml b/dosgi/pom.xml
index 0bfde3b..43f8f71 100644
--- a/dosgi/pom.xml
+++ b/dosgi/pom.xml
@@ -40,8 +40,12 @@
<artifactId>org.apache.karaf.cellar.core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.table</artifactId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -72,27 +76,28 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.dosgi*;version="${project.version}"
+ !org.apache.karaf.cellar.dosgi.internal.osgi,
+ org.apache.karaf.cellar.dosgi*
</Export-Package>
<Import-Package>
- javax.management*,
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.apache.felix.service.command,
- org.apache.felix.gogo.commands,
- org.apache.karaf.shell.console;version="[3,5)",
- org.apache.karaf.shell.console.commands;version="[3,5)",
- org.apache.karaf.shell.console.completer;version="[3,5)",
- org.apache.karaf.shell.commands;version="[3,5)",
- org.apache.karaf.shell.table;version="[3,5)",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ org.apache.karaf.shell*;resolution:=optional,
+ *
</Import-Package>
<DynamicImport-Package>javax.*,org.w3c.*,org.xml.*,org.apache.karaf.cellar.*</DynamicImport-Package>
+ <Private-Package>
+ org.apache.karaf.cellar.dosgi.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/internal/osgi/Activator.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/internal/osgi/Activator.java
new file mode 100644
index 0000000..2a17db2
--- /dev/null
+++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/internal/osgi/Activator.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed 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.cellar.dosgi.internal.osgi;
+
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.command.CommandStore;
+import org.apache.karaf.cellar.core.event.EventHandler;
+import org.apache.karaf.cellar.core.event.EventTransportFactory;
+import org.apache.karaf.cellar.dosgi.*;
+import org.apache.karaf.cellar.dosgi.management.internal.ServiceMBeanImpl;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.hooks.service.ListenerHook;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(ListenerHook.class),
+ @ProvideService(EventHandler.class)
+ },
+ requires = {
+ @RequireService(ClusterManager.class),
+ @RequireService(EventTransportFactory.class),
+ @RequireService(CommandStore.class),
+ @RequireService(ConfigurationAdmin.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private ImportServiceListener importServiceListener;
+ private ExportServiceListener exportServiceListener;
+ private ServiceRegistration mbeanRegistration;
+
+ @Override
+ public void doStart() throws Exception {
+
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ EventTransportFactory eventTransportFactory = getTrackedService(EventTransportFactory.class);
+ CommandStore commandStore = getTrackedService(CommandStore.class);
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+
+ LOGGER.debug("[CELLAR DOSGi] Init remote service call handler");
+ RemoteServiceCallHandler remoteServiceCallHandler = new RemoteServiceCallHandler();
+ remoteServiceCallHandler.setEventTransportFactory(eventTransportFactory);
+ remoteServiceCallHandler.setClusterManager(clusterManager);
+ remoteServiceCallHandler.setBundleContext(bundleContext);
+ remoteServiceCallHandler.setConfigurationAdmin(configurationAdmin);
+ Hashtable props = new Hashtable();
+ props.put("managed", "true");
+ register(EventHandler.class, remoteServiceCallHandler, props);
+
+ LOGGER.debug("[CELLAR DOSGi] Init remote service result handler");
+ RemoteServiceResultHandler remoteServiceResultHandler = new RemoteServiceResultHandler();
+ remoteServiceResultHandler.setCommandStore(commandStore);
+ register(EventHandler.class, remoteServiceCallHandler);
+
+ LOGGER.debug("[CELLAR DOSGi] Init import service listener");
+ importServiceListener = new ImportServiceListener();
+ importServiceListener.setClusterManager(clusterManager);
+ importServiceListener.setEventTransportFactory(eventTransportFactory);
+ importServiceListener.setCommandStore(commandStore);
+ importServiceListener.setBundleContext(bundleContext);
+ importServiceListener.init();
+ register(ListenerHook.class, importServiceListener);
+
+ LOGGER.debug("[CELLAR DOSGi] Init export service listener");
+ exportServiceListener = new ExportServiceListener();
+ exportServiceListener.setClusterManager(clusterManager);
+ exportServiceListener.setEventTransportFactory(eventTransportFactory);
+ exportServiceListener.setBundleContext(bundleContext);
+ exportServiceListener.init();
+
+ LOGGER.debug("[CELLAR DOSGi] Register MBean");
+ ServiceMBeanImpl mbean = new ServiceMBeanImpl();
+ mbean.setClusterManager(clusterManager);
+ props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=service,name=" + System.getProperty("karaf.name"));
+ mbeanRegistration = bundleContext.registerService(getInterfaceNames(mbean), mbean, props);
+ }
+
+ @Override
+ public void doStop() {
+ if (mbeanRegistration != null) {
+ mbeanRegistration.unregister();
+ mbeanRegistration = null;
+ }
+ if (exportServiceListener != null) {
+ exportServiceListener.destroy();
+ exportServiceListener = null;
+ }
+ if (importServiceListener != null) {
+ importServiceListener.destroy();
+ importServiceListener = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java
----------------------------------------------------------------------
diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java
index c3bf6e4..d5ad96b 100644
--- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java
+++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java
@@ -17,13 +17,15 @@ import org.apache.karaf.cellar.core.Node;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
import org.apache.karaf.cellar.dosgi.Constants;
import org.apache.karaf.cellar.dosgi.EndpointDescription;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.table.ShellTable;
import java.util.Map;
import java.util.Set;
@Command(scope = "cluster", name = "service-list", description = "List the services available on the cluster")
+@Service
public class ListDistributedServicesCommand extends CellarCommandSupport {
@Override
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 51171fc..0000000
--- a/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
- -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <!-- Import Service Listener -->
- <bean id="importServiceListener" class="org.apache.karaf.cellar.dosgi.ImportServiceListener" init-method="init" destroy-method="destroy">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="commandStore" ref="commandStore"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="eventTransportFactory" ref="eventTransportFactory"/>
- </bean>
- <service ref="importServiceListener" interface="org.osgi.framework.hooks.service.ListenerHook"/>
-
- <!-- Export Service Listener -->
- <bean id="exportServiceListener" class="org.apache.karaf.cellar.dosgi.ExportServiceListener" init-method="init" destroy-method="destroy">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="eventTransportFactory" ref="eventTransportFactory"/>
- </bean>
-
- <!-- Remote Service Call Event Handler -->
- <bean id="remoteServiceCallHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="eventTransportFactory" ref="eventTransportFactory"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="configurationAdmin" ref="configurationAdmin" />
- </bean>
- <service ref="remoteServiceCallHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
- <service-properties>
- <entry key="managed" value="true"/>
- </service-properties>
- </service>
-
- <!-- Remote Service Result Event Handler -->
- <bean id="remoteServiceResultHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceResultHandler">
- <property name="commandStore" ref="commandStore"/>
- </bean>
- <service ref="remoteServiceResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
- <reference id="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
- <reference id="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/dosgi/src/main/resources/OSGI-INF/blueprint/management.xml
----------------------------------------------------------------------
diff --git a/dosgi/src/main/resources/OSGI-INF/blueprint/management.xml b/dosgi/src/main/resources/OSGI-INF/blueprint/management.xml
deleted file mode 100644
index 3b52c9a..0000000
--- a/dosgi/src/main/resources/OSGI-INF/blueprint/management.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed 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.
- -->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
-
- <!-- system properties -->
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
-
- <!-- Cellar Service MBean -->
- <bean id="cellarServiceMBean" class="org.apache.karaf.cellar.dosgi.management.internal.ServiceMBeanImpl">
- <property name="clusterManager" ref="clusterManager"/>
- </bean>
- <service ref="cellarServiceMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf.cellar:type=service,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml
----------------------------------------------------------------------
diff --git a/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml b/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml
deleted file mode 100644
index c365313..0000000
--- a/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.apache.karaf.cellar.dosgi.shell.ListDistributedServicesCommand">
- <property name="clusterManager" ref="clusterManager"/>
- </action>
- </command>
- </command-bundle>
-
-</blueprint>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/event/NOTICE
----------------------------------------------------------------------
diff --git a/event/NOTICE b/event/NOTICE
index addb35c..64cb235 100644
--- a/event/NOTICE
+++ b/event/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/event/pom.xml
----------------------------------------------------------------------
diff --git a/event/pom.xml b/event/pom.xml
index 5c01fb2..3ad8b67 100644
--- a/event/pom.xml
+++ b/event/pom.xml
@@ -40,6 +40,15 @@
<artifactId>org.apache.karaf.cellar.core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
@@ -56,18 +65,26 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.event*;version="${project.version}"
+ !org.apache.karaf.cellar.event.internal.osgi,
+ org.apache.karaf.cellar.event*
</Export-Package>
<Import-Package>
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ *
</Import-Package>
+ <Private-Package>
+ org.apache.karaf.cellar.event.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
+ </Private-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/event/src/main/java/org/apache/karaf/cellar/event/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/event/src/main/java/org/apache/karaf/cellar/event/internal/osgi/Activator.java b/event/src/main/java/org/apache/karaf/cellar/event/internal/osgi/Activator.java
new file mode 100644
index 0000000..e4810f1
--- /dev/null
+++ b/event/src/main/java/org/apache/karaf/cellar/event/internal/osgi/Activator.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed 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.cellar.event.internal.osgi;
+
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.core.event.EventHandler;
+import org.apache.karaf.cellar.core.event.EventProducer;
+import org.apache.karaf.cellar.event.ClusterEventHandler;
+import org.apache.karaf.cellar.event.LocalEventListener;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.event.EventAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(EventHandler.class),
+ @ProvideService(org.osgi.service.event.EventHandler.class)
+ },
+ requires = {
+ @RequireService(ClusterManager.class),
+ @RequireService(GroupManager.class),
+ @RequireService(ConfigurationAdmin.class),
+ @RequireService(EventAdmin.class),
+ @RequireService(EventProducer.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private LocalEventListener localEventListener;
+ private ClusterEventHandler clusterEventHandler;
+
+ @Override
+ public void doStart() throws Exception {
+
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ GroupManager groupManager = getTrackedService(GroupManager.class);
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+ EventAdmin eventAdmin = getTrackedService(EventAdmin.class);
+ EventProducer eventProducer = getTrackedService(EventProducer.class);
+
+ LOGGER.debug("[CELLAR EVENTADMIN] Init event handler");
+ clusterEventHandler = new ClusterEventHandler();
+ clusterEventHandler.setConfigurationAdmin(configurationAdmin);
+ clusterEventHandler.setGroupManager(groupManager);
+ clusterEventHandler.setClusterManager(clusterManager);
+ clusterEventHandler.setEventAdmin(eventAdmin);
+ clusterEventHandler.init();
+ Hashtable props = new Hashtable();
+ props.put("managed", "true");
+ register(EventHandler.class, clusterEventHandler, props);
+
+ LOGGER.debug("[CELLAR EVENTADMIN] Init local event listener");
+ localEventListener = new LocalEventListener();
+ localEventListener.setClusterManager(clusterManager);
+ localEventListener.setGroupManager(groupManager);
+ localEventListener.setConfigurationAdmin(configurationAdmin);
+ localEventListener.setEventProducer(eventProducer);
+ localEventListener.init();
+ props = new Hashtable();
+ props.put("event.topics", "*");
+ register(org.osgi.service.event.EventHandler.class, localEventListener, props);
+ }
+
+ @Override
+ public void doStop() {
+ if (localEventListener != null) {
+ localEventListener.destroy();
+ localEventListener = null;
+ }
+ if (clusterEventHandler != null) {
+ clusterEventHandler.destroy();
+ clusterEventHandler = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 577b34c..0000000
--- a/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed 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.
- -->
-<blueprint default-availability="mandatory"
- xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
- http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <!-- Local Event Listener -->
- <bean id="localEventListener" class="org.apache.karaf.cellar.event.LocalEventListener" init-method="init" destroy-method="destroy">
- <property name="clusterManager" ref="clusterManager"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="eventProducer" ref="eventProducer"/>
- </bean>
- <service ref="localEventListener">
- <interfaces>
- <value>org.osgi.service.event.EventHandler</value>
- </interfaces>
- <service-properties>
- <entry key="event.topics">
- <array value-type="java.lang.String">
- <value>*</value>
- </array>
- </entry>
- </service-properties>
- </service>
-
- <!-- Cluster Event Handler -->
- <bean id="clusterEventHandler" class="org.apache.karaf.cellar.event.ClusterEventHandler" init-method="init" destroy-method="destroy">
- <property name="configurationAdmin" ref="configurationAdmin"/>
- <property name="groupManager" ref="groupManager"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="eventAdmin" ref="eventAdmin"/>
- </bean>
- <service ref="clusterEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
- <service-properties>
- <entry key="managed" value="true"/>
- </service-properties>
- </service>
-
- <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
- <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
- <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
- <reference id="eventAdmin" interface="org.osgi.service.event.EventAdmin" />
- <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/NOTICE
----------------------------------------------------------------------
diff --git a/features/NOTICE b/features/NOTICE
index addb35c..64cb235 100644
--- a/features/NOTICE
+++ b/features/NOTICE
@@ -1,5 +1,5 @@
Apache Karaf Cellar
-Copyright 2011-2014 The Apache Software Foundation
+Copyright 2011-2015 The Apache Software Foundation
I. Used Software
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/pom.xml
----------------------------------------------------------------------
diff --git a/features/pom.xml b/features/pom.xml
index ed3f00a..075e79f 100644
--- a/features/pom.xml
+++ b/features/pom.xml
@@ -40,8 +40,12 @@
<artifactId>org.apache.karaf.cellar.core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.table</artifactId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -59,10 +63,6 @@
<groupId>org.apache.karaf.features</groupId>
<artifactId>org.apache.karaf.features.core</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.karaf.features</groupId>
- <artifactId>org.apache.karaf.features.command</artifactId>
- </dependency>
<!-- Logging -->
<dependency>
@@ -92,29 +92,28 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
- org.apache.karaf.cellar.features*;version="${project.version}"
+ !org.apache.karaf.cellar.features.management.internal,
+ !org.apache.karaf.cellar.features.internal.osgi,
+ org.apache.karaf.cellar.features*
</Export-Package>
<Import-Package>
- javax.management*,
- org.apache.karaf.cellar.core*;version="${project.version}",
- org.apache.felix.service.command,
- org.apache.felix.gogo.commands,
- org.apache.karaf.shell.console;version="[3,5)",
- org.apache.karaf.shell.console.commands;version="[3,5)",
- org.apache.karaf.shell.console.completer;version="[3,5)",
- org.apache.karaf.shell.table;version="[3,5)",
- org.apache.karaf.shell.commands;version="[3,5)",
- org.apache.karaf.features*;version="[3,5)",
- org.osgi*,
- org.slf4j;version="[1.6,2)";resolution:=optional
+ org.slf4j;version="[1.6,2)";resolution:=optional,
+ org.apache.karaf.shell*;resolution:=optional,
+ *
</Import-Package>
<Private-Package>
- org.apache.karaf.cellar.features.management.internal
+ org.apache.karaf.cellar.features.management.internal,
+ org.apache.karaf.cellar.features.internal.osgi,
+ org.apache.karaf.util.tracker;-split-package:=merge-first
</Private-Package>
</instructions>
</configuration>
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/internal/osgi/Activator.java b/features/src/main/java/org/apache/karaf/cellar/features/internal/osgi/Activator.java
new file mode 100644
index 0000000..e8ea14a
--- /dev/null
+++ b/features/src/main/java/org/apache/karaf/cellar/features/internal/osgi/Activator.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed 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.cellar.features.internal.osgi;
+
+import org.apache.karaf.cellar.core.ClusterManager;
+import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.core.Synchronizer;
+import org.apache.karaf.cellar.core.event.EventProducer;
+import org.apache.karaf.cellar.features.FeaturesEventHandler;
+import org.apache.karaf.cellar.features.FeaturesSynchronizer;
+import org.apache.karaf.cellar.features.LocalFeaturesListener;
+import org.apache.karaf.cellar.features.RepositoryEventHandler;
+import org.apache.karaf.cellar.features.management.internal.CellarFeaturesMBeanImpl;
+import org.apache.karaf.features.FeaturesListener;
+import org.apache.karaf.features.FeaturesService;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.ProvideService;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.event.EventHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Hashtable;
+
+@Services(
+ provides = {
+ @ProvideService(FeaturesListener.class),
+ @ProvideService(Synchronizer.class),
+ @ProvideService(EventHandler.class)
+ },
+ requires = {
+ @RequireService(ClusterManager.class),
+ @RequireService(GroupManager.class),
+ @RequireService(EventProducer.class),
+ @RequireService(ConfigurationAdmin.class),
+ @RequireService(FeaturesService.class)
+ }
+)
+public class Activator extends BaseActivator {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Activator.class);
+
+ private LocalFeaturesListener localFeaturesListener;
+ private FeaturesSynchronizer featuresSynchronizer;
+ private FeaturesEventHandler featuresEventHandler;
+ private RepositoryEventHandler repositoryEventHandler;
+ private ServiceRegistration mbeanRegistration;
+
+ @Override
+ public void doStart() throws Exception {
+
+ ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
+ ClusterManager clusterManager = getTrackedService(ClusterManager.class);
+ GroupManager groupManager = getTrackedService(GroupManager.class);
+ EventProducer eventProducer = getTrackedService(EventProducer.class);
+ FeaturesService featuresService = getTrackedService(FeaturesService.class);
+
+ LOGGER.debug("[CELLAR FEATURES] Init repository event handler");
+ repositoryEventHandler = new RepositoryEventHandler();
+ repositoryEventHandler.setConfigurationAdmin(configurationAdmin);
+ repositoryEventHandler.setFeaturesService(featuresService);
+ repositoryEventHandler.setClusterManager(clusterManager);
+ repositoryEventHandler.setGroupManager(groupManager);
+ repositoryEventHandler.init();
+ Hashtable props = new Hashtable();
+ props.put("managed", "true");
+ register(new Class[]{ EventHandler.class }, repositoryEventHandler, props);
+
+ LOGGER.debug("[CELLAR FEATURES] Init features event handler");
+ featuresEventHandler = new FeaturesEventHandler();
+ featuresEventHandler.setFeaturesService(featuresService);
+ featuresEventHandler.setClusterManager(clusterManager);
+ featuresEventHandler.setGroupManager(groupManager);
+ featuresEventHandler.setConfigurationAdmin(configurationAdmin);
+ featuresEventHandler.init();
+ register(new Class[]{ EventHandler.class }, featuresEventHandler, props);
+
+ LOGGER.debug("[CELLAR FEATURES] Init local features listener");
+ localFeaturesListener = new LocalFeaturesListener();
+ localFeaturesListener.setClusterManager(clusterManager);
+ localFeaturesListener.setGroupManager(groupManager);
+ localFeaturesListener.setEventProducer(eventProducer);
+ localFeaturesListener.setConfigurationAdmin(configurationAdmin);
+ localFeaturesListener.setFeaturesService(featuresService);
+ localFeaturesListener.init();
+ register(FeaturesListener.class, localFeaturesListener);
+
+ LOGGER.debug("[CELLAR FEATURES] Init features synchronizer");
+ featuresSynchronizer = new FeaturesSynchronizer();
+ featuresSynchronizer.setClusterManager(clusterManager);
+ featuresSynchronizer.setGroupManager(groupManager);
+ featuresSynchronizer.setConfigurationAdmin(configurationAdmin);
+ featuresSynchronizer.setFeaturesService(featuresService);
+ featuresSynchronizer.init();
+ props = new Hashtable();
+ props.put("resource", "feature");
+ register(Synchronizer.class, featuresSynchronizer, props);
+
+ LOGGER.debug("[CELLAR FEATURES] Register MBean");
+ CellarFeaturesMBeanImpl mbean = new CellarFeaturesMBeanImpl();
+ mbean.setClusterManager(clusterManager);
+ mbean.setGroupManager(groupManager);
+ mbean.setConfigurationAdmin(configurationAdmin);
+ mbean.setFeaturesService(featuresService);
+ mbean.setEventProducer(eventProducer);
+ props = new Hashtable();
+ props.put("jmx.objectname", "org.apache.karaf.cellar:type=feature,name=" + System.getProperty("karaf.name"));
+ mbeanRegistration = bundleContext.registerService(getInterfaceNames(mbean), mbean, props);
+
+ }
+
+ @Override
+ public void doStop() {
+ if (mbeanRegistration != null) {
+ mbeanRegistration.unregister();
+ mbeanRegistration = null;
+ }
+ if (featuresSynchronizer != null) {
+ featuresSynchronizer.destroy();
+ featuresSynchronizer = null;
+ }
+ if (localFeaturesListener != null) {
+ localFeaturesListener.destroy();
+ localFeaturesListener = null;
+ }
+ if (featuresEventHandler != null) {
+ featuresEventHandler.destroy();
+ featuresEventHandler = null;
+ }
+ if (repositoryEventHandler != null) {
+ repositoryEventHandler.destroy();
+ repositoryEventHandler = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/shell/BlockCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/BlockCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/BlockCommand.java
index cf9143d..eb246e7 100644
--- a/features/src/main/java/org/apache/karaf/cellar/features/shell/BlockCommand.java
+++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/BlockCommand.java
@@ -18,17 +18,22 @@ import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.features.Constants;
-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.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.Set;
@Command(scope = "cluster", name = "feature-block", description = "Change the blocking policy for a feature")
+@Service
public class BlockCommand extends CellarCommandSupport {
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "featurePattern", description = "The feature pattern to block.", required = false, multiValued = false)
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/3e5e7c33/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java
----------------------------------------------------------------------
diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java
index 9c36e7e..2a43ed6 100644
--- a/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java
+++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java
@@ -20,19 +20,24 @@ import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
+import org.apache.karaf.cellar.core.shell.completer.AllGroupsCompleter;
import org.apache.karaf.cellar.features.ClusterFeaturesEvent;
import org.apache.karaf.cellar.features.Constants;
import org.apache.karaf.cellar.features.FeatureState;
import org.apache.karaf.features.FeatureEvent;
import org.apache.karaf.features.FeaturesService;
-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.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
import java.util.Map;
@Command(scope = "cluster", name = "feature-install", description = "Install a feature in a cluster group")
+@Service
public class InstallFeatureCommand extends CellarCommandSupport {
@Option(name = "-c", aliases = {"--no-clean"}, description = "Do not uninstall bundles on failure", required = false, multiValued = false)
@@ -45,12 +50,16 @@ public class InstallFeatureCommand extends CellarCommandSupport {
boolean noStart;
@Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
+ @Completion(AllGroupsCompleter.class)
String groupName;
@Argument(index = 1, name = "features", description = "The name and version of the features to install. A feature id looks like name/version. The version is optional.", required = true, multiValued = true)
List<String> features;
+ @Reference
private EventProducer eventProducer;
+
+ @Reference
private FeaturesService featuresService;
@Override