From: Maros Marsalek Date: Fri, 31 Jan 2014 13:35:27 +0000 (+0100) Subject: Maven archetype for config subsystem aware bundles X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~519^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=cd9f036ba5f985f0321b80acdaf8ae9257a670f3 Maven archetype for config subsystem aware bundles Change-Id: I0b109770f03917b923de3d4fd78d91f43eded4e2 Signed-off-by: Maros Marsalek --- diff --git a/opendaylight/config/config-module-archetype/pom.xml b/opendaylight/config/config-module-archetype/pom.xml new file mode 100644 index 0000000000..42c9105c05 --- /dev/null +++ b/opendaylight/config/config-module-archetype/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.opendaylight.controller + config-subsystem + 0.2.4-SNAPSHOT + + + config-module-archetype + config-module-archetype + Archetype for new module managed by configuration subsystem + + diff --git a/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 0000000000..fc30b4d2c3 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,46 @@ + + config-module-archetype + + true + + + + + + + + impl + + + 2013-04-05 + + + 0.2.4-SNAPSHOT + + + 0.6.2-SNAPSHOT + + + 2014-01-31 + + + java.lang.AutoCloseable + + + 2.4.0 + + + urn:opendaylight:params:xml:ns:yang:controller + + + org.opendaylight.controller.config.yang + + + + + + + src/main/yang + + + diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000000..d1c371d618 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,104 @@ + + 4.0.0 + + ${groupId} + ${artifactId} + ${version} + bundle + + + ${project.build.directory}/generated-sources/config + ${config-api-version} + ${maven-bundle-plugin-version} + + + + + org.opendaylight.controller + config-api + ${config.version} + + + + + + + org.opendaylight.yangtools + yang-maven-plugin + ${yang-maven-plugin-version} + + + config + + generate-sources + + + + + + org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + + ${jmxGeneratorPath} + + + ${yang-namespace-mapping-from}==${yang-namespace-mapping-to} + + + + + true + + + + + + org.opendaylight.controller + yang-jmx-generator-plugin + ${config.version} + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + ${jmxGeneratorPath} + + + + + + + + org.apache.felix + maven-bundle-plugin + ${maven.bundle.version} + true + + + ${project.groupId}.${project.artifactId} + + ${yang-namespace-mapping-to}.${module-name}, + + + * + + + + + + + + + diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang new file mode 100644 index 0000000000..8c1dab1495 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang @@ -0,0 +1,54 @@ +// vi: set smarttab et sw=4 tabstop=4: +module ${module-name}-${module-implementation-name} { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${module-name}:${module-implementation-name}"; + prefix "${module-name}-${module-implementation-name}"; + + import config { prefix config; revision-date ${config-api-yang-revision}; } + import ${module-name} { prefix ${module-name}; revision-date ${revision}; } + + description + "This module contains the base YANG definitions for + ${module-name} ${module-implementation-name} implementation."; + + revision "${revision}" { + description + "Initial revision."; + } + + // This is the definition of a service implementation + identity ${module-name}-${module-implementation-name} { + base config:module-type; + config:provided-service ${module-name}:${module-name}; + config:java-name-prefix ${module-name-java-prefix}; + } + + augment "/config:modules/config:module/config:configuration" { + case ${module-name}-${module-implementation-name} { + when "/config:modules/config:module/config:type = '${module-name}-${module-implementation-name}'"; + + leaf simple-attribute { + type uint32; + } + + container dto-attribute { + leaf inner-attribute { + type string; + } + } + + // Dependency attribute demonstration, the config:required-identity points to a service type + // In this case it is the same service type as this implementation provides: ${module-name} + container dependency-attribute { + uses config:service-ref { + refine type { + mandatory false; + config:required-identity ${module-name}:${module-name}; + } + } + } + + } + } +} \ No newline at end of file diff --git a/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang new file mode 100644 index 0000000000..2afc91e8e3 --- /dev/null +++ b/opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang @@ -0,0 +1,27 @@ +// vi: set smarttab et sw=4 tabstop=4: +module ${module-name} { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${module-name}"; + prefix "${module-name}"; + + import config { prefix config; revision-date ${config-api-yang-revision}; } + + description + "This module contains the base YANG definitions for + ${module-name} services."; + + revision "${revision}" { + description + "Initial revision."; + } + + // This is the definition of a service + identity ${module-name} { + + base "config:service-type"; + + // TODO modify the java class + config:java-class " ${service-java-class}"; + } +} \ No newline at end of file diff --git a/opendaylight/config/pom.xml b/opendaylight/config/pom.xml index dbf8654d6e..80621a4d44 100644 --- a/opendaylight/config/pom.xml +++ b/opendaylight/config/pom.xml @@ -1,6 +1,5 @@ - - + 4.0.0 @@ -44,6 +43,7 @@ yang-test-plugin shutdown-api shutdown-impl + config-module-archetype @@ -410,7 +410,7 @@ - + @@ -420,4 +420,4 @@ - + \ No newline at end of file