Fixes to the -simple and -flow archetypes 23/6323/1
authorAnirudh Ramachandran <anirudhvr@gmail.com>
Tue, 22 Apr 2014 23:03:52 +0000 (16:03 -0700)
committerAnirudh Ramachandran <anirudhvr@gmail.com>
Tue, 22 Apr 2014 23:09:08 +0000 (16:09 -0700)
 + Add ${artifactId} at a couple of places in the simple archetype js
   which would take care of someone choosing a name other than simple
 + Adding Rest-Resource-Name for flow archetype
 + Removing 'phoenix' keyword where not required in the flow archetype

Change-Id: I6fdb4901a174181188a1ccb62577d12e9dd6d5e9
Signed-off-by: Anirudh Ramachandran <anirudhvr@gmail.com>
main/archetypes/archetype-app-flow/pom.xml
main/archetypes/archetype-app-flow/src/main/resources/META-INF/maven/archetype-metadata.xml
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/pom.xml
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
main/archetypes/archetype-app-flow/src/test/resources/projects/basic/archetype.properties
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/ISimple.java
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/collections/SimpleCollection.js
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/models/SimpleModel.js
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/views/View.js

index b268afe2a7d4ea9f3615fcc1615db31338604558..2c0e49e0cb7b6701c5995cae49d833ccc013b725 100644 (file)
@@ -2,12 +2,12 @@
 <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
 \r
-  <groupId>org.opendaylight.phoenix</groupId>\r
-  <artifactId>phoenix-app-flow-archetype</artifactId>\r
+  <groupId>org.opendaylight.toolkit</groupId>\r
+  <artifactId>toolkit-app-flow-archetype</artifactId>\r
   <version>1.0-SNAPSHOT</version>\r
   <packaging>maven-archetype</packaging>\r
 \r
-  <name>phoenix-app-flow-archetype</name>\r
+  <name>toolkit-app-flow-archetype</name>\r
 \r
   <build>\r
     <extensions>\r
index 5ccd8931e46c7bfd4431faed6c2428df97f0a28d..23505cfe27c7a23a907c33fe7f34388baaee63d4 100644 (file)
@@ -67,4 +67,7 @@
       </includes>
     </fileSet>
   </fileSets>
+  <requiredProperties>
+      <requiredProperty key="REST-Resource-Name"/>
+  </requiredProperties>
 </archetype-descriptor>
index 61a469d1ae304cb8e51f37c3e465744e09e59477..b731752e38d9aa3e7a2a407f4d8af69748f46773 100644 (file)
@@ -3,7 +3,7 @@
 <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
-    <groupId>org.opendaylight.phoenix</groupId>\r
+    <groupId>org.opendaylight.toolkit</groupId>\r
     <artifactId>common</artifactId>\r
     <version>0.0.1-SNAPSHOT</version>\r
     <relativePath>../common</relativePath>\r
@@ -25,7 +25,7 @@
         <extensions>true</extensions>\r
         <configuration>\r
           <instructions>\r
-            <Import-Package>org.opendaylight.phoenix.web,\r
+            <Import-Package>org.opendaylight.toolkit.web,\r
               org.opendaylight.controller.sal.authorization,\r
               org.opendaylight.controller.sal.core,\r
               org.opendaylight.controller.sal.utils,\r
@@ -90,7 +90,7 @@
   </build>\r
   <dependencies>\r
     <dependency>\r
-      <groupId>org.opendaylight.phoenix</groupId>\r
+      <groupId>org.opendaylight.toolkit</groupId>\r
       <artifactId>web</artifactId>\r
     </dependency>\r
     <dependency>\r
index b0046995081258b6591c049232e2ecf390c34032..90abafa2688513d2ef757c6837c500bb0112fc27 100644 (file)
@@ -3,15 +3,37 @@
 #set( $symbol_escape = '\' )
 package ${package}.northbound;
 
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriInfo;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.opendaylight.controller.northbound.commons.RestMessages;
+import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
+import org.opendaylight.controller.northbound.commons.exception.UnauthorizedException;
+import org.opendaylight.controller.northbound.commons.utils.NorthboundUtils;
+import org.opendaylight.controller.sal.authorization.Privilege;
+import org.opendaylight.controller.sal.utils.Status;
 
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.codehaus.enunciate.jaxrs.TypeHint;
 
 /**
  * Northbound REST API
@@ -48,7 +70,7 @@ public class AppNorthbound {
      * Example:
      *
      * Request URL:
-     * http://localhost:8080/${artifactId}/northbound/api
+     * http://localhost:8080/app/northbound/${artifactId}/${REST-Resource-Name}
      *
      * Response body in XML:
      * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
@@ -58,7 +80,7 @@ public class AppNorthbound {
      * Sample Northbound API
      * </pre>
      */
-    @Path("/api")
+    @Path("/${REST-Resource-Name}")
     @GET
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @TypeHint(String.class)
index dc57d2da8cd6907aa676f8a7acffd22dde3b93e9..826bc713f15fa95243c6cc65d04f83d25dd926cb 100644 (file)
@@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.opendaylight.controller.sal.authorization.UserLevel;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
-import org.opendaylight.phoenix.web.IDaylightWeb;
+import org.opendaylight.toolkit.web.IDaylightWeb;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
index 95538616f7482afa6e4de1140f06c3fc35c9c484..9702312ef7c51ac671e9f66668e7d220cebc9225 100644 (file)
@@ -80,7 +80,7 @@
   </servlet-mapping>
   
   <listener>
-    <listener-class>org.opendaylight.phoenix.web.ControllerUISessionManager</listener-class>
+    <listener-class>org.opendaylight.toolkit.web.ControllerUISessionManager</listener-class>
   </listener>
 
   <!-- <session-config> // needs further testing
index 9857f0e305a8cabcfaf31378d15f2c8971fb5ec9..5fa40b3ef9ee2bbe202fc8cd8c8e247a787200f1 100644 (file)
@@ -3,3 +3,4 @@ package=it.pkg
 version=0.1-SNAPSHOT
 groupId=archetype.it
 artifactId=basic
+REST-Resource-Name=simple-data
index 917c47bbb0d17998b1b2a638cf79e9d917abe749..f8d1adf3ec80b6aa9285f9420d80d9a474f1a38b 100644 (file)
@@ -13,4 +13,4 @@ public interface ISimple {
     public Map<UUID, SimpleData> readData();
     public Status updateData(UUID uuid, SimpleData data);
     public Status deleteData(UUID uuid);
-}
\ No newline at end of file
+}
index f11ac887b4f78cd5849751a57e9f2ebc5d2ec73b..572175e144820925eb961bc861623890a6c914c9 100644 (file)
@@ -7,7 +7,7 @@ define(
     ], function(Backbone, _, SimpleModel) {
       var SimpleCollection = Backbone.Collection.extend({
         model : SimpleModel,
-        url : '/${artifactId}/northbound/simple'
+        url : '/${artifactId}/northbound/${artifactId}'
       });
       return SimpleCollection;
     });
index db53b19c1e8cc36897ec3a3822c3a45dcdcac3ea..fa4fb567ab959a73ab20c6b5860a3358aee1268a 100644 (file)
@@ -9,7 +9,7 @@ define(['backbone', 'underscore'], function(Backbone, _) {
     initialize : function() {
     },
     setUrlRoot: function() {
-      this.urlRoot = '/${artifactId}/northbound/simple';
+      this.urlRoot = '/${artifactId}/northbound/${artifactId}';
     }
   });
   return SimpleModel;
index a53b0d28aae63bd61852a998f930cd90e188e5d9..66cb5f19dc2aa340db36986cdfa38031ec1357af 100644 (file)
@@ -13,7 +13,7 @@ define(
         initialize: function() {
           var self = this;
           this.collection = new SimpleCollection();
-          this.collection.url = '/${artifactId}/northbound/simple';
+          this.collection.url = '/${artifactId}/northbound/${artifactId}';
           this.collection.fetch({
             success : function(call, response) {
               self.render();
@@ -40,7 +40,7 @@ define(
               foo : $('#simpleFooInput').val(),
               bar : $('#simpleBarInput').val()
             });
-            simpleModel.urlRoot = '/${artifactId}/northbound/simple';
+            simpleModel.urlRoot = '/${artifactId}/northbound/${artifactId}';
             simpleModel.save(null, {
               dataType: 'text',
               success: function(model, response) {