Committed by
Gerrit Code Review
Added onos-ui-archetype as a partial archetype to bootstrap UI development.
Modified onos-cli-archetype to be a partial archetype. Change-Id: I172bca5f67519f052bbb116486b3f1d7c51bc4bf
Showing
18 changed files
with
369 additions
and
5 deletions
... | @@ -14,7 +14,9 @@ | ... | @@ -14,7 +14,9 @@ |
14 | ~ See the License for the specific language governing permissions and | 14 | ~ See the License for the specific language governing permissions and |
15 | ~ limitations under the License. | 15 | ~ limitations under the License. |
16 | --> | 16 | --> |
17 | -<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" | 17 | +<archetype-descriptor |
18 | + 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" | ||
19 | + name="onos-bundle" | ||
18 | xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | 20 | xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" |
19 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | 21 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
20 | <fileSets> | 22 | <fileSets> | ... | ... |
... | @@ -14,7 +14,9 @@ | ... | @@ -14,7 +14,9 @@ |
14 | ~ See the License for the specific language governing permissions and | 14 | ~ See the License for the specific language governing permissions and |
15 | ~ limitations under the License. | 15 | ~ limitations under the License. |
16 | --> | 16 | --> |
17 | -<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" | 17 | +<archetype-descriptor |
18 | + 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" | ||
19 | + name="onos-bundle" | ||
18 | xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | 20 | xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" |
19 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | 21 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
20 | <fileSets> | 22 | <fileSets> | ... | ... |
... | @@ -27,6 +27,10 @@ | ... | @@ -27,6 +27,10 @@ |
27 | 27 | ||
28 | <properties> | 28 | <properties> |
29 | <onos.version>1.2.0-SNAPSHOT</onos.version> | 29 | <onos.version>1.2.0-SNAPSHOT</onos.version> |
30 | + <!-- Uncomment to generate ONOS app from this module. | ||
31 | + <onos.app.name>org.foo.app</onos.app.name> | ||
32 | + <onos.app.origin>Foo, Inc.</onos.app.origin> | ||
33 | + --> | ||
30 | </properties> | 34 | </properties> |
31 | 35 | ||
32 | <dependencies> | 36 | <dependencies> | ... | ... |
... | @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory; | ... | @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory; |
31 | @Component(immediate = true) | 31 | @Component(immediate = true) |
32 | public class AppComponent { | 32 | public class AppComponent { |
33 | 33 | ||
34 | - private static Logger log = LoggerFactory.getLogger(AppComponent.class); | 34 | + private final Logger log = LoggerFactory.getLogger(getClass()); |
35 | 35 | ||
36 | @Activate | 36 | @Activate |
37 | protected void activate() { | 37 | protected void activate() { | ... | ... |
... | @@ -14,7 +14,9 @@ | ... | @@ -14,7 +14,9 @@ |
14 | ~ See the License for the specific language governing permissions and | 14 | ~ See the License for the specific language governing permissions and |
15 | ~ limitations under the License. | 15 | ~ limitations under the License. |
16 | --> | 16 | --> |
17 | -<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" | 17 | +<archetype-descriptor |
18 | + 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" | ||
19 | + name="onos-cli" partial="true" | ||
18 | xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | 20 | xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" |
19 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | 21 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
20 | <fileSets> | 22 | <fileSets> | ... | ... |
tools/package/archetypes/ui/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<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"> | ||
18 | + <modelVersion>4.0.0</modelVersion> | ||
19 | + | ||
20 | + <parent> | ||
21 | + <groupId>org.onosproject</groupId> | ||
22 | + <artifactId>onos-archetypes</artifactId> | ||
23 | + <version>1.2.0-SNAPSHOT</version> | ||
24 | + </parent> | ||
25 | + | ||
26 | + <artifactId>onos-ui-archetype</artifactId> | ||
27 | + <packaging>maven-archetype</packaging> | ||
28 | + | ||
29 | + <description>ONOS UI overlay archetype</description> | ||
30 | + | ||
31 | +</project> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<archetype-descriptor | ||
18 | + 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" | ||
19 | + name="onos-ui" partial="true" | ||
20 | + xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | ||
21 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
22 | + <fileSets> | ||
23 | + <fileSet filtered="true" packaged="true" encoding="UTF-8"> | ||
24 | + <directory>src/main/java</directory> | ||
25 | + <includes> | ||
26 | + <include>**/*.java</include> | ||
27 | + </includes> | ||
28 | + </fileSet> | ||
29 | + <fileSet filtered="true" packaged="false" encoding="UTF-8"> | ||
30 | + <directory>src/main/resources</directory> | ||
31 | + <includes> | ||
32 | + <include>**/*.html</include> | ||
33 | + <include>**/*.js</include> | ||
34 | + <include>**/*.css</include> | ||
35 | + </includes> | ||
36 | + </fileSet> | ||
37 | + </fileSets> | ||
38 | +</archetype-descriptor> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<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"> | ||
18 | + <modelVersion>4.0.0</modelVersion> | ||
19 | + | ||
20 | + <groupId>${groupId}</groupId> | ||
21 | + <artifactId>${artifactId}</artifactId> | ||
22 | + <version>${version}</version> | ||
23 | + <packaging>bundle</packaging> | ||
24 | + | ||
25 | + <description>ONOS OSGi UI bundle archetype</description> | ||
26 | + <url>http://onosproject.org</url> | ||
27 | + | ||
28 | + <properties> | ||
29 | + <onos.version>1.2.0-SNAPSHOT</onos.version> | ||
30 | + <!-- Uncomment to generate ONOS app from this module. | ||
31 | + <onos.app.name>org.foo.app</onos.app.name> | ||
32 | + <onos.app.origin>Foo, Inc.</onos.app.origin> | ||
33 | + --> | ||
34 | + </properties> | ||
35 | + | ||
36 | + <dependencies> | ||
37 | + <dependency> | ||
38 | + <groupId>org.onosproject</groupId> | ||
39 | + <artifactId>onos-api</artifactId> | ||
40 | + <version>${onos.version}</version> | ||
41 | + </dependency> | ||
42 | + | ||
43 | + <dependency> | ||
44 | + <groupId>org.onosproject</groupId> | ||
45 | + <artifactId>onlab-osgi</artifactId> | ||
46 | + <version>${onos.version}</version> | ||
47 | + </dependency> | ||
48 | + | ||
49 | + <dependency> | ||
50 | + <groupId>junit</groupId> | ||
51 | + <artifactId>junit</artifactId> | ||
52 | + <version>4.11</version> | ||
53 | + <scope>test</scope> | ||
54 | + </dependency> | ||
55 | + | ||
56 | + <dependency> | ||
57 | + <groupId>org.onosproject</groupId> | ||
58 | + <artifactId>onos-api</artifactId> | ||
59 | + <version>${onos.version}</version> | ||
60 | + <scope>test</scope> | ||
61 | + <classifier>tests</classifier> | ||
62 | + </dependency> | ||
63 | + | ||
64 | + <dependency> | ||
65 | + <groupId>org.apache.felix</groupId> | ||
66 | + <artifactId>org.apache.felix.scr.annotations</artifactId> | ||
67 | + <version>1.9.8</version> | ||
68 | + <scope>provided</scope> | ||
69 | + </dependency> | ||
70 | + </dependencies> | ||
71 | + | ||
72 | + <build> | ||
73 | + <plugins> | ||
74 | + <plugin> | ||
75 | + <groupId>org.apache.felix</groupId> | ||
76 | + <artifactId>maven-bundle-plugin</artifactId> | ||
77 | + <version>2.5.3</version> | ||
78 | + <extensions>true</extensions> | ||
79 | + </plugin> | ||
80 | + <plugin> | ||
81 | + <groupId>org.apache.maven.plugins</groupId> | ||
82 | + <artifactId>maven-compiler-plugin</artifactId> | ||
83 | + <version>2.5.1</version> | ||
84 | + <configuration> | ||
85 | + <source>1.8</source> | ||
86 | + <target>1.8</target> | ||
87 | + </configuration> | ||
88 | + </plugin> | ||
89 | + <plugin> | ||
90 | + <groupId>org.apache.felix</groupId> | ||
91 | + <artifactId>maven-scr-plugin</artifactId> | ||
92 | + <version>1.20.0</version> | ||
93 | + <executions> | ||
94 | + <execution> | ||
95 | + <id>generate-scr-srcdescriptor</id> | ||
96 | + <goals> | ||
97 | + <goal>scr</goal> | ||
98 | + </goals> | ||
99 | + </execution> | ||
100 | + </executions> | ||
101 | + <configuration> | ||
102 | + <supportedProjectTypes> | ||
103 | + <supportedProjectType>bundle</supportedProjectType> | ||
104 | + <supportedProjectType>war</supportedProjectType> | ||
105 | + </supportedProjectTypes> | ||
106 | + </configuration> | ||
107 | + </plugin> | ||
108 | + <plugin> | ||
109 | + <groupId>org.onosproject</groupId> | ||
110 | + <artifactId>onos-maven-plugin</artifactId> | ||
111 | + <version>1.4-SNAPSHOT</version> | ||
112 | + <executions> | ||
113 | + <execution> | ||
114 | + <id>cfg</id> | ||
115 | + <phase>generate-resources</phase> | ||
116 | + <goals> | ||
117 | + <goal>cfg</goal> | ||
118 | + </goals> | ||
119 | + </execution> | ||
120 | + <execution> | ||
121 | + <id>app</id> | ||
122 | + <phase>package</phase> | ||
123 | + <goals> | ||
124 | + <goal>app</goal> | ||
125 | + </goals> | ||
126 | + </execution> | ||
127 | + </executions> | ||
128 | + </plugin> | ||
129 | + </plugins> | ||
130 | + </build> | ||
131 | + | ||
132 | +</project> |
tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
0 → 100644
1 | +#set( $symbol_pound = '#' ) | ||
2 | +#set( $symbol_dollar = '$' ) | ||
3 | +#set( $symbol_escape = '\' ) | ||
4 | +/* | ||
5 | + * Copyright 2014 Open Networking Laboratory | ||
6 | + * | ||
7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
8 | + * you may not use this file except in compliance with the License. | ||
9 | + * You may obtain a copy of the License at | ||
10 | + * | ||
11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
12 | + * | ||
13 | + * Unless required by applicable law or agreed to in writing, software | ||
14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
16 | + * See the License for the specific language governing permissions and | ||
17 | + * limitations under the License. | ||
18 | + */ | ||
19 | +package ${package}; | ||
20 | + | ||
21 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
22 | +import com.google.common.collect.ImmutableList; | ||
23 | +import com.google.common.collect.ImmutableSet; | ||
24 | +import org.apache.felix.scr.annotations.Activate; | ||
25 | +import org.apache.felix.scr.annotations.Component; | ||
26 | +import org.apache.felix.scr.annotations.Deactivate; | ||
27 | +import org.apache.felix.scr.annotations.Service; | ||
28 | +import org.apache.felix.scr.annotations.Reference; | ||
29 | +import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
30 | +import org.onosproject.ui.UiExtension; | ||
31 | +import org.onosproject.ui.UiExtensionService; | ||
32 | +import org.onosproject.ui.UiMessageHandler; | ||
33 | +import org.onosproject.ui.UiMessageHandlerFactory; | ||
34 | +import org.onosproject.ui.UiView; | ||
35 | +import org.slf4j.Logger; | ||
36 | +import org.slf4j.LoggerFactory; | ||
37 | + | ||
38 | +import java.util.List; | ||
39 | + | ||
40 | +/** | ||
41 | + * Skeletal ONOS UI application component. | ||
42 | + */ | ||
43 | +@Component(immediate = true) | ||
44 | +public class AppUiComponent { | ||
45 | + | ||
46 | + private final Logger log = LoggerFactory.getLogger(getClass()); | ||
47 | + | ||
48 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
49 | + protected UiExtensionService uiExtensionService; | ||
50 | + | ||
51 | + // List of application views | ||
52 | + private final List<UiView> uiViews = ImmutableList.of( | ||
53 | + new UiView(UiView.Category.OTHER, "sample", "Sample") | ||
54 | + ); | ||
55 | + | ||
56 | + // Factory for UI message handlers | ||
57 | + private final UiMessageHandlerFactory messageHandlerFactory = | ||
58 | + () -> ImmutableList.of( | ||
59 | + new AppUiMessageHandler() | ||
60 | + ); | ||
61 | + | ||
62 | + // Application UI exctension | ||
63 | + protected UiExtension extension = new UiExtension(uiViews, messageHandlerFactory, | ||
64 | + getClass().getClassLoader()); | ||
65 | + | ||
66 | + @Activate | ||
67 | + protected void activate() { | ||
68 | + uiExtensionService.register(extension); | ||
69 | + log.info("Started"); | ||
70 | + } | ||
71 | + | ||
72 | + @Deactivate | ||
73 | + protected void deactivate() { | ||
74 | + uiExtensionService.unregister(extension); | ||
75 | + log.info("Stopped"); | ||
76 | + } | ||
77 | + | ||
78 | + // Application UI message handler | ||
79 | + private class AppUiMessageHandler extends UiMessageHandler { | ||
80 | + protected AppUiMessageHandler() { | ||
81 | + super(ImmutableSet.of("sampleRequest")); | ||
82 | + } | ||
83 | + | ||
84 | + @Override | ||
85 | + public void process(ObjectNode objectNode) { | ||
86 | + log.info("We got a message: {}", objectNode); | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | +} |
1 | +/* css for sample app view */ | ||
2 | + | ||
3 | +#ov-sample p { | ||
4 | + margin: 0 30px; | ||
5 | + padding: 10px; | ||
6 | + border: 2px solid; | ||
7 | +} | ||
8 | + | ||
9 | +.light #ov-sample p { | ||
10 | + color: darkblue; | ||
11 | + border-color: #88c; | ||
12 | +} | ||
13 | +.dark #ov-sample p { | ||
14 | + color: #aac; | ||
15 | + border-color: #448; | ||
16 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// js for sample app view | ||
2 | +(function () { | ||
3 | + 'use strict'; | ||
4 | + | ||
5 | + angular.module('ovSample', []) | ||
6 | + .controller('OvSampleCtrl', | ||
7 | + ['$log', '$scope', | ||
8 | + | ||
9 | + function ($log, $scope) { | ||
10 | + var self = this; | ||
11 | + | ||
12 | + self.msg = 'A message from our app...'; | ||
13 | + | ||
14 | + $log.log('OvSampleCtrl has been created'); | ||
15 | + }]); | ||
16 | +}()); |
tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html
0 → 100644
1 | +<link rel="stylesheet" href="app/view/sample/sample.css"> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html
0 → 100644
1 | +<script src="app/view/sample/sample.js"></script> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# | ||
2 | +# Copyright 2014 Open Networking Laboratory | ||
3 | +# | ||
4 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | +# you may not use this file except in compliance with the License. | ||
6 | +# You may obtain a copy of the License at | ||
7 | +# | ||
8 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | +# | ||
10 | +# Unless required by applicable law or agreed to in writing, software | ||
11 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | +# See the License for the specific language governing permissions and | ||
14 | +# limitations under the License. | ||
15 | +# | ||
16 | + | ||
17 | +#Thu Dec 04 09:24:50 PST 2014 | ||
18 | +package=it.pkg | ||
19 | +version=0.1-SNAPSHOT | ||
20 | +groupId=archetype.it | ||
21 | +artifactId=basic |
File mode changed
... | @@ -7,7 +7,7 @@ export AROOT=/tmp/foo | ... | @@ -7,7 +7,7 @@ export AROOT=/tmp/foo |
7 | export ARCHETYPE_OPTS="-DarchetypeGroupId=org.onosproject -Dversion=1.2.0-SNAPSHOT" | 7 | export ARCHETYPE_OPTS="-DarchetypeGroupId=org.onosproject -Dversion=1.2.0-SNAPSHOT" |
8 | 8 | ||
9 | mkdir -p $AROOT | 9 | mkdir -p $AROOT |
10 | -for an in api bundle cli; do | 10 | +for an in api bundle cli ui; do |
11 | cd $AROOT | 11 | cd $AROOT |
12 | rm -fr $AROOT/foo-$an | 12 | rm -fr $AROOT/foo-$an |
13 | mvn archetype:generate $ARCHETYPE_OPTS \ | 13 | mvn archetype:generate $ARCHETYPE_OPTS \ | ... | ... |
-
Please register or login to post a comment