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
