whitespace change to re trigger the build 64/6264/4
authorHarman Singh <harmasin@cisco.com>
Thu, 17 Apr 2014 21:05:41 +0000 (14:05 -0700)
committerHarman Singh <harmasin@cisco.com>
Thu, 29 May 2014 23:48:01 +0000 (16:48 -0700)
Change-Id: I2d27da99fcb96a42192178369671b2b3ce0c6fce
Signed-off-by: Harman Singh <harmasin@cisco.com>
60 files changed:
main/archetypes/archetype-md-sal-app-simple/pom.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/consumer/pom.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/consumer/src/main/java/consumer/ConsumerActivator.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/pom.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGenerator.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGeneratorUtil.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ConsumerTemplateProcessor.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/Field.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ProviderField.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ProviderTemplateProcessor.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerImpl.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerModule.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerModuleFactory.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerService.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerYang.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/abstractConsumerModule.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/abstractConsumerModuleFactory.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/consumerModuleMXBean.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/consumerServiceInterface.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/abstractConsumerImpl.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/abstractConsumerService.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/consumerImpl.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/consumerImplBuilder.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/rpcRegistry.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/rpcRegistryBuilder.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/yangModelBindingProvider.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/yangModuleInfoImpl.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/initialConfig.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/provider.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerModule.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerModuleFactory.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerYang.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/abstractProviderModule.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/abstractProviderModuleFactory.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/providerModuleMXBean.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/ProviderImpl.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/ProviderImpl.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/dataBroker.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/dataBrokerBuilder.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/providerImplBuilder.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/rpcRegistry.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/rpcRegistryBuilder.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/yangModelBindingProvider.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/yangModuleInfoImpl.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/view.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/yang.vm [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/model/pom.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/model/src/main/yang/yang.sample [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/provider/pom.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/pom.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/java/org/opendaylight/controller/app/web/SampleAppController.java [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/md-sal-app-servlet.xml [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/pages/view.jsp [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]

diff --git a/main/archetypes/archetype-md-sal-app-simple/pom.xml b/main/archetypes/archetype-md-sal-app-simple/pom.xml
new file mode 100644 (file)
index 0000000..12b06b2
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <groupId>org.opendaylight.toolkit</groupId>
+  <artifactId>md-sal-app-simple</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+  <name>archetype-md-sal-app-simple</name>
+
+  <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/main/archetypes/archetype-md-sal-app-simple/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..ec880a3
--- /dev/null
@@ -0,0 +1,98 @@
+<?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="md-sal-apps"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+     
+  <requiredProperties>
+    <requiredProperty key="appName">
+      <defaultValue>task</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="modelFields">
+      <defaultValue>{"title":"string", "desc":"string"}</defaultValue>
+    </requiredProperty>
+  </requiredProperties>
+  <modules>
+    <module id="sample-generate" dir="generate" name="sample-generate">
+    <fileSets>
+     <fileSet filtered="true" packaged="true" encoding="UTF-8">
+        <directory>src/main/java</directory>
+          <includes>
+            <include>**/*.java</include>
+          </includes>
+        </fileSet>
+        <fileSet encoding="UTF-8">
+          <directory>src/main/template</directory>
+          <includes>
+            <include>**/*.vm</include>
+          </includes>
+        </fileSet>
+  </fileSets>
+    </module>
+    <module id="sample-model" dir="model" name="sample-model">
+      <fileSets>
+        <fileSet encoding="UTF-8">
+          <directory>META-INF</directory>
+          <includes>
+            <include>**/*.MF</include>
+          </includes>
+        </fileSet>
+      </fileSets>
+    </module>
+    <module id="sample-provider" dir="provider" name="sample-provider">
+      <fileSets>
+        <fileSet filtered="true" packaged="true" encoding="UTF-8">
+          <directory>src/main/java</directory>
+          <includes>
+            <include>**/*.java</include>
+          </includes>
+        </fileSet>
+        <fileSet encoding="UTF-8">
+          <directory>META-INF</directory>
+          <includes>
+            <include>**/*.MF</include>
+          </includes>
+        </fileSet>
+      </fileSets>
+    </module>
+    <module id="sample-consumer" dir="consumer" name="sample-consumer">
+      <fileSets>
+        <fileSet filtered="true" packaged="true" encoding="UTF-8">
+          <directory>src/main/java</directory>
+          <includes>
+            <include>**/*.java</include>
+          </includes>
+        </fileSet>
+        <fileSet encoding="UTF-8">
+          <directory>META-INF</directory>
+          <includes>
+            <include>**/*.MF</include>
+          </includes>
+        </fileSet>
+      </fileSets>
+    </module>
+    <module id="sample-web" dir="web" name="sample-web">
+      <fileSets>
+        <fileSet encoding="UTF-8">
+          <directory>src/main/java</directory>
+          <includes>
+            <include>**/*.java</include>
+          </includes>
+        </fileSet>
+        <fileSet encoding="UTF-8">
+          <directory>src/main/resources/META-INF</directory>
+          <includes>
+            <include>**/*</include>
+          </includes>
+        </fileSet>
+        <fileSet encoding="UTF-8">
+          <directory>src/main/resources/WEB-INF</directory>
+          <includes>
+            <include>**/*.xml</include>
+            <include>**/*.jsp</include>
+          </includes>
+        </fileSet>
+      </fileSets>
+    </module>
+  </modules>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/consumer/pom.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/consumer/pom.xml
new file mode 100644 (file)
index 0000000..dd9d3d9
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+       <modelVersion>4.0.0</modelVersion>\r
+       <parent>\r
+               <artifactId>${rootArtifactId}</artifactId>\r
+               <groupId>${groupId}</groupId>\r
+               <version>${version}</version>\r
+       </parent>\r
+       <artifactId>${rootArtifactId}-consumer</artifactId>\r
+       <packaging>bundle</packaging>\r
+    <scm>\r
+      <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
+      <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
+      <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
+      <tag>HEAD</tag>\r
+  </scm>\r
+\r
+       <build>\r
+               <plugins>\r
+                       <plugin>\r
+                               <groupId>org.apache.felix</groupId>\r
+                               <artifactId>maven-bundle-plugin</artifactId>\r
+                               <version>${bundle.plugin.version}</version>\r
+                               <extensions>true</extensions>\r
+                               <configuration>\r
+                    <instructions>\r
+                        <Export-Package>org.opendaylight.controller.config.yang.config.${appName}_consumer.impl</Export-Package>\r
+                        <Import-Package>*</Import-Package>\r
+                    </instructions>\r
+                               </configuration>\r
+                       </plugin>\r
+            <plugin>\r
+                <groupId>org.opendaylight.yangtools</groupId>\r
+                <artifactId>yang-maven-plugin</artifactId>\r
+                <version>${yangtools.version}</version>\r
+                <executions>\r
+                    <execution>\r
+                        <id>config</id>\r
+                        <goals>\r
+                            <goal>generate-sources</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <codeGenerators>\r
+                                <generator>\r
+                                    <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>\r
+                                    <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>\r
+                                    <additionalConfiguration>\r
+                                        <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>\r
+                                    </additionalConfiguration>\r
+                                </generator>\r
+                                <generator>\r
+                                    <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>\r
+                                    <outputBaseDir>${salGeneratorPath}</outputBaseDir>\r
+                                </generator>\r
+                            </codeGenerators>\r
+                            <inspectDependencies>true</inspectDependencies>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+                <dependencies>\r
+                    <dependency>\r
+                        <groupId>org.opendaylight.yangtools</groupId>\r
+                        <artifactId>maven-sal-api-gen-plugin</artifactId>\r
+                        <version>${yangtools.version}</version>\r
+                        <type>jar</type>\r
+                    </dependency>\r
+                    <dependency>\r
+                        <groupId>org.opendaylight.controller</groupId>\r
+                        <artifactId>yang-jmx-generator-plugin</artifactId>\r
+                        <version>0.2.5-SNAPSHOT</version>\r
+                    </dependency>\r
+                </dependencies>\r
+            </plugin>\r
+               </plugins>\r
+       </build>\r
+\r
+       <dependencies>\r
+               <dependency>\r
+                       <groupId>${groupId}</groupId>\r
+                       <artifactId>${rootArtifactId}-model</artifactId>\r
+                       <version>${version}</version>\r
+               </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>config-api</artifactId>\r
+            <version>${config.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>sal-binding-config</artifactId>\r
+            <version>${mdsal.version}</version>\r
+        </dependency>\r
+               <dependency>\r
+                       <groupId>org.opendaylight.controller</groupId>\r
+                       <artifactId>sal-binding-api</artifactId>\r
+                       <version>${mdsal.version}</version>\r
+               </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>sal-common-util</artifactId>\r
+            <version>${mdsal.version}</version>\r
+        </dependency>\r
+               <dependency>\r
+      <groupId>equinoxSDK381</groupId>\r
+      <artifactId>org.eclipse.osgi</artifactId>\r
+      <version>${equinox.osgi.version}</version>\r
+    </dependency>\r
+       </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/consumer/src/main/java/consumer/ConsumerActivator.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/consumer/src/main/java/consumer/ConsumerActivator.java
new file mode 100644 (file)
index 0000000..9ec3132
--- /dev/null
@@ -0,0 +1,17 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package ${package}.consumer;
+
+
+public class ConsumerActivator {
+       
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/pom.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/pom.xml
new file mode 100644 (file)
index 0000000..7bea919
--- /dev/null
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+       <modelVersion>4.0.0</modelVersion>\r
+       <parent>\r
+               <artifactId>${rootArtifactId}</artifactId>\r
+               <groupId>${groupId}</groupId>\r
+               <version>${version}</version>\r
+       </parent>\r
+       <artifactId>${rootArtifactId}-generate</artifactId>\r
+       <packaging>jar</packaging>\r
+       <scm>\r
+               <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
+               <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
+               <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
+               <tag>HEAD</tag>\r
+       </scm>\r
+       <profiles>\r
+               <profile>\r
+                       <id>generateCode</id>\r
+                       <activation>\r
+                               <property>\r
+                                       <name>gen</name>\r
+                               </property>\r
+                       </activation>\r
+                       <build>\r
+                               <plugins>\r
+                                   <!-- Move your template files under classes folder, so code generator can use them -->\r
+                                       <plugin>\r
+                                               <artifactId>maven-resources-plugin</artifactId>\r
+                                               <version>2.6</version>\r
+                                               <executions>\r
+                                                       <execution>\r
+                                                               <id>copy-resources</id>\r
+                                                               <phase>process-classes</phase>\r
+                                                               <goals>\r
+                                                                       <goal>copy-resources</goal>\r
+                                                               </goals>\r
+                                                               <configuration>\r
+                                                                       <outputDirectory>${basedir}/target/classes</outputDirectory>\r
+                                                                       <resources>\r
+                                                                               <resource>\r
+                                                                                       <directory>src/main/template</directory>\r
+                                                                                       <filtering>true</filtering>\r
+                                                                               </resource>\r
+                                                                       </resources>\r
+                                                               </configuration>\r
+                                                       </execution>\r
+                                               </executions>\r
+                                       </plugin>\r
+                    <!-- run your code generator only once-->\r
+                                       <plugin>\r
+                                               <groupId>org.codehaus.mojo</groupId>\r
+                                               <artifactId>exec-maven-plugin</artifactId>\r
+                                               <version>1.2.1</version>\r
+                                               <executions>\r
+                                                       <execution>\r
+                                                               <phase>process-classes</phase>\r
+                                                               <goals>\r
+                                                                       <goal>java</goal>\r
+                                                               </goals>\r
+                                                               <configuration>\r
+                                                                       <mainClass>${package}.generate.CodeGenerator</mainClass>\r
+                                                                       <arguments>\r
+                                                                               <argument>${appName}</argument>\r
+                                                                               <argument>${modelFields}</argument>\r
+                                                                       </arguments>\r
+                                                               </configuration>\r
+                                                       </execution>\r
+                                               </executions>\r
+                                       </plugin>\r
+                               </plugins>\r
+                       </build>\r
+               </profile>\r
+       </profiles>\r
+       <dependencies>\r
+               <dependency>\r
+                       <groupId>org.apache.velocity</groupId>\r
+                       <artifactId>velocity</artifactId>\r
+                       <version>1.6.4</version>\r
+               </dependency>\r
+               <dependency>\r
+                       <groupId>com.googlecode.json-simple</groupId>\r
+                       <artifactId>json-simple</artifactId>\r
+                       <version>1.1</version>\r
+               </dependency>\r
+       </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGenerator.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGenerator.java
new file mode 100644 (file)
index 0000000..89a25de
--- /dev/null
@@ -0,0 +1,102 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+
+package ${package}.generate;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+
+/**
+ * This code generator use velocity templates to generate yang, java and jsp files,
+ * which are used in model, provider and web projects respectively.
+ * @author harmansingh
+ *
+ */
+public class CodeGenerator {
+  
+  private static String basePackage = "${package}";
+  
+  /**
+   * This method expects two arguments application name and fields for application,
+   * which it will receive from command line, while generating the project.
+   * If user does not specify those fields, a default value will be picked up.
+   * arg[1] should be a valid JSON, otherwise, ParseException will be thrown. 
+   * Second argument should be a valid string  
+   * @param args
+   * @throws Exception
+   */
+  public static void main(String[] args) throws Exception {  
+    //TODO : Do some preconditions check
+    JSONParser parser = new JSONParser();
+    Object obj = parser.parse(args[1]);
+    JSONObject jsonObject = (JSONObject) obj;
+    Set fieldKeys = jsonObject.keySet();
+    /*  first, get and initialize an engine  */
+    VelocityEngine ve = new VelocityEngine();
+    ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
+    ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
+    ve.init();
+    processModelYangTemplate(args[0], fieldKeys, ve, jsonObject);
+    ProviderTemplateProcessor.processProviderTemplates(args[0], fieldKeys, ve);
+    ConsumerTemplateProcessor.processConsumerTemplates(args[0], fieldKeys, ve);
+    processWebViewTemplate(args[0], fieldKeys, ve);
+    processInitialConfig(args[0], ve);
+  }
+  
+  
+  private static void processModelYangTemplate(String appName, Set fieldKeys, VelocityEngine ve, JSONObject jsonObject)
+      throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "yang.vm" );
+    /*  create a context and add data */
+    VelocityContext context = new VelocityContext();
+    context.put("app", appName);
+    List<Field> fields = new ArrayList<>();
+    for(Object fieldKey : fieldKeys) {
+      Field field1 = new Field((String)fieldKey, (String)jsonObject.get(fieldKey));
+      fields.add(field1);
+    }
+    context.put("fields", fields);
+    /* now render the template into a File */
+    String path = "model/src/main/yang/"+appName + ".yang";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processInitialConfig(String appName, VelocityEngine ve) throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "initialConfig.vm" );
+    /*  create a context and add data */
+    VelocityContext context = new VelocityContext();
+    context.put("app", appName);
+    /* now render the template into a File */
+    String path = "configuration/initial/05-"+appName + "-sample.xml";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  
+  private static void processWebViewTemplate(String appName, Set fieldKeys, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "view.vm" );
+    /*  create a context and add data */
+    VelocityContext context = new VelocityContext();
+    context.put("fields", fieldKeys);
+    context.put("app", appName);
+    context.put("capitalApp", CodeGeneratorUtil.capitalizeFirstLetter(appName));
+    String path = "web/src/main/resources/WEB-INF/pages/view.jsp";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGeneratorUtil.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGeneratorUtil.java
new file mode 100644 (file)
index 0000000..0d7e560
--- /dev/null
@@ -0,0 +1,53 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+
+package ${package}.generate;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.StringWriter;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+
+
+/**
+ * This code generator use velocity templates to generate yang, java and jsp files,
+ * which are used in model, provider and web projects respectively.
+ * @author harmansingh
+ *
+ */
+public class CodeGeneratorUtil {
+  
+  public static void writeFile(String path, VelocityContext context, Template template) throws Exception {
+    File file = new File(path);
+    File parent = file.getParentFile();
+    if(!parent.exists()){
+      parent.mkdirs();
+    }
+    // if file doesnt exists, then create it
+    if (!file.exists()) {
+      file.createNewFile();
+    }
+    FileWriter fw = new FileWriter(file.getAbsoluteFile());
+    BufferedWriter bw = new BufferedWriter(fw);
+    template.merge( context, bw );
+    bw.close();
+  }
+  
+  public static String capitalizeFirstLetter(String original){
+    if(original.length() == 0)
+        return original;
+    return original.substring(0, 1).toUpperCase() + original.substring(1);
+  }
+
+  public static VelocityContext createBasicVelocityContext(String appName){
+    VelocityContext context = new VelocityContext();
+    context.put("capitalApp", capitalizeFirstLetter(appName));
+    context.put("app", appName);
+    return context;
+  }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ConsumerTemplateProcessor.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ConsumerTemplateProcessor.java
new file mode 100644 (file)
index 0000000..07e44b2
--- /dev/null
@@ -0,0 +1,227 @@
+package ${package}.generate;
+import java.util.Set;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+
+public class ConsumerTemplateProcessor {
+
+  private static String basePackage = "${package}";
+
+  public static void processConsumerTemplates(String appName, Set fieldKeys, VelocityEngine ve)  throws Exception{
+    processConsumerImpl(appName, ve);
+    processConsumerService(appName, ve);
+    processConsumerModule(appName, ve);
+    processConsumerModuleFactory(appName, ve);
+    processAbstractConsumerModule(appName, ve);
+    processAbstractConsumerModuleFactory(appName, ve);
+    processConsumerModuleMXBean(appName, ve);
+    processConsumerServiceInterface(appName, ve);
+    processAbstractConsumerService(appName, ve);
+    processAbstractConsumerImpl(appName, ve);
+    processYangModelBindingProvider(appName, ve);
+    processYangModuleInfoImpl(appName, ve);
+    processConsumerImplInterface(appName, ve);
+    processConsumerImplBuilder(appName, ve);
+    processRpcRegistry(appName, ve);
+    processRpcRegistryBuilder(appName, ve);
+    processConsumerYang(appName, ve);
+  }
+
+  private static void processConsumerImpl(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/consumerImpl.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    context.put("package", basePackage);
+    String path = "consumer/src/main/java/"+ basePackage.replaceAll("\\.", "/") + "/consumer/"
+        + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerImpl.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerService(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/consumerService.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    context.put("package", basePackage);
+    String path = "consumer/src/main/java/"+ basePackage.replaceAll("\\.", "/") + "/consumer/"
+        + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerService.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerModule(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/consumerModule.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    context.put("package", basePackage);
+    String path = "consumer/src/main/java/org/opendaylight/controller/config/yang/config/"+
+        appName +"_consumer/impl/" + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerModule.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerModuleFactory(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/consumerModuleFactory.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    context.put("package", basePackage);
+    String path = "consumer/src/main/java/org/opendaylight/controller/config/yang/config/"+
+        appName +"_consumer/impl/" + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerModuleFactory.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerYang(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/consumerYang.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    context.put("package", basePackage);
+    String path = "consumer/src/main/yang/"+ appName + "-consumer-impl.yang";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerServiceInterface(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-config/consumerServiceInterface.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    context.put("package", basePackage);
+    String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
+    + appName+"_consumer/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerServiceServiceInterface.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processAbstractConsumerModule(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-config/abstractConsumerModule.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
+        + appName+"_consumer/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerModule.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processAbstractConsumerModuleFactory(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-config/abstractConsumerModuleFactory.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
+        + appName+"_consumer/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerModuleFactory.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerModuleMXBean(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-config/consumerModuleMXBean.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
+        + appName+"_consumer/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerModuleMXBean.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processAbstractConsumerService(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/abstractConsumerService.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerService.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processAbstractConsumerImpl(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/abstractConsumerImpl.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerImpl.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processYangModelBindingProvider(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/yangModelBindingProvider.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/$YangModelBindingProvider.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processYangModuleInfoImpl(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/yangModuleInfoImpl.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/$YangModuleInfoImpl.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerImplInterface(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/config/consumerImpl.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +
+        "ConsumerImpl.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processConsumerImplBuilder(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/config/consumerImplBuilder.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +
+        "ConsumerImplBuilder.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processRpcRegistry(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/config/rpcRegistry.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ lowerApp+
+        "/consumer/impl/RpcRegistry.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processRpcRegistryBuilder(String appName, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "consumer/yang-gen-sal/config/rpcRegistryBuilder.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ lowerApp+
+        "/consumer/impl/RpcRegistryBuilder.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+}
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/Field.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/Field.java
new file mode 100644 (file)
index 0000000..83922e3
--- /dev/null
@@ -0,0 +1,31 @@
+
+package ${package}.generate;
+
+public class Field {
+  
+  private String name;
+  
+  private String type;
+
+  public Field(String name, String type) {
+    this.name = name;
+    this.type = type;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ProviderField.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ProviderField.java
new file mode 100644 (file)
index 0000000..6c6c1ab
--- /dev/null
@@ -0,0 +1,31 @@
+
+package ${package}.generate;
+
+public class ProviderField {
+  
+  private String name;
+  
+  private String method;
+
+  public ProviderField(String name, String method) {
+    this.name = name;
+    this.method = method;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getMethod() {
+    return method;
+  }
+
+  public void setMethod(String method) {
+    this.method = method;
+  }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ProviderTemplateProcessor.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ProviderTemplateProcessor.java
new file mode 100644 (file)
index 0000000..f7ec5f5
--- /dev/null
@@ -0,0 +1,188 @@
+package ${package}.generate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+
+public class ProviderTemplateProcessor {
+  private static String basePackage = "${package}";
+
+  public static void processProviderTemplates(String appName, Set fieldKeys, VelocityEngine ve)  throws Exception{
+    processProviderTemplate(appName, fieldKeys, ve);
+    processProviderYang(appName, ve);
+    processProviderSalImpl(appName, ve);
+    processProviderSalYangModImpl(appName, ve);
+    processProviderSalYangBinding(appName, ve);
+    processProviderSalConfImpl(appName, ve);
+    processProviderSalConfBuilder(appName, ve);
+    processProviderSalDataBroker(appName, ve);
+    processProviderSalRpc(appName, ve);
+    processProviderSalBrokerBuilder(appName, ve);
+    processProviderSalRpcBuilder(appName, ve);
+    processProviderAbstractModule(appName, ve);
+    processProviderAbstractModuleFactory(appName, ve);
+    processProviderMXBean(appName, ve);
+    processProviderModule(appName, ve);
+    processProviderModuleFactory(appName, ve);
+  }
+
+  private static void processProviderTemplate(String appName, Set fieldKeys, VelocityEngine ve)  throws Exception{
+    /*  next, get the Template  */
+    Template template = ve.getTemplate( "provider/provider.vm" );
+    /*  create a context and add data */
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    List<ProviderField> fields = new ArrayList<>();
+    for(Object fieldKey : fieldKeys) {
+      String name = (String)fieldKey;
+      ProviderField field1 = new ProviderField(name, "set" +CodeGeneratorUtil.capitalizeFirstLetter(name));
+      fields.add(field1);
+    }
+    String capitalAppName = CodeGeneratorUtil.capitalizeFirstLetter(appName);
+    context.put("fields", fields);
+    context.put("package", basePackage);
+    String path = "provider/src/main/java/"+ basePackage.replaceAll("\\.", "/") + "/provider/"+capitalAppName+"Provider.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderYang(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/providerYang.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "provider/src/main/yang/"+ appName + "-provider-impl.yang";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalImpl(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/providerImpl.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/" + CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderImpl.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalYangModImpl(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/yangModuleInfoImpl.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/$YangModuleInfoImpl.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalYangBinding(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/yangModelBindingProvider.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/$YangModelBindingProvider.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalConfImpl(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/config/providerImpl.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderImpl.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalConfBuilder(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/config/providerImplBuilder.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderImplBuilder.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalDataBroker(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/config/dataBroker.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/DataBroker.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalBrokerBuilder(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/config/dataBrokerBuilder.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/DataBrokerBuilder.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalRpc(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/config/rpcRegistry.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/RpcRegistry.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderSalRpcBuilder(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-sal/config/rpcRegistryBuilder.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String lowerApp = appName.toLowerCase();
+    context.put("lowerApp", lowerApp);
+    String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
+        + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/RpcRegistryBuilder.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderAbstractModule(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-config/abstractProviderModule.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "provider/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
+        + appName + "_provider/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModule.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderAbstractModuleFactory(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-config/abstractProviderModuleFactory.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "provider/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
+        + appName + "_provider/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModuleFactory.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderMXBean(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/yang-gen-config/providerModuleMXBean.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "provider/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
+        + appName + "_provider/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModuleMXBean.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderModule(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/providerModule.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    context.put("package", basePackage);
+    String path = "provider/src/main/java/org/opendaylight/controller/config/yang/config/"
+        + appName + "_provider/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModule.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+
+  private static void processProviderModuleFactory(String appName, VelocityEngine ve)  throws Exception {
+    Template template = ve.getTemplate( "provider/providerModuleFactory.vm" );
+    VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
+    String path = "provider/src/main/java/org/opendaylight/controller/config/yang/config/"
+        + appName + "_provider/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModuleFactory.java";
+    CodeGeneratorUtil.writeFile(path, context, template);
+  }
+}
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerImpl.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerImpl.vm
new file mode 100644 (file)
index 0000000..643edd8
--- /dev/null
@@ -0,0 +1,60 @@
+package ${package}.consumer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ExecutionException;
+
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.SaveEntryInputBuilder;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${capitalApp}Service;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.saveentry.input.EntryField;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.saveentry.input.EntryFieldBuilder;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is a auto generated class which calls provider service to create an entry in 
+ * data store
+ * @author harmansingh
+ *
+ */
+public class ${capitalApp}ConsumerImpl implements ${capitalApp}ConsumerService {
+  
+  private static final Logger log = LoggerFactory.getLogger(${capitalApp}ConsumerImpl.class);
+  
+  ${capitalApp}Service service;
+  Random rand = new Random();
+  
+  public ${capitalApp}ConsumerImpl(${capitalApp}Service service) {
+    this.service = service;
+  }
+  
+  public void createEntry(Map<String, String> data) {
+    if(data == null || data.isEmpty()) {
+      log.debug("empty input data");
+      return;
+    }
+    List<EntryField> fields = new ArrayList<> ();
+    for(String key : data.keySet()) {
+      EntryFieldBuilder fieldBuilder = new EntryFieldBuilder();
+      fieldBuilder.setKey(key);
+      fieldBuilder.setValue(data.get(key));
+      fields.add(fieldBuilder.build());
+    }
+    
+    SaveEntryInputBuilder inputbuilder = new SaveEntryInputBuilder();
+    inputbuilder.setEntryId(String.valueOf(rand.nextInt(1000000000)));
+    inputbuilder.setEntryField(fields);
+    try {
+      RpcResult<Void> result = service.saveEntry(inputbuilder.build()).get();
+      if(result.isSuccessful()) {
+        log.debug("Successfully Added entry");
+      }
+    } catch (InterruptedException | ExecutionException e) {
+      e.printStackTrace();
+    }
+  } 
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerModule.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerModule.vm
new file mode 100644 (file)
index 0000000..8adec42
--- /dev/null
@@ -0,0 +1,52 @@
+package org.opendaylight.controller.config.yang.config.${app}_consumer.impl;
+
+import ${package}.consumer.${capitalApp}ConsumerImpl;
+import ${package}.consumer.${capitalApp}ConsumerService;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${capitalApp}Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+public class ${capitalApp}ConsumerModule extends org.opendaylight.controller.config.yang.config.${app}_consumer.impl.Abstract${capitalApp}ConsumerModule {
+    private static final Logger log = LoggerFactory.getLogger(${capitalApp}ConsumerModule.class);
+
+    public ${capitalApp}ConsumerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public ${capitalApp}ConsumerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule oldModule, AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public AutoCloseable createInstance() {
+        ${capitalApp}Service service = getRpcRegistryDependency().getRpcService(${capitalApp}Service.class);
+
+        final ${capitalApp}ConsumerImpl consumerImpl = new ${capitalApp}ConsumerImpl(service);
+
+
+        final class AutoCloseableService implements ${capitalApp}ConsumerService, AutoCloseable {
+
+            @Override
+            public void close() throws Exception {
+                log.info("${capitalApp}ConsumerService (instance {}) torn down.", this);
+            }
+
+            @Override
+            public void createEntry(Map<String, String> data) {
+                consumerImpl.createEntry(data);
+            }
+        }
+
+        AutoCloseable ret = new AutoCloseableService();
+        log.info("${capitalApp}ConsumerService (instance {}) initialized.", ret );
+        return ret;
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerModuleFactory.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerModuleFactory.vm
new file mode 100644 (file)
index 0000000..fc0f51e
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-consumer-impl yang module local name: ${app}-consumer-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sat May 24 19:33:40 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_consumer.impl;
+public class ${capitalApp}ConsumerModuleFactory extends org.opendaylight.controller.config.yang.config.${app}_consumer.impl.Abstract${capitalApp}ConsumerModuleFactory {
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerService.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerService.vm
new file mode 100644 (file)
index 0000000..d6e00bf
--- /dev/null
@@ -0,0 +1,8 @@
+package ${package}.consumer;
+
+import java.util.Map;
+
+public interface ${capitalApp}ConsumerService {
+    public void createEntry(Map<String, String> data);
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerYang.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/consumerYang.vm
new file mode 100644 (file)
index 0000000..84fb9b5
--- /dev/null
@@ -0,0 +1,48 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module ${app}-consumer-impl {
+
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl";
+    prefix "${app}-consumer-impl";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+    description
+        "This module contains the base YANG definitions for
+        ${app}-consumer impl implementation.";
+
+    revision "2014-05-23" {
+        description
+            "Initial revision.";
+    }
+
+    // This is the definition of consumer service interface identity.
+        identity ${app}-consumer-service {
+            base "config:service-type";
+            config:java-class "${package}.consumer.${capitalApp}ConsumerService";
+        }
+
+    // This is the definition of the service implementation as a module identity.
+    identity ${app}-consumer-impl {
+            base config:module-type;
+            config:provided-service ${app}-consumer-service;
+            // Specifies the prefix for generated java classes.
+            config:java-name-prefix ${capitalApp}Consumer;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+                case ${app}-consumer-impl {
+                    when "/config:modules/config:module/config:type = '${app}-consumer-impl'";
+
+                    container rpc-registry {
+                        uses config:service-ref {
+                            refine type {
+                                mandatory true;
+                                config:required-identity mdsal:binding-rpc-registry;
+                            }
+                        }
+                    }
+                }
+            }
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/abstractConsumerModule.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/abstractConsumerModule.vm
new file mode 100644 (file)
index 0000000..506986d
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-consumer-impl yang module local name: ${app}-consumer-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue May 27 13:19:37 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_consumer.impl;
+@org.opendaylight.yangtools.yang.binding.annotations.ModuleQName(revision = "2014-05-23", name = "${app}-consumer-impl", namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl")
+
+public abstract class Abstract${capitalApp}ConsumerModule implements org.opendaylight.controller.config.spi.Module,org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModuleMXBean,org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerServiceServiceInterface {
+    private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(org.opendaylight.controller.config.yang.config.${app}_consumer.impl.Abstract${capitalApp}ConsumerModule.class);
+
+    //attributes start
+
+    public static final org.opendaylight.controller.config.api.JmxAttribute rpcRegistryJmxAttribute = new org.opendaylight.controller.config.api.JmxAttribute("RpcRegistry");
+    private javax.management.ObjectName rpcRegistry; // mandatory
+
+    //attributes end
+
+    private final Abstract${capitalApp}ConsumerModule oldModule;
+    private final AutoCloseable oldInstance;
+    private AutoCloseable instance;
+    private final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver;
+    private final org.opendaylight.controller.config.api.ModuleIdentifier identifier;
+    @Override
+    public org.opendaylight.controller.config.api.ModuleIdentifier getIdentifier() {
+        return identifier;
+    }
+
+    public Abstract${capitalApp}ConsumerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        this.identifier = identifier;
+        this.dependencyResolver = dependencyResolver;
+        this.oldInstance=null;
+        ;this.oldModule=null;
+    }
+
+    public Abstract${capitalApp}ConsumerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,Abstract${capitalApp}ConsumerModule oldModule,AutoCloseable oldInstance) {
+        this.identifier = identifier;
+        this.dependencyResolver = dependencyResolver;
+        this.oldModule = oldModule;
+        this.oldInstance = oldInstance;
+    }
+
+    @Override
+    public void validate() {
+        dependencyResolver.validateDependency(org.opendaylight.controller.config.yang.md.sal.binding.RpcProviderRegistryServiceInterface.class, rpcRegistry, rpcRegistryJmxAttribute);
+        customValidation();
+    }
+
+    protected void customValidation() {
+    }
+
+    private org.opendaylight.controller.sal.binding.api.RpcProviderRegistry rpcRegistryDependency;
+    protected final org.opendaylight.controller.sal.binding.api.RpcProviderRegistry getRpcRegistryDependency(){
+        return rpcRegistryDependency;
+    }
+
+    @Override
+    public final AutoCloseable getInstance() {
+        if(instance==null) {
+            rpcRegistryDependency = dependencyResolver.resolveInstance(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry.class, rpcRegistry, rpcRegistryJmxAttribute);if(oldInstance!=null && canReuseInstance(oldModule)) {
+                instance = reuseInstance(oldInstance);
+            } else {
+                if(oldInstance!=null) {
+                    try {
+                        oldInstance.close();
+                    } catch(Exception e) {
+                        logger.error("An error occurred while closing old instance " + oldInstance, e);
+                    }
+                }
+                instance = createInstance();
+                if (instance == null) {
+                    throw new IllegalStateException("Error in createInstance - null is not allowed as return value");
+                }
+            }
+        }
+        return instance;
+    }
+    public abstract AutoCloseable createInstance();
+
+    public boolean canReuseInstance(Abstract${capitalApp}ConsumerModule oldModule){
+        // allow reusing of old instance if no parameters was changed
+        return isSame(oldModule);
+    }
+
+    public AutoCloseable reuseInstance(AutoCloseable oldInstance){
+        // implement if instance reuse should be supported. Override canReuseInstance to change the criteria.
+        return oldInstance;
+    }
+
+    public boolean isSame(Abstract${capitalApp}ConsumerModule other) {
+        if (other == null) {
+            throw new IllegalArgumentException("Parameter 'other' is null");
+        }
+        if (rpcRegistryDependency != other.rpcRegistryDependency) { // reference to dependency must be same
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        Abstract${capitalApp}ConsumerModule that = (Abstract${capitalApp}ConsumerModule) o;
+        return identifier.equals(that.identifier);
+    }
+
+    @Override
+    public int hashCode() {
+        return identifier.hashCode();
+    }
+
+    // getters and setters
+    @Override
+    public javax.management.ObjectName getRpcRegistry() {
+        return rpcRegistry;
+    }
+
+    @Override
+    @org.opendaylight.controller.config.api.annotations.RequireInterface(value = org.opendaylight.controller.config.yang.md.sal.binding.RpcProviderRegistryServiceInterface.class)
+    public void setRpcRegistry(javax.management.ObjectName rpcRegistry) {
+        this.rpcRegistry = rpcRegistry;
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/abstractConsumerModuleFactory.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/abstractConsumerModuleFactory.vm
new file mode 100644 (file)
index 0000000..dd99d16
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-consumer-impl yang module local name: ${app}-consumer-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue May 27 13:19:37 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_consumer.impl;
+@org.opendaylight.yangtools.yang.binding.annotations.ModuleQName(revision = "2014-05-23", name = "${app}-consumer-impl", namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl")
+
+public abstract class Abstract${capitalApp}ConsumerModuleFactory implements org.opendaylight.controller.config.spi.ModuleFactory {
+    public static final String NAME = "${app}-consumer-impl";
+
+    private static final java.util.Set<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>> serviceIfcs;
+
+    @Override
+    public final String getImplementationName() {
+        return NAME;
+    }
+
+    static {
+        java.util.Set<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>> serviceIfcs2 = new java.util.HashSet<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>>();
+        serviceIfcs2.add(org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerServiceServiceInterface.class);
+        serviceIfcs = java.util.Collections.unmodifiableSet(serviceIfcs2);
+    }
+
+    @Override
+    public final boolean isModuleImplementingServiceInterface(Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface> serviceInterface) {
+        for (Class<?> ifc: serviceIfcs) {
+            if (serviceInterface.isAssignableFrom(ifc)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public java.util.Set<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>> getImplementedServiceIntefaces() {
+        return serviceIfcs;
+    }
+
+    @Override
+    public org.opendaylight.controller.config.spi.Module createModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.osgi.framework.BundleContext bundleContext) {
+        return instantiateModule(instanceName, dependencyResolver, bundleContext);
+    }
+
+    @Override
+    public org.opendaylight.controller.config.spi.Module createModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.api.DynamicMBeanWithInstance old, org.osgi.framework.BundleContext bundleContext) throws Exception {
+        org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule oldModule = null;
+        try {
+            oldModule = (org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule) old.getModule();
+        } catch(Exception e) {
+            return handleChangedClass(old);
+        }
+        org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule module = instantiateModule(instanceName, dependencyResolver, oldModule, old.getInstance(), bundleContext);
+        module.setRpcRegistry(oldModule.getRpcRegistry());
+
+        return module;
+    }
+
+    public org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule instantiateModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule oldModule, AutoCloseable oldInstance, org.osgi.framework.BundleContext bundleContext) {
+        return new org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule(new org.opendaylight.controller.config.api.ModuleIdentifier(NAME, instanceName), dependencyResolver, oldModule, oldInstance);
+    }
+
+    public org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule instantiateModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.osgi.framework.BundleContext bundleContext) {
+        return new org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule(new org.opendaylight.controller.config.api.ModuleIdentifier(NAME, instanceName), dependencyResolver);
+    }
+
+    public org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule handleChangedClass(org.opendaylight.controller.config.api.DynamicMBeanWithInstance old) throws Exception {
+        throw new UnsupportedOperationException("Class reloading is not supported");
+    }
+
+    @Override
+    public java.util.Set<org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule> getDefaultModules(org.opendaylight.controller.config.api.DependencyResolverFactory dependencyResolverFactory, org.osgi.framework.BundleContext bundleContext) {
+        return new java.util.HashSet<org.opendaylight.controller.config.yang.config.${app}_consumer.impl.${capitalApp}ConsumerModule>();
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/consumerModuleMXBean.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/consumerModuleMXBean.vm
new file mode 100644 (file)
index 0000000..ab92641
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-consumer-impl yang module local name: ${app}-consumer-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue May 27 13:19:37 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_consumer.impl;
+public interface ${capitalApp}ConsumerModuleMXBean {
+    public javax.management.ObjectName getRpcRegistry();
+
+    public void setRpcRegistry(javax.management.ObjectName rpcRegistry);
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/consumerServiceInterface.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-config/consumerServiceInterface.vm
new file mode 100644 (file)
index 0000000..3c1e5b8
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-consumer-impl yang module local name: ${app}-consumer-service
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue May 27 13:19:36 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_consumer.impl;
+@org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation(value = "(urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl?revision=2014-05-23)${app}-consumer-service", osgiRegistrationType = ${package}.consumer.${capitalApp}ConsumerService.class, namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl", revision = "2014-05-23", localName = "${app}-consumer-service")
+
+@org.opendaylight.yangtools.yang.binding.annotations.ModuleQName(namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl", revision = "2014-05-23", name = "${app}-consumer-impl")
+
+public interface ${capitalApp}ConsumerServiceServiceInterface extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface {
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/abstractConsumerImpl.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/abstractConsumerImpl.vm
new file mode 100644 (file)
index 0000000..60a16ce
--- /dev/null
@@ -0,0 +1,21 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ModuleType;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public abstract class ${capitalApp}ConsumerImpl extends ModuleType
+ {
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl","2014-05-23","${app}-consumer-impl")
+    ;
+
+    public ${capitalApp}ConsumerImpl() {
+    }
+    
+
+
+
+
+
+
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/abstractConsumerService.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/abstractConsumerService.vm
new file mode 100644 (file)
index 0000000..50d055b
--- /dev/null
@@ -0,0 +1,21 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public abstract class ${capitalApp}ConsumerService extends ServiceType
+ {
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl","2014-05-23","${app}-consumer-service")
+    ;
+
+    public ${capitalApp}ConsumerService() {
+    }
+
+
+
+
+
+
+
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/consumerImpl.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/consumerImpl.vm
new file mode 100644 (file)
index 0000000..e61702e
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.module.Configuration;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public interface ${capitalApp}ConsumerImpl
+    extends
+    DataObject,
+    Augmentable<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>,
+    Configuration
+{
+
+
+
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl","2014-05-23","${app}-consumer-impl")
+    ;
+
+    RpcRegistry getRpcRegistry();
+
+}
+
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/consumerImplBuilder.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/consumerImplBuilder.vm
new file mode 100644 (file)
index 0000000..e6e05ed
--- /dev/null
@@ -0,0 +1,150 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry;
+import java.util.Map;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import java.util.HashMap;
+import java.util.Collections;
+
+
+
+public class ${capitalApp}ConsumerImplBuilder {
+
+    private RpcRegistry _rpcRegistry;
+
+    private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>> augmentation = new HashMap<>();
+
+    public ${capitalApp}ConsumerImplBuilder() {
+    } 
+    
+
+
+    public RpcRegistry getRpcRegistry() {
+        return _rpcRegistry;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>> E getAugmentation(Class<E> augmentationType) {
+        if (augmentationType == null) {
+            throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+        }
+        return (E) augmentation.get(augmentationType);
+    }
+
+    public ${capitalApp}ConsumerImplBuilder setRpcRegistry(RpcRegistry value) {
+    
+        this._rpcRegistry = value;
+        return this;
+    }
+    
+    public ${capitalApp}ConsumerImplBuilder addAugmentation(Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl> augmentation) {
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    public ${capitalApp}ConsumerImpl build() {
+        return new ${capitalApp}ConsumerImplImpl(this);
+    }
+
+    private static final class ${capitalApp}ConsumerImplImpl implements ${capitalApp}ConsumerImpl {
+
+        public Class<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl> getImplementedInterface() {
+            return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl.class;
+        }
+
+        private final RpcRegistry _rpcRegistry;
+
+        private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>> augmentation;
+
+        private ${capitalApp}ConsumerImplImpl(${capitalApp}ConsumerImplBuilder builder) {
+            this._rpcRegistry = builder.getRpcRegistry();
+            switch (builder.augmentation.size()) {
+             case 0:
+                 this.augmentation = Collections.emptyMap();
+                 break;
+             case 1:
+                 final Map.Entry<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>> e = builder.augmentation.entrySet().iterator().next();
+                 this.augmentation = Collections.<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>>singletonMap(e.getKey(), e.getValue());
+                 break;
+             default :
+                 this.augmentation = new HashMap<>(builder.augmentation);
+             }
+        }
+
+        @Override
+        public RpcRegistry getRpcRegistry() {
+            return _rpcRegistry;
+        }
+        
+        @SuppressWarnings("unchecked")
+        @Override
+        public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${capitalApp}ConsumerImpl>> E getAugmentation(Class<E> augmentationType) {
+            if (augmentationType == null) {
+                throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+            }
+            return (E) augmentation.get(augmentationType);
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((_rpcRegistry == null) ? 0 : _rpcRegistry.hashCode());
+            result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ${capitalApp}ConsumerImplImpl other = (${capitalApp}ConsumerImplImpl) obj;
+            if (_rpcRegistry == null) {
+                if (other._rpcRegistry != null) {
+                    return false;
+                }
+            } else if(!_rpcRegistry.equals(other._rpcRegistry)) {
+                return false;
+            }
+            if (augmentation == null) {
+                if (other.augmentation != null) {
+                    return false;
+                }
+            } else if(!augmentation.equals(other.augmentation)) {
+                return false;
+            }
+            return true;
+        }
+        
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder("${capitalApp}ConsumerImpl [");
+            boolean first = true;
+        
+            if (_rpcRegistry != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_rpcRegistry=");
+                builder.append(_rpcRegistry);
+             }
+            if (first) {
+                first = false;
+            } else {
+                builder.append(", ");
+            }
+            builder.append("augmentation=");
+            builder.append(augmentation.values());
+            return builder.append(']').toString();
+        }
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/rpcRegistry.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/rpcRegistry.vm
new file mode 100644 (file)
index 0000000..25b7aad
--- /dev/null
@@ -0,0 +1,23 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.Module;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public interface RpcRegistry
+    extends
+    ChildOf<Module>,
+    Augmentable<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>,
+    ServiceRef
+{
+
+
+
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl","2014-05-23","rpc-registry")
+    ;
+
+
+}
+
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/rpcRegistryBuilder.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/config/rpcRegistryBuilder.vm
new file mode 100644 (file)
index 0000000..5753d6a
--- /dev/null
@@ -0,0 +1,212 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl;
+import java.util.Map;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import java.util.HashMap;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import java.util.Collections;
+
+
+
+public class RpcRegistryBuilder {
+
+    private Object _name;
+    private Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
+
+    private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>> augmentation = new HashMap<>();
+
+    public RpcRegistryBuilder() {
+    } 
+    
+    public RpcRegistryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef arg) {
+        this._name = arg.getName();
+        this._type = arg.getType();
+    }
+
+    /**
+     Set fields from given grouping argument. Valid argument is instance of one of following types:
+     * <ul>
+     * <li>org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef</li>
+     * </ul>
+     *
+     * @param arg grouping object
+     * @throws IllegalArgumentException if given argument is none of valid types
+    */
+    public void fieldsFrom(DataObject arg) {
+        boolean isValidArg = false;
+        if (arg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef) {
+            this._name = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getName();
+            this._type = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getType();
+            isValidArg = true;
+        }
+        if (!isValidArg) {
+            throw new IllegalArgumentException(
+              "expected one of: [org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef] \n" +
+              "but was: " + arg
+            );
+        }
+    }
+
+    public Object getName() {
+        return _name;
+    }
+    
+    public Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
+        return _type;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>> E getAugmentation(Class<E> augmentationType) {
+        if (augmentationType == null) {
+            throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+        }
+        return (E) augmentation.get(augmentationType);
+    }
+
+    public RpcRegistryBuilder setName(Object value) {
+    
+        this._name = value;
+        return this;
+    }
+    
+    public RpcRegistryBuilder setType(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> value) {
+    
+        this._type = value;
+        return this;
+    }
+    
+    public RpcRegistryBuilder addAugmentation(Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry> augmentation) {
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    public RpcRegistry build() {
+        return new RpcRegistryImpl(this);
+    }
+
+    private static final class RpcRegistryImpl implements RpcRegistry {
+
+        public Class<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry> getImplementedInterface() {
+            return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry.class;
+        }
+
+        private final Object _name;
+        private final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
+
+        private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>> augmentation;
+
+        private RpcRegistryImpl(RpcRegistryBuilder builder) {
+            this._name = builder.getName();
+            this._type = builder.getType();
+            switch (builder.augmentation.size()) {
+             case 0:
+                 this.augmentation = Collections.emptyMap();
+                 break;
+             case 1:
+                 final Map.Entry<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>> e = builder.augmentation.entrySet().iterator().next();
+                 this.augmentation = Collections.<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>>singletonMap(e.getKey(), e.getValue());
+                 break;
+             default :
+                 this.augmentation = new HashMap<>(builder.augmentation);
+             }
+        }
+
+        @Override
+        public Object getName() {
+            return _name;
+        }
+        
+        @Override
+        public Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
+            return _type;
+        }
+        
+        @SuppressWarnings("unchecked")
+        @Override
+        public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523.modules.module.configuration.${lowerApp}.consumer.impl.RpcRegistry>> E getAugmentation(Class<E> augmentationType) {
+            if (augmentationType == null) {
+                throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+            }
+            return (E) augmentation.get(augmentationType);
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((_name == null) ? 0 : _name.hashCode());
+            result = prime * result + ((_type == null) ? 0 : _type.hashCode());
+            result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            RpcRegistryImpl other = (RpcRegistryImpl) obj;
+            if (_name == null) {
+                if (other._name != null) {
+                    return false;
+                }
+            } else if(!_name.equals(other._name)) {
+                return false;
+            }
+            if (_type == null) {
+                if (other._type != null) {
+                    return false;
+                }
+            } else if(!_type.equals(other._type)) {
+                return false;
+            }
+            if (augmentation == null) {
+                if (other.augmentation != null) {
+                    return false;
+                }
+            } else if(!augmentation.equals(other.augmentation)) {
+                return false;
+            }
+            return true;
+        }
+        
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder("RpcRegistry [");
+            boolean first = true;
+        
+            if (_name != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_name=");
+                builder.append(_name);
+             }
+            if (_type != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_type=");
+                builder.append(_type);
+             }
+            if (first) {
+                first = false;
+            } else {
+                builder.append(", ");
+            }
+            builder.append("augmentation=");
+            builder.append(augmentation.values());
+            return builder.append(']').toString();
+        }
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/yangModelBindingProvider.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/yangModelBindingProvider.vm
new file mode 100644 (file)
index 0000000..242a375
--- /dev/null
@@ -0,0 +1,8 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523;
+
+public final class $YangModelBindingProvider implements org.opendaylight.yangtools.yang.binding.YangModelBindingProvider {
+
+    public org.opendaylight.yangtools.yang.binding.YangModuleInfo getModuleInfo() {
+        return $YangModuleInfoImpl.getInstance();
+    }
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/yangModuleInfoImpl.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/consumer/yang-gen-sal/yangModuleInfoImpl.vm
new file mode 100644 (file)
index 0000000..2bf6f1f
--- /dev/null
@@ -0,0 +1,80 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.consumer.impl.rev140523 ;
+import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
+import java.util.Set;
+import java.util.HashSet;
+import com.google.common.collect.ImmutableSet;
+import java.io.InputStream;
+import java.io.IOException;
+public final class $YangModuleInfoImpl implements YangModuleInfo {
+
+    private static final YangModuleInfo INSTANCE = new $YangModuleInfoImpl();
+
+    private final String name = "${app}-consumer-impl";
+    private final String namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl";
+    private final String revision = "2014-05-23";
+    private final String resourcePath = "/META-INF/yang/${app}-consumer-impl.yang";
+    
+    private final Set<YangModuleInfo> importedModules;
+
+    public static YangModuleInfo getInstance() {
+        return INSTANCE;
+    }
+
+    private $YangModuleInfoImpl() {
+        Set<YangModuleInfo> set = new HashSet<>();
+        set.add(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.$YangModuleInfoImpl.getInstance());
+        set.add(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.binding.rev131028.$YangModuleInfoImpl.getInstance());
+        importedModules = ImmutableSet.copyOf(set);
+        InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath);
+        if (stream == null) {
+            throw new IllegalStateException("Resource '" + resourcePath + "' is missing");
+        }
+        try {
+            stream.close();
+        } catch (IOException e) {
+        // Resource leak, but there is nothing we can do
+        }
+    }
+    
+    @Override
+    public String getName() {
+        return name;
+    }
+    
+    @Override
+    public String getRevision() {
+        return revision;
+    }
+    
+    @Override
+    public String getNamespace() {
+        return namespace;
+    }
+    
+    @Override
+    public InputStream getModuleSourceStream() throws IOException {
+        InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath);
+        if (stream == null) {
+            throw new IOException("Resource " + resourcePath + " is missing");
+        }
+        return stream;
+    }
+    
+    @Override
+    public Set<YangModuleInfo> getImportedModules() {
+        return importedModules;
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(this.getClass().getCanonicalName());
+        sb.append("[");
+        sb.append("name = " + name);
+        sb.append(", namespace = " + namespace);
+        sb.append(", revision = " + revision);
+        sb.append(", resourcePath = " + resourcePath);
+        sb.append(", imports = " + importedModules);
+        sb.append("]");
+        return sb.toString();
+    }
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/initialConfig.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/initialConfig.vm
new file mode 100644 (file)
index 0000000..34ab3f5
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+    <configuration>
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl">
+                        prefix:${app}-provider-impl
+                    </type>
+                    <name>${app}-provider-impl</name>
+
+                    <rpc-registry>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+                        <name>binding-rpc-broker</name>
+                    </rpc-registry>
+                    <data-broker>
+                       <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-data-broker</type>
+                       <name>binding-data-broker</name>
+                    </data-broker>
+                </module>
+
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl">
+                        prefix:${app}-consumer-impl
+                    </type>
+                    <name>${app}-consumer-impl</name>
+
+                    <rpc-registry>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+                        <name>binding-rpc-broker</name>
+                    </rpc-registry>
+                </module>
+            </modules>
+             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+               <service>
+                   <type xmlns:${app}="urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl">
+                       ${app}:${app}-consumer-service
+                   </type>
+                   <instance>
+                       <name>${app}-consumer-service</name>
+                       <provider>/modules/module[type='${app}-consumer-impl'][name='${app}-consumer-impl']</provider>
+                   </instance>
+               </service>
+           </services>
+        </data>
+
+    </configuration>
+
+    <required-capabilities>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:${app}-consumer:impl?module=${app}-consumer-impl&amp;revision=2014-05-23</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl?module=${app}-provider-impl&amp;revision=2014-05-23</capability>
+    </required-capabilities>
+
+</snapshot>
+
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/provider.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/provider.vm
new file mode 100644 (file)
index 0000000..7d62e75
--- /dev/null
@@ -0,0 +1,121 @@
+package ${package}.provider;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.EntryId;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.SaveEntryInput;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${capitalApp};
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${capitalApp}Service;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.saveentry.input.EntryField;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${app}.Entry;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${app}.EntryBuilder;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${app}.EntryKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is a generated class based on the user inputs of application name
+ * and fields json. This class implements a service created by yang model
+ * @author harmansingh
+ *
+ */
+public class ${capitalApp}Provider implements ${capitalApp}Service, AutoCloseable {
+
+    private static final Logger log = LoggerFactory.getLogger(${capitalApp}Provider.class);
+    
+    private DataBrokerService dataService;
+    
+    private final ExecutorService executor;
+    
+    public DataBrokerService getDataService() {
+      return dataService;
+    }
+
+    public void setDataService(DataBrokerService dataService) {
+      this.dataService = dataService;
+    }
+
+    public ${capitalApp}Provider() {
+      executor = Executors.newFixedThreadPool(1);
+    }
+    
+     /**
+     * This is an example to show how yang based RPC can be used to perform an operation.
+     * Here this is saving data in data store. This code also gives insight into how we can 
+     * insert data into data store
+     * @param input
+     * @return
+     */
+     
+    @Override
+    public Future<RpcResult<Void>> saveEntry(SaveEntryInput input) {
+      log.debug("Saving the entry");
+      if(input == null || input.getEntryId() == null) {
+        log.debug("exiting the save entry because of invalid input");
+        return null;
+      }
+      // EntryBuilder will be used to build an Entry object
+      // We will store entry object in data store
+      EntryBuilder entryBuilder = new EntryBuilder();
+      entryBuilder.setKey(new EntryKey(new EntryId(input.getEntryId())));
+      List<EntryField> entryFields = input.getEntryField();
+      
+      for(EntryField field : entryFields) {
+        String key = field.getKey();
+        String value = field.getValue();
+        if(key == null || value == null) {
+          continue;
+        }
+        switch(key) {
+          #foreach( $field in $fields )
+          case "$field.name" : 
+            entryBuilder.${field.method}(value);
+            break;
+          #end
+        }
+      }
+      Entry entry = entryBuilder.build();
+      return executor.submit(new SaveEntry(entry));
+    }
+
+    @Override
+        public void close() throws Exception {
+            executor.shutdown();
+        }
+    
+    private class SaveEntry implements Callable<RpcResult<Void>> {
+
+      Entry entry;
+
+      public SaveEntry(Entry entry) {
+        this.entry = entry;
+      }
+
+      @Override
+      public RpcResult<Void> call() throws InterruptedException {
+        // Each entry will be identifiable by a unique key, we have to create that identifier 
+        InstanceIdentifier.InstanceIdentifierBuilder<Entry> entryIdBuilder =
+            InstanceIdentifier.<${capitalApp}>builder(${capitalApp}.class)
+            .child(Entry.class, entry.getKey());
+        InstanceIdentifier<Entry> path = entryIdBuilder.toInstance();
+        // Place entry in data store tree
+        final DataModificationTransaction it = dataService.beginTransaction();
+        it.putOperationalData(path, entry);
+        it.commit();
+          return Rpcs.<Void> getRpcResult(true, null, Collections.<RpcError> emptySet());
+      }
+   }
+    
+}
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerModule.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerModule.vm
new file mode 100644 (file)
index 0000000..9faed90
--- /dev/null
@@ -0,0 +1,53 @@
+package org.opendaylight.controller.config.yang.config.${app}_provider.impl;
+
+import ${package}.provider.${capitalApp}Provider;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yang.gen.v1.opendaylight.sample.rev140407.${capitalApp}Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ${capitalApp}ProviderModule extends org.opendaylight.controller.config.yang.config.${app}_provider.impl.Abstract${capitalApp}ProviderModule {
+    private static final Logger log = LoggerFactory.getLogger(${capitalApp}ProviderModule.class);
+
+    public ${capitalApp}ProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public ${capitalApp}ProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule oldModule, AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public AutoCloseable createInstance() {
+        final ${capitalApp}Provider appProvider = new ${capitalApp}Provider();
+
+        DataProviderService dataBrokerService = getDataBrokerDependency();
+        appProvider.setDataService(dataBrokerService);
+        final BindingAwareBroker.RpcRegistration<${capitalApp}Service> rpcRegistration = getRpcRegistryDependency()
+                .addRpcImplementation(${capitalApp}Service.class, appProvider);
+
+        // Wrap toaster as AutoCloseable and close registrations to md-sal at
+        // close()
+        final class AutoCloseableToaster implements AutoCloseable {
+
+            @Override
+            public void close() throws Exception {
+                rpcRegistration.close();
+                appProvider.close();
+                log.info("${capitalApp}Provider (instance {}) torn down.", this);
+            }
+        }
+
+        AutoCloseable ret = new AutoCloseableToaster();
+        log.info("${capitalApp}Provider (instance {}) initialized.", ret);
+        return ret;
+    }
+
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerModuleFactory.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerModuleFactory.vm
new file mode 100644 (file)
index 0000000..2473654
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-provider-impl yang module local name: ${app}-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri May 23 11:39:12 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_provider.impl;
+public class ${capitalApp}ProviderModuleFactory extends org.opendaylight.controller.config.yang.config.${app}_provider.impl.Abstract${capitalApp}ProviderModuleFactory {
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerYang.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/providerYang.vm
new file mode 100644 (file)
index 0000000..65a4f08
--- /dev/null
@@ -0,0 +1,51 @@
+module ${app}-provider-impl {
+
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl";
+    prefix "${app}-provider-impl";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+    description
+        "This module contains the base YANG definitions for
+        ${app}-provider impl implementation.";
+
+    revision "2014-05-23" {
+        description
+            "Initial revision.";
+    }
+
+    // This is the definition of the service implementation as a module identity.
+    identity ${app}-provider-impl {
+            base config:module-type;
+
+            // Specifies the prefix for generated java classes.
+            config:java-name-prefix ${capitalApp}Provider;
+    }
+
+    // Augments the 'configuration' choice node under modules/module.
+    augment "/config:modules/config:module/config:configuration" {
+        case ${app}-provider-impl {
+            when "/config:modules/config:module/config:type = '${app}-provider-impl'";
+
+            container rpc-registry {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-rpc-registry;
+                    }
+                }
+            }
+
+            container data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity mdsal:binding-data-broker;
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/abstractProviderModule.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/abstractProviderModule.vm
new file mode 100644 (file)
index 0000000..6564e67
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-provider-impl yang module local name: ${app}-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri May 23 16:54:25 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_provider.impl;
+@org.opendaylight.yangtools.yang.binding.annotations.ModuleQName(revision = "2014-05-23", name = "${app}-provider-impl", namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl")
+
+public abstract class Abstract${capitalApp}ProviderModule implements org.opendaylight.controller.config.spi.Module,org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModuleMXBean {
+    private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(org.opendaylight.controller.config.yang.config.${app}_provider.impl.Abstract${capitalApp}ProviderModule.class);
+
+    //attributes start
+
+    public static final org.opendaylight.controller.config.api.JmxAttribute rpcRegistryJmxAttribute = new org.opendaylight.controller.config.api.JmxAttribute("RpcRegistry");
+    private javax.management.ObjectName rpcRegistry; // mandatory
+
+    public static final org.opendaylight.controller.config.api.JmxAttribute dataBrokerJmxAttribute = new org.opendaylight.controller.config.api.JmxAttribute("DataBroker");
+    private javax.management.ObjectName dataBroker; // optional
+
+    //attributes end
+
+    private final Abstract${capitalApp}ProviderModule oldModule;
+    private final AutoCloseable oldInstance;
+    private AutoCloseable instance;
+    private final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver;
+    private final org.opendaylight.controller.config.api.ModuleIdentifier identifier;
+    @Override
+    public org.opendaylight.controller.config.api.ModuleIdentifier getIdentifier() {
+        return identifier;
+    }
+
+    public Abstract${capitalApp}ProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        this.identifier = identifier;
+        this.dependencyResolver = dependencyResolver;
+        this.oldInstance=null;
+        ;this.oldModule=null;
+    }
+
+    public Abstract${capitalApp}ProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,Abstract${capitalApp}ProviderModule oldModule,AutoCloseable oldInstance) {
+        this.identifier = identifier;
+        this.dependencyResolver = dependencyResolver;
+        this.oldModule = oldModule;
+        this.oldInstance = oldInstance;
+    }
+
+    @Override
+    public void validate() {
+        dependencyResolver.validateDependency(org.opendaylight.controller.config.yang.md.sal.binding.RpcProviderRegistryServiceInterface.class, rpcRegistry, rpcRegistryJmxAttribute);
+        customValidation();
+    }
+
+    protected void customValidation() {
+    }
+
+    private org.opendaylight.controller.sal.binding.api.RpcProviderRegistry rpcRegistryDependency;
+    protected final org.opendaylight.controller.sal.binding.api.RpcProviderRegistry getRpcRegistryDependency(){
+        return rpcRegistryDependency;
+    }private org.opendaylight.controller.sal.binding.api.data.DataProviderService dataBrokerDependency;
+    protected final org.opendaylight.controller.sal.binding.api.data.DataProviderService getDataBrokerDependency(){
+        return dataBrokerDependency;
+    }
+
+    @Override
+    public final AutoCloseable getInstance() {
+        if(instance==null) {
+            if (dataBroker!=null) {
+                dataBrokerDependency = dependencyResolver.resolveInstance(org.opendaylight.controller.sal.binding.api.data.DataProviderService.class, dataBroker, dataBrokerJmxAttribute);;
+            }rpcRegistryDependency = dependencyResolver.resolveInstance(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry.class, rpcRegistry, rpcRegistryJmxAttribute);if(oldInstance!=null && canReuseInstance(oldModule)) {
+                instance = reuseInstance(oldInstance);
+            } else {
+                if(oldInstance!=null) {
+                    try {
+                        oldInstance.close();
+                    } catch(Exception e) {
+                        logger.error("An error occurred while closing old instance " + oldInstance, e);
+                    }
+                }
+                instance = createInstance();
+                if (instance == null) {
+                    throw new IllegalStateException("Error in createInstance - null is not allowed as return value");
+                }
+            }
+        }
+        return instance;
+    }
+    public abstract AutoCloseable createInstance();
+
+    public boolean canReuseInstance(Abstract${capitalApp}ProviderModule oldModule){
+        // allow reusing of old instance if no parameters was changed
+        return isSame(oldModule);
+    }
+
+    public AutoCloseable reuseInstance(AutoCloseable oldInstance){
+        // implement if instance reuse should be supported. Override canReuseInstance to change the criteria.
+        return oldInstance;
+    }
+
+    public boolean isSame(Abstract${capitalApp}ProviderModule other) {
+        if (other == null) {
+            throw new IllegalArgumentException("Parameter 'other' is null");
+        }
+        if (rpcRegistryDependency != other.rpcRegistryDependency) { // reference to dependency must be same
+            return false;
+        }
+        if (dataBrokerDependency != other.dataBrokerDependency) { // reference to dependency must be same
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        Abstract${capitalApp}ProviderModule that = (Abstract${capitalApp}ProviderModule) o;
+        return identifier.equals(that.identifier);
+    }
+
+    @Override
+    public int hashCode() {
+        return identifier.hashCode();
+    }
+
+    // getters and setters
+    @Override
+    public javax.management.ObjectName getRpcRegistry() {
+        return rpcRegistry;
+    }
+
+    @Override
+    @org.opendaylight.controller.config.api.annotations.RequireInterface(value = org.opendaylight.controller.config.yang.md.sal.binding.RpcProviderRegistryServiceInterface.class)
+    public void setRpcRegistry(javax.management.ObjectName rpcRegistry) {
+        this.rpcRegistry = rpcRegistry;
+    }
+
+    @Override
+    public javax.management.ObjectName getDataBroker() {
+        return dataBroker;
+    }
+
+    @Override
+    @org.opendaylight.controller.config.api.annotations.RequireInterface(value = org.opendaylight.controller.config.yang.md.sal.binding.DataProviderServiceServiceInterface.class)
+    public void setDataBroker(javax.management.ObjectName dataBroker) {
+        this.dataBroker = dataBroker;
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/abstractProviderModuleFactory.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/abstractProviderModuleFactory.vm
new file mode 100644 (file)
index 0000000..75e697d
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-provider-impl yang module local name: ${app}-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri May 23 16:54:25 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_provider.impl;
+@org.opendaylight.yangtools.yang.binding.annotations.ModuleQName(revision = "2014-05-23", name = "${app}-provider-impl", namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl")
+
+public abstract class Abstract${capitalApp}ProviderModuleFactory implements org.opendaylight.controller.config.spi.ModuleFactory {
+    public static final String NAME = "${app}-provider-impl";
+
+    private static final java.util.Set<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>> serviceIfcs;
+
+    @Override
+    public final String getImplementationName() {
+        return NAME;
+    }
+
+    static {
+        java.util.Set<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>> serviceIfcs2 = new java.util.HashSet<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>>();
+        serviceIfcs = java.util.Collections.unmodifiableSet(serviceIfcs2);
+    }
+
+    @Override
+    public final boolean isModuleImplementingServiceInterface(Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface> serviceInterface) {
+        for (Class<?> ifc: serviceIfcs) {
+            if (serviceInterface.isAssignableFrom(ifc)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public java.util.Set<Class<? extends org.opendaylight.controller.config.api.annotations.AbstractServiceInterface>> getImplementedServiceIntefaces() {
+        return serviceIfcs;
+    }
+
+    @Override
+    public org.opendaylight.controller.config.spi.Module createModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.osgi.framework.BundleContext bundleContext) {
+        return instantiateModule(instanceName, dependencyResolver, bundleContext);
+    }
+
+    @Override
+    public org.opendaylight.controller.config.spi.Module createModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.api.DynamicMBeanWithInstance old, org.osgi.framework.BundleContext bundleContext) throws Exception {
+        org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule oldModule = null;
+        try {
+            oldModule = (org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule) old.getModule();
+        } catch(Exception e) {
+            return handleChangedClass(old);
+        }
+        org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule module = instantiateModule(instanceName, dependencyResolver, oldModule, old.getInstance(), bundleContext);
+        module.setRpcRegistry(oldModule.getRpcRegistry());
+        module.setDataBroker(oldModule.getDataBroker());
+
+        return module;
+    }
+
+    public org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule instantiateModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule oldModule, AutoCloseable oldInstance, org.osgi.framework.BundleContext bundleContext) {
+        return new org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule(new org.opendaylight.controller.config.api.ModuleIdentifier(NAME, instanceName), dependencyResolver, oldModule, oldInstance);
+    }
+
+    public org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule instantiateModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.osgi.framework.BundleContext bundleContext) {
+        return new org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule(new org.opendaylight.controller.config.api.ModuleIdentifier(NAME, instanceName), dependencyResolver);
+    }
+
+    public org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule handleChangedClass(org.opendaylight.controller.config.api.DynamicMBeanWithInstance old) throws Exception {
+        throw new UnsupportedOperationException("Class reloading is not supported");
+    }
+
+    @Override
+    public java.util.Set<org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule> getDefaultModules(org.opendaylight.controller.config.api.DependencyResolverFactory dependencyResolverFactory, org.osgi.framework.BundleContext bundleContext) {
+        return new java.util.HashSet<org.opendaylight.controller.config.yang.config.${app}_provider.impl.${capitalApp}ProviderModule>();
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/providerModuleMXBean.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-config/providerModuleMXBean.vm
new file mode 100644 (file)
index 0000000..a68703d
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: ${app}-provider-impl yang module local name: ${app}-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri May 23 16:54:25 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.${app}_provider.impl;
+public interface ${capitalApp}ProviderModuleMXBean {
+    public javax.management.ObjectName getRpcRegistry();
+
+    public void setRpcRegistry(javax.management.ObjectName rpcRegistry);
+
+    public javax.management.ObjectName getDataBroker();
+
+    public void setDataBroker(javax.management.ObjectName dataBroker);
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/ProviderImpl.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/ProviderImpl.vm
new file mode 100644 (file)
index 0000000..f5509c8
--- /dev/null
@@ -0,0 +1,21 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ModuleType;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public abstract class ${capitalApp}ProviderImpl extends ModuleType
+ {
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl","2014-05-23","${app}-provider-impl")
+    ;
+
+    public ${capitalApp}ProviderImpl() {
+    }
+
+
+
+
+
+
+
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/ProviderImpl.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/ProviderImpl.vm
new file mode 100644 (file)
index 0000000..cd46a61
--- /dev/null
@@ -0,0 +1,28 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.module.Configuration;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public interface ${capitalApp}ProviderImpl
+    extends
+    DataObject,
+    Augmentable<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>,
+    Configuration
+{
+
+
+
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl","2014-05-23","${app}-provider-impl")
+    ;
+
+    DataBroker getDataBroker();
+
+    RpcRegistry getRpcRegistry();
+
+}
+
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/dataBroker.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/dataBroker.vm
new file mode 100644 (file)
index 0000000..0ea9275
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.Module;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public interface DataBroker
+    extends
+    ChildOf<Module>,
+    Augmentable<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>,
+    ServiceRef
+{
+
+
+
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl","2014-05-23","data-broker")
+    ;
+
+
+}
+
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/dataBrokerBuilder.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/dataBrokerBuilder.vm
new file mode 100644 (file)
index 0000000..3683a17
--- /dev/null
@@ -0,0 +1,214 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl;
+
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+public class DataBrokerBuilder {
+
+    private Object _name;
+    private Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
+
+    private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>> augmentation = new HashMap<>();
+
+    public DataBrokerBuilder() {
+    }
+
+    public DataBrokerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef arg) {
+        this._name = arg.getName();
+        this._type = arg.getType();
+    }
+
+    /**
+     Set fields from given grouping argument. Valid argument is instance of one of following types:
+     * <ul>
+     * <li>org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef</li>
+     * </ul>
+     *
+     * @param arg grouping object
+     * @throws IllegalArgumentException if given argument is none of valid types
+    */
+    public void fieldsFrom(DataObject arg) {
+        boolean isValidArg = false;
+        if (arg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef) {
+            this._name = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getName();
+            this._type = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getType();
+            isValidArg = true;
+        }
+        if (!isValidArg) {
+            throw new IllegalArgumentException(
+              "expected one of: [org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef] \n" +
+              "but was: " + arg
+            );
+        }
+    }
+
+    public Object getName() {
+        return _name;
+    }
+
+    public Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
+        return _type;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>> E getAugmentation(Class<E> augmentationType) {
+        if (augmentationType == null) {
+            throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+        }
+        return (E) augmentation.get(augmentationType);
+    }
+
+    public DataBrokerBuilder setName(Object value) {
+
+        this._name = value;
+        return this;
+    }
+
+    public DataBrokerBuilder setType(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> value) {
+
+        this._type = value;
+        return this;
+    }
+
+    public DataBrokerBuilder addAugmentation(Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker> augmentation) {
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    public DataBroker build() {
+        return new DataBrokerImpl(this);
+    }
+
+    private static final class DataBrokerImpl implements DataBroker {
+
+        public Class<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker> getImplementedInterface() {
+            return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker.class;
+        }
+
+        private final Object _name;
+        private final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
+
+        private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>> augmentation;
+
+        private DataBrokerImpl(DataBrokerBuilder builder) {
+            this._name = builder.getName();
+            this._type = builder.getType();
+            switch (builder.augmentation.size()) {
+             case 0:
+                 this.augmentation = Collections.emptyMap();
+                 break;
+             case 1:
+                 final Map.Entry<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>> e = builder.augmentation.entrySet().iterator().next();
+                 this.augmentation = Collections.<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>>singletonMap(e.getKey(), e.getValue());
+                 break;
+             default :
+                 this.augmentation = new HashMap<>(builder.augmentation);
+             }
+        }
+
+        @Override
+        public Object getName() {
+            return _name;
+        }
+
+        @Override
+        public Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
+            return _type;
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker>> E getAugmentation(Class<E> augmentationType) {
+            if (augmentationType == null) {
+                throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+            }
+            return (E) augmentation.get(augmentationType);
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((_name == null) ? 0 : _name.hashCode());
+            result = prime * result + ((_type == null) ? 0 : _type.hashCode());
+            result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            DataBrokerImpl other = (DataBrokerImpl) obj;
+            if (_name == null) {
+                if (other._name != null) {
+                    return false;
+                }
+            } else if(!_name.equals(other._name)) {
+                return false;
+            }
+            if (_type == null) {
+                if (other._type != null) {
+                    return false;
+                }
+            } else if(!_type.equals(other._type)) {
+                return false;
+            }
+            if (augmentation == null) {
+                if (other.augmentation != null) {
+                    return false;
+                }
+            } else if(!augmentation.equals(other.augmentation)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder("DataBroker [");
+            boolean first = true;
+
+            if (_name != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_name=");
+                builder.append(_name);
+             }
+            if (_type != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_type=");
+                builder.append(_type);
+             }
+            if (first) {
+                first = false;
+            } else {
+                builder.append(", ");
+            }
+            builder.append("augmentation=");
+            builder.append(augmentation.values());
+            return builder.append(']').toString();
+        }
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/providerImplBuilder.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/providerImplBuilder.vm
new file mode 100644 (file)
index 0000000..807ea03
--- /dev/null
@@ -0,0 +1,188 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.DataBroker;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+public class ${capitalApp}ProviderImplBuilder {
+
+    private DataBroker _dataBroker;
+    private RpcRegistry _rpcRegistry;
+
+    private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>> augmentation = new HashMap<>();
+
+    public ${capitalApp}ProviderImplBuilder() {
+    }
+
+
+
+    public DataBroker getDataBroker() {
+        return _dataBroker;
+    }
+
+    public RpcRegistry getRpcRegistry() {
+        return _rpcRegistry;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>> E getAugmentation(Class<E> augmentationType) {
+        if (augmentationType == null) {
+            throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+        }
+        return (E) augmentation.get(augmentationType);
+    }
+
+    public ${capitalApp}ProviderImplBuilder setDataBroker(DataBroker value) {
+
+        this._dataBroker = value;
+        return this;
+    }
+
+    public ${capitalApp}ProviderImplBuilder setRpcRegistry(RpcRegistry value) {
+
+        this._rpcRegistry = value;
+        return this;
+    }
+
+    public ${capitalApp}ProviderImplBuilder addAugmentation(Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl> augmentation) {
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    public ${capitalApp}ProviderImpl build() {
+        return new ${capitalApp}ProviderImplImpl(this);
+    }
+
+    private static final class ${capitalApp}ProviderImplImpl implements ${capitalApp}ProviderImpl {
+
+        public Class<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl> getImplementedInterface() {
+            return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl.class;
+        }
+
+        private final DataBroker _dataBroker;
+        private final RpcRegistry _rpcRegistry;
+
+        private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>> augmentation;
+
+        private ${capitalApp}ProviderImplImpl(${capitalApp}ProviderImplBuilder builder) {
+            this._dataBroker = builder.getDataBroker();
+            this._rpcRegistry = builder.getRpcRegistry();
+            switch (builder.augmentation.size()) {
+             case 0:
+                 this.augmentation = Collections.emptyMap();
+                 break;
+             case 1:
+                 final Map.Entry<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>> e = builder.augmentation.entrySet().iterator().next();
+                 this.augmentation = Collections.<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>>singletonMap(e.getKey(), e.getValue());
+                 break;
+             default :
+                 this.augmentation = new HashMap<>(builder.augmentation);
+             }
+        }
+
+        @Override
+        public DataBroker getDataBroker() {
+            return _dataBroker;
+        }
+
+        @Override
+        public RpcRegistry getRpcRegistry() {
+            return _rpcRegistry;
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${capitalApp}ProviderImpl>> E getAugmentation(Class<E> augmentationType) {
+            if (augmentationType == null) {
+                throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+            }
+            return (E) augmentation.get(augmentationType);
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((_dataBroker == null) ? 0 : _dataBroker.hashCode());
+            result = prime * result + ((_rpcRegistry == null) ? 0 : _rpcRegistry.hashCode());
+            result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            ${capitalApp}ProviderImplImpl other = (${capitalApp}ProviderImplImpl) obj;
+            if (_dataBroker == null) {
+                if (other._dataBroker != null) {
+                    return false;
+                }
+            } else if(!_dataBroker.equals(other._dataBroker)) {
+                return false;
+            }
+            if (_rpcRegistry == null) {
+                if (other._rpcRegistry != null) {
+                    return false;
+                }
+            } else if(!_rpcRegistry.equals(other._rpcRegistry)) {
+                return false;
+            }
+            if (augmentation == null) {
+                if (other.augmentation != null) {
+                    return false;
+                }
+            } else if(!augmentation.equals(other.augmentation)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder("${capitalApp}ProviderImpl [");
+            boolean first = true;
+
+            if (_dataBroker != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_dataBroker=");
+                builder.append(_dataBroker);
+             }
+            if (_rpcRegistry != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_rpcRegistry=");
+                builder.append(_rpcRegistry);
+             }
+            if (first) {
+                first = false;
+            } else {
+                builder.append(", ");
+            }
+            builder.append("augmentation=");
+            builder.append(augmentation.values());
+            return builder.append(']').toString();
+        }
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/rpcRegistry.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/rpcRegistry.vm
new file mode 100644 (file)
index 0000000..ed18ffd
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.Module;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+public interface RpcRegistry
+    extends
+    ChildOf<Module>,
+    Augmentable<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>,
+    ServiceRef
+{
+
+
+
+    public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl","2014-05-23","rpc-registry")
+    ;
+
+
+}
+
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/rpcRegistryBuilder.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/config/rpcRegistryBuilder.vm
new file mode 100644 (file)
index 0000000..8499855
--- /dev/null
@@ -0,0 +1,214 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl;
+
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+public class RpcRegistryBuilder {
+
+    private Object _name;
+    private Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
+
+    private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>> augmentation = new HashMap<>();
+
+    public RpcRegistryBuilder() {
+    }
+
+    public RpcRegistryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef arg) {
+        this._name = arg.getName();
+        this._type = arg.getType();
+    }
+
+    /**
+     Set fields from given grouping argument. Valid argument is instance of one of following types:
+     * <ul>
+     * <li>org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef</li>
+     * </ul>
+     *
+     * @param arg grouping object
+     * @throws IllegalArgumentException if given argument is none of valid types
+    */
+    public void fieldsFrom(DataObject arg) {
+        boolean isValidArg = false;
+        if (arg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef) {
+            this._name = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getName();
+            this._type = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getType();
+            isValidArg = true;
+        }
+        if (!isValidArg) {
+            throw new IllegalArgumentException(
+              "expected one of: [org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef] \n" +
+              "but was: " + arg
+            );
+        }
+    }
+
+    public Object getName() {
+        return _name;
+    }
+
+    public Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
+        return _type;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>> E getAugmentation(Class<E> augmentationType) {
+        if (augmentationType == null) {
+            throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+        }
+        return (E) augmentation.get(augmentationType);
+    }
+
+    public RpcRegistryBuilder setName(Object value) {
+
+        this._name = value;
+        return this;
+    }
+
+    public RpcRegistryBuilder setType(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> value) {
+
+        this._type = value;
+        return this;
+    }
+
+    public RpcRegistryBuilder addAugmentation(Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry> augmentation) {
+        this.augmentation.put(augmentationType, augmentation);
+        return this;
+    }
+
+    public RpcRegistry build() {
+        return new RpcRegistryImpl(this);
+    }
+
+    private static final class RpcRegistryImpl implements RpcRegistry {
+
+        public Class<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry> getImplementedInterface() {
+            return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry.class;
+        }
+
+        private final Object _name;
+        private final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
+
+        private final Map<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>> augmentation;
+
+        private RpcRegistryImpl(RpcRegistryBuilder builder) {
+            this._name = builder.getName();
+            this._type = builder.getType();
+            switch (builder.augmentation.size()) {
+             case 0:
+                 this.augmentation = Collections.emptyMap();
+                 break;
+             case 1:
+                 final Map.Entry<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>> e = builder.augmentation.entrySet().iterator().next();
+                 this.augmentation = Collections.<Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>>singletonMap(e.getKey(), e.getValue());
+                 break;
+             default :
+                 this.augmentation = new HashMap<>(builder.augmentation);
+             }
+        }
+
+        @Override
+        public Object getName() {
+            return _name;
+        }
+
+        @Override
+        public Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
+            return _type;
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523.modules.module.configuration.${lowerApp}.provider.impl.RpcRegistry>> E getAugmentation(Class<E> augmentationType) {
+            if (augmentationType == null) {
+                throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
+            }
+            return (E) augmentation.get(augmentationType);
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((_name == null) ? 0 : _name.hashCode());
+            result = prime * result + ((_type == null) ? 0 : _type.hashCode());
+            result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            RpcRegistryImpl other = (RpcRegistryImpl) obj;
+            if (_name == null) {
+                if (other._name != null) {
+                    return false;
+                }
+            } else if(!_name.equals(other._name)) {
+                return false;
+            }
+            if (_type == null) {
+                if (other._type != null) {
+                    return false;
+                }
+            } else if(!_type.equals(other._type)) {
+                return false;
+            }
+            if (augmentation == null) {
+                if (other.augmentation != null) {
+                    return false;
+                }
+            } else if(!augmentation.equals(other.augmentation)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder("RpcRegistry [");
+            boolean first = true;
+
+            if (_name != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_name=");
+                builder.append(_name);
+             }
+            if (_type != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    builder.append(", ");
+                }
+                builder.append("_type=");
+                builder.append(_type);
+             }
+            if (first) {
+                first = false;
+            } else {
+                builder.append(", ");
+            }
+            builder.append("augmentation=");
+            builder.append(augmentation.values());
+            return builder.append(']').toString();
+        }
+    }
+
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/yangModelBindingProvider.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/yangModelBindingProvider.vm
new file mode 100644 (file)
index 0000000..ddfb2d2
--- /dev/null
@@ -0,0 +1,8 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.{lowerApp}.provider.impl.rev140523;
+
+public final class $YangModelBindingProvider implements org.opendaylight.yangtools.yang.binding.YangModelBindingProvider {
+
+    public org.opendaylight.yangtools.yang.binding.YangModuleInfo getModuleInfo() {
+        return $YangModuleInfoImpl.getInstance();
+    }
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/yangModuleInfoImpl.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/provider/yang-gen-sal/yangModuleInfoImpl.vm
new file mode 100644 (file)
index 0000000..10ac8a5
--- /dev/null
@@ -0,0 +1,80 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.${lowerApp}.provider.impl.rev140523 ;
+import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
+import java.util.Set;
+import java.util.HashSet;
+import com.google.common.collect.ImmutableSet;
+import java.io.InputStream;
+import java.io.IOException;
+public final class $YangModuleInfoImpl implements YangModuleInfo {
+
+    private static final YangModuleInfo INSTANCE = new $YangModuleInfoImpl();
+
+    private final String name = "${app}-provider-impl";
+    private final String namespace = "urn:opendaylight:params:xml:ns:yang:controller:config:${app}-provider:impl";
+    private final String revision = "2014-05-23";
+    private final String resourcePath = "/META-INF/yang/${app}-provider-impl.yang";
+
+    private final Set<YangModuleInfo> importedModules;
+
+    public static YangModuleInfo getInstance() {
+        return INSTANCE;
+    }
+
+    private $YangModuleInfoImpl() {
+        Set<YangModuleInfo> set = new HashSet<>();
+        set.add(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.$YangModuleInfoImpl.getInstance());
+        set.add(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.binding.rev131028.$YangModuleInfoImpl.getInstance());
+        importedModules = ImmutableSet.copyOf(set);
+        InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath);
+        if (stream == null) {
+            throw new IllegalStateException("Resource '" + resourcePath + "' is missing");
+        }
+        try {
+            stream.close();
+        } catch (IOException e) {
+        // Resource leak, but there is nothing we can do
+        }
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getRevision() {
+        return revision;
+    }
+
+    @Override
+    public String getNamespace() {
+        return namespace;
+    }
+
+    @Override
+    public InputStream getModuleSourceStream() throws IOException {
+        InputStream stream = $YangModuleInfoImpl.class.getResourceAsStream(resourcePath);
+        if (stream == null) {
+            throw new IOException("Resource " + resourcePath + " is missing");
+        }
+        return stream;
+    }
+
+    @Override
+    public Set<YangModuleInfo> getImportedModules() {
+        return importedModules;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(this.getClass().getCanonicalName());
+        sb.append("[");
+        sb.append("name = " + name);
+        sb.append(", namespace = " + namespace);
+        sb.append(", revision = " + revision);
+        sb.append(", resourcePath = " + resourcePath);
+        sb.append(", imports = " + importedModules);
+        sb.append("]");
+        return sb.toString();
+    }
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/view.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/view.vm
new file mode 100644 (file)
index 0000000..9f932da
--- /dev/null
@@ -0,0 +1,120 @@
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>${app} Application</title>
+
+    <!-- Latest compiled and minified CSS -->
+<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
+
+<!-- Optional theme -->
+<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
+<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
+    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
+    <!-- Latest compiled and minified JavaScript -->
+    <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>  
+  </head>
+  <body>
+  <div class="container">
+    <h2>${app} application</h2>
+       <div class="actions" style="padding:15px 0px;">
+       <button class="btn btn-primary" data-toggle="modal" data-target="#myModal">
+      Add entry
+    </button>
+    </div>
+    <div class="content">
+    <table class="table table-hover">
+      <thead>
+        <tr>
+          <th>id</th>
+          #foreach( $field in $fields )
+            <th>${field}</th>
+          #end
+        </tr>
+      </thead>
+      <tbody> 
+      </tbody>
+    </table>
+    </div>
+    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+      <div class="modal-dialog">
+        <div class="modal-content">
+          <div class="modal-header">
+            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+            <h4 class="modal-title" id="myModalLabel">Add entry</h4>
+          </div>
+          <div class="modal-body">
+                   <form id="addEntry" role="form">
+                     #foreach( $field in $fields )
+                       <div class="form-group">
+                <label for="${field}">${field}</label>
+                <input type="text" class="form-control" name="${field}" id="${field}">
+              </div>
+                     #end
+              <div class="form-group">
+                <button type="submit" class="btn btn-primary">Save</button>
+              </div>
+           </form>
+          </div>
+      </div>
+    </div>
+  </div>
+  </div>
+  
+
+<script type="text/javascript">
+jQuery(document).ready(function(){
+  jQuery.ajax({
+         url: window.location.origin +"/restconf/operational/${app}:${app}",
+         dataType: "json",
+         success: function(data) { 
+           jQuery.each(data.${app}.entry, 
+                 function(){ 
+               var rowEntry = "<tr><td>" +
+                       this['entry-id']+"</td>"
+                       #foreach( $field in $fields )
+                         + "<td>" + this.${field} + "</td>"
+               #end
+                       
+                       +"</tr>";
+               console.log(rowEntry);
+               jQuery(".table tbody").append(rowEntry);
+           });
+         },
+         error : function(){ console.log("no data found");}
+  });
+});
+
+jQuery("form").on( "submit", function( event ) {
+         event.preventDefault();
+         var entryId = Math.random()*100000000000000000;
+         var formData = '{"input":{"entryField":[' 
+         #foreach( $field in $fields )
+          + '{"key":"${field}", "value":"'+ jQuery("input[name='${field}']").val()+ '"}'
+           #if($velocityCount != $fields.size()) 
+             +','
+           #end
+         #end
+         +'], "entryId" : "'+entryId+'" } }';
+         console.log( jQuery( this ).serialize() );
+         jQuery.ajax({
+                 url: window.location.origin +"/restconf/operations/${app}:saveEntry",
+                 type: "POST",
+                 headers: { 
+                       'Accept': 'application/json',
+                       'Content-Type': 'application/json' 
+                 },
+                 data: formData,
+                 dataType: "json",
+                 success: function(data) { 
+                         location.reload(true);
+                 },
+                 error : function(){ console.log("Error");}
+         });
+         
+       });
+</script>
+    
+  </body>
+</html>
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/yang.vm b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/template/yang.vm
new file mode 100644 (file)
index 0000000..cd35b85
--- /dev/null
@@ -0,0 +1,68 @@
+module $app {
+
+    yang-version 1;
+
+    namespace "opendaylight:sample";
+
+    prefix $app;
+
+       import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+       
+    organization "Netconf Central";
+
+    contact
+      "Harman Singh <harmasin@cisco.com>";
+
+    description
+      "YANG version of the sample app models";
+
+    revision "2014-04-07" {
+      description
+        "MD-SAL sample app";
+    }
+    
+    typedef entry-id {
+      type inet:uri;
+      description "An identifier for app entry.";
+    }
+    
+    container $app {
+      description
+        "Top-level container for all application database objects.";
+      list entry {
+       key "entry-id";
+        leaf entry-id {
+          type entry-id;
+          description "identifier of single list of entries.";
+        }
+        #foreach( $field in $fields )
+        leaf $field.name {
+          type $field.type;
+        }
+        #end
+      }
+    }
+    
+    rpc saveEntry {
+     description " Method to add a new entry into datastore.";
+     input {
+       list entryField {
+         leaf key {
+           type string;
+           description "name of the field";
+         }
+         
+         leaf value {
+           type string;
+           description "value of the field";
+         }
+       }
+       
+       leaf entryId {
+         type string;
+         description "entry Identifier";
+       }
+     }
+    }
+    
+}
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/model/pom.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/model/pom.xml
new file mode 100644 (file)
index 0000000..fd64a52
--- /dev/null
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <parent>\r
+        <artifactId>${rootArtifactId}</artifactId>\r
+        <groupId>${groupId}</groupId>\r
+        <version>${version}</version>\r
+    </parent>\r
+    <artifactId>${rootArtifactId}-model</artifactId>\r
+    <packaging>bundle</packaging>\r
+    <scm>\r
+      <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
+      <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
+      <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
+      <tag>HEAD</tag>\r
+  </scm>\r
+\r
+    <build>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.apache.felix</groupId>\r
+                <artifactId>maven-bundle-plugin</artifactId>\r
+                <version>${bundle.plugin.version}</version>\r
+                <extensions>true</extensions>\r
+                <configuration>\r
+                    <instructions>\r
+                        <Bundle-Name>${groupId}.${rootArtifactId}-model</Bundle-Name>\r
+                        <Import-Package>org.opendaylight.yangtools.yang.binding.annotations, *</Import-Package>\r
+                    </instructions>\r
+                </configuration>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>org.opendaylight.yangtools</groupId>\r
+                <artifactId>yang-maven-plugin</artifactId>\r
+                <version>${yangtools.version}</version>\r
+                <executions>\r
+                    <execution>\r
+                        <goals>\r
+                            <goal>generate-sources</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <yangFilesRootDir>src/main/yang</yangFilesRootDir>\r
+                            <codeGenerators>\r
+                                <generator>\r
+                                    <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>\r
+                                    <outputBaseDir>target/generated-sources/sal</outputBaseDir>\r
+                                </generator>\r
+                            </codeGenerators>\r
+                            <inspectDependencies>true</inspectDependencies>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+                <dependencies>\r
+                    <dependency>\r
+                        <groupId>org.opendaylight.yangtools</groupId>\r
+                        <artifactId>maven-sal-api-gen-plugin</artifactId>\r
+                        <version>${yangtools.version}</version>\r
+                        <type>jar</type>\r
+                    </dependency>\r
+                </dependencies>\r
+            </plugin>\r
+        </plugins>\r
+        <pluginManagement>\r
+            <plugins>\r
+                <!--This plugin's configuration is used to store Eclipse \r
+                    m2e settings only. It has no influence on the Maven build itself. -->\r
+                <plugin>\r
+                    <groupId>org.eclipse.m2e</groupId>\r
+                    <artifactId>lifecycle-mapping</artifactId>\r
+                    <version>1.0.0</version>\r
+                    <configuration>\r
+                        <lifecycleMappingMetadata>\r
+                            <pluginExecutions>\r
+                                <pluginExecution>\r
+                                    <pluginExecutionFilter>\r
+                                        <groupId>org.opendaylight.yangtools</groupId>\r
+                                        <artifactId>yang-maven-plugin</artifactId>\r
+                                        <versionRange>[0.5,)</versionRange>\r
+                                        <goals>\r
+                                            <goal>generate-sources</goal>\r
+                                        </goals>\r
+                                    </pluginExecutionFilter>\r
+                                    <action>\r
+                                        <ignore />\r
+                                    </action>\r
+                                </pluginExecution>\r
+                            </pluginExecutions>\r
+                        </lifecycleMappingMetadata>\r
+                    </configuration>\r
+                </plugin>\r
+            </plugins>\r
+        </pluginManagement>\r
+    </build>\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>org.opendaylight.yangtools</groupId>\r
+            <artifactId>yang-binding</artifactId>\r
+            <version>${yangtools.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.yangtools</groupId>\r
+            <artifactId>yang-common</artifactId>\r
+            <version>${yangtools.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+       <groupId>org.opendaylight.yangtools.model</groupId>\r
+       <artifactId>ietf-inet-types</artifactId>\r
+       <version>${ietf-inet-types.version}</version>\r
+      </dependency>\r
+      <dependency>\r
+       <groupId>org.opendaylight.yangtools.model</groupId>\r
+       <artifactId>ietf-yang-types</artifactId>\r
+       <version>${ietf-yang-types.version}</version>\r
+      </dependency>\r
+    </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/model/src/main/yang/yang.sample b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/model/src/main/yang/yang.sample
new file mode 100644 (file)
index 0000000..cc90784
--- /dev/null
@@ -0,0 +1,69 @@
+module task {
+
+    yang-version 1;
+
+    namespace "opendaylight:sample";
+
+    prefix task;
+
+       import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+       
+    organization "Netconf Central";
+
+    contact
+      "Harman Singh <harmasin@cisco.com>";
+
+    description
+      "YANG version of the sample app models";
+
+    revision "2014-04-07" {
+      description
+        "MD-SAL sample app";
+    }
+    
+    typedef entry-id {
+      type inet:uri;
+      description "An identifier for app entry.";
+    }
+    
+    container task {
+      description
+        "Top-level container for all application database objects.";
+      list entry {
+       key "entry-id";
+        leaf entry-id {
+          type entry-id;
+          description "identifier of single list of entries.";
+        }
+                leaf title {
+          type string;
+        }
+                leaf desc {
+          type string;
+        }
+              }
+    }
+    
+    rpc saveEntry {
+     description " Method to add a new entry into datastore.";
+     input {
+       list entryField {
+         leaf key {
+           type string;
+           description "name of the field";
+         }
+         
+         leaf value {
+           type string;
+           description "value of the field";
+         }
+       }
+       
+       leaf entryId {
+         type string;
+         description "entry Identifier";
+       }
+     }
+    }
+    
+}
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..9c31653
--- /dev/null
@@ -0,0 +1,125 @@
+<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>
+  <packaging>pom</packaging>
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
+    <yangtools.version>0.6.2-SNAPSHOT</yangtools.version>
+    <bundle.plugin.version>2.3.7</bundle.plugin.version>
+    <sitedeploy>dav:http://nexus.opendaylight.org/content/sites/site</sitedeploy>
+    <java.version.source>1.7</java.version.source>
+    <java.version.target>1.7</java.version.target>
+    <maven.compile.plugin.version>2.5.1</maven.compile.plugin.version>
+    <mdsal.version>1.1-SNAPSHOT</mdsal.version>
+    <equinox.osgi.version>3.8.1.v20120830-144521</equinox.osgi.version>
+    <ietf-inet-types.version>2010.09.24.4-SNAPSHOT</ietf-inet-types.version>
+       <ietf-yang-types.version>2010.09.24.4-SNAPSHOT</ietf-yang-types.version>
+    <spring.version>3.1.3.RELEASE</spring.version>
+       <jackson.version>1.9.10</jackson.version>
+    <jmxGeneratorPath>src/main/yang-gen-config</jmxGeneratorPath>
+    <salGeneratorPath>src/main/yang-gen-sal</salGeneratorPath>
+    <config.version>0.2.5-SNAPSHOT</config.version>
+  </properties>
+  
+  <scm>
+      <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+      <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+      <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+      <tag>HEAD</tag>
+  </scm>
+  
+    <pluginRepositories>
+    <!-- OpenDayLight Repo Mirror -->
+    <pluginRepository>
+      <id>opendaylight-mirror</id>
+      <name>opendaylight-mirror</name>
+      <url>${nexusproxy}/groups/public/</url>
+      <snapshots>
+          <enabled>false</enabled>
+      </snapshots>
+      <releases>
+          <enabled>true</enabled>
+          <updatePolicy>never</updatePolicy>
+      </releases>
+    </pluginRepository>
+    <!-- OpenDayLight Snapshot artifact -->
+    <pluginRepository>
+      <id>opendaylight-snapshot</id>
+      <name>opendaylight-snapshot</name>
+      <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+      <snapshots>
+          <enabled>true</enabled>
+      </snapshots>
+      <releases>
+          <enabled>false</enabled>
+      </releases>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <repositories>
+    <!-- OpenDayLight Repo Mirror -->
+    <repository>
+      <id>opendaylight-mirror</id>
+      <name>opendaylight-mirror</name>
+      <url>${nexusproxy}/groups/public/</url>
+      <snapshots>
+          <enabled>false</enabled>
+      </snapshots>
+      <releases>
+          <enabled>true</enabled>
+          <updatePolicy>never</updatePolicy>
+      </releases>
+    </repository>
+    <!-- OpenDayLight Snapshot artifact -->
+    <repository>
+      <id>opendaylight-snapshot</id>
+      <name>opendaylight-snapshot</name>
+      <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+      <snapshots>
+          <enabled>true</enabled>
+      </snapshots>
+      <releases>
+          <enabled>false</enabled>
+      </releases>
+    </repository>
+  </repositories>
+  
+  <distributionManagement>
+    <!-- OpenDayLight Released artifact -->
+    <repository>
+      <id>opendaylight-release</id>
+      <url>${nexusproxy}/repositories/opendaylight.release/</url>
+    </repository>
+    <!-- OpenDayLight Snapshot artifact -->
+    <snapshotRepository>
+      <id>opendaylight-snapshot</id>
+      <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+    </snapshotRepository>
+    <!-- Site deployment -->
+    <site>
+      <id>website</id>
+      <url>${sitedeploy}</url>
+    </site>
+  </distributionManagement>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>${maven.compile.plugin.version}</version>
+          <configuration>
+            <source>${java.version.source}</source>
+            <target>${java.version.target}</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/provider/pom.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/provider/pom.xml
new file mode 100644 (file)
index 0000000..c09d8ce
--- /dev/null
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <parent>\r
+        <artifactId>${rootArtifactId}</artifactId>\r
+        <groupId>${groupId}</groupId>\r
+        <version>${version}</version>\r
+    </parent>\r
+    <artifactId>${rootArtifactId}-provider</artifactId>\r
+    <packaging>bundle</packaging>\r
+    <scm>\r
+        <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>\r
+        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>\r
+        <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>\r
+      <tag>HEAD</tag>\r
+  </scm>\r
+\r
+\r
+    <build>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.apache.felix</groupId>\r
+                <artifactId>maven-bundle-plugin</artifactId>\r
+                <version>${bundle.plugin.version}</version>\r
+                <extensions>true</extensions>\r
+                <configuration>\r
+                    <instructions>\r
+                        <Export-Package>org.opendaylight.controller.config.yang.config.${appName}_provider.impl</Export-Package>\r
+                        <Import-Package>*</Import-Package>\r
+                    </instructions>\r
+                </configuration>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>org.opendaylight.yangtools</groupId>\r
+                <artifactId>yang-maven-plugin</artifactId>\r
+                <version>${yangtools.version}</version>\r
+                <executions>\r
+                    <execution>\r
+                        <id>config</id>\r
+                        <goals>\r
+                            <goal>generate-sources</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <codeGenerators>\r
+                                <generator>\r
+                                    <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>\r
+                                    <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>\r
+                                    <additionalConfiguration>\r
+                                        <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>\r
+                                    </additionalConfiguration>\r
+                                </generator>\r
+                                <generator>\r
+                                    <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>\r
+                                    <outputBaseDir>${salGeneratorPath}</outputBaseDir>\r
+                                </generator>\r
+                            </codeGenerators>\r
+                            <inspectDependencies>true</inspectDependencies>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+                <dependencies>\r
+                    <dependency>\r
+                        <groupId>org.opendaylight.yangtools</groupId>\r
+                        <artifactId>maven-sal-api-gen-plugin</artifactId>\r
+                        <version>${yangtools.version}</version>\r
+                        <type>jar</type>\r
+                    </dependency>\r
+                    <dependency>\r
+                        <groupId>org.opendaylight.controller</groupId>\r
+                        <artifactId>yang-jmx-generator-plugin</artifactId>\r
+                        <version>0.2.5-SNAPSHOT</version>\r
+                    </dependency>\r
+                </dependencies>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>${groupId}</groupId>\r
+            <artifactId>${rootArtifactId}-model</artifactId>\r
+            <version>${version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>config-api</artifactId>\r
+            <version>${config.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>sal-binding-config</artifactId>\r
+            <version>${mdsal.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>sal-binding-api</artifactId>\r
+            <version>${mdsal.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>sal-common-util</artifactId>\r
+            <version>${mdsal.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+      <groupId>equinoxSDK381</groupId>\r
+      <artifactId>org.eclipse.osgi</artifactId>\r
+      <version>${equinox.osgi.version}</version>\r
+    </dependency>\r
+    </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/pom.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/pom.xml
new file mode 100644 (file)
index 0000000..d8e4bc5
--- /dev/null
@@ -0,0 +1,107 @@
+<?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">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+        <artifactId>${rootArtifactId}</artifactId>
+        <groupId>${groupId}</groupId>
+        <version>${version}</version>
+    </parent>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
+    <tag>HEAD</tag>
+  </scm>
+
+  <artifactId>${rootArtifactId}-web</artifactId>
+  <packaging>bundle</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${bundle.plugin.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+          <Import-Package>
+              javax.annotation,
+              javax.naming,
+              javax.servlet,
+              javax.servlet.annotation,
+              javax.servlet.http,
+              javax.servlet.jsp,
+              javax.servlet.jsp.el,
+              javax.servlet.jsp.jstl.core,
+              javax.servlet.jsp.jstl.fmt,
+              javax.servlet.jsp.jstl.tlv,
+              javax.servlet.jsp.tagext,
+              javax.servlet.resources,
+              javax.xml.parsers,
+              javax.xml.transform,
+              org.apache.commons.logging,
+              org.apache.taglibs.standard.functions,
+              org.apache.taglibs.standard.resources,
+              org.apache.taglibs.standard.tag.common.core,
+              org.apache.taglibs.standard.tag.common.fmt,
+              org.apache.taglibs.standard.tag.rt.core,
+              org.apache.taglibs.standard.tag.rt.fmt,
+              org.apache.taglibs.standard.tei,
+              org.apache.taglibs.standard.tlv,
+              com.fasterxml.jackson.core,
+              com.fasterxml.jackson.databind,
+              com.fasterxml.jackson.annotation,
+              org.osgi.framework,
+              org.slf4j,
+              org.springframework.beans,
+              org.springframework.beans.factory.xml,
+              org.springframework.context.config,
+              org.springframework.core,
+              org.springframework.stereotype,
+              org.springframework.ui,
+              org.springframework.web,
+              org.springframework.web.bind.annotation,
+              org.springframework.web.servlet,
+              org.springframework.web.servlet.config,
+              org.springframework.web.servlet.view,
+              org.springframework.web.servlet.view.json,
+              org.springframework.web.filter,
+              org.springframework.web.context,
+              org.springframework.util,
+              org.apache.catalina.filters
+            </Import-Package>
+            <Export-Package>${groupId}.web</Export-Package>
+            <Web-ContextPath>/controller/web/${rootArtifactId}</Web-ContextPath>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+       <!-- Spring 3 dependencies -->
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-core</artifactId>
+                       <version>${spring.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-web</artifactId>
+                       <version>${spring.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-webmvc</artifactId>
+                       <version>${spring.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.codehaus.jackson</groupId>
+                       <artifactId>jackson-mapper-asl</artifactId>
+                       <version>${jackson.version}</version>
+               </dependency>
+               </dependencies>
+  </project>
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/java/org/opendaylight/controller/app/web/SampleAppController.java b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/java/org/opendaylight/controller/app/web/SampleAppController.java
new file mode 100644 (file)
index 0000000..51ce011
--- /dev/null
@@ -0,0 +1,25 @@
+
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.app.web;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+@RequestMapping("/")
+public class SampleAppController {
+  
+  @RequestMapping(value="/view", method = RequestMethod.GET)
+  public String viewList(){
+    return "view";
+  }
+   
+}
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.factories
new file mode 100644 (file)
index 0000000..93db02e
--- /dev/null
@@ -0,0 +1 @@
+org.springframework.beans.BeanInfoFactory=org.springframework.beans.ExtendedBeanInfoFactory
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.handlers
new file mode 100644 (file)
index 0000000..957af91
--- /dev/null
@@ -0,0 +1,10 @@
+http\://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler
+http\://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler
+http\://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler
+http\://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler
+http\://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler
+http\://www.springframework.org/schema/c=org.springframework.beans.factory.xml.SimpleConstructorNamespaceHandler
+http\://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler
+http\://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler
+http\://www.springframework.org/schema/mvc=org.springframework.web.servlet.config.MvcNamespaceHandler
+http\://www.springframework.org/schema/security=org.springframework.security.config.SecurityNamespaceHandler
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.schemas
new file mode 100644 (file)
index 0000000..d865edc
--- /dev/null
@@ -0,0 +1,49 @@
+http\://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd
+http\://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd
+http\://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd
+http\://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd
+http\://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd
+http\://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd
+http\://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd
+http\://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd
+http\://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd
+http\://www.springframework.org/schema/tool/spring-tool-3.1.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd
+http\://www.springframework.org/schema/tool/spring-tool-3.2.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd
+http\://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd
+http\://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd
+http\://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd
+http\://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd
+http\://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd
+http\://www.springframework.org/schema/util/spring-util-3.2.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd
+http\://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd
+http\://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd
+http\://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd
+http\://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd
+http\://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd
+http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.2.xsd
+http\://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd
+http\://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd
+http\://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd
+http\://www.springframework.org/schema/jee/spring-jee-3.1.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd
+http\://www.springframework.org/schema/jee/spring-jee-3.2.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd
+http\://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd
+http\://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd
+http\://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd
+http\://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd
+http\://www.springframework.org/schema/lang/spring-lang-3.1.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd
+http\://www.springframework.org/schema/lang/spring-lang-3.2.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd
+http\://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd
+http\://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd
+http\://www.springframework.org/schema/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd
+http\://www.springframework.org/schema/task/spring-task-3.2.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd
+http\://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd
+http\://www.springframework.org/schema/cache/spring-cache-3.1.xsd=org/springframework/cache/config/spring-cache-3.1.xsd
+http\://www.springframework.org/schema/cache/spring-cache-3.2.xsd=org/springframework/cache/config/spring-cache-3.2.xsd
+http\://www.springframework.org/schema/cache/spring-cache.xsd=org/springframework/cache/config/spring-cache-3.2.xsd
+http\://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd
+http\://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd=org/springframework/web/servlet/config/spring-mvc-3.1.xsd
+http\://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd=org/springframework/web/servlet/config/spring-mvc-3.2.xsd
+http\://www.springframework.org/schema/mvc/spring-mvc.xsd=org/springframework/web/servlet/config/spring-mvc-3.2.xsd
+http\://www.springframework.org/schema/security/spring-security-3.1.xsd=org/springframework/security/config/spring-security-3.1.xsd
+http\://www.springframework.org/schema/security/spring-security-3.2.xsd=org/springframework/security/config/spring-security-3.2.xsd
+
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/META-INF/spring.tooling
new file mode 100644 (file)
index 0000000..057d834
--- /dev/null
@@ -0,0 +1,39 @@
+# Tooling related information for the beans namespace
+http\://www.springframework.org/schema/beans@name=beans Namespace
+http\://www.springframework.org/schema/beans@prefix=beans
+http\://www.springframework.org/schema/beans@icon=org/springframework/beans/factory/xml/spring-beans.gif
+
+# Tooling related information for the util namespace
+http\://www.springframework.org/schema/util@name=util Namespace
+http\://www.springframework.org/schema/util@prefix=util
+http\://www.springframework.org/schema/util@icon=org/springframework/beans/factory/xml/spring-util.gif
+
+# Tooling related information for the context namespace
+http\://www.springframework.org/schema/context@name=context Namespace
+http\://www.springframework.org/schema/context@prefix=context
+http\://www.springframework.org/schema/context@icon=org/springframework/context/config/spring-context.gif
+
+# Tooling related information for the jee namespace
+http\://www.springframework.org/schema/jee@name=jee Namespace
+http\://www.springframework.org/schema/jee@prefix=jee
+http\://www.springframework.org/schema/jee@icon=org/springframework/ejb/config/spring-jee.gif
+
+# Tooling related information for the scheduling namespace
+http\://www.springframework.org/schema/task@name=task Namespace
+http\://www.springframework.org/schema/task@prefix=task
+http\://www.springframework.org/schema/task@icon=org/springframework/scheduling/config/spring-task.gif
+
+# Tooling related information for the lang namespace
+http\://www.springframework.org/schema/lang@name=lang Namespace
+http\://www.springframework.org/schema/lang@prefix=lang
+http\://www.springframework.org/schema/lang@icon=org/springframework/scripting/config/spring-lang.gif
+
+# Tooling related information for the cache namespace
+http\://www.springframework.org/schema/cache@name=cache Namespace
+http\://www.springframework.org/schema/cache@prefix=cache
+http\://www.springframework.org/schema/cache@icon=org/springframework/cache/config/spring-cache.gif
+
+# Tooling related information for the mvc namespace
+http\://www.springframework.org/schema/mvc@name=mvc Namespace
+http\://www.springframework.org/schema/mvc@prefix=mvc
+http\://www.springframework.org/schema/mvc@icon=org/springframework/web/servlet/config/spring-mvc.gif
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/md-sal-app-servlet.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/md-sal-app-servlet.xml
new file mode 100644 (file)
index 0000000..ee81d11
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:context="http://www.springframework.org/schema/context"
+  xmlns:mvc="http://www.springframework.org/schema/mvc"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+       <context:component-scan base-package="org.opendaylight.controller.app.web" />
+
+    <mvc:resources mapping="/js/**" location="/js/" />
+  <mvc:resources mapping="/css/**" location="/css/" />
+  <mvc:resources mapping="/img/**" location="/img/" />
+
+       <mvc:annotation-driven />
+       
+       <bean
+               class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+               <property name="prefix">
+                       <value>/WEB-INF/pages/</value>
+               </property>
+               <property name="suffix">
+                       <value>.jsp</value>
+               </property>
+       </bean>
+</beans>
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/pages/view.jsp b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/pages/view.jsp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/web/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..9d3b19b
--- /dev/null
@@ -0,0 +1,20 @@
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+        version="3.0">
+  <display-name>MD-SAL Application</display-name>
+  
+  <servlet>
+               <servlet-name>md-sal-app</servlet-name>
+               <servlet-class>
+                       org.springframework.web.servlet.DispatcherServlet
+               </servlet-class>
+               <load-on-startup>1</load-on-startup>
+       </servlet>
+       <servlet-mapping>
+               <servlet-name>md-sal-app</servlet-name>
+               <url-pattern>/</url-pattern>
+       </servlet-mapping>
+       
+</web-app>