Repository: incubator-brooklyn Updated Branches: refs/heads/master 25e1c31d2 -> 8457515f6
[BROOKLYN-183] Skeleton of karaf shell commands project Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/99c8218a Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/99c8218a Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/99c8218a Branch: refs/heads/master Commit: 99c8218a01fe9c3feda783363e250112719c2371 Parents: b9d5a46 Author: Ciprian Ciubotariu <[email protected]> Authored: Thu Sep 24 17:37:59 2015 +0300 Committer: Ciprian Ciubotariu <[email protected]> Committed: Sun Oct 25 00:58:37 2015 +0300 ---------------------------------------------------------------------- karaf/commands/pom.xml | 77 ++++++++++++++++++++ .../apache/brooklyn/karaf/commands/Catalog.java | 27 +++++++ karaf/features/src/main/resources/features.xml | 4 + karaf/pom.xml | 4 +- 4 files changed, 110 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/commands/pom.xml ---------------------------------------------------------------------- diff --git a/karaf/commands/pom.xml b/karaf/commands/pom.xml new file mode 100644 index 0000000..f3c60e6 --- /dev/null +++ b/karaf/commands/pom.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <!-- + 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. + --> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>brooklyn-karaf</artifactId> + <groupId>org.apache.brooklyn</groupId> + <version>0.9.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-commands</artifactId> + <packaging>bundle</packaging> + <version>0.9.0-SNAPSHOT</version> + + <name>Brooklyn Karaf Shell Commands</name> + <description>Provides brooklyn commands within karaf's shell</description> + + <dependencies> + <dependency> + <groupId>org.apache.karaf.shell</groupId> + <artifactId>org.apache.karaf.shell.core</artifactId> + <version>${karaf.version}</version> + </dependency> + + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <version>${org.osgi.core.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${org.osgi.compendium.version}</version> + <scope>provided</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> + <Export-Package>org.apache.brooklyn.karaf.commands*;version=${project.version};-noimport:=true</Export-Package> + <Karaf-Commands>org.apache.brooklyn.karaf.commands*</Karaf-Commands> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java ---------------------------------------------------------------------- diff --git a/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java b/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java new file mode 100644 index 0000000..3df948a --- /dev/null +++ b/karaf/commands/src/main/java/org/apache/brooklyn/karaf/commands/Catalog.java @@ -0,0 +1,27 @@ + +package org.apache.brooklyn.karaf.commands; + +import org.apache.karaf.shell.api.action.Action; +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.Service; + +@Command(scope = "brooklyn", name = "catalog", description = "Manage the local brooklyn catalog") +@Service +public class Catalog implements Action { + + @Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false) + private String option; + + @Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false) + private String argument; + + @Override + public Object execute() throws Exception { + System.out.println("Executing command catalog"); + System.out.println("Option: " + option); + System.out.println("Argument: " + argument); + return null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/features/src/main/resources/features.xml ---------------------------------------------------------------------- diff --git a/karaf/features/src/main/resources/features.xml b/karaf/features/src/main/resources/features.xml index ff843f9..ccbd649 100755 --- a/karaf/features/src/main/resources/features.xml +++ b/karaf/features/src/main/resources/features.xml @@ -9,4 +9,8 @@ <feature name="brooklyn-core" version="${project.version}" resolver="(obr)"> <bundle>mvn:org.apache.brooklyn/brooklyn-core/${project.version}</bundle> </feature> + + <feature name="brooklyn-commands" version="${project.version}"> + <bundle>mvn:org.apache.brooklyn/brooklyn-commands/${project.version}</bundle> + </feature> </features> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/99c8218a/karaf/pom.xml ---------------------------------------------------------------------- diff --git a/karaf/pom.xml b/karaf/pom.xml index 94b7750..b5c70d8 100644 --- a/karaf/pom.xml +++ b/karaf/pom.xml @@ -17,8 +17,7 @@ specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -46,6 +45,7 @@ <modules> <module>features</module> <module>apache-brooklyn</module> + <module>commands</module> </modules> <build>
