Adding archetype for onos-bundle and onos-cli projects.
Change-Id: I5df9db6a571be682ff2200c182bad8100dd95bfe
diff --git a/tools/build/onos-package b/tools/build/onos-package
index ff1d218..5a528ba 100755
--- a/tools/build/onos-package
+++ b/tools/build/onos-package
@@ -72,6 +72,6 @@
# Now package up the ONOS tar file
cd $ONOS_STAGE_ROOT
COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS
-which -a zip && zip -rq $ONOS_ZIP $ONOS_BITS
+which zip >/dev/null && zip -rq $ONOS_ZIP $ONOS_BITS
ls -l $ONOS_TAR $ONOS_ZIP >&2
rm -r $ONOS_STAGE
diff --git a/tools/dev/bin/onos-build-selective b/tools/dev/bin/onos-build-selective
index 32b75e7..0becd32 100755
--- a/tools/dev/bin/onos-build-selective
+++ b/tools/dev/bin/onos-build-selective
@@ -4,7 +4,7 @@
# ----------------------------------------------------------------------------
projects=$(find $ONOS_ROOT -name '*.java' \
- -not -path '*/openflowj/*' -and -not -path '.git/*' \
+ -not -path '*/openflowj/*' -and -not -path '.git/*' -and -not -path '*/archetypes/*' \
-exec $ONOS_ROOT/tools/dev/bin/onos-build-selective-hook {} \; | \
sort -u | sed "s:$ONOS_ROOT::g" | tr '\n' ',' | \
sed 's:/,:,:g;s:,/:,:g;s:^/::g;s:,$::g')
diff --git a/tools/package/archetypes/api/pom.xml b/tools/package/archetypes/api/pom.xml
new file mode 100644
index 0000000..f0fc19a
--- /dev/null
+++ b/tools/package/archetypes/api/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-archetypes</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>onos-api-archetype</artifactId>
+ <packaging>maven-archetype</packaging>
+
+ <description>ONOS OSGi API bundle archetype</description>
+
+</project>
diff --git a/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..5057fbf
--- /dev/null
+++ b/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="onos-bundle"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</archetype-descriptor>
diff --git a/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..2000913
--- /dev/null
+++ b/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+ <packaging>bundle</packaging>
+
+ <description>ONOS OSGi API bundle archetype</description>
+ <url>http://onosproject.org</url>
+
+ <properties>
+ <onos.version>1.0.0-SNAPSHOT</onos.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.5.3</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tools/package/archetypes/bundle/src/main/java/sample/bundle/AppService.java b/tools/package/archetypes/api/src/main/resources/archetype-resources/src/main/java/AppService.java
similarity index 86%
rename from tools/package/archetypes/bundle/src/main/java/sample/bundle/AppService.java
rename to tools/package/archetypes/api/src/main/resources/archetype-resources/src/main/java/AppService.java
index 9e658d4..4878f2b 100644
--- a/tools/package/archetypes/bundle/src/main/java/sample/bundle/AppService.java
+++ b/tools/package/archetypes/api/src/main/resources/archetype-resources/src/main/java/AppService.java
@@ -1,3 +1,6 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
/*
* Copyright 2014 Open Networking Laboratory
*
@@ -13,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package sample.bundle;
+package ${package};
/**
* Skeletal ONOS application API.
diff --git a/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..f641e66
--- /dev/null
+++ b/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,5 @@
+#Thu Dec 04 09:24:50 PST 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/tools/package/archetypes/api/src/test/resources/projects/basic/goal.txt b/tools/package/archetypes/api/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/package/archetypes/api/src/test/resources/projects/basic/goal.txt
diff --git a/tools/package/archetypes/bundle/pom.xml b/tools/package/archetypes/bundle/pom.xml
index 900a416..472fc6e 100644
--- a/tools/package/archetypes/bundle/pom.xml
+++ b/tools/package/archetypes/bundle/pom.xml
@@ -1,100 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2014 Open Networking Laboratory
- ~
- ~ 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.
- -->
-<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">
- <modelVersion>4.0.0</modelVersion>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
<groupId>org.onosproject</groupId>
- <artifactId>onos-bundle</artifactId>
+ <artifactId>onos-archetypes</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
+ </parent>
- <description>ONOS OSGi bundle archetype</description>
- <url>http://onosproject.org</url>
+ <artifactId>onos-bundle-archetype</artifactId>
+ <packaging>maven-archetype</packaging>
- <properties>
- <onos.version>1.0.0-SNAPSHOT</onos.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.8</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <version>${onos.version}</version>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.5.3</version>
- <extensions>true</extensions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.20.0</version>
- <executions>
- <execution>
- <id>generate-scr-srcdescriptor</id>
- <goals>
- <goal>scr</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <description>ONOS OSGi bundle archetype</description>
</project>
diff --git a/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..7ab9be8
--- /dev/null
+++ b/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="onos-bundle"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</archetype-descriptor>
diff --git a/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..d99567d
--- /dev/null
+++ b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+ <packaging>bundle</packaging>
+
+ <description>ONOS OSGi bundle archetype</description>
+ <url>http://onosproject.org</url>
+
+ <properties>
+ <onos.version>1.0.0-SNAPSHOT</onos.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-osgi</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ <version>1.9.8</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.5.3</version>
+ <extensions>true</extensions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ <version>1.20.0</version>
+ <executions>
+ <execution>
+ <id>generate-scr-srcdescriptor</id>
+ <goals>
+ <goal>scr</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <supportedProjectTypes>
+ <supportedProjectType>bundle</supportedProjectType>
+ <supportedProjectType>war</supportedProjectType>
+ </supportedProjectTypes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tools/package/archetypes/bundle/src/main/java/sample/bundle/AppComponent.java b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java
similarity index 89%
rename from tools/package/archetypes/bundle/src/main/java/sample/bundle/AppComponent.java
rename to tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java
index 1d17f5f..cd66e59 100644
--- a/tools/package/archetypes/bundle/src/main/java/sample/bundle/AppComponent.java
+++ b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java
@@ -1,3 +1,6 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
/*
* Copyright 2014 Open Networking Laboratory
*
@@ -13,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package sample.bundle;
+package ${package};
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
@@ -26,8 +29,7 @@
* Skeletal ONOS application component.
*/
@Component(immediate = true)
-@Service
-public class AppComponent implements AppService {
+public class AppComponent {
private static Logger log = LoggerFactory.getLogger(AppComponent.class);
diff --git a/tools/package/archetypes/bundle/src/test/java/sample/bundle/AppComponentTest.java b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/test/java/AppComponentTest.java
similarity index 90%
rename from tools/package/archetypes/bundle/src/test/java/sample/bundle/AppComponentTest.java
rename to tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/test/java/AppComponentTest.java
index d18ba0d..b981225 100644
--- a/tools/package/archetypes/bundle/src/test/java/sample/bundle/AppComponentTest.java
+++ b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/test/java/AppComponentTest.java
@@ -1,3 +1,6 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
/*
* Copyright 2014 Open Networking Laboratory
*
@@ -13,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package sample.bundle;
+package ${package};
import org.junit.After;
import org.junit.Before;
diff --git a/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..f641e66
--- /dev/null
+++ b/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,5 @@
+#Thu Dec 04 09:24:50 PST 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/tools/package/archetypes/bundle/src/test/resources/projects/basic/goal.txt b/tools/package/archetypes/bundle/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/package/archetypes/bundle/src/test/resources/projects/basic/goal.txt
diff --git a/tools/package/archetypes/cli/pom.xml b/tools/package/archetypes/cli/pom.xml
new file mode 100644
index 0000000..59538e2
--- /dev/null
+++ b/tools/package/archetypes/cli/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-archetypes</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>onos-cli-archetype</artifactId>
+ <packaging>maven-archetype</packaging>
+
+ <name>onos-cli-archetype</name>
+ <description>ONOS Apache Karaf bundle archetype</description>
+
+</project>
diff --git a/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..5f30b85
--- /dev/null
+++ b/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="onos-bundle"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false" encoding="UTF-8">
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</archetype-descriptor>
diff --git a/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..1ffc613
--- /dev/null
+++ b/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+ <packaging>bundle</packaging>
+
+ <description>ONOS OSGi bundle archetype</description>
+ <url>http://onosproject.org</url>
+
+ <properties>
+ <onos.version>1.0.0-SNAPSHOT</onos.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-osgi</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-cli</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.3.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ <version>1.9.8</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <version>3.0.2</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.5.3</version>
+ <extensions>true</extensions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ <version>1.20.0</version>
+ <executions>
+ <execution>
+ <id>generate-scr-srcdescriptor</id>
+ <goals>
+ <goal>scr</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <supportedProjectTypes>
+ <supportedProjectType>bundle</supportedProjectType>
+ <supportedProjectType>war</supportedProjectType>
+ </supportedProjectTypes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tools/package/archetypes/bundle/src/main/java/sample/bundle/AppService.java b/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/java/AppCommand.java
similarity index 60%
copy from tools/package/archetypes/bundle/src/main/java/sample/bundle/AppService.java
copy to tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/java/AppCommand.java
index 9e658d4..9262b2e 100644
--- a/tools/package/archetypes/bundle/src/main/java/sample/bundle/AppService.java
+++ b/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/java/AppCommand.java
@@ -13,11 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package sample.bundle;
+package ${package};
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
/**
- * Skeletal ONOS application API.
+ * Sample Apache Karaf CLI command
*/
-public interface AppService {
+@Command(scope = "onos", name = "sample",
+ description = "Sample Apache Karaf CLI command")
+public class AppCommand extends AbstractShellCommand {
+
+ @Override
+ protected void execute() {
+ print("Hello %s", "World");
+ }
}
diff --git a/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..202ab9e
--- /dev/null
+++ b/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ 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">
+
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command>
+ <action class="${package}.AppCommand"/>
+ </command>
+ </command-bundle>
+
+</blueprint>
diff --git a/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..f641e66
--- /dev/null
+++ b/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,5 @@
+#Thu Dec 04 09:24:50 PST 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/tools/package/archetypes/cli/src/test/resources/projects/basic/goal.txt b/tools/package/archetypes/cli/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/package/archetypes/cli/src/test/resources/projects/basic/goal.txt
diff --git a/tools/package/archetypes/pom.xml b/tools/package/archetypes/pom.xml
index b0b61a8..4fa578d 100644
--- a/tools/package/archetypes/pom.xml
+++ b/tools/package/archetypes/pom.xml
@@ -21,18 +21,40 @@
<parent>
<groupId>org.onosproject</groupId>
- <artifactId>onos</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../../../pom.xml</relativePath>
+ <artifactId>onos-base</artifactId>
+ <version>1</version>
+ <relativePath>../../build/pom.xml</relativePath>
</parent>
<artifactId>onos-archetypes</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <description>ONOS Maven archetype projects</description>
+ <description>ONOS archetypes project</description>
<modules>
+ <module>api</module>
<module>bundle</module>
+ <module>cli</module>
</modules>
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>2.2</version>
+ </extension>
+ </extensions>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
</project>
diff --git a/tools/package/archetypes/web-bundle/save.xml b/tools/package/archetypes/web-bundle/save.xml
deleted file mode 100644
index 43e33fb..0000000
--- a/tools/package/archetypes/web-bundle/save.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-<!--
- ~ Copyright 2014 Open Networking Laboratory
- ~
- ~ 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.
- -->
-<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">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.onosproject</groupId>
- <artifactId>onos-web-bundle</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <description>ONOS OSGi web bundle archetype</description>
- <url>http://onosproject.org</url>
-
- <properties>
- <onos.version>1.0.0-SNAPSHOT</onos.version>
- <jersey.version>1.18.1</jersey.version>
- <jackson.version>2.4.2</jackson.version>
- <guava.version>18.0</guava.version>
-
- <web.context>sample</web.context>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-rest</artifactId>
- <version>${onos.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <version>${onos.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey.jersey-test-framework</groupId>
- <artifactId>jersey-test-framework-core</artifactId>
- <version>${jersey.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey.jersey-test-framework</groupId>
- <artifactId>jersey-test-framework-grizzly2</artifactId>
- <version>${jersey.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.3.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.8</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <_wab>src/main/webapp/</_wab>
- <Bundle-SymbolicName>
- ${project.groupId}.${project.artifactId}
- </Bundle-SymbolicName>
- <Import-Package>
- org.slf4j,
- org.osgi.framework,
- javax.ws.rs,javax.ws.rs.core,javax.ws.rs.ext,
- com.sun.jersey.api.core,
- com.sun.jersey.spi.container.servlet,
- com.sun.jersey.server.impl.container.servlet,
- com.fasterxml.jackson.databind,
- com.fasterxml.jackson.databind.node,
- org.onlab.util.*,
- org.onlab.osgi.*,
- org.onlab.packet.*,
- org.onlab.rest.*,
- org.onosproject.*
- </Import-Package>
- <Web-ContextPath>${web.context}</Web-ContextPath>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/tools/package/etc/users.properties b/tools/package/etc/users.properties
new file mode 100644
index 0000000..60aa1a3
--- /dev/null
+++ b/tools/package/etc/users.properties
@@ -0,0 +1,34 @@
+################################################################################
+#
+# 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.
+#
+################################################################################
+
+#
+# This file contains the users, groups, and roles.
+# Each line has to be of the format:
+#
+# USER=PASSWORD,ROLE1,ROLE2,...
+# USER=PASSWORD,_g_:GROUP,...
+# _g_\:GROUP=ROLE1,ROLE2,...
+#
+# All users, grousp, and roles entered in this file are available after Karaf startup
+# and modifiable via the JAAS command group. These users reside in a JAAS domain
+# with the name "karaf".
+#
+karaf = karaf,_g_:admingroup
+onos = onos,_g_:admingroup
+_g_\:admingroup = group,admin,manager,viewer,webconsole
diff --git a/tools/test/bin/onos-archetypes-test b/tools/test/bin/onos-archetypes-test
new file mode 100755
index 0000000..a7ae186
--- /dev/null
+++ b/tools/test/bin/onos-archetypes-test
@@ -0,0 +1,18 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Builds a set of projects using ONOS archetypes.
+# -----------------------------------------------------------------------------
+
+export AROOT=/tmp/foo
+export ARCHETYPE_OPTS="-DarchetypeGroupId=org.onosproject -Dversion=1.0.0-SNAPSHOT"
+
+for an in api bundle cli; do
+ cd $AROOT
+ rm -fr $AROOT/foo-$an
+ mvn archetype:generate $ARCHETYPE_OPTS \
+ -DarchetypeArtifactId=onos-$an-archetype \
+ -DgroupId=org.foo -DartifactId=foo-$an -Dversion=1.0 \
+ -Dpackage=org.foo.$an -DinteractiveMode=false
+ cd $AROOT/foo-$an
+ mvn clean install
+done