Initial commit 17/5917/1
authorAndrew Kim <h.andrew.kim@gmail.com>
Fri, 4 Apr 2014 23:32:58 +0000 (18:32 -0500)
committerAndrew Kim <h.andrew.kim@gmail.com>
Fri, 4 Apr 2014 23:34:22 +0000 (18:34 -0500)
Change-Id: Iccd04b0f5bebf4dd3d158e571f62075f68f67cf9
Signed-off-by: Andrew Kim <h.andrew.kim@gmail.com>
293 files changed:
.gitignore [new file with mode: 0644]
README.md [new file with mode: 0644]
common/opendaylight/full/pom.xml [new file with mode: 0644]
common/pom.xml [new file with mode: 0644]
main/archetypes/README [new file with mode: 0644]
main/archetypes/archetype-app-device/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/app.js [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicePropertiesCollection.js [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/main.js [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/templates/deviceProperties.html [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/views/DevicePropertiesView.js [new file with mode: 0644]
main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js [new file with mode: 0644]
main/archetypes/archetype-app-device/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
main/archetypes/archetype-app-device/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
main/archetypes/archetype-app-flow/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/css/flows.css [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/app.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicePropertiesCollection.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/FlowsCollection.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/main.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/models/FlowsModel.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/deviceProperties.html [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/flow.html [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/flows.html [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/DevicePropertiesView.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/FlowView.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/FlowsListView.js [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
main/archetypes/archetype-app-flow/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
main/archetypes/archetype-app-northbound/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
main/archetypes/archetype-app-northbound/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
main/archetypes/archetype-app-simple/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/ISimple.java [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/SimpleData.java [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/internal/Activator.java [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/internal/Simple.java [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/css/simple.css [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/app.js [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/collections/SimpleCollection.js [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/main.js [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/models/SimpleModel.js [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/templates/simple.html [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/views/View.js [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
main/archetypes/archetype-app-simple/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/java/App.java [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/App-servlet.xml [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/autherror.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/error.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/login.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/js/sample.js [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
main/archetypes/archetype-app-web-topology/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
main/archetypes/archetype-app-web/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/java/App.java [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/App-servlet.xml [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/autherror.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/error.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/login.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/js/sample.js [new file with mode: 0644]
main/archetypes/archetype-app-web/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
main/archetypes/archetype-app-web/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
main/archetypes/archetype-app/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/app.js [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/main.js [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html [new file with mode: 0644]
main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js [new file with mode: 0644]
main/archetypes/archetype-app/src/test/resources/projects/basic/archetype.properties [new file with mode: 0644]
main/archetypes/archetype-app/src/test/resources/projects/basic/goal.txt [new file with mode: 0644]
main/dev.js [new file with mode: 0644]
main/opendaylight-local.target [new file with mode: 0644]
main/opendaylight.target [new file with mode: 0644]
main/pom.xml [new file with mode: 0644]
main/src/assemble/bin.xml [new file with mode: 0644]
main/src/main/resources/configuration/RSA.pk [new file with mode: 0644]
main/src/main/resources/configuration/config.ini [new file with mode: 0644]
main/src/main/resources/configuration/context.xml [new file with mode: 0644]
main/src/main/resources/configuration/logback.xml [new file with mode: 0644]
main/src/main/resources/configuration/startup/README [new file with mode: 0644]
main/src/main/resources/configuration/tomcat-logging.properties [new file with mode: 0644]
main/src/main/resources/configuration/tomcat-server.xml [new file with mode: 0644]
main/src/main/resources/run.sh [new file with mode: 0755]
main/src/main/resources/version.properties [new file with mode: 0644]
main/templates/app-archetype-device-template/pom.xml [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/java/org/opendaylight/phoenix/app/northbound/AppNorthbound.java [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/java/org/opendaylight/phoenix/app/web/AppWeb.java [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/WEB-INF/AppWeb-servlet.xml [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/app/js [new symlink]
main/templates/app-archetype-device-template/src/main/resources/dev/css [new symlink]
main/templates/app-archetype-device-template/src/main/resources/dev/dev.sh [new file with mode: 0755]
main/templates/app-archetype-device-template/src/main/resources/dev/device/js [new symlink]
main/templates/app-archetype-device-template/src/main/resources/dev/img [new symlink]
main/templates/app-archetype-device-template/src/main/resources/dev/index.html [new symlink]
main/templates/app-archetype-device-template/src/main/resources/dev/js [new symlink]
main/templates/app-archetype-device-template/src/main/resources/dev/node [new symlink]
main/templates/app-archetype-device-template/src/main/resources/js/app.js [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/collections/DevicePropertiesCollection.js [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/collections/DevicesCollection.js [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/main.js [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/models/DeviceModel.js [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/templates/device.html [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/templates/deviceProperties.html [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/views/DevicePropertiesView.js [new file with mode: 0644]
main/templates/app-archetype-device-template/src/main/resources/js/views/DeviceView.js [new file with mode: 0644]
main/templates/app-archetype-northbound-template/pom.xml [new file with mode: 0644]
main/templates/app-archetype-northbound-template/src/main/java/org/opendaylight/phoenix/northbound/Northbound.java [new file with mode: 0644]
main/templates/app-archetype-northbound-template/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/templates/app-archetype-template/pom.xml [new file with mode: 0644]
main/templates/app-archetype-template/src/main/java/org/opendaylight/phoenix/app/northbound/AppNorthbound.java [new file with mode: 0644]
main/templates/app-archetype-template/src/main/java/org/opendaylight/phoenix/app/web/AppWeb.java [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/WEB-INF/AppWeb-servlet.xml [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/app/js [new symlink]
main/templates/app-archetype-template/src/main/resources/js/app.js [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/js/collections/DevicesCollection.js [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/js/main.js [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/js/models/DeviceModel.js [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/js/templates/device.html [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/js/views/DeviceView.js [new file with mode: 0644]
main/templates/app-archetype-template/src/main/resources/node/app/js [new symlink]
main/templates/app-archetype-template/src/main/resources/node/css [new symlink]
main/templates/app-archetype-template/src/main/resources/node/index.html [new symlink]
main/templates/app-archetype-template/src/main/resources/node/js [new symlink]
main/templates/app-bare-archetype-template/pom.xml [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/java/org/opendaylight/phoenix/app/App.java [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/App-servlet.xml [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/autherror.jsp [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/error.jsp [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/login.jsp [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
main/templates/app-bare-archetype-template/src/main/resources/js/sample.js [new file with mode: 0644]
main/templates/main [new symlink]
pom.xml [new file with mode: 0644]
web/.gitignore [new file with mode: 0644]
web/pom.xml [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/ClusterNodeBean.java [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/ControllerUISessionManager.java [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/DaylightWeb.java [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/DaylightWebAdmin.java [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/DaylightWebUtil.java [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/IDaylightWeb.java [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/NodeBean.java [new file with mode: 0644]
web/src/main/java/org/opendaylight/toolkit/web/UserBean.java [new file with mode: 0644]
web/src/main/resources/META-INF/spring.factories [new file with mode: 0644]
web/src/main/resources/META-INF/spring.handlers [new file with mode: 0644]
web/src/main/resources/META-INF/spring.schemas [new file with mode: 0644]
web/src/main/resources/META-INF/spring.tooling [new file with mode: 0644]
web/src/main/resources/WEB-INF/RootGUI-servlet.xml [new file with mode: 0644]
web/src/main/resources/WEB-INF/jsp/autherror.jsp [new file with mode: 0644]
web/src/main/resources/WEB-INF/jsp/error.jsp [new file with mode: 0644]
web/src/main/resources/WEB-INF/jsp/login.jsp [new file with mode: 0644]
web/src/main/resources/WEB-INF/jsp/main.jsp [new file with mode: 0644]
web/src/main/resources/WEB-INF/spring/servlet/security.xml [new file with mode: 0644]
web/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
web/src/main/resources/boilerplate.js [new file with mode: 0644]
web/src/main/resources/css/.bowerrc [new file with mode: 0644]
web/src/main/resources/css/bower.json [new file with mode: 0644]
web/src/main/resources/css/core.css [new file with mode: 0644]
web/src/main/resources/css/flows.css [new file with mode: 0644]
web/src/main/resources/css/global.css [new file with mode: 0644]
web/src/main/resources/css/header.css [new file with mode: 0644]
web/src/main/resources/css/login.css [new file with mode: 0644]
web/src/main/resources/css/menu.css [new file with mode: 0644]
web/src/main/resources/css/phoenix.css [new file with mode: 0644]
web/src/main/resources/dev/css [new symlink]
web/src/main/resources/dev/dev.sh [new file with mode: 0755]
web/src/main/resources/dev/images [new symlink]
web/src/main/resources/dev/index.html [new symlink]
web/src/main/resources/dev/js [new symlink]
web/src/main/resources/img/favicon.ico [new file with mode: 0644]
web/src/main/resources/img/logo.png [new file with mode: 0644]
web/src/main/resources/img/opendaylight.png [new file with mode: 0644]
web/src/main/resources/js/.bowerrc [new file with mode: 0644]
web/src/main/resources/js/app.js [new file with mode: 0644]
web/src/main/resources/js/assets/phoenix-topology.js [new file with mode: 0644]
web/src/main/resources/js/bower.json [new file with mode: 0644]
web/src/main/resources/js/collections/DevicePropertiesCollection.js [new file with mode: 0644]
web/src/main/resources/js/collections/DevicesCollection.js [new file with mode: 0644]
web/src/main/resources/js/collections/FlowsCollection.js [new file with mode: 0644]
web/src/main/resources/js/main.js [new file with mode: 0644]
web/src/main/resources/js/models/DeviceModel.js [new file with mode: 0644]
web/src/main/resources/js/models/FlowsModel.js [new file with mode: 0644]
web/src/main/resources/js/phoenix.js [new file with mode: 0644]
web/src/main/resources/js/templates/device.html [new file with mode: 0644]
web/src/main/resources/js/templates/deviceProperties.html [new file with mode: 0644]
web/src/main/resources/js/templates/flow.html [new file with mode: 0644]
web/src/main/resources/js/templates/flows.html [new file with mode: 0644]
web/src/main/resources/js/templates/home.html [new file with mode: 0644]
web/src/main/resources/js/views/DevicePropertiesView.js [new file with mode: 0644]
web/src/main/resources/js/views/DeviceView.js [new file with mode: 0644]
web/src/main/resources/js/views/FlowView.js [new file with mode: 0644]
web/src/main/resources/js/views/FlowsListView.js [new file with mode: 0644]
web/src/main/resources/js/views/HomeView.js [new file with mode: 0644]
web/src/main/resources/node/README [new file with mode: 0644]
web/src/main/resources/node/relay.js [new file with mode: 0644]
web/src/main/resources/node/routing.js [new file with mode: 0644]
web/src/main/resources/node/server.js [new file with mode: 0644]
web/src/main/resources/node/static.js [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..84b0c6c
--- /dev/null
@@ -0,0 +1,18 @@
+MANIFEST.MF
+.checkstyle
+ext/
+node_modules/
+
+*.class
+
+# Package Files #
+*.jar
+*.war
+*.ear
+.metadata
+.project
+.settings
+.classpath
+.prefs
+target/
+
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..163c460
--- /dev/null
+++ b/README.md
@@ -0,0 +1,42 @@
+# OpenDaylight Toolkit
+
+[![Build Status](https://travis-ci.org/opendaylight-toolkit/opendaylight-toolkit.svg?branch=master)](https://travis-ci.org/opendaylight-toolkit/opendaylight-toolkit)
+
+![alt text](http://media.playdota.com/items/121/icon.jpg "Mekansm")
+
+Quick HowTo
+-----------
+
+1) Go to <code>main/archetypes/archetype-app-simple</code> and run <code>mvn install</code> to install the simple archetype
+
+2) Go to the project root directory and generate an app using the simple archetypes you just installed <code>mvn archetype:generate -DarchetypeCatalog=local</code>
+
+>**groupId:** *org.bar.foo* <code>&lt;or any package name&gt;</code>
+
+>**artifactId:** *simple* <code>&lt;or any artifact name&gt;</code>
+
+>**version:** <code>&lt;press enter, default&gt;</code>
+
+>**package:** <code>&lt;press enter, default&gt;</code>
+
+3) *[optional]* Install the necessary web bower components, under directories <code>web/src/main/resources/js</code> and <code>web/src/main/resources/css</code> issue <code>bower install</code>
+
+>Note: you may need to install bower on your system using <code>npm -g install bower</code>
+
+>Note: [tip for setting up Node.js and npm on Mac](http://shapeshed.com/setting-up-nodejs-and-npm-on-mac-osx/)
+
+4) **[important]** Install the base controller, within project root directory (where common, main, web are located) issue <code>mvn install</code>
+>Note: This may take a while if you're on a new system 
+
+5) Then go into one of the apps you just generated and issue <code>mvn install</code> to install that bundle
+
+6) Then start the controller under <code>main/target/main-osgipackage/opendaylight</code> and <code>./run.sh -console</code>
+
+7) *[optional]* If you installed the bower components, you can access the toolkit web UI at <code>http://localhost:8080</code>
+
+Troubleshooting
+---------------
+
+Please visit the wiki for more information
+
+https://wiki.opendaylight.org/view/OpenDaylight_Toolkit:Main
diff --git a/common/opendaylight/full/pom.xml b/common/opendaylight/full/pom.xml
new file mode 100644 (file)
index 0000000..482b3dc
--- /dev/null
@@ -0,0 +1,316 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.opendaylight.toolkit</groupId>
+  <artifactId>common.opendaylight.full</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+
+  <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>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- OpenDaylight Toolkit -->
+      <dependency>
+        <groupId>org.opendaylight.toolkit</groupId>
+        <artifactId>web</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+      </dependency>
+
+      <!-- ODL Mirror -->
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>arphandler</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>clustering.services</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>clustering.services-implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>clustering.test</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>configuration</artifactId>
+        <version>0.4.3-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>configuration.implementation</artifactId>
+        <version>0.4.3-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>containermanager</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>appauth</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>containermanager.implementation</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwarding.staticrouting</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>routing.dijkstra_implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwardingrulesmanager</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwardingrulesmanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>hosttracker</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>hosttracker.implementation</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>switchmanager</artifactId>
+        <version>0.7.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>switchmanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>statisticsmanager</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>statisticsmanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>topologymanager</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>usermanager</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>usermanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>protocol_plugins.openflow</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal</artifactId>
+        <version>0.8.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>logging.bridge</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>security</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.connection</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>connectionmanager</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>connectionmanager.implementation</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.connection.implementation</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.networkconfiguration</artifactId>
+        <version>${sal.networkconfiguration.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.networkconfiguration.implementation</artifactId>
+        <version>${sal.networkconfiguration.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>org.openflow.openflowj</artifactId>
+        <version>1.0.3-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.ovsdb</groupId>
+        <artifactId>ovsdb</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>net.sf.jung2</artifactId>
+        <version>2.0.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>com.sun.jersey.jersey-servlet</artifactId>
+        <version>1.18-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
+        <version>7.0.43-SNAPSHOT</version>
+      </dependency>
+
+      <!-- ODL Northbound -->
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>commons.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>connectionmanager.northbound</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>containermanager.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>controllermanager.northbound</artifactId>
+        <version>0.0.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>flowprogrammer.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwarding.staticrouting.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>hosttracker.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>statistics.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>subnets.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>switchmanager.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>topology.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>usermanager.northbound</artifactId>
+        <version>0.0.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>bundlescanner.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>bundlescanner</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+</project>
diff --git a/common/pom.xml b/common/pom.xml
new file mode 100644 (file)
index 0000000..e303f0e
--- /dev/null
@@ -0,0 +1,916 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.opendaylight.toolkit</groupId>
+    <artifactId>common.opendaylight.full</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>opendaylight/full/</relativePath>
+  </parent>
+
+  <artifactId>common</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+
+  <properties>
+    <!-- Maven Compiler Plugin Version -->
+    <compiler.version>3.1</compiler.version>
+    <!-- Java Versions -->
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
+    <!-- ODL repository / plugin repository -->
+    <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
+    <!-- plugins -->
+    <bundle.plugin.version>2.4.0</bundle.plugin.version>
+    <surefire.version>2.15</surefire.version>
+    <checkstyle.version>2.10</checkstyle.version>
+    <enforcer.version>1.3.1</enforcer.version>
+    <!-- dependencies -->
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <virgo.version>3.6.0.RELEASE</virgo.version>
+    <slf4j.version>1.7.2</slf4j.version>
+    <logback.version>1.0.9</logback.version>
+    <jersey.version>1.17</jersey.version>
+    <commons.lang.version>3.1</commons.lang.version>
+    <spring-security.version>3.1.3.RELEASE</spring-security.version>
+    <spring.version>3.1.3.RELEASE</spring.version>
+    <spring.current.version>4.0.2.RELEASE</spring.current.version>
+    <netty.version>4.0.10.Final</netty.version>
+    <guava.version>14.0.1</guava.version>
+    <sal.networkconfiguration.version>0.0.3-SNAPSHOT</sal.networkconfiguration.version>
+
+
+    <!-- web dependencies -->
+    <jackson.version>2.3.0</jackson.version>
+    <geminiweb.version>2.2.0.RELEASE</geminiweb.version>
+  </properties>
+
+  <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>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- OpenDaylight Toolkit -->
+      <dependency>
+        <groupId>org.opendaylight.toolkit</groupId>
+        <artifactId>web</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+      </dependency>
+      
+      <!-- ODL Mirror -->
+      <!--
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>arphandler</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>clustering.services</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>clustering.services-implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>clustering.test</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>configuration</artifactId>
+        <version>0.4.3-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>configuration.implementation</artifactId>
+        <version>0.4.3-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>containermanager</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>appauth</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>containermanager.implementation</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwarding.staticrouting</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>routing.dijkstra_implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwardingrulesmanager</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwardingrulesmanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>hosttracker</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>hosttracker.implementation</artifactId>
+        <version>0.5.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>switchmanager</artifactId>
+        <version>0.7.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>switchmanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>statisticsmanager</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>statisticsmanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>topologymanager</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>usermanager</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>usermanager.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>protocol_plugins.openflow</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal</artifactId>
+        <version>0.8.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>logging.bridge</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>security</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.connection</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>connectionmanager</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>connectionmanager.implementation</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.connection.implementation</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.networkconfiguration</artifactId>
+        <version>${sal.networkconfiguration.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal.networkconfiguration.implementation</artifactId>
+        <version>${sal.networkconfiguration.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>org.openflow.openflowj</artifactId>
+        <version>1.0.3-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.ovsdb</groupId>
+        <artifactId>ovsdb</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>net.sf.jung2</artifactId>
+        <version>2.0.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>com.sun.jersey.jersey-servlet</artifactId>
+        <version>1.18-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller.thirdparty</groupId>
+        <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
+        <version>7.0.43-SNAPSHOT</version>
+      </dependency>
+      -->
+
+      <!-- ODL Northbound -->
+      <!--
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>commons.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>connectionmanager.northbound</artifactId>
+        <version>0.1.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>containermanager.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>controllermanager.northbound</artifactId>
+        <version>0.0.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>flowprogrammer.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>forwarding.staticrouting.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>hosttracker.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>statistics.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>subnets.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>switchmanager.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>topology.northbound</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>usermanager.northbound</artifactId>
+        <version>0.0.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>bundlescanner.implementation</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>bundlescanner</artifactId>
+        <version>0.4.2-SNAPSHOT</version>
+      </dependency>
+      -->
+
+      <!-- enunciate -->
+      <dependency>
+        <groupId>org.codehaus.enunciate</groupId>
+        <artifactId>enunciate-core-annotations</artifactId>
+        <version>1.28</version>
+      </dependency>
+
+      <!-- javax -->
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>javax.servlet</artifactId>
+        <version>3.0.0.v201112011016</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>javax.servlet.jsp</artifactId>
+        <version>2.2.0.v201112011158</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.el</artifactId>
+        <version>2.2.0.v201108011116</version>
+      </dependency>
+      <dependency>
+        <groupId>eclipselink</groupId>
+        <artifactId>javax.resource</artifactId>
+        <version>1.5.0.v200906010428</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.spec.javax.transaction</groupId>
+        <artifactId>jboss-transaction-api_1.1_spec</artifactId>
+        <version>1.0.1.Final</version>
+      </dependency>
+
+      <!-- objectweb -->
+      <dependency>
+        <groupId>org.ow2.asm</groupId>
+        <artifactId>asm-all</artifactId>
+        <version>4.1</version>
+      </dependency>
+
+      <!-- equinox + felix -->
+      <dependency>
+        <groupId>org.eclipse.equinox.http</groupId>
+        <artifactId>servlet</artifactId>
+        <version>1.0.0-v20070606</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.eclipse.osgi</artifactId>
+        <version>3.8.1.v20120830-144521</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.gogo.command</artifactId>
+        <version>0.8.0</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.apache.felix.gogo.runtime</artifactId>
+        <version>0.8.0.v201108120515</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.apache.felix.gogo.shell</artifactId>
+        <version>0.8.0.v201110170705</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.dependencymanager</artifactId>
+        <version>3.1.0</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.dependencymanager.shell</artifactId>
+        <version>3.0.1</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.eclipse.equinox.console</artifactId>
+        <version>1.0.0.v20120522-1841</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.eclipse.equinox.launcher</artifactId>
+        <version>1.3.0.v20120522-1813</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.eclipse.equinox.ds</artifactId>
+        <version>1.4.0.v20120522-1841</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.eclipse.equinox.util</artifactId>
+        <version>1.0.400.v20120522-2049</version>
+      </dependency>
+      <dependency>
+        <groupId>equinoxSDK381</groupId>
+        <artifactId>org.eclipse.osgi.services</artifactId>
+        <version>3.3.100.v20120522-1822</version>
+      </dependency>
+
+      <!-- virgomirror -->
+      <dependency>
+        <groupId>virgomirror</groupId>
+        <artifactId>org.eclipse.jdt.core.compiler.batch</artifactId>
+        <version>3.8.0.I20120518-2145</version>
+      </dependency>
+
+      <!-- felix -->
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.fileinstall</artifactId>
+        <version>3.1.6</version>
+      </dependency>
+
+      <!-- Spring Framework -->
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-context</artifactId>
+        <version>${spring.current.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-web</artifactId>
+        <version>${spring.current.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-websocket</artifactId>
+        <version>${spring.current.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-mock</artifactId>
+        <version>2.0.8</version>
+      </dependency>
+
+      <!-- Spring Framework ODL -->
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.asm</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.aop</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.context</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.context.support</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.core</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.beans</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.expression</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.web</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.aopalliance</groupId>
+        <artifactId>com.springsource.org.aopalliance</artifactId>
+        <version>1.0.0</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.web.servlet</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+
+      <!-- Spring security -->
+      <dependency>
+        <groupId>org.springframework.security</groupId>
+        <artifactId>spring-security-config</artifactId>
+        <version>${spring-security.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.security</groupId>
+        <artifactId>spring-security-core</artifactId>
+        <version>${spring-security.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.security</groupId>
+        <artifactId>spring-security-web</artifactId>
+        <version>${spring-security.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework.security</groupId>
+        <artifactId>spring-security-taglibs</artifactId>
+        <version>${spring-security.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>org.springframework.transaction</artifactId>
+        <version>${spring-security.version}</version>
+      </dependency>
+
+      <!-- slf4j -->
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>${slf4j.version}</version>
+        <scope>compile</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>log4j-over-slf4j</artifactId>
+        <version>${slf4j.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>jcl-over-slf4j</artifactId>
+        <version>${slf4j.version}</version>
+      </dependency>
+
+      <!-- apache -->
+      <dependency>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-lang3</artifactId>
+        <version>${commons.lang.version}</version>
+      </dependency>
+
+      <!-- logback -->
+      <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-core</artifactId>
+        <version>${logback.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-classic</artifactId>
+        <version>${logback.version}</version>
+      </dependency>
+
+      <!-- Jersey for JAXRS -->
+      <dependency>
+        <groupId>com.sun.jersey</groupId>
+        <artifactId>jersey-core</artifactId>
+        <version>${jersey.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.sun.jersey</groupId>
+        <artifactId>jersey-server</artifactId>
+        <version>${jersey.version}</version>
+      </dependency>
+
+      <!-- JUnit -->
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>3.8.1</version>
+        <scope>test</scope>
+      </dependency>
+
+      <!-- Web -->
+      <dependency>
+        <groupId>com.google.code.gson</groupId>
+        <artifactId>gson</artifactId>
+        <version>2.2.4</version>
+      </dependency>
+      <dependency>
+        <groupId>com.google.guava</groupId>
+        <artifactId>guava</artifactId>
+        <version>${guava.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.servlet.jsp.jstl</artifactId>
+        <version>1.2.0.v201105211821</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.servlet.jsp.jstl.impl</artifactId>
+        <version>1.2.0.v201210211230</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-annotations</artifactId>
+        <version>${jackson.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-core</artifactId>
+        <version>${jackson.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-databind</artifactId>
+        <version>${jackson.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.jaxrs</groupId>
+        <artifactId>jackson-jaxrs-base</artifactId>
+        <version>${jackson.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.jaxrs</groupId>
+        <artifactId>jackson-jaxrs-json-provider</artifactId>
+        <version>${jackson.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.module</groupId>
+        <artifactId>jackson-module-jaxb-annotations</artifactId>
+        <version>${jackson.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>org.apache.catalina</artifactId>
+        <version>7.0.32.v201211201336</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.annotation</artifactId>
+        <version>1.1.0.v201209060031</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.ejb</artifactId>
+        <version>3.1.1.v201204261316</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.xml.rpc</artifactId>
+        <version>1.1.0.v201005080400</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.mail.glassfish</artifactId>
+        <version>1.4.1.v201108011116</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>javax.activation</artifactId>
+        <version>1.1.0.v201211130549</version>
+      </dependency>
+      <dependency>
+        <groupId>eclipselink</groupId>
+        <artifactId>javax.persistence</artifactId>
+        <version>2.0.4.v201112161009</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>org.apache.coyote</artifactId>
+        <version>7.0.32.v201211201952</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>org.apache.juli.extras</artifactId>
+        <version>7.0.32.v201211081135</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>org.apache.tomcat.api</artifactId>
+        <version>7.0.32.v201211081135</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>org.apache.tomcat.util</artifactId>
+        <version>7.0.32.v201211201952</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>org.apache.jasper</artifactId>
+        <version>7.0.32.v201211201952</version>
+      </dependency>
+      <dependency>
+        <groupId>orbit</groupId>
+        <artifactId>org.apache.el</artifactId>
+        <version>7.0.32.v201211081135</version>
+      </dependency>
+      <!-- Gemini Web -->
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.gemini.web.core</artifactId>
+        <version>${geminiweb.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.gemini.web.extender</artifactId>
+        <version>${geminiweb.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.gemini.web.tomcat</artifactId>
+        <version>${geminiweb.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.virgo.kernel.equinox.extensions</artifactId>
+        <version>${virgo.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.virgo.util.common</artifactId>
+        <version>${virgo.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.virgo.util.io</artifactId>
+        <version>${virgo.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.virgo.util.math</artifactId>
+        <version>${virgo.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.virgo.util.osgi</artifactId>
+        <version>${virgo.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.virgo.util.osgi.manifest</artifactId>
+        <version>${virgo.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>geminiweb</groupId>
+        <artifactId>org.eclipse.virgo.util.parser.manifest</artifactId>
+        <version>${virgo.version}</version>
+      </dependency>
+
+        <!--Netty-->
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-handler</artifactId>
+            <version>${netty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-codec</artifactId>
+            <version>${netty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-buffer</artifactId>
+            <version>${netty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport</artifactId>
+            <version>${netty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-common</artifactId>
+            <version>${netty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-codec-http</artifactId>
+            <version>${netty.version}</version>
+        </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+        <configuration>
+          <systemProperties>
+            <property>
+              <name>logback.configurationFile</name>
+              <value>logback.xml</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+      <!--
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${checkstyle.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>0.0.3-SNAPSHOT</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <phase>process-sources</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <failsOnError>true</failsOnError>
+          <configLocation>controller/checkstyle.xml</configLocation>
+          <consoleOutput>true</consoleOutput>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+          <sourceDirectory>${project.basedir}</sourceDirectory>
+          <includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</includes>
+          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/</excludes>
+        </configuration>
+      </plugin>
+      -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>${enforcer.version}</version>
+        <executions>
+          <execution>
+            <id>enforce-java</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireJavaVersion>
+                  <version>1.7.0</version>
+                </requireJavaVersion>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>${compiler.version}</version>
+          <configuration>
+            <source>${maven.compiler.source}</source>
+            <target>${maven.compiler.target}</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/main/archetypes/README b/main/archetypes/README
new file mode 100644 (file)
index 0000000..4dc1ec3
--- /dev/null
@@ -0,0 +1,7 @@
+archetype-app-simple : o
+archetype-app-device : x
+archetype-app-flow: x
+archetype-app : x
+archetype-add-northbound: x
+archetype-app-web : x
+archetype-app-web-topology : x
diff --git a/main/archetypes/archetype-app-device/pom.xml b/main/archetypes/archetype-app-device/pom.xml
new file mode 100644 (file)
index 0000000..6e25cfb
--- /dev/null
@@ -0,0 +1,30 @@
+<?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
+\r
+  <groupId>org.opendaylight.phoenix</groupId>\r
+  <artifactId>phoenix-app-device-archetype</artifactId>\r
+  <version>1.0-SNAPSHOT</version>\r
+  <packaging>maven-archetype</packaging>\r
+\r
+  <name>phoenix-app-device-archetype</name>\r
+\r
+  <build>\r
+    <extensions>\r
+      <extension>\r
+        <groupId>org.apache.maven.archetype</groupId>\r
+        <artifactId>archetype-packaging</artifactId>\r
+        <version>2.2</version>\r
+      </extension>\r
+    </extensions>\r
+\r
+    <pluginManagement>\r
+      <plugins>\r
+        <plugin>\r
+          <artifactId>maven-archetype-plugin</artifactId>\r
+          <version>2.2</version>\r
+        </plugin>\r
+      </plugins>\r
+    </pluginManagement>\r
+  </build>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-device/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-app-device/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..5ccd893
--- /dev/null
@@ -0,0 +1,70 @@
+<?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="device"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java/</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.jsp</include>
+        <include>**/*.xml</include>
+        <include>**/*.html</include>
+        <include>**/*.txt</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources/js</directory>
+      <includes>
+        <include>**/*.js</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.</include>
+        <include>**/*.schemas</include>
+        <include>**/*.bowerrc</include>
+        <include>**/*.js</include>
+        <include>**/*.ico</include>
+        <include>**/*.editorconfig</include>
+        <include>**/*.tooling</include>
+        <include>**/*.sh</include>
+        <include>**/*.factories</include>
+        <include>**/*.npmignore</include>
+        <include>**/*.handlers</include>
+        <include>**/*.png</include>
+        <include>**/*.md</include>
+        <include>**/*.json</include>
+        <include>**/*.map</include>
+        <include>**/*.types</include>
+        <include>**/*.gitignore</include>
+        <include>**/*.css</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.checkstyle</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..61a469d
--- /dev/null
@@ -0,0 +1,113 @@
+#set( $symbol_dollar = '$' )\r
+<?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
+    <groupId>org.opendaylight.phoenix</groupId>\r
+    <artifactId>common</artifactId>\r
+    <version>0.0.1-SNAPSHOT</version>\r
+    <relativePath>../common</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>${artifactId}</artifactId>\r
+\r
+  <groupId>${groupId}</groupId>\r
+  <version>${version}</version>\r
+\r
+  <packaging>bundle</packaging>\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
+            <Import-Package>org.opendaylight.phoenix.web,\r
+              org.opendaylight.controller.sal.authorization,\r
+              org.opendaylight.controller.sal.core,\r
+              org.opendaylight.controller.sal.utils,\r
+              javax.annotation,\r
+              javax.naming,\r
+              javax.servlet,\r
+              javax.servlet.annotation,\r
+              javax.servlet.http,\r
+              javax.servlet.jsp,\r
+              javax.servlet.jsp.el,\r
+              javax.servlet.jsp.jstl.core,\r
+              javax.servlet.jsp.jstl.fmt,\r
+              javax.servlet.jsp.jstl.tlv,\r
+              javax.servlet.jsp.tagext,\r
+              javax.servlet.resources,\r
+              javax.xml.parsers,\r
+              javax.xml.transform,\r
+              org.apache.commons.logging,\r
+              org.apache.taglibs.standard.functions,\r
+              org.apache.taglibs.standard.resources,\r
+              org.apache.taglibs.standard.tag.common.core,\r
+              org.apache.taglibs.standard.tag.common.fmt,\r
+              org.apache.taglibs.standard.tag.rt.core,\r
+              org.apache.taglibs.standard.tag.rt.fmt,\r
+              org.apache.taglibs.standard.tei,\r
+              org.apache.taglibs.standard.tlv,\r
+              org.osgi.framework,\r
+              org.slf4j,\r
+              org.springframework.beans,\r
+              org.springframework.beans.factory.xml,\r
+              org.springframework.context.config,\r
+              org.springframework.stereotype,\r
+              org.springframework.ui,\r
+              org.springframework.web,\r
+              org.springframework.web.bind.annotation,\r
+              org.springframework.web.servlet,\r
+              org.springframework.web.servlet.config,\r
+              org.springframework.web.servlet.view,\r
+              org.springframework.web.filter,\r
+              org.springframework.web.context,\r
+\r
+              org.opendaylight.controller.northbound.commons,\r
+              com.sun.jersey.spi.container.servlet,\r
+              com.fasterxml.jackson.annotation,\r
+              javax.ws.rs,\r
+              javax.ws.rs.core,\r
+              javax.xml.bind,\r
+              javax.xml.bind.annotation,\r
+              org.apache.catalina.filters,\r
+              com.fasterxml.jackson.jaxrs.base,\r
+              com.fasterxml.jackson.jaxrs.json,\r
+              !org.codehaus.enunciate.jaxrs</Import-Package>\r
+            <Export-Package></Export-Package>\r
+            <Web-ContextPath>/${artifactId}</Web-ContextPath>\r
+            <Jaxrs-Resources>,${symbol_dollar}{classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>\r
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->\r
+        </configuration>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.opendaylight.phoenix</groupId>\r
+      <artifactId>web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.springframework</groupId>\r
+      <artifactId>spring-web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.codehaus.enunciate</groupId>\r
+      <artifactId>enunciate-core-annotations</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>commons.northbound</artifactId>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java
new file mode 100644 (file)
index 0000000..00c914f
--- /dev/null
@@ -0,0 +1,70 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.northbound;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ *
+ * This entire web class can be accessed via /northbound prefix as specified in
+ * web.xml
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+@Path("/")
+public class AppNorthbound {
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     *
+     * Sample REST API call
+     *
+     * @return A response string
+     *
+     * <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/app/northbound/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - ${artifactId}";
+        return result;
+    }
+}
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java
new file mode 100644 (file)
index 0000000..dc57d2d
--- /dev/null
@@ -0,0 +1,61 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.web;
+
+import javax.servlet.http.HttpServletRequest;
+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.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * This entire web class can be accessed via /web prefix as specified in web.xml
+ */
+@Controller
+@RequestMapping("/")
+public class AppWeb implements IDaylightWeb {
+    private static final String WEB_NAME = "${artifactId} App";
+    private static final String WEB_ID = "${artifactId}";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public AppWeb() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/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-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/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-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/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-app-device/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/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-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml
new file mode 100644 (file)
index 0000000..bc4f337
--- /dev/null
@@ -0,0 +1,24 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="${package}"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..b3b182a
--- /dev/null
@@ -0,0 +1,25 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>App</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <!-- style -->
+    <link rel="stylesheet" href="/css/ext/pure/pure.css"/>
+    <link rel="stylesheet" href="/css/phoenix.css"/>
+
+    <!-- style app -->
+
+    <!-- scripts -->
+    <script data-main="/${artifactId}/js/main" src="/js/ext/requirejs/require.js"></script>
+  </head>
+  <body>
+    <div id="main"></div>
+  </body>
+</html>
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..9553861
--- /dev/null
@@ -0,0 +1,141 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+
+  <security-constraint>
+    <display-name>App</display-name>
+    <web-resource-collection>
+      <web-resource-name>AppWeb</web-resource-name>
+      <url-pattern>/web/js/*</url-pattern>
+      <url-pattern>/web/images/*</url-pattern>
+      <url-pattern>/web/css/*</url-pattern>
+      <url-pattern>/web/favicon.ico</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>App</web-resource-name>
+      <url-pattern>/*</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>AppNorthbound</web-resource-name>
+      <url-pattern>/northbound/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <!-- <login-config> // enabling this auto directs to login page, considering removing this
+    <auth-method>FORM</auth-method>
+    <form-login-config>
+      <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+      <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+    </form-login-config>
+  </login-config>-->
+  
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+
+  <!-- <error-page>
+    <error-code>403</error-code>
+    <location>/WEB-INF/jsp/autherror.jsp</location>
+  </error-page> -->
+
+  <!-- web -->
+  <servlet>
+    <servlet-name>AppWeb</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppWeb</servlet-name>
+    <url-pattern>/web/*</url-pattern>
+  </servlet-mapping>
+  
+  <listener>
+    <listener-class>org.opendaylight.phoenix.web.ControllerUISessionManager</listener-class>
+  </listener>
+
+  <!-- <session-config> // needs further testing
+    <cookie-config>
+      <path>/</path>
+    </cookie-config>
+  </session-config>-->
+  
+  <!-- northbound -->
+  <servlet>
+    <servlet-name>AppNorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppNorthbound</servlet-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </filter-mapping>
+
+</web-app>
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/app.js b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/app.js
new file mode 100644 (file)
index 0000000..97364c1
--- /dev/null
@@ -0,0 +1,18 @@
+#set( $symbol_dollar = '$' )
+// Filename: app.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',                                    // lib/jquery/jquery
+  'underscore',                                // lib/underscore/underscore
+  'backbone',                                  // lib/backbone/backbone
+  '/${artifactId}/js/views/DeviceView.js'      // app
+], function($, _, Backbone, DeviceView){
+  var initialize = function() {
+    var deviceView = new DeviceView(); // this calls initialize which in turn calls render
+  }
+
+  return {
+    initialize : initialize
+  };
+});
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicePropertiesCollection.js b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicePropertiesCollection.js
new file mode 100644 (file)
index 0000000..60d4497
--- /dev/null
@@ -0,0 +1,4 @@
+define(['backbone','underscore'], function(Backbone, _) {
+  var DevicePropertiesCollection = Backbone.Collection.extend();
+  return DevicePropertiesCollection;
+});
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js
new file mode 100644 (file)
index 0000000..c60fcbb
--- /dev/null
@@ -0,0 +1,7 @@
+#set( $symbol_dollar = '$' )
+define(['backbone','underscore','/${artifactId}/js/models/DeviceModel.js'], function(Backbone, _, DeviceModel) {
+  var DevicesCollection = Backbone.Collection.extend({
+    model: DeviceModel
+  });
+  return DevicesCollection;
+});
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/main.js b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/main.js
new file mode 100644 (file)
index 0000000..c909cb6
--- /dev/null
@@ -0,0 +1,19 @@
+#set( $symbol_dollar = '$' )
+// Filename: main.js
+
+require.config({
+  paths: {
+    "jquery": "/js/ext/jquery/dist/jquery.min",
+    "underscore": "/js/ext/underscore/underscore",
+    "backbone": "/js/ext/backbone/backbone",
+    "models": "/${artifactId}/js/models",                          // app
+    "views": "/${artifactId}/js/views",                                    // app
+    "collections": "/${artifactId}/js/collections"     // app
+  }
+});
+require([
+  'app', '/js/phoenix.js'
+], function(App, Phoenix) {
+  new App.initialize();
+  new Phoenix.initialize();
+});
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js
new file mode 100644 (file)
index 0000000..aaec02f
--- /dev/null
@@ -0,0 +1,11 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+  var DeviceModel = Backbone.Model.extend({
+    defaults: {
+      name: "New device"
+    },
+    initialize: function() {
+      // initialize of DeviceModel called
+    }
+  });
+  return DeviceModel;
+});
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html
new file mode 100644 (file)
index 0000000..b28135a
--- /dev/null
@@ -0,0 +1,28 @@
+<script type="text/template" id="devicescontainer">
+  <div id="deviceDiv" style="margin-left:20px; float: left;">
+    <h3>Devices</h3>
+    <table class="pure-table pure-table-bordered">
+      <thead>
+        <tr>
+          <th>Node ID</th>
+          <th>Type</th>
+          <th>Properties</th>
+        </tr>
+      </thead>
+      <tbody>
+        <% _.each(devices, function(device) { %>
+          <tr data-nodeType="<%= device.node.type%>" data-nodeId="<%= device.node.id%>" style="cursor:pointer;">
+            <td><%= device.node.id %></td>
+            <td><%= device.node.type %></td>
+            <td>
+              <div>Mac Address: <%= device.properties.macAddress.value %></div>
+              <div>Description: <%= device.properties.description.value %></div>
+              <div>Mac Address: <%= device.properties.macAddress.value %></div>
+            </td>
+          </tr>
+          <% }); %>
+      </tbody>
+    </table>
+
+  </div>
+</script>
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/templates/deviceProperties.html b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/templates/deviceProperties.html
new file mode 100644 (file)
index 0000000..b222399
--- /dev/null
@@ -0,0 +1,33 @@
+<script type="text/template">
+  <div id="deviceProperties" style="float: left; margin-left: 20px;">
+    <h3>Device Properties - <%=nodeId %></h3>
+    <table class="pure-table pure-table-bordered">
+      <thead>
+        <tr>
+          <th>Property Name</th>
+          <th>Property Value</th>
+        </tr>
+      </thead>
+      <tbody>
+        <% _.each(deviceProps, function(prop) { %>
+          <tr>
+            <td>Bandwidth</td>
+            <td><%= prop.properties.bandwidth ? prop.properties.bandwidth.value : '' %></td>
+          </tr>
+          <tr>
+            <td>config</td>
+            <td><%= prop.properties.config.value%></td>
+          </tr>
+          <tr>
+            <td>name</td>
+            <td><%= prop.properties.name.value%></td>
+          </tr>
+          <tr>
+            <td>state</td>
+            <td><%= prop.properties.state.value%></td>
+          </tr>
+          <% }); %>
+      </tbody>
+    </table>
+  </div>
+</script>
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/views/DevicePropertiesView.js b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/views/DevicePropertiesView.js
new file mode 100644 (file)
index 0000000..489d78f
--- /dev/null
@@ -0,0 +1,31 @@
+#set( $symbol_dollar = '$' )
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    '/${artifactId}/js/collections/DevicePropertiesCollection.js',
+    '/js/ext/text/text.js!/${artifactId}/js/templates/deviceProperties.html'
+    ], function($, Backbone, _, DevicePropertiesCollection, DevicePropertiesTemplate) {
+
+      var DevicePropertiesView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+          // initialize of DevicePropertiesView called
+        },
+        render: function() {
+          var self = this;
+          $(self.el).find("#deviceProperties").remove();
+          this.collection = new DevicePropertiesCollection();
+          this.collection.url = "/controller/nb/v2/switchmanager/default/node/OF/" + self.nodeId;
+          this.collection.fetch({success: function(coll, response) {
+            var compiledTemplate = _.template(DevicePropertiesTemplate, {
+              deviceProps: response.nodeConnectorProperties,
+              nodeId: self.nodeId
+            });
+            $(self.el).append($(compiledTemplate).html());
+          }});
+        }
+      }); // DevicePropertiesView extend ends here
+      return DevicePropertiesView;
+    });
diff --git a/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js b/main/archetypes/archetype-app-device/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js
new file mode 100644 (file)
index 0000000..96ea20b
--- /dev/null
@@ -0,0 +1,42 @@
+#set( $symbol_dollar = '$' )
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    '/${artifactId}/js/collections/DevicesCollection.js',
+    '/${artifactId}/js/models/DeviceModel.js',
+    '/${artifactId}/js/views/DevicePropertiesView.js',
+    '/js/ext/text/text.js!/${artifactId}/js/templates/device.html'
+    ], function($, Backbone, _, DevicesCollection, DeviceModel, DevicePropertiesView, DeviceTemplate) {
+      var DeviceView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+          var self = this;
+          this.collection = new DevicesCollection();
+          this.collection.url = "/controller/nb/v2/switchmanager/default/nodes";
+          this.collection.fetch({
+            success: function(coll, response) {
+              // pass collection call to get devices
+              self.render();
+            }
+          });
+        },
+        render: function() {
+          // DevicesView initialize call
+          var that = this;
+          var compiledTemplate = _.template(DeviceTemplate, {devices: that.collection.models[0].get('nodeProperties')});
+          $(this.el).append($(compiledTemplate).html());
+        },
+        events: {
+          "click tr": "getNodeProperties"
+        },
+        getNodeProperties: function(evt) {
+          var $tr = $(evt.currentTarget);
+          var devicePropsView = new DevicePropertiesView();
+          devicePropsView.nodeId = $tr.attr("data-nodeId");
+          devicePropsView.render();
+        }
+      });
+      return DeviceView;
+    });
diff --git a/main/archetypes/archetype-app-device/src/test/resources/projects/basic/archetype.properties b/main/archetypes/archetype-app-device/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..9857f0e
--- /dev/null
@@ -0,0 +1,5 @@
+#Sat Mar 15 19:51:35 CDT 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/main/archetypes/archetype-app-device/src/test/resources/projects/basic/goal.txt b/main/archetypes/archetype-app-device/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-app-flow/pom.xml b/main/archetypes/archetype-app-flow/pom.xml
new file mode 100644 (file)
index 0000000..b268afe
--- /dev/null
@@ -0,0 +1,30 @@
+<?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
+\r
+  <groupId>org.opendaylight.phoenix</groupId>\r
+  <artifactId>phoenix-app-flow-archetype</artifactId>\r
+  <version>1.0-SNAPSHOT</version>\r
+  <packaging>maven-archetype</packaging>\r
+\r
+  <name>phoenix-app-flow-archetype</name>\r
+\r
+  <build>\r
+    <extensions>\r
+      <extension>\r
+        <groupId>org.apache.maven.archetype</groupId>\r
+        <artifactId>archetype-packaging</artifactId>\r
+        <version>2.2</version>\r
+      </extension>\r
+    </extensions>\r
+\r
+    <pluginManagement>\r
+      <plugins>\r
+        <plugin>\r
+          <artifactId>maven-archetype-plugin</artifactId>\r
+          <version>2.2</version>\r
+        </plugin>\r
+      </plugins>\r
+    </pluginManagement>\r
+  </build>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-app-flow/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..5ccd893
--- /dev/null
@@ -0,0 +1,70 @@
+<?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="device"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java/</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.jsp</include>
+        <include>**/*.xml</include>
+        <include>**/*.html</include>
+        <include>**/*.txt</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources/js</directory>
+      <includes>
+        <include>**/*.js</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.</include>
+        <include>**/*.schemas</include>
+        <include>**/*.bowerrc</include>
+        <include>**/*.js</include>
+        <include>**/*.ico</include>
+        <include>**/*.editorconfig</include>
+        <include>**/*.tooling</include>
+        <include>**/*.sh</include>
+        <include>**/*.factories</include>
+        <include>**/*.npmignore</include>
+        <include>**/*.handlers</include>
+        <include>**/*.png</include>
+        <include>**/*.md</include>
+        <include>**/*.json</include>
+        <include>**/*.map</include>
+        <include>**/*.types</include>
+        <include>**/*.gitignore</include>
+        <include>**/*.css</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.checkstyle</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..61a469d
--- /dev/null
@@ -0,0 +1,113 @@
+#set( $symbol_dollar = '$' )\r
+<?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
+    <groupId>org.opendaylight.phoenix</groupId>\r
+    <artifactId>common</artifactId>\r
+    <version>0.0.1-SNAPSHOT</version>\r
+    <relativePath>../common</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>${artifactId}</artifactId>\r
+\r
+  <groupId>${groupId}</groupId>\r
+  <version>${version}</version>\r
+\r
+  <packaging>bundle</packaging>\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
+            <Import-Package>org.opendaylight.phoenix.web,\r
+              org.opendaylight.controller.sal.authorization,\r
+              org.opendaylight.controller.sal.core,\r
+              org.opendaylight.controller.sal.utils,\r
+              javax.annotation,\r
+              javax.naming,\r
+              javax.servlet,\r
+              javax.servlet.annotation,\r
+              javax.servlet.http,\r
+              javax.servlet.jsp,\r
+              javax.servlet.jsp.el,\r
+              javax.servlet.jsp.jstl.core,\r
+              javax.servlet.jsp.jstl.fmt,\r
+              javax.servlet.jsp.jstl.tlv,\r
+              javax.servlet.jsp.tagext,\r
+              javax.servlet.resources,\r
+              javax.xml.parsers,\r
+              javax.xml.transform,\r
+              org.apache.commons.logging,\r
+              org.apache.taglibs.standard.functions,\r
+              org.apache.taglibs.standard.resources,\r
+              org.apache.taglibs.standard.tag.common.core,\r
+              org.apache.taglibs.standard.tag.common.fmt,\r
+              org.apache.taglibs.standard.tag.rt.core,\r
+              org.apache.taglibs.standard.tag.rt.fmt,\r
+              org.apache.taglibs.standard.tei,\r
+              org.apache.taglibs.standard.tlv,\r
+              org.osgi.framework,\r
+              org.slf4j,\r
+              org.springframework.beans,\r
+              org.springframework.beans.factory.xml,\r
+              org.springframework.context.config,\r
+              org.springframework.stereotype,\r
+              org.springframework.ui,\r
+              org.springframework.web,\r
+              org.springframework.web.bind.annotation,\r
+              org.springframework.web.servlet,\r
+              org.springframework.web.servlet.config,\r
+              org.springframework.web.servlet.view,\r
+              org.springframework.web.filter,\r
+              org.springframework.web.context,\r
+\r
+              org.opendaylight.controller.northbound.commons,\r
+              com.sun.jersey.spi.container.servlet,\r
+              com.fasterxml.jackson.annotation,\r
+              javax.ws.rs,\r
+              javax.ws.rs.core,\r
+              javax.xml.bind,\r
+              javax.xml.bind.annotation,\r
+              org.apache.catalina.filters,\r
+              com.fasterxml.jackson.jaxrs.base,\r
+              com.fasterxml.jackson.jaxrs.json,\r
+              !org.codehaus.enunciate.jaxrs</Import-Package>\r
+            <Export-Package></Export-Package>\r
+            <Web-ContextPath>/${artifactId}</Web-ContextPath>\r
+            <Jaxrs-Resources>,${symbol_dollar}{classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>\r
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->\r
+        </configuration>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.opendaylight.phoenix</groupId>\r
+      <artifactId>web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.springframework</groupId>\r
+      <artifactId>spring-web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.codehaus.enunciate</groupId>\r
+      <artifactId>enunciate-core-annotations</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>commons.northbound</artifactId>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java
new file mode 100644 (file)
index 0000000..b004699
--- /dev/null
@@ -0,0 +1,70 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.northbound;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ *
+ * This entire web class can be accessed via /northbound prefix as specified in
+ * web.xml
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+@Path("/")
+public class AppNorthbound {
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     *
+     * Sample REST API call
+     *
+     * @return A response string
+     *
+     * <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/${artifactId}/northbound/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - ${artifactId}";
+        return result;
+    }
+}
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java
new file mode 100644 (file)
index 0000000..dc57d2d
--- /dev/null
@@ -0,0 +1,61 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.web;
+
+import javax.servlet.http.HttpServletRequest;
+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.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * This entire web class can be accessed via /web prefix as specified in web.xml
+ */
+@Controller
+@RequestMapping("/")
+public class AppWeb implements IDaylightWeb {
+    private static final String WEB_NAME = "${artifactId} App";
+    private static final String WEB_ID = "${artifactId}";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public AppWeb() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/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-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/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-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/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-app-flow/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/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-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml
new file mode 100644 (file)
index 0000000..bc4f337
--- /dev/null
@@ -0,0 +1,24 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="${package}"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..dcfa8a9
--- /dev/null
@@ -0,0 +1,26 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>App</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <!-- style -->
+    <link rel="stylesheet" href="/css/ext/pure/pure.css"/>
+    <link rel="stylesheet" href="/css/phoenix.css"/>
+    <link rel="stylesheet" href="/css/flows.css"/>
+
+    <!-- style app -->
+
+    <!-- scripts -->
+    <script data-main="/${artifactId}/js/main" src="/js/ext/requirejs/require.js"></script>
+  </head>
+  <body>
+    <div id="main"></div>
+  </body>
+</html>
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..9553861
--- /dev/null
@@ -0,0 +1,141 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+
+  <security-constraint>
+    <display-name>App</display-name>
+    <web-resource-collection>
+      <web-resource-name>AppWeb</web-resource-name>
+      <url-pattern>/web/js/*</url-pattern>
+      <url-pattern>/web/images/*</url-pattern>
+      <url-pattern>/web/css/*</url-pattern>
+      <url-pattern>/web/favicon.ico</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>App</web-resource-name>
+      <url-pattern>/*</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>AppNorthbound</web-resource-name>
+      <url-pattern>/northbound/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <!-- <login-config> // enabling this auto directs to login page, considering removing this
+    <auth-method>FORM</auth-method>
+    <form-login-config>
+      <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+      <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+    </form-login-config>
+  </login-config>-->
+  
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+
+  <!-- <error-page>
+    <error-code>403</error-code>
+    <location>/WEB-INF/jsp/autherror.jsp</location>
+  </error-page> -->
+
+  <!-- web -->
+  <servlet>
+    <servlet-name>AppWeb</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppWeb</servlet-name>
+    <url-pattern>/web/*</url-pattern>
+  </servlet-mapping>
+  
+  <listener>
+    <listener-class>org.opendaylight.phoenix.web.ControllerUISessionManager</listener-class>
+  </listener>
+
+  <!-- <session-config> // needs further testing
+    <cookie-config>
+      <path>/</path>
+    </cookie-config>
+  </session-config>-->
+  
+  <!-- northbound -->
+  <servlet>
+    <servlet-name>AppNorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppNorthbound</servlet-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </filter-mapping>
+
+</web-app>
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/css/flows.css b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/css/flows.css
new file mode 100644 (file)
index 0000000..8d4c4e0
--- /dev/null
@@ -0,0 +1,28 @@
+.selectedrow {
+    background: #F3F781
+}
+
+.button-success {
+    background: rgb(28, 184, 65); /* this is a green */
+}
+
+.button-error {
+    background: rgb(202, 60, 60); /* this is a maroon */
+}
+
+.button-warning {
+    background: rgb(223, 117, 20); /* this is an orange */
+}
+
+.button-secondary {
+    background: rgb(66, 184, 221); /* this is a light blue */
+}
+
+.button-success,
+.button-error,
+.button-warning,
+.button-secondary {
+    color: white;
+    border-radius: 4px;
+    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
+}
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/app.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/app.js
new file mode 100644 (file)
index 0000000..c5cbc8b
--- /dev/null
@@ -0,0 +1,18 @@
+#set( $symbol_dollar = '$' )
+// Filename: app.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',                                    // lib/jquery/jquery
+  'underscore',                                // lib/underscore/underscore
+  'backbone',                                  // lib/backbone/backbone
+  '/${artifactId}/js/views/FlowsListView.js'   // app
+], function($, _, Backbone, FlowsListView){
+  var initialize = function() {
+    var flowsListView = new FlowsListView(); // this calls initialize which in turn calls render
+  }
+
+  return {
+    initialize : initialize
+  };
+});
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicePropertiesCollection.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicePropertiesCollection.js
new file mode 100644 (file)
index 0000000..60d4497
--- /dev/null
@@ -0,0 +1,4 @@
+define(['backbone','underscore'], function(Backbone, _) {
+  var DevicePropertiesCollection = Backbone.Collection.extend();
+  return DevicePropertiesCollection;
+});
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js
new file mode 100644 (file)
index 0000000..2f6025c
--- /dev/null
@@ -0,0 +1,8 @@
+#set( $symbol_dollar = '$' )
+define(['backbone','underscore','/${artifactId}/js/models/DeviceModel.js'], function(Backbone, _, DeviceModel) {
+  var DevicesCollection = Backbone.Collection.extend({
+    model: DeviceModel,
+    url : "/controller/nb/v2/switchmanager/default/nodes"
+  });
+  return DevicesCollection;
+});
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/FlowsCollection.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/collections/FlowsCollection.js
new file mode 100644 (file)
index 0000000..6c0e701
--- /dev/null
@@ -0,0 +1,9 @@
+#set( $symbol_dollar = '$' )
+
+define([ 'backbone', 'underscore', '/${artifactId}/js/models/FlowsModel.js' ], function(Backbone, _,
+FlowsModel) {
+  var FlowsCollection = Backbone.Collection.extend({
+    model : FlowsModel
+  });
+  return FlowsCollection;
+});
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/main.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/main.js
new file mode 100644 (file)
index 0000000..c909cb6
--- /dev/null
@@ -0,0 +1,19 @@
+#set( $symbol_dollar = '$' )
+// Filename: main.js
+
+require.config({
+  paths: {
+    "jquery": "/js/ext/jquery/dist/jquery.min",
+    "underscore": "/js/ext/underscore/underscore",
+    "backbone": "/js/ext/backbone/backbone",
+    "models": "/${artifactId}/js/models",                          // app
+    "views": "/${artifactId}/js/views",                                    // app
+    "collections": "/${artifactId}/js/collections"     // app
+  }
+});
+require([
+  'app', '/js/phoenix.js'
+], function(App, Phoenix) {
+  new App.initialize();
+  new Phoenix.initialize();
+});
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js
new file mode 100644 (file)
index 0000000..aaec02f
--- /dev/null
@@ -0,0 +1,11 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+  var DeviceModel = Backbone.Model.extend({
+    defaults: {
+      name: "New device"
+    },
+    initialize: function() {
+      // initialize of DeviceModel called
+    }
+  });
+  return DeviceModel;
+});
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/models/FlowsModel.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/models/FlowsModel.js
new file mode 100644 (file)
index 0000000..3af2abc
--- /dev/null
@@ -0,0 +1,27 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+  var FlowsModel = Backbone.Model.extend({
+    defaults: {
+      id: 'NewFlow',
+      installInHw: "false",
+      node: {
+        id: '',
+        type: 'OF'
+      },
+      ingressPort: "1",
+      priority: "500",
+      etherType: "0x800",
+      nwSrc: "9.9.1.1",
+      actions: ["OUTPUT=2"]
+    },
+    initialize: function() {
+      console.log("FlowsModel initialize called");
+    },
+    setUrlRoot: function() {
+      this.urlRoot="/controller/nb/v2/flowprogrammer/default/node/";
+      this.urlRoot += this.get("node").type + "/";
+      this.urlRoot += this.get("node").id + "/";
+      this.urlRoot += "staticFlow/";
+    }
+  });
+  return FlowsModel;
+});
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html
new file mode 100644 (file)
index 0000000..b28135a
--- /dev/null
@@ -0,0 +1,28 @@
+<script type="text/template" id="devicescontainer">
+  <div id="deviceDiv" style="margin-left:20px; float: left;">
+    <h3>Devices</h3>
+    <table class="pure-table pure-table-bordered">
+      <thead>
+        <tr>
+          <th>Node ID</th>
+          <th>Type</th>
+          <th>Properties</th>
+        </tr>
+      </thead>
+      <tbody>
+        <% _.each(devices, function(device) { %>
+          <tr data-nodeType="<%= device.node.type%>" data-nodeId="<%= device.node.id%>" style="cursor:pointer;">
+            <td><%= device.node.id %></td>
+            <td><%= device.node.type %></td>
+            <td>
+              <div>Mac Address: <%= device.properties.macAddress.value %></div>
+              <div>Description: <%= device.properties.description.value %></div>
+              <div>Mac Address: <%= device.properties.macAddress.value %></div>
+            </td>
+          </tr>
+          <% }); %>
+      </tbody>
+    </table>
+
+  </div>
+</script>
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/deviceProperties.html b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/deviceProperties.html
new file mode 100644 (file)
index 0000000..b222399
--- /dev/null
@@ -0,0 +1,33 @@
+<script type="text/template">
+  <div id="deviceProperties" style="float: left; margin-left: 20px;">
+    <h3>Device Properties - <%=nodeId %></h3>
+    <table class="pure-table pure-table-bordered">
+      <thead>
+        <tr>
+          <th>Property Name</th>
+          <th>Property Value</th>
+        </tr>
+      </thead>
+      <tbody>
+        <% _.each(deviceProps, function(prop) { %>
+          <tr>
+            <td>Bandwidth</td>
+            <td><%= prop.properties.bandwidth ? prop.properties.bandwidth.value : '' %></td>
+          </tr>
+          <tr>
+            <td>config</td>
+            <td><%= prop.properties.config.value%></td>
+          </tr>
+          <tr>
+            <td>name</td>
+            <td><%= prop.properties.name.value%></td>
+          </tr>
+          <tr>
+            <td>state</td>
+            <td><%= prop.properties.state.value%></td>
+          </tr>
+          <% }); %>
+      </tbody>
+    </table>
+  </div>
+</script>
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/flow.html b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/flow.html
new file mode 100644 (file)
index 0000000..f533ac4
--- /dev/null
@@ -0,0 +1,69 @@
+<script type="text/template">
+  <div id="flowFormContainer"
+    style="margin-top: 20px; margin-left: 20px; padding: 10px;">
+    <fieldset>
+      <legend><%= flowAction %> Flow</legend>
+      <table>
+        <tr>
+          <td><label>Flow Name:</label></td>
+          <td><input type="text" id="flowName" name="flowName" value="<%= flowModel.get('id') %>" <%= flowAction =='Edit' ? 'disabled' : '' %> ></td>
+        </tr>
+        <tr>
+          <td><label>Node ID:</label></td>
+          <td>
+            <select id="nodeId" name="nodeId" value="" <%= flowAction =='Edit' ? 'disabled' : '' %> >
+              <% _.each(devices, function(device){ %>
+                <option <%= flowModel.get('node').id == device.node.id ? 'selected' : '' %>  > <%= device.node.id %> </option>
+                <% }); %>
+            </select>
+          </td>
+        </tr>
+        <tr>
+          <td><label>Ingress Port:</label></td>
+          <td><input type="text" id="ingressPort" name="ingressPort"
+            value="<%= flowModel.get('ingressPort') %>"></td>
+        </tr>
+        <tr>
+          <td><label>Priority:</label></td>
+          <td><input type="text" id="priority" name="priority" value="<%= flowModel.get('priority') %>"></td>
+        </tr>
+        <tr>
+          <td><label>Ether Type:</label></td>
+          <td><input type="text" id="etherType" name="etherType" value="<%= flowModel.get('etherType') %>"></td>
+        </tr>
+        <tr>
+          <td><label>Network Source:</label></td>
+          <td><input type="text" id="nwSrc" name="nwSrc" value="<%= flowModel.get('nwSrc') %>"></td>
+        </tr>
+        <tr>
+          <td><label>Actions:</label></td>
+          <td>
+            <select id="actions" name="actions">
+              <option value="DROP">Drop</option>
+              <option value="LOOPBACK">Loopback</option>
+              <option value="FLOOD">Flood</option>
+              <option value="SW_PATH">Software Path</option>
+              <option value="HW_PATH">Hardware Path</option>
+              <option value="CONTROLLER">Controller</option>
+              <option value="OUTPUT">Add Output Ports</option>
+              <option value="SET_VLAN_ID">Set VLAN ID</option>
+              <option value="SET_VLAN_PCP">Set VLAN Priority</option>
+              <option value="POP_VLAN">Strip VLAN Header</option>
+              <option value="SET_DL_SRC">Modify Datalayer Source Address</option>
+              <option value="SET_DL_DST">Modify Datalayer Destination Address</option>
+              <option value="SET_NW_SRC">Modify Network Source Address</option>
+              <option value="SET_NW_DST">Modify Network Destination Address</option>
+              <option value="SET_NW_TOS">Modify ToS Bits</option>
+              <option value="SET_TP_SRC">Modify Transport Source Port</option>
+              <option value="SET_TP_DST">Modify Transport Destination Port</option>
+            </select>
+          </td>
+        </tr>
+      </table>
+    </fieldset>
+    <div id="flowFormButtonsContainer" style="margin-top:10px;">
+      <button id="saveFlowButton" class="pure-button button-success">Save</button>
+      <button id="cancelFlowButton" class="pure-button">Cancel</button>
+    </div>
+  </div>
+</script>
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/flows.html b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/templates/flows.html
new file mode 100644 (file)
index 0000000..8199b7e
--- /dev/null
@@ -0,0 +1,43 @@
+<script type="text/template">
+       <div id="flowsContainer" style="margin-left: 20px;">
+               <h3>Flows</h3>
+               <div id="flowsTableButtonsContainer" style="margin-bottom: 10px;">
+                       <button id="createFlowButton" class="pure-button pure-button-primary">Create
+                               Flow</button>
+                       <button id="editFlowButton" class="pure-button pure-button-primary">Edit
+                               Flow</button>
+                       <button id="deleteFlowButton" class="pure-button button-error">Delete
+                               Flow</button>
+               </div>
+               <table class="pure-table pure-table-bordered">
+                       <thead>
+                               <tr>
+                                       <th>Flow Name</th>
+                                       <th>Node ID</th>
+                                       <th>Type</th>
+                                       <th>Install in Hardware</th>
+                                       <th>Ingress Port</th>
+                                       <th>Priority</th>
+                                       <th>Ether Type</th>
+                                       <th>Network Source</th>
+                                       <th>Actions</th>
+                               </tr>
+                       </thead>
+                       <tbody>
+                               <% _.each(flows, function(flow) { %>
+                               <tr data-flowName="<%= flow.name%>" style="cursor: pointer;">
+                                       <td><%= flow.name %></td>
+                                       <td><%= flow.node.id %></td>
+                                       <td><%= flow.node.type %></td>
+                                       <td><%= flow.installInHw %></td>
+                                       <td><%= flow.ingressPort %></td>
+                                       <td><%= flow.priority %></td>
+                                       <td><%= flow.etherType %></td>
+                                       <td><%= flow.nwSrc %></td>
+                                       <td><%= actionsMap[flow.actions.toString()] %></td>
+                               </tr>
+                               <% }); %>
+                       </tbody>
+               </table>
+       </div>
+</script>
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/DevicePropertiesView.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/DevicePropertiesView.js
new file mode 100644 (file)
index 0000000..489d78f
--- /dev/null
@@ -0,0 +1,31 @@
+#set( $symbol_dollar = '$' )
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    '/${artifactId}/js/collections/DevicePropertiesCollection.js',
+    '/js/ext/text/text.js!/${artifactId}/js/templates/deviceProperties.html'
+    ], function($, Backbone, _, DevicePropertiesCollection, DevicePropertiesTemplate) {
+
+      var DevicePropertiesView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+          // initialize of DevicePropertiesView called
+        },
+        render: function() {
+          var self = this;
+          $(self.el).find("#deviceProperties").remove();
+          this.collection = new DevicePropertiesCollection();
+          this.collection.url = "/controller/nb/v2/switchmanager/default/node/OF/" + self.nodeId;
+          this.collection.fetch({success: function(coll, response) {
+            var compiledTemplate = _.template(DevicePropertiesTemplate, {
+              deviceProps: response.nodeConnectorProperties,
+              nodeId: self.nodeId
+            });
+            $(self.el).append($(compiledTemplate).html());
+          }});
+        }
+      }); // DevicePropertiesView extend ends here
+      return DevicePropertiesView;
+    });
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js
new file mode 100644 (file)
index 0000000..96ea20b
--- /dev/null
@@ -0,0 +1,42 @@
+#set( $symbol_dollar = '$' )
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    '/${artifactId}/js/collections/DevicesCollection.js',
+    '/${artifactId}/js/models/DeviceModel.js',
+    '/${artifactId}/js/views/DevicePropertiesView.js',
+    '/js/ext/text/text.js!/${artifactId}/js/templates/device.html'
+    ], function($, Backbone, _, DevicesCollection, DeviceModel, DevicePropertiesView, DeviceTemplate) {
+      var DeviceView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+          var self = this;
+          this.collection = new DevicesCollection();
+          this.collection.url = "/controller/nb/v2/switchmanager/default/nodes";
+          this.collection.fetch({
+            success: function(coll, response) {
+              // pass collection call to get devices
+              self.render();
+            }
+          });
+        },
+        render: function() {
+          // DevicesView initialize call
+          var that = this;
+          var compiledTemplate = _.template(DeviceTemplate, {devices: that.collection.models[0].get('nodeProperties')});
+          $(this.el).append($(compiledTemplate).html());
+        },
+        events: {
+          "click tr": "getNodeProperties"
+        },
+        getNodeProperties: function(evt) {
+          var $tr = $(evt.currentTarget);
+          var devicePropsView = new DevicePropertiesView();
+          devicePropsView.nodeId = $tr.attr("data-nodeId");
+          devicePropsView.render();
+        }
+      });
+      return DeviceView;
+    });
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/FlowView.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/FlowView.js
new file mode 100644 (file)
index 0000000..4910d06
--- /dev/null
@@ -0,0 +1,90 @@
+#set( $symbol_dollar = '$' )
+
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    '/${artifactId}/js/models/FlowsModel.js',
+    '/${artifactId}/js/collections/DevicesCollection.js',
+    '/js/ext/text/text.js!/${artifactId}/js/templates/flow.html'
+    ], function($, Backbone, _, FlowsModel, DevicesCollection, FlowTemplate) {
+      var FlowView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+        },
+        render: function() {
+          // remove any existing form
+          $("#flowFormContainer").remove();
+          var self = this;
+          var devicesCollection = new DevicesCollection();
+          devicesCollection.fetch({
+            success: function(coll, response) {
+              var flowModel = self.flowModel;
+              var flowAction = "Edit";
+              if(!flowModel) {
+                flowAction = "Create";
+                flowModel = {
+                  get: function(arg1) {
+                    return "";
+                  }
+                };
+              }
+              var compiledTemplate = _.template(FlowTemplate, 
+                {
+                  "flowAction": flowAction,
+                  "devices": response.nodeProperties,
+                  "flowModel": flowModel
+                });
+                $(self.el).append($(compiledTemplate).html());
+                // hack to set the actions value in case of edit
+                if(flowAction == "Edit") {
+                  $("#actions option[value='" + flowModel.get('actions') + "']")[0].selected =  true;
+                }
+            }
+          });
+        },
+        events: {
+          "click div#flowFormButtonsContainer button": "handleFlowFormButtons"
+        },
+        handleFlowFormButtons: function(evt) {
+          var self = this;
+          var $button = $(evt.currentTarget);
+          if($button.attr("id") == "saveFlowButton") {
+            // create FlowModel and save it.
+            var flowModel = new FlowsModel({
+              id: $("#flowName").val(),
+              installInHw: "true",
+              name: $("#flowName").val(),
+              node: {
+                id: $("#nodeId").val(),
+                type: "OF"
+              },
+              ingressPort: $("#ingressPort").val(),
+              priority: $("#priority").val(),
+              etherType: $("#etherType").val(),
+              nwSrc: $("#nwSrc").val(),
+              actions: [$("#actions").val()]
+            });
+            flowModel.urlRoot="/controller/nb/v2/flowprogrammer/default/node/OF/";
+            flowModel.urlRoot += $("#nodeId").val() + "/";
+            flowModel.urlRoot += "staticFlow/";
+            flowModel.save(null, {
+              // REST call does not return JSON. so we need this, else 
+                // the success callback wont get called
+              dataType: "text",
+              success: function(model, response) {
+                console.log("Flow Created.");
+                $("#flowFormContainer").remove();
+                self.parentListView.updateView();
+              }
+            });
+
+          } else {
+            // cancel button
+            $("#flowFormContainer").remove();
+          }
+        }
+      });
+      return FlowView;
+    });
diff --git a/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/FlowsListView.js b/main/archetypes/archetype-app-flow/src/main/resources/archetype-resources/src/main/resources/js/views/FlowsListView.js
new file mode 100644 (file)
index 0000000..b0beaa2
--- /dev/null
@@ -0,0 +1,126 @@
+#set( $symbol_dollar = '$' )
+
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    '/${artifactId}/js/collections/FlowsCollection.js',
+    '/${artifactId}/js/models/FlowsModel.js',
+    '/${artifactId}/js/views/FlowView.js',
+    '/js/ext/text/text.js!/${artifactId}/js/templates/flows.html'
+    ], function($, Backbone, _, FlowsCollection, FlowsModel, FlowView, FlowsTemplate) {
+      var FlowsView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+          var self = this;
+          this.collection = new FlowsCollection();
+          this.collection.url = "/controller/nb/v2/flowprogrammer/default";
+          this.collection.fetch({
+            success: function(coll, response) {
+              self.render();
+            }
+          });
+        },
+        render: function() {
+          var self = this;
+          // populate collection with models
+          var flowObjectsArr = self.collection.models[0].get('flowConfig');
+          $(flowObjectsArr).each(function(index, flowObject) {
+            var flowsModel = new FlowsModel({
+              id: flowObject.name,
+              installInHw: flowObject.installInHw,
+              name: flowObject.name,
+              node: {
+                id: flowObject.node.id,
+                type: flowObject.node.type
+              },
+              priority: flowObject.priority,
+              ingressPort: flowObject.ingressPort,
+              etherPort: flowObject.etherPort,
+              nwSrc: flowObject.nwSrc,
+              actions: flowObject.actions
+            });
+            self.collection.add(flowsModel);
+          });
+          var compiledTemplate = _.template(FlowsTemplate,
+            {
+              flows: self.collection.models[0].get('flowConfig'),
+              actionsMap: self.actionsMap
+            });
+            $(this.el).append($(compiledTemplate).html());
+        },
+        events: {
+          "click div#flowsTableButtonsContainer button": "handleFlowCrud",
+          "click div#flowsContainer table tbody tr": "tableRowClicked"
+        },
+        handleFlowCrud: function(evt) {
+          var self = this;
+          var $button = $(evt.currentTarget);
+          if($button.attr("id") == "createFlowButton") {
+            self.flowView = self.flowView || new FlowView();
+            self.flowView.parentListView = self;
+            delete self.flowView.flowModel;
+            self.flowView.render();
+          } else if($button.attr("id") == "editFlowButton") {
+            self.flowView = self.flowView || new FlowView();
+            self.flowView.parentListView = self;
+            // get data for selected model
+            var flowName = $("div#flowsContainer tbody tr.selectedrow").attr("data-flowName");
+            var flowModel = self.collection.get(flowName);
+            self.flowView.flowModel = flowModel;
+            self.flowView.render();
+          } else {
+            // delete flow
+            var id = $("div#flowsContainer tbody tr.selectedrow").attr("data-flowName");
+            var flowModel = self.collection.get(id);
+            flowModel.setUrlRoot();
+            flowModel.destroy({
+              dataType: "text",
+              success: function() {
+                console.log("delete succeeded!");
+                $("#flowFormContainer").remove();
+                self.updateView();
+              },
+              error: function() {
+                console.log("delete error callback called");
+                $("#flowFormContainer").remove();
+                self.updateView();
+              }
+            });
+          }
+        },
+        tableRowClicked: function(evt) {
+          $("div#flowsContainer tbody tr.selectedrow").removeClass("selectedrow");
+          var $tr = $(evt.currentTarget);
+          $tr.addClass("selectedrow");
+        },
+        updateView: function() {
+          $("#flowsContainer").remove();
+          this.initialize();
+        },
+        /*
+        * temporary map of actions
+        */
+        actionsMap: {
+          "DROP" : "Drop",
+          "LOOPBACK" : "Loopback",
+          "FLOOD" : "Flood",
+          "SW_PATH" : "Software Path",
+          "HW_PATH" : "Hardware Path",
+          "CONTROLLER" : "Controller",
+          "OUTPUT" : "Add Output Ports",
+          "SET_VLAN_ID" : "Set VLAN ID",
+          "SET_VLAN_PCP" : "Set VLAN Priority",
+          "POP_VLAN" : "Strip VLAN Header",
+          "SET_DL_SRC" : "Modify Datalayer Source Address",
+          "SET_DL_DST" : "Modify Datalayer Destination Address",
+          "SET_NW_SRC" : "Modify Network Source Address",
+          "SET_NW_DST" :"Modify Network Destination Address",
+          "SET_NW_TOS" : "Modify ToS Bits",
+          "SET_TP_SRC" : "Modify Transport Source Port",
+          "SET_TP_DST" : "Modify Transport Destination Port"
+        }
+      });
+      return FlowsView;
+    });
diff --git a/main/archetypes/archetype-app-flow/src/test/resources/projects/basic/archetype.properties b/main/archetypes/archetype-app-flow/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..9857f0e
--- /dev/null
@@ -0,0 +1,5 @@
+#Sat Mar 15 19:51:35 CDT 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/main/archetypes/archetype-app-flow/src/test/resources/projects/basic/goal.txt b/main/archetypes/archetype-app-flow/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-app-northbound/pom.xml b/main/archetypes/archetype-app-northbound/pom.xml
new file mode 100644 (file)
index 0000000..66755b8
--- /dev/null
@@ -0,0 +1,30 @@
+<?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
+\r
+  <groupId>org.opendaylight.phoenix.archetypes</groupId>\r
+  <artifactId>northbound-archetype</artifactId>\r
+  <version>1.0-SNAPSHOT</version>\r
+  <packaging>maven-archetype</packaging>\r
+\r
+  <name>northbound-archetype</name>\r
+\r
+  <build>\r
+    <extensions>\r
+      <extension>\r
+        <groupId>org.apache.maven.archetype</groupId>\r
+        <artifactId>archetype-packaging</artifactId>\r
+        <version>2.2</version>\r
+      </extension>\r
+    </extensions>\r
+\r
+    <pluginManagement>\r
+      <plugins>\r
+        <plugin>\r
+          <artifactId>maven-archetype-plugin</artifactId>\r
+          <version>2.2</version>\r
+        </plugin>\r
+      </plugins>\r
+    </pluginManagement>\r
+  </build>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-app-northbound/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..7b4d70d
--- /dev/null
@@ -0,0 +1,42 @@
+<?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="northbound"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.schemas</include>
+        <include>**/*.MF</include>
+        <include>**/*.tooling</include>
+        <include>**/*.factories</include>
+        <include>**/*.handlers</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..72f8924
--- /dev/null
@@ -0,0 +1,65 @@
+#set ( $dollar = '$' )\r
+<?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
+    <groupId>org.opendaylight.phoenix</groupId>\r
+    <artifactId>common</artifactId>\r
+    <version>0.0.1-SNAPSHOT</version>\r
+    <relativePath>../common</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>${artifactId}</artifactId>\r
+\r
+  <groupId>${groupId}</groupId>\r
+  <version>${version}</version>\r
+\r
+  <packaging>bundle</packaging>\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></Export-Package>\r
+            <Import-Package>org.opendaylight.controller.northbound.commons,\r
+              com.sun.jersey.spi.container.servlet,\r
+              com.fasterxml.jackson.annotation,\r
+              javax.ws.rs,\r
+              javax.ws.rs.core,\r
+              javax.xml.bind,\r
+              javax.xml.bind.annotation,\r
+              org.slf4j,\r
+              org.apache.catalina.filters,\r
+              com.fasterxml.jackson.jaxrs.base,\r
+              com.fasterxml.jackson.jaxrs.json,\r
+              !org.codehaus.enunciate.jaxrs</Import-Package>\r
+            <Web-ContextPath>/northbound/northbound</Web-ContextPath>\r
+            <Jaxrs-Resources>,${dollar}{classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>\r
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->\r
+        </configuration>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.codehaus.enunciate</groupId>\r
+      <artifactId>enunciate-core-annotations</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>commons.${rootArtifactId}</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>junit</groupId>\r
+      <artifactId>junit</artifactId>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java b/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/java/Northbound.java
new file mode 100644 (file)
index 0000000..0c972c0
--- /dev/null
@@ -0,0 +1,70 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package};
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ * 
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+
+@Path("/")
+public class Northbound {
+
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     * 
+     * Sample REST API call
+     * 
+     * @return A response string
+     * 
+     *         <pre>
+     * Example:
+     * 
+     * Request URL:
+     * http://localhost:8080/northbound/${artifactId}/api
+     * 
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     * 
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - ${artifactId}";
+        return result;
+    }
+
+}
diff --git a/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/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-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/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-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/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-app-northbound/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/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-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-app-northbound/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..e9cc85f
--- /dev/null
@@ -0,0 +1,92 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+  <servlet>
+    <servlet-name>JAXRSNorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>JAXRSNorthbound</servlet-name>
+    <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <security-constraint>
+    <web-resource-collection>
+      <web-resource-name>${artifactId}</web-resource-name>
+      <url-pattern>/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+</web-app>
diff --git a/main/archetypes/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties b/main/archetypes/archetype-app-northbound/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..6d9f4bd
--- /dev/null
@@ -0,0 +1,5 @@
+#Thu Mar 13 13:11:13 CDT 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/main/archetypes/archetype-app-northbound/src/test/resources/projects/basic/goal.txt b/main/archetypes/archetype-app-northbound/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-app-simple/pom.xml b/main/archetypes/archetype-app-simple/pom.xml
new file mode 100644 (file)
index 0000000..5438fa6
--- /dev/null
@@ -0,0 +1,30 @@
+<?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
+\r
+  <groupId>org.opendaylight.toolkit</groupId>\r
+  <artifactId>toolkit-app-simple-archetype</artifactId>\r
+  <version>1.0-SNAPSHOT</version>\r
+  <packaging>maven-archetype</packaging>\r
+\r
+  <name>opendaylight-toolkit-app-simple-archetype</name>\r
+\r
+  <build>\r
+    <extensions>\r
+      <extension>\r
+        <groupId>org.apache.maven.archetype</groupId>\r
+        <artifactId>archetype-packaging</artifactId>\r
+        <version>2.2</version>\r
+      </extension>\r
+    </extensions>\r
+\r
+    <pluginManagement>\r
+      <plugins>\r
+        <plugin>\r
+          <artifactId>maven-archetype-plugin</artifactId>\r
+          <version>2.2</version>\r
+        </plugin>\r
+      </plugins>\r
+    </pluginManagement>\r
+  </build>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-app-simple/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..5ccd893
--- /dev/null
@@ -0,0 +1,70 @@
+<?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="device"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java/</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.jsp</include>
+        <include>**/*.xml</include>
+        <include>**/*.html</include>
+        <include>**/*.txt</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources/js</directory>
+      <includes>
+        <include>**/*.js</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.</include>
+        <include>**/*.schemas</include>
+        <include>**/*.bowerrc</include>
+        <include>**/*.js</include>
+        <include>**/*.ico</include>
+        <include>**/*.editorconfig</include>
+        <include>**/*.tooling</include>
+        <include>**/*.sh</include>
+        <include>**/*.factories</include>
+        <include>**/*.npmignore</include>
+        <include>**/*.handlers</include>
+        <include>**/*.png</include>
+        <include>**/*.md</include>
+        <include>**/*.json</include>
+        <include>**/*.map</include>
+        <include>**/*.types</include>
+        <include>**/*.gitignore</include>
+        <include>**/*.css</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.checkstyle</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..a080b2b
--- /dev/null
@@ -0,0 +1,122 @@
+#set( $symbol_dollar = '$' )\r
+<?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
+    <groupId>org.opendaylight.toolkit</groupId>\r
+    <artifactId>common</artifactId>\r
+    <version>0.0.1-SNAPSHOT</version>\r
+    <relativePath>../common</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>${artifactId}</artifactId>\r
+\r
+  <groupId>${groupId}</groupId>\r
+  <version>${version}</version>\r
+\r
+  <packaging>bundle</packaging>\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
+            <Import-Package>\r
+              org.opendaylight.toolkit.web,\r
+              org.opendaylight.controller.sal.authorization,\r
+              org.opendaylight.controller.sal.core,\r
+              org.opendaylight.controller.sal.utils,\r
+              javax.annotation,\r
+              javax.naming,\r
+              javax.servlet,\r
+              javax.servlet.annotation,\r
+              javax.servlet.http,\r
+              javax.servlet.jsp,\r
+              javax.servlet.jsp.el,\r
+              javax.servlet.jsp.jstl.core,\r
+              javax.servlet.jsp.jstl.fmt,\r
+              javax.servlet.jsp.jstl.tlv,\r
+              javax.servlet.jsp.tagext,\r
+              javax.servlet.resources,\r
+              javax.xml.parsers,\r
+              javax.xml.transform,\r
+              org.apache.commons.logging,\r
+              org.apache.taglibs.standard.functions,\r
+              org.apache.taglibs.standard.resources,\r
+              org.apache.taglibs.standard.tag.common.core,\r
+              org.apache.taglibs.standard.tag.common.fmt,\r
+              org.apache.taglibs.standard.tag.rt.core,\r
+              org.apache.taglibs.standard.tag.rt.fmt,\r
+              org.apache.taglibs.standard.tei,\r
+              org.apache.taglibs.standard.tlv,\r
+              org.osgi.framework,\r
+              org.slf4j,\r
+              org.springframework.beans,\r
+              org.springframework.beans.factory.xml,\r
+              org.springframework.context.config,\r
+              org.springframework.stereotype,\r
+              org.springframework.ui,\r
+              org.springframework.web,\r
+              org.springframework.web.bind.annotation,\r
+              org.springframework.web.servlet,\r
+              org.springframework.web.servlet.config,\r
+              org.springframework.web.servlet.view,\r
+              org.springframework.web.filter,\r
+              org.springframework.web.context,\r
+\r
+              org.apache.felix.dm,\r
+\r
+              org.opendaylight.controller.northbound.commons,\r
+              org.opendaylight.controller.northbound.commons.exception,\r
+              org.opendaylight.controller.northbound.commons.utils,\r
+              com.sun.jersey.spi.container.servlet,\r
+              com.fasterxml.jackson.annotation,\r
+              javax.ws.rs,\r
+              javax.ws.rs.core,\r
+              javax.xml.bind,\r
+              javax.xml.bind.annotation,\r
+              org.apache.catalina.filters,\r
+              com.fasterxml.jackson.jaxrs.base,\r
+              com.fasterxml.jackson.jaxrs.json,\r
+              !org.codehaus.enunciate.jaxrs\r
+            </Import-Package>\r
+            <Export-Package></Export-Package>\r
+            <Web-ContextPath>/${artifactId}</Web-ContextPath>\r
+            <Jaxrs-Resources>,${symbol_dollar}{classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>\r
+            <Bundle-Activator>\r
+              ${package}.internal.Activator\r
+               </Bundle-Activator>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>\r
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->\r
+        </configuration>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.opendaylight.toolkit</groupId>\r
+      <artifactId>web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.springframework</groupId>\r
+      <artifactId>spring-web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.codehaus.enunciate</groupId>\r
+      <artifactId>enunciate-core-annotations</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>commons.northbound</artifactId>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/ISimple.java b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/ISimple.java
new file mode 100644 (file)
index 0000000..917c47b
--- /dev/null
@@ -0,0 +1,16 @@
+#set( $symbol_pound = '#' )
+
+package ${package};
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.opendaylight.controller.sal.utils.Status;
+
+public interface ISimple {
+    public UUID createData(SimpleData datum);
+    public SimpleData readData(UUID uuid);
+    public Map<UUID, SimpleData> readData();
+    public Status updateData(UUID uuid, SimpleData data);
+    public Status deleteData(UUID uuid);
+}
\ No newline at end of file
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/SimpleData.java b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/SimpleData.java
new file mode 100644 (file)
index 0000000..6b96180
--- /dev/null
@@ -0,0 +1,37 @@
+#set( $symbol_pound = '#' )
+
+package ${package};
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class SimpleData {
+    @XmlElement
+    private String uuid;
+    @XmlElement
+    private String foo;
+    @XmlElement
+    private String bar;
+
+    public String getUuid() {
+        return uuid;
+    }
+    public String getFoo() {
+        return foo;
+    }
+    public String getBar() {
+        return bar;
+    }
+    public SimpleData() {
+        super();
+    }
+    public SimpleData(String uuid, String foo, String bar) {
+        super();
+        this.uuid = uuid;
+        this.foo = foo;
+        this.bar = bar;
+    }
+}
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/internal/Activator.java b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/internal/Activator.java
new file mode 100644 (file)
index 0000000..436d207
--- /dev/null
@@ -0,0 +1,75 @@
+#set( $symbol_pound = '#' )
+
+package ${package}.internal;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Set;
+
+import org.apache.felix.dm.Component;
+import ${package}.ISimple;
+import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator extends ComponentActivatorAbstractBase {
+    protected static final Logger log = LoggerFactory.getLogger(Activator.class);
+
+    /**
+     * Function called when the activator starts just after some initializations
+     * are done by the ComponentActivatorAbstractBase.
+     *
+     */
+    @Override
+    public void init() {
+    }
+
+    /**
+     * Function called when the activator stops just before the cleanup done by
+     * ComponentActivatorAbstractBase
+     *
+     */
+    @Override
+    public void destroy() {
+    }
+
+    /**
+     * Function that is used to communicate to dependency manager the list of
+     * known implementations for services inside a container
+     *
+     *
+     * @return An array containing all the CLASS objects that will be
+     *         instantiated in order to get an fully working implementation
+     *         Object
+     */
+    @Override
+    public Object[] getGlobalImplementations() {
+        Object[] res = { Simple.class };
+        return res;
+    }
+
+    /**
+     * Function that is called when configuration of the dependencies is
+     * required.
+     *
+     * @param c
+     *            dependency manager Component object, used for configuring the
+     *            dependencies exported and imported
+     * @param imp
+     *            Implementation class that is being configured, needed as long
+     *            as the same routine can configure multiple implementations
+     * @param containerName
+     *            The containerName being configured, this allow also optional
+     *            per-container different behavior if needed, usually should not
+     *            be the case though.
+     */
+    @Override
+    public void configureGlobalInstance(Component c, Object imp) {
+        if (imp.equals(Simple.class)) {
+            Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
+            String interfaces[] = null;
+            interfaces = new String[] { ISimple.class.getName() };
+            c.setInterface(interfaces, props);
+        }
+    }
+}
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/internal/Simple.java b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/internal/Simple.java
new file mode 100644 (file)
index 0000000..6cab58c
--- /dev/null
@@ -0,0 +1,57 @@
+#set( $symbol_pound = '#' )
+
+package ${package}.internal;
+
+import ${package}.ISimple;
+import ${package}.SimpleData;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.UUID;
+import java.util.Map;
+
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+
+public class Simple implements ISimple {
+    private Map<UUID, SimpleData> data;
+    protected static final Logger log = LoggerFactory.getLogger(Simple.class);
+    @Override
+    public UUID createData(SimpleData datum) {
+        UUID uuid = UUID.randomUUID();
+        SimpleData sData = new SimpleData(uuid.toString(), datum.getFoo(), datum.getBar());
+        data.put(uuid, sData);
+        return uuid;
+    }
+    @Override
+    public SimpleData readData(UUID uuid) {
+        return data.get(uuid);
+    }
+    @Override
+    public Map<UUID, SimpleData> readData() {
+        return data;
+    }
+    @Override
+    public Status updateData(UUID uuid, SimpleData datum) {
+        data.put(uuid, datum);
+        return new Status(StatusCode.SUCCESS);
+    }
+    @Override
+    public Status deleteData(UUID uuid) {
+        data.remove(uuid);
+        return new Status(StatusCode.SUCCESS);
+    }
+    void init() {
+        log.info("Initializing Simple application");
+        data = new ConcurrentHashMap<UUID, SimpleData>();
+    }
+    void start() {
+        log.info("Simple application starting");
+    }
+
+    void stop() {
+        log.info("Simple application stopping");
+    }
+}
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java
new file mode 100644 (file)
index 0000000..f7ba319
--- /dev/null
@@ -0,0 +1,259 @@
+#set( $symbol_pound = '#' )
+
+package ${package}.northbound;
+
+import ${package}.ISimple;
+import ${package}.SimpleData;
+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;
+
+/**
+ * Northbound REST API
+ *
+ * This entire web class can be accessed via /northbound prefix as specified in
+ * web.xml
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+@Path("/")
+public class AppNorthbound {
+    @Context
+    private UriInfo _uriInfo;
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    protected String getUserName() {
+        return username;
+    }
+
+    /**
+     *
+     * Sample GET REST API call
+     *
+     * @return A response string
+     *
+     * <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/app/northbound/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/simple")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @StatusCodes()
+    public List<SimpleData> getData() {
+        if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
+            throw new UnauthorizedException("User is not authorized to perform this operation");
+        }
+        ISimple simple = (ISimple) ServiceHelper.getGlobalInstance(ISimple.class, this);
+        if (simple == null) {
+            throw new ServiceUnavailableException("Simple Service " + RestMessages.SERVICEUNAVAILABLE.toString());
+        }
+
+        Map<UUID, SimpleData> sDataMap = simple.readData();
+        if (sDataMap != null) {
+            return new ArrayList<SimpleData>(sDataMap.values());
+        }
+        return new ArrayList<SimpleData>();
+    }
+
+    @Path("/simple/{uuid}")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(SimpleData.class)
+    @StatusCodes()
+    public SimpleData getData(@PathParam("uuid") String uuid) {
+        if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
+            throw new UnauthorizedException("User is not authorized to perform this operation");
+        }
+        ISimple simple = (ISimple) ServiceHelper.getGlobalInstance(ISimple.class, this);
+        if (simple == null) {
+            throw new ServiceUnavailableException("Simple Service " + RestMessages.SERVICEUNAVAILABLE.toString());
+        }
+
+        return simple.readData(UUID.fromString(uuid));
+    }
+
+    /**
+     *
+     * Sample POST REST API call
+     *
+     * @return A response string
+     *
+     *         <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/app/northbound/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/simple")
+    @POST
+    @StatusCodes({ @ResponseCode(code = 201, condition = "Data Inserted successfully"),
+        @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
+        @ResponseCode(code = 500, condition = "Error inserting data"),
+        @ResponseCode(code = 503, condition = "One or more of service is unavailable")})
+    @Consumes({ MediaType.APPLICATION_JSON})
+    public Response createData(@TypeHint(SimpleData.class) SimpleData data) {
+        if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
+            throw new UnauthorizedException("User is not authorized to perform this operation");
+        }
+        ISimple simple = (ISimple) ServiceHelper.getGlobalInstance(ISimple.class, this);
+        if (simple == null) {
+            throw new ServiceUnavailableException("Simple Service " + RestMessages.SERVICEUNAVAILABLE.toString());
+        }
+        
+        UUID uuid = simple.createData(data);
+        if (uuid == null) {
+            return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
+        }
+        return Response.status(Response.Status.CREATED)
+                .header("Location", String.format("%s/%s", _uriInfo.getAbsolutePath().toString(),
+                                                            uuid.toString()))
+                .entity(uuid.toString())
+                .build();
+    }
+
+    /**
+    *
+    * Sample PUT REST API call
+    *
+    * @return A response string
+    *
+    *         <pre>
+    * Example:
+    *
+    * Request URL:
+    * http://localhost:8080/app/northbound/api/{uuid}
+    *
+    * Response body in XML:
+    * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+    * Sample Northbound API
+    *
+    * Response body in JSON:
+    * Sample Northbound API
+    * </pre>
+    */
+   @Path("/simple/{uuid}")
+   @PUT
+   @StatusCodes({ @ResponseCode(code = 200, condition = "Data Updated successfully"),
+       @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
+       @ResponseCode(code = 500, condition = "Error updating data"),
+       @ResponseCode(code = 503, condition = "One or more of service is unavailable")})
+   @Consumes({ MediaType.APPLICATION_JSON})
+   public Response updateData(@PathParam("uuid") String uuid, @TypeHint(SimpleData.class) SimpleData data) {
+       if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
+           throw new UnauthorizedException("User is not authorized to perform this operation");
+       }
+       ISimple simple = (ISimple) ServiceHelper.getGlobalInstance(ISimple.class, this);
+       if (simple == null) {
+           throw new ServiceUnavailableException("Simple Service " + RestMessages.SERVICEUNAVAILABLE.toString());
+       }
+       
+       Status status = simple.updateData(UUID.fromString(uuid), data);
+       if (!status.isSuccess()) {
+           return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
+       }
+       return Response.status(Response.Status.OK).build();
+   }
+
+   /**
+   *
+   * Sample Delete REST API call
+   *
+   * @return A response string
+   *
+   *         <pre>
+   * Example:
+   *
+   * Request URL:
+   * http://localhost:8080/app/northbound/api/{uuid}
+   *
+   * Response body in XML:
+   * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+   * Sample Northbound API
+   *
+   * Response body in JSON:
+   * Sample Northbound API
+   * </pre>
+   */
+  @Path("/simple/{uuid}")
+  @DELETE
+  @StatusCodes({ @ResponseCode(code = 200, condition = "Data Deleted successfully"),
+                 @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
+                 @ResponseCode(code = 500, condition = "Error deleting data"),
+                 @ResponseCode(code = 503, condition = "One or more of service is unavailable")})
+  @Consumes({ MediaType.APPLICATION_JSON})
+  public Response updateData(@PathParam("uuid") String uuid) {
+      if (!NorthboundUtils.isAuthorized(getUserName(), "default", Privilege.WRITE, this)) {
+          throw new UnauthorizedException("User is not authorized to perform this operation");
+      }
+      ISimple simple = (ISimple) ServiceHelper.getGlobalInstance(ISimple.class, this);
+      if (simple == null) {
+          throw new ServiceUnavailableException("Simple Service " + RestMessages.SERVICEUNAVAILABLE.toString());
+      }
+      
+      Status status = simple.deleteData(UUID.fromString(uuid));
+      if (!status.isSuccess()) {
+          return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
+      }
+      return Response.status(Response.Status.OK).build();
+  }
+
+}
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java
new file mode 100644 (file)
index 0000000..14faf3d
--- /dev/null
@@ -0,0 +1,58 @@
+package ${package}.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.opendaylight.controller.sal.authorization.UserLevel;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.toolkit.web.IDaylightWeb;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * This entire web class can be accessed via /web prefix as specified in web.xml
+ */
+@Controller
+@RequestMapping("/")
+public class AppWeb implements IDaylightWeb {
+    private static final String WEB_NAME = "${artifactId} App";
+    private static final String WEB_ID = "${artifactId}";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public AppWeb() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/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-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/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-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/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-app-simple/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/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-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml
new file mode 100644 (file)
index 0000000..bc4f337
--- /dev/null
@@ -0,0 +1,24 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="${package}"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..650bcba
--- /dev/null
@@ -0,0 +1,26 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>App</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <!-- style -->
+    <link rel="stylesheet" href="/css/ext/pure/pure.css"/>
+    <link rel="stylesheet" href="/css/phoenix.css"/>
+
+    <!-- style app -->
+    <link rel="stylesheet" href="/${artifactId}/web/css/simple.css"/>
+
+    <!-- scripts -->
+    <script data-main="/${artifactId}/web/js/main" src="/js/ext/requirejs/require.js"></script>
+  </head>
+  <body>
+    <div id="main"></div>
+  </body>
+</html>
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..9702312
--- /dev/null
@@ -0,0 +1,141 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+
+  <security-constraint>
+    <display-name>App</display-name>
+    <web-resource-collection>
+      <web-resource-name>AppWeb</web-resource-name>
+      <url-pattern>/web/js/*</url-pattern>
+      <url-pattern>/web/images/*</url-pattern>
+      <url-pattern>/web/css/*</url-pattern>
+      <url-pattern>/web/favicon.ico</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>App</web-resource-name>
+      <url-pattern>/*</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>AppNorthbound</web-resource-name>
+      <url-pattern>/northbound/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <!-- <login-config> // enabling this auto directs to login page, considering removing this
+    <auth-method>FORM</auth-method>
+    <form-login-config>
+      <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+      <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+    </form-login-config>
+  </login-config>-->
+  
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+
+  <!-- <error-page>
+    <error-code>403</error-code>
+    <location>/WEB-INF/jsp/autherror.jsp</location>
+  </error-page> -->
+
+  <!-- web -->
+  <servlet>
+    <servlet-name>AppWeb</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppWeb</servlet-name>
+    <url-pattern>/web/*</url-pattern>
+  </servlet-mapping>
+  
+  <listener>
+    <listener-class>org.opendaylight.toolkit.web.ControllerUISessionManager</listener-class>
+  </listener>
+
+  <!-- <session-config> // needs further testing
+    <cookie-config>
+      <path>/</path>
+    </cookie-config>
+  </session-config>-->
+  
+  <!-- northbound -->
+  <servlet>
+    <servlet-name>AppNorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppNorthbound</servlet-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </filter-mapping>
+
+</web-app>
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/css/simple.css b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/css/simple.css
new file mode 100644 (file)
index 0000000..54f3b08
--- /dev/null
@@ -0,0 +1,39 @@
+/* pure */
+.selected {
+  background: #F3F781
+}
+
+.button-success,
+.button-error {
+  color: white;
+  border-radius: 4px;
+  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
+}
+
+.button-success {
+  background: rgb(28, 184, 65); /* this is a green */
+}
+
+.button-error {
+  background: rgb(202, 60, 60); /* this is a maroon */
+}
+
+table {
+  width: 100%;
+  margin-bottom: 20px;
+}
+
+fieldset {
+}
+
+fieldset > label {
+  display: block;
+}
+
+fieldset > input {
+  width: 100%;
+}
+
+#simpleContainer {
+  margin-top: 15px;
+}
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/app.js b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/app.js
new file mode 100644 (file)
index 0000000..9323487
--- /dev/null
@@ -0,0 +1,18 @@
+#set( $symbol_dollar = '$' )
+// Filename: app.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',                                    // lib/jquery/jquery
+  'underscore',                                // lib/underscore/underscore
+  'backbone',                                  // lib/backbone/backbone
+  '/${artifactId}/web/js/views/View.js'        // app
+], function($, _, Backbone, View){
+  var initialize = function() {
+    var view = new View(); // this calls initialize which in turn calls render
+  }
+
+  return {
+    initialize : initialize
+  };
+});
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/collections/SimpleCollection.js b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/collections/SimpleCollection.js
new file mode 100644 (file)
index 0000000..f11ac88
--- /dev/null
@@ -0,0 +1,13 @@
+#set( $symbol_dollar = '$' )
+define(
+  [
+    'backbone',
+    'underscore',
+    '/${artifactId}/web/js/models/SimpleModel.js'
+    ], function(Backbone, _, SimpleModel) {
+      var SimpleCollection = Backbone.Collection.extend({
+        model : SimpleModel,
+        url : '/${artifactId}/northbound/simple'
+      });
+      return SimpleCollection;
+    });
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/main.js b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/main.js
new file mode 100644 (file)
index 0000000..4010d05
--- /dev/null
@@ -0,0 +1,19 @@
+#set( $symbol_dollar = '$' )
+// Filename: main.js
+
+require.config({
+  paths: {
+    "jquery": "/js/ext/jquery/dist/jquery.min",
+    "underscore": "/js/ext/underscore/underscore",
+    "backbone": "/js/ext/backbone/backbone",
+    "models": "/${artifactId}/web/js/models",                      // app
+    "views": "/${artifactId}/web/js/views",                                // app
+    "collections": "/${artifactId}/web/js/collections"         // app
+  }
+});
+require([
+  'app', '/js/phoenix.js'
+], function(App, Phoenix) {
+  new App.initialize();
+  new Phoenix.initialize();
+});
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/models/SimpleModel.js b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/models/SimpleModel.js
new file mode 100644 (file)
index 0000000..db53b19
--- /dev/null
@@ -0,0 +1,16 @@
+#set( $symbol_dollar = '$' )
+define(['backbone', 'underscore'], function(Backbone, _) {
+  var SimpleModel = Backbone.Model.extend({
+    idAttribute : 'uuid',
+    defaults : {
+      foo : '',
+      bar : ''
+    },
+    initialize : function() {
+    },
+    setUrlRoot: function() {
+      this.urlRoot = '/${artifactId}/northbound/simple';
+    }
+  });
+  return SimpleModel;
+});
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/templates/simple.html b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/templates/simple.html
new file mode 100644 (file)
index 0000000..2ad8bc6
--- /dev/null
@@ -0,0 +1,37 @@
+<script type="text/template" id="simpleContainer">
+  <div id="simpleDiv" style="margin-left:20px; float: left;">
+    <h3>Connection Application</h3>
+    <table id="simpleTable" class="pure-table pure-table-bordered">
+      <thead>
+        <tr>
+          <th>UUID</th>
+          <th>A</th>
+          <th>B</th>
+        </tr>
+      </thead>
+      <tbody>
+        <% _.each(simple, function(simpleton) { %>
+          <tr data-id="<%= simpleton.id %>">
+            <td><%= simpleton.attributes.uuid %></td>
+            <td><%= simpleton.attributes.foo %></td>
+            <td><%= simpleton.attributes.bar %></td>
+          </tr>
+        <% }); %>
+      </tbody>
+    </table>
+    <form class="pure-form">
+      <fieldset>
+        <legend>Connection Form</legend>
+        <label for="simpleFooInput">Input A</label>
+        <input type="text" id="simpleFooInput" placeholder="Input A" />
+        <label for="simpleBarInput">Input B</label>
+        <input type="text" id="simpleBarInput" placeholder="Input B" />
+        <div id="simpleContainer">
+          <button id="simpleButton" class="pure-button button-success" onclick="return false;">Submit</button>
+          <button id="simpleRemoveButton" class="pure-button button-error" onclick="return false;">Remove</button>
+          <button class="pure-button" onclick="return false;">Cancel</button>
+        </div>
+      </fieldset>
+    </form>
+  </div>
+</script>
diff --git a/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/views/View.js b/main/archetypes/archetype-app-simple/src/main/resources/archetype-resources/src/main/resources/js/views/View.js
new file mode 100644 (file)
index 0000000..a53b0d2
--- /dev/null
@@ -0,0 +1,82 @@
+#set( $symbol_dollar = '$' )
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    '/${artifactId}/web/js/collections/SimpleCollection.js',
+    '/${artifactId}/web/js/models/SimpleModel.js',
+    '/js/ext/text/text.js!/${artifactId}/web/js/templates/simple.html'
+    ], function($, Backbone, _, SimpleCollection, SimpleModel, Template) {
+      var View = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+          var self = this;
+          this.collection = new SimpleCollection();
+          this.collection.url = '/${artifactId}/northbound/simple';
+          this.collection.fetch({
+            success : function(call, response) {
+              self.render();
+            }
+          });
+        },
+        render: function() {
+          var that = this;
+          var compiledTemplate = _.template(Template, 
+          {
+            simple : that.collection.models
+          });
+          $(this.el).append($(compiledTemplate).html());
+        },
+        events : {
+          'click #simpleContainer button' : 'handleSimpleButton',
+          'click #simpleTable tbody tr' : 'tableRowClicked'
+        },
+        handleSimpleButton : function(evt) {
+          var self = this;
+          var $button = $(evt.currentTarget);
+          if ($button.attr('id') == 'simpleButton') {
+            var simpleModel = new SimpleModel({
+              foo : $('#simpleFooInput').val(),
+              bar : $('#simpleBarInput').val()
+            });
+            simpleModel.urlRoot = '/${artifactId}/northbound/simple';
+            simpleModel.save(null, {
+              dataType: 'text',
+              success: function(model, response) {
+                $('#main').empty();
+                self.updateView();
+              }
+            });
+          } else if ($button.attr('id') == 'simpleRemoveButton') {
+            var id = $('#simpleTable tbody tr.selected').attr('data-id');
+            var simpleModel = self.collection.get(id);
+            simpleModel.setUrlRoot();
+            simpleModel.destroy({
+              dataType: 'text',
+              success: function() {
+                $('#main').empty();
+                self.updateView();
+              },
+              error: function() {
+                $('#main').empty();
+                self.updateView();
+              }
+            });
+          } else {
+            // cancel button
+            $('#simpleInput').val('');
+          }
+        },
+        tableRowClicked : function(evt) {
+          $('#simpleTable tbody tr.selected').removeClass('selected');
+          var $tr = $(evt.currentTarget);
+          $tr.addClass('selected');
+        },
+        updateView : function() {
+          $('#simpleContainer').remove();
+          this.initialize();
+        }
+      });
+      return View;
+    });
diff --git a/main/archetypes/archetype-app-simple/src/test/resources/projects/basic/archetype.properties b/main/archetypes/archetype-app-simple/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..9857f0e
--- /dev/null
@@ -0,0 +1,5 @@
+#Sat Mar 15 19:51:35 CDT 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/main/archetypes/archetype-app-simple/src/test/resources/projects/basic/goal.txt b/main/archetypes/archetype-app-simple/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-app-web-topology/pom.xml b/main/archetypes/archetype-app-web-topology/pom.xml
new file mode 100644 (file)
index 0000000..6675b96
--- /dev/null
@@ -0,0 +1,30 @@
+<?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
+\r
+  <groupId>org.opendaylight.phoenix</groupId>\r
+  <artifactId>phoenix-app-web-topology</artifactId>\r
+  <version>0.0.1-SNAPSHOT</version>\r
+  <packaging>maven-archetype</packaging>\r
+\r
+  <name>phoenix-app-web-topology</name>\r
+\r
+  <build>\r
+    <extensions>\r
+      <extension>\r
+        <groupId>org.apache.maven.archetype</groupId>\r
+        <artifactId>archetype-packaging</artifactId>\r
+        <version>2.2</version>\r
+      </extension>\r
+    </extensions>\r
+\r
+    <pluginManagement>\r
+      <plugins>\r
+        <plugin>\r
+          <artifactId>maven-archetype-plugin</artifactId>\r
+          <version>2.2</version>\r
+        </plugin>\r
+      </plugins>\r
+    </pluginManagement>\r
+  </build>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-app-web-topology/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..69e35bf
--- /dev/null
@@ -0,0 +1,50 @@
+<?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="app"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.jsp</include>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.schemas</include>
+        <include>**/*.MF</include>
+        <include>**/*.js</include>
+        <include>**/*.tooling</include>
+        <include>**/*.factories</include>
+        <include>**/*.handlers</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.checkstyle</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..f578002
--- /dev/null
@@ -0,0 +1,111 @@
+<?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
+    <groupId>org.opendaylight.phoenix</groupId>\r
+    <artifactId>common</artifactId>\r
+    <version>0.0.1-SNAPSHOT</version>\r
+    <relativePath>../common</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>${artifactId}</artifactId>\r
+\r
+  <groupId>${groupId}</groupId>\r
+  <packaging>bundle</packaging>\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
+            <Import-Package>\r
+              org.opendaylight.phoenix.web,\r
+              org.opendaylight.controller.sal.authorization,\r
+              org.opendaylight.controller.sal.core,\r
+              org.opendaylight.controller.sal.utils,\r
+              org.opendaylight.controller.topologymanager,\r
+              javax.annotation,\r
+              javax.naming,\r
+              javax.servlet,\r
+              javax.servlet.annotation,\r
+              javax.servlet.http,\r
+              javax.servlet.jsp,\r
+              javax.servlet.jsp.el,\r
+              javax.servlet.jsp.jstl.core,\r
+              javax.servlet.jsp.jstl.fmt,\r
+              javax.servlet.jsp.jstl.tlv,\r
+              javax.servlet.jsp.tagext,\r
+              javax.servlet.resources,\r
+              javax.xml.parsers,\r
+              javax.xml.transform,\r
+              org.apache.commons.logging,\r
+              org.apache.taglibs.standard.functions,\r
+              org.apache.taglibs.standard.resources,\r
+              org.apache.taglibs.standard.tag.common.core,\r
+              org.apache.taglibs.standard.tag.common.fmt,\r
+              org.apache.taglibs.standard.tag.rt.core,\r
+              org.apache.taglibs.standard.tag.rt.fmt,\r
+              org.apache.taglibs.standard.tei,\r
+              org.apache.taglibs.standard.tlv,\r
+              org.osgi.framework,\r
+              org.slf4j,\r
+              org.springframework.beans,\r
+              org.springframework.beans.factory.xml,\r
+              org.springframework.context.config,\r
+              org.springframework.stereotype,\r
+              org.springframework.ui,\r
+              org.springframework.web,\r
+              org.springframework.web.bind.annotation,\r
+              org.springframework.web.servlet,\r
+              org.springframework.web.servlet.config,\r
+              org.springframework.web.servlet.view,\r
+              org.springframework.web.filter,\r
+              org.springframework.web.context</Import-Package>\r
+            <Export-Package></Export-Package>\r
+            <Web-ContextPath>/${artifactId}</Web-ContextPath>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>\r
+        </configuration>\r
+      </plugin>\r
+      <plugin>\r
+        <groupId>org.apache.maven.plugins</groupId>\r
+        <artifactId>maven-jar-plugin</artifactId>\r
+        <executions>\r
+          <execution>\r
+            <id>jar-to-main</id>\r
+            <configuration>\r
+              <outputDirectory>../main/target/main-osgipackage/opendaylight/plugins/</outputDirectory>\r
+            </configuration>\r
+            <goals>\r
+              <goal>jar</goal>\r
+            </goals>\r
+          </execution>\r
+        </executions>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+\r
+  <version>${version}</version>\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.opendaylight.phoenix</groupId>\r
+      <artifactId>web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>topologymanager</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.springframework</groupId>\r
+      <artifactId>spring-web</artifactId>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/java/App.java b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/java/App.java
new file mode 100644 (file)
index 0000000..9bebf95
--- /dev/null
@@ -0,0 +1,112 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package};
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.opendaylight.controller.sal.authorization.UserLevel;
+import org.opendaylight.controller.sal.core.Edge;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.topologymanager.ITopologyManager;
+import org.opendaylight.phoenix.web.IDaylightWeb;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+@RequestMapping("/")
+public class App implements IDaylightWeb {
+    private static final String WEB_NAME = "${artifactId}";
+    private static final String WEB_ID = "${artifactId}";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public App() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @RequestMapping(value = "/visual.json", method = RequestMethod.GET)
+    @ResponseBody
+    public Map<String, Object> getLinkData(HttpServletRequest request) {
+        Map<String, Object> result = new HashMap<String, Object>();
+
+        ITopologyManager topologyManager = (ITopologyManager) ServiceHelper.getInstance(ITopologyManager.class,
+                GlobalConstants.DEFAULT.toString(), this);
+        if (topologyManager == null) {
+            return result;
+        }
+
+        Map<Node, Set<Edge>> nodeEdges = topologyManager.getNodeEdges();
+        List<Node> globalNodes = new ArrayList<Node>(nodeEdges.keySet());
+
+        result.put("directed", false);
+        result.put("multigraph", false);
+        result.put("graph", new ArrayList());
+
+        List<Map<String, Object>> nodes = new ArrayList<Map<String, Object>>();
+        result.put("nodes", nodes);
+
+        List<Map<String, Integer>> links = new ArrayList<Map<String, Integer>>();
+        result.put("links", links);
+
+        for (Node n : globalNodes) {
+            Map<String, Object> node = new HashMap<String, Object>();
+            node.put("id", n.toString());
+            node.put("fixed", true);
+            nodes.add(node);
+
+            for (Edge edge : nodeEdges.get(n)) {
+                Map<String, Integer> e = new HashMap<String, Integer>();
+
+                e.put("source", globalNodes.indexOf(edge.getHeadNodeConnector().getNode()));
+                e.put("target", globalNodes.indexOf(edge.getTailNodeConnector().getNode()));
+                links.add(e);
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/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-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/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-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/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-app-web-topology/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/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-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/App-servlet.xml b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/App-servlet.xml
new file mode 100644 (file)
index 0000000..bc4f337
--- /dev/null
@@ -0,0 +1,24 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="${package}"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/autherror.jsp b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/autherror.jsp
new file mode 100644 (file)
index 0000000..712a6a3
--- /dev/null
@@ -0,0 +1,3 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/error.jsp b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/error.jsp
new file mode 100644 (file)
index 0000000..712a6a3
--- /dev/null
@@ -0,0 +1,3 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/login.jsp b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/login.jsp
new file mode 100644 (file)
index 0000000..712a6a3
--- /dev/null
@@ -0,0 +1,3 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..07630c5
--- /dev/null
@@ -0,0 +1,36 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+       pageEncoding="UTF-8"%>
+<%@ page import="java.net.URL"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<!DOCTYPE html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>OpenDaylight Phoenix - App</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <!-- style -->
+    <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"/>
+    <style type="text/css">
+      .link {
+        stroke: #999;
+        stroke-opacity: 0.6;
+      }
+    </style>
+
+    <!-- scripts -->
+    <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
+    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
+    <script src="/js/assets/phoenix-topology.js"></script>
+    <script src="/${artifactId}/js/sample.js"></script>
+  </head>
+  <body>
+    <p>${artifactId}</p>
+    <div id="topology"></div>
+  </body>
+</html>
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..a54cd12
--- /dev/null
@@ -0,0 +1,78 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+        <security-constraint>
+                <web-resource-collection>
+                        <web-resource-name>free access</web-resource-name>
+                        <url-pattern>/js/*</url-pattern>
+                        <url-pattern>/images/*</url-pattern>
+                        <url-pattern>/css/*</url-pattern>
+                        <url-pattern>/favicon.ico</url-pattern>
+                </web-resource-collection>
+        </security-constraint>
+
+        <security-constraint>
+                <display-name>App</display-name>
+                <web-resource-collection>
+                        <web-resource-name>AppGUI</web-resource-name>
+                        <url-pattern>/*</url-pattern>
+                </web-resource-collection>
+                <auth-constraint>
+                        <role-name>System-Admin</role-name>
+                        <role-name>Network-Admin</role-name>
+                        <role-name>Network-Operator</role-name>
+                        <role-name>Container-User</role-name>
+                </auth-constraint>
+        </security-constraint>
+
+        <security-role>
+                <role-name>System-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Operator</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Container-User</role-name>
+        </security-role>
+
+        <login-config>
+                <auth-method>FORM</auth-method>
+                <form-login-config>
+                        <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+                        <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+                </form-login-config>
+        </login-config>
+
+    <error-page>
+            <error-code>403</error-code>
+            <location>/WEB-INF/jsp/autherror.jsp</location>
+    </error-page>
+
+        <servlet>
+                <servlet-name>App</servlet-name>
+                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+                <load-on-startup>1</load-on-startup>
+        </servlet>
+
+        <servlet-mapping>
+                <servlet-name>App</servlet-name>
+                <url-pattern>/</url-pattern>
+        </servlet-mapping>
+
+        <listener>
+                <listener-class>${groupId}.web.ControllerUISessionManager</listener-class>
+        </listener>
+        <session-config>
+                <cookie-config>
+                        <path>/</path>
+                </cookie-config>
+        </session-config>
+
+</web-app>
diff --git a/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/js/sample.js b/main/archetypes/archetype-app-web-topology/src/main/resources/archetype-resources/src/main/resources/js/sample.js
new file mode 100644 (file)
index 0000000..8df5588
--- /dev/null
@@ -0,0 +1,7 @@
+$('document').ready(function() {
+  $.getJSON('/app/visual.json', function(data) { // TODO hard-coded
+    $('#topology').width(960);
+    $('#topology').height(500);
+    phoenix.topology.build(data, '#topology');
+  });
+});
diff --git a/main/archetypes/archetype-app-web-topology/src/test/resources/projects/basic/archetype.properties b/main/archetypes/archetype-app-web-topology/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..7fd4375
--- /dev/null
@@ -0,0 +1,5 @@
+#Thu Mar 06 17:24:05 CST 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/main/archetypes/archetype-app-web-topology/src/test/resources/projects/basic/goal.txt b/main/archetypes/archetype-app-web-topology/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-app-web/pom.xml b/main/archetypes/archetype-app-web/pom.xml
new file mode 100644 (file)
index 0000000..866d0eb
--- /dev/null
@@ -0,0 +1,30 @@
+<?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
+\r
+  <groupId>org.opendaylight.phoenix</groupId>\r
+  <artifactId>phoenix-app-web</artifactId>\r
+  <version>0.0.1-SNAPSHOT</version>\r
+  <packaging>maven-archetype</packaging>\r
+\r
+  <name>phoenix-app-web</name>\r
+\r
+  <build>\r
+    <extensions>\r
+      <extension>\r
+        <groupId>org.apache.maven.archetype</groupId>\r
+        <artifactId>archetype-packaging</artifactId>\r
+        <version>2.2</version>\r
+      </extension>\r
+    </extensions>\r
+\r
+    <pluginManagement>\r
+      <plugins>\r
+        <plugin>\r
+          <artifactId>maven-archetype-plugin</artifactId>\r
+          <version>2.2</version>\r
+        </plugin>\r
+      </plugins>\r
+    </pluginManagement>\r
+  </build>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-web/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-app-web/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..69e35bf
--- /dev/null
@@ -0,0 +1,50 @@
+<?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="app"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.jsp</include>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.schemas</include>
+        <include>**/*.MF</include>
+        <include>**/*.js</include>
+        <include>**/*.tooling</include>
+        <include>**/*.factories</include>
+        <include>**/*.handlers</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.checkstyle</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..8ef94d5
--- /dev/null
@@ -0,0 +1,105 @@
+<?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
+    <groupId>org.opendaylight.phoenix</groupId>\r
+    <artifactId>common</artifactId>\r
+    <version>0.0.1-SNAPSHOT</version>\r
+    <relativePath>../common</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>${artifactId}</artifactId>\r
+\r
+  <groupId>${groupId}</groupId>\r
+  <packaging>bundle</packaging>\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
+            <Import-Package>org.opendaylight.phoenix.web,\r
+              org.opendaylight.controller.sal.authorization,\r
+              org.opendaylight.controller.sal.core,\r
+              org.opendaylight.controller.sal.utils,\r
+              javax.annotation,\r
+              javax.naming,\r
+              javax.servlet,\r
+              javax.servlet.annotation,\r
+              javax.servlet.http,\r
+              javax.servlet.jsp,\r
+              javax.servlet.jsp.el,\r
+              javax.servlet.jsp.jstl.core,\r
+              javax.servlet.jsp.jstl.fmt,\r
+              javax.servlet.jsp.jstl.tlv,\r
+              javax.servlet.jsp.tagext,\r
+              javax.servlet.resources,\r
+              javax.xml.parsers,\r
+              javax.xml.transform,\r
+              org.apache.commons.logging,\r
+              org.apache.taglibs.standard.functions,\r
+              org.apache.taglibs.standard.resources,\r
+              org.apache.taglibs.standard.tag.common.core,\r
+              org.apache.taglibs.standard.tag.common.fmt,\r
+              org.apache.taglibs.standard.tag.rt.core,\r
+              org.apache.taglibs.standard.tag.rt.fmt,\r
+              org.apache.taglibs.standard.tei,\r
+              org.apache.taglibs.standard.tlv,\r
+              org.osgi.framework,\r
+              org.slf4j,\r
+              org.springframework.beans,\r
+              org.springframework.beans.factory.xml,\r
+              org.springframework.context.config,\r
+              org.springframework.stereotype,\r
+              org.springframework.ui,\r
+              org.springframework.web,\r
+              org.springframework.web.bind.annotation,\r
+              org.springframework.web.servlet,\r
+              org.springframework.web.servlet.config,\r
+              org.springframework.web.servlet.view,\r
+              org.springframework.web.filter,\r
+              org.springframework.web.context</Import-Package>\r
+            <Export-Package></Export-Package>\r
+            <Web-ContextPath>/${artifactId}</Web-ContextPath>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>\r
+        </configuration>\r
+      </plugin>\r
+      <plugin>\r
+        <groupId>org.apache.maven.plugins</groupId>\r
+        <artifactId>maven-jar-plugin</artifactId>\r
+        <executions>\r
+          <execution>\r
+            <id>jar-to-main</id>\r
+            <configuration>\r
+              <outputDirectory>../main/target/main-osgipackage/opendaylight/plugins/</outputDirectory>\r
+            </configuration>\r
+            <goals>\r
+              <goal>jar</goal>\r
+            </goals>\r
+          </execution>\r
+        </executions>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+\r
+  <version>${version}</version>\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.opendaylight.phoenix</groupId>\r
+      <artifactId>web</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal</artifactId>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.springframework</groupId>\r
+      <artifactId>spring-web</artifactId>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/java/App.java b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/java/App.java
new file mode 100644 (file)
index 0000000..8c5406f
--- /dev/null
@@ -0,0 +1,58 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package};
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.opendaylight.controller.sal.authorization.UserLevel;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import ${groupId}.web.IDaylightWeb;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("/")
+public class App implements IDaylightWeb {
+    private static final String WEB_NAME = "App";
+    private static final String WEB_ID = "${artifactId}";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public App() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/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-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/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-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/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-app-web/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/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-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/App-servlet.xml b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/App-servlet.xml
new file mode 100644 (file)
index 0000000..bc4f337
--- /dev/null
@@ -0,0 +1,24 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="${package}"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/autherror.jsp b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/autherror.jsp
new file mode 100644 (file)
index 0000000..712a6a3
--- /dev/null
@@ -0,0 +1,3 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/error.jsp b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/error.jsp
new file mode 100644 (file)
index 0000000..712a6a3
--- /dev/null
@@ -0,0 +1,3 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/login.jsp b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/login.jsp
new file mode 100644 (file)
index 0000000..712a6a3
--- /dev/null
@@ -0,0 +1,3 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..aa65029
--- /dev/null
@@ -0,0 +1,4 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+${artifactId}
\ No newline at end of file
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..a54cd12
--- /dev/null
@@ -0,0 +1,78 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+        <security-constraint>
+                <web-resource-collection>
+                        <web-resource-name>free access</web-resource-name>
+                        <url-pattern>/js/*</url-pattern>
+                        <url-pattern>/images/*</url-pattern>
+                        <url-pattern>/css/*</url-pattern>
+                        <url-pattern>/favicon.ico</url-pattern>
+                </web-resource-collection>
+        </security-constraint>
+
+        <security-constraint>
+                <display-name>App</display-name>
+                <web-resource-collection>
+                        <web-resource-name>AppGUI</web-resource-name>
+                        <url-pattern>/*</url-pattern>
+                </web-resource-collection>
+                <auth-constraint>
+                        <role-name>System-Admin</role-name>
+                        <role-name>Network-Admin</role-name>
+                        <role-name>Network-Operator</role-name>
+                        <role-name>Container-User</role-name>
+                </auth-constraint>
+        </security-constraint>
+
+        <security-role>
+                <role-name>System-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Operator</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Container-User</role-name>
+        </security-role>
+
+        <login-config>
+                <auth-method>FORM</auth-method>
+                <form-login-config>
+                        <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+                        <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+                </form-login-config>
+        </login-config>
+
+    <error-page>
+            <error-code>403</error-code>
+            <location>/WEB-INF/jsp/autherror.jsp</location>
+    </error-page>
+
+        <servlet>
+                <servlet-name>App</servlet-name>
+                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+                <load-on-startup>1</load-on-startup>
+        </servlet>
+
+        <servlet-mapping>
+                <servlet-name>App</servlet-name>
+                <url-pattern>/</url-pattern>
+        </servlet-mapping>
+
+        <listener>
+                <listener-class>${groupId}.web.ControllerUISessionManager</listener-class>
+        </listener>
+        <session-config>
+                <cookie-config>
+                        <path>/</path>
+                </cookie-config>
+        </session-config>
+
+</web-app>
diff --git a/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/js/sample.js b/main/archetypes/archetype-app-web/src/main/resources/archetype-resources/src/main/resources/js/sample.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-app-web/src/test/resources/projects/basic/archetype.properties b/main/archetypes/archetype-app-web/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..7fd4375
--- /dev/null
@@ -0,0 +1,5 @@
+#Thu Mar 06 17:24:05 CST 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/main/archetypes/archetype-app-web/src/test/resources/projects/basic/goal.txt b/main/archetypes/archetype-app-web/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/archetypes/archetype-app/pom.xml b/main/archetypes/archetype-app/pom.xml
new file mode 100644 (file)
index 0000000..86fb520
--- /dev/null
@@ -0,0 +1,30 @@
+<?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>
+
+  <groupId>org.opendaylight.phoenix.archetype</groupId>
+  <artifactId>app-archetype</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>app-archetype</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-app/src/main/resources/META-INF/maven/archetype-metadata.xml b/main/archetypes/archetype-app/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644 (file)
index 0000000..b61d162
--- /dev/null
@@ -0,0 +1,51 @@
+<?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="app"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.jsp</include>
+        <include>**/*.xml</include>
+        <include>**/*.html</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.schemas</include>
+        <include>**/*.MF</include>
+        <include>**/*.js</include>
+        <include>**/*.tooling</include>
+        <include>**/*.factories</include>
+        <include>**/*.handlers</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>.settings</directory>
+      <includes>
+        <include>**/*.prefs</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.checkstyle</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/pom.xml b/main/archetypes/archetype-app/src/main/resources/archetype-resources/pom.xml
new file mode 100644 (file)
index 0000000..51d9720
--- /dev/null
@@ -0,0 +1,113 @@
+#set( $dollar = '$' )
+<?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>
+    <groupId>org.opendaylight.phoenix</groupId>
+    <artifactId>common</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>../common</relativePath>
+  </parent>
+
+  <artifactId>${artifactId}</artifactId>
+
+  <groupId>${groupId}</groupId>
+  <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>org.opendaylight.phoenix.web,
+              org.opendaylight.controller.sal.authorization,
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.utils,
+              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,
+              org.osgi.framework,
+              org.slf4j,
+              org.springframework.beans,
+              org.springframework.beans.factory.xml,
+              org.springframework.context.config,
+              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.filter,
+              org.springframework.web.context,
+
+              org.opendaylight.controller.northbound.commons,
+              com.sun.jersey.spi.container.servlet,
+              com.fasterxml.jackson.annotation,
+              javax.ws.rs,
+              javax.ws.rs.core,
+              javax.xml.bind,
+              javax.xml.bind.annotation,
+              org.apache.catalina.filters,
+              com.fasterxml.jackson.jaxrs.base,
+              com.fasterxml.jackson.jaxrs.json,
+              !org.codehaus.enunciate.jaxrs</Import-Package>
+            <Export-Package></Export-Package>
+            <Web-ContextPath>/app</Web-ContextPath>
+            <Jaxrs-Resources>,${dollar}{classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <version>${version}</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.phoenix</groupId>
+      <artifactId>web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>commons.northbound</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/java/northbound/AppNorthbound.java
new file mode 100644 (file)
index 0000000..bca48a0
--- /dev/null
@@ -0,0 +1,70 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.${artifactId}.northbound;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ *
+ * This entire web class can be accessed via /northbound prefix as specified in
+ * web.xml
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+@Path("/")
+public class AppNorthbound {
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     *
+     * Sample REST API call
+     *
+     * @return A response string
+     *
+     * <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/${artifactId}/northbound/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - ${artifactId}";
+        return result;
+    }
+}
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/java/web/AppWeb.java
new file mode 100644 (file)
index 0000000..5e099c3
--- /dev/null
@@ -0,0 +1,61 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.${artifactId}.web;
+
+import javax.servlet.http.HttpServletRequest;
+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.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * This entire web class can be accessed via /web prefix as specified in web.xml
+ */
+@Controller
+@RequestMapping("/")
+public class AppWeb implements IDaylightWeb {
+    private static final String WEB_NAME = "App";
+    private static final String WEB_ID = "${artifactId}";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public AppWeb() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "/main")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.factories b/main/archetypes/archetype-app/src/main/resources/archetype-resources/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-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers b/main/archetypes/archetype-app/src/main/resources/archetype-resources/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-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas b/main/archetypes/archetype-app/src/main/resources/archetype-resources/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-app/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.tooling b/main/archetypes/archetype-app/src/main/resources/archetype-resources/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-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/AppWeb-servlet.xml
new file mode 100644 (file)
index 0000000..8ecff6e
--- /dev/null
@@ -0,0 +1,24 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?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="${package}"/>
+
+  <mvc:resources mapping="/js/**" location="/js/" />
+  <mvc:resources mapping="/css/**" location="/css/" />
+  <mvc:resources mapping="/img/**" location="/img/" />
+  <mvc:annotation-driven/>
+
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+        <property name="prefix" value="/WEB-INF/jsp/"/>
+        <property name="suffix" value=".jsp"/>
+  </bean>
+</beans>
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..ae18d8d
--- /dev/null
@@ -0,0 +1,35 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+       pageEncoding="UTF-8"%>
+<%@ page import="java.net.URL"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<!DOCTYPE html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>App</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <!-- style -->
+    <!-- <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"/> -->
+    <link rel="stylesheet" href="/css/ext/pure/pure.css"/>
+    <link rel="stylesheet" href="/css/global.css"/>
+    <link rel="stylesheet" href="/css/header.css"/>
+    <link rel="stylesheet" href="/css/menu.css"/>
+    <link rel="stylesheet" href="/css/core.css"/>
+
+    <!-- scripts -->
+    <script data-main="/app/js/main" src="/js/ext/requirejs/require.js"></script>
+    <!-- 
+    <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
+    <script src="/js/core.js"></script>
+    -->
+  </head>
+  <body>
+    <h3>App</h3>
+    <div id="main"></div>
+  </body>
+</html>
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..9553861
--- /dev/null
@@ -0,0 +1,141 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+
+  <security-constraint>
+    <display-name>App</display-name>
+    <web-resource-collection>
+      <web-resource-name>AppWeb</web-resource-name>
+      <url-pattern>/web/js/*</url-pattern>
+      <url-pattern>/web/images/*</url-pattern>
+      <url-pattern>/web/css/*</url-pattern>
+      <url-pattern>/web/favicon.ico</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>App</web-resource-name>
+      <url-pattern>/*</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>AppNorthbound</web-resource-name>
+      <url-pattern>/northbound/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <!-- <login-config> // enabling this auto directs to login page, considering removing this
+    <auth-method>FORM</auth-method>
+    <form-login-config>
+      <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+      <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+    </form-login-config>
+  </login-config>-->
+  
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+
+  <!-- <error-page>
+    <error-code>403</error-code>
+    <location>/WEB-INF/jsp/autherror.jsp</location>
+  </error-page> -->
+
+  <!-- web -->
+  <servlet>
+    <servlet-name>AppWeb</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppWeb</servlet-name>
+    <url-pattern>/web/*</url-pattern>
+  </servlet-mapping>
+  
+  <listener>
+    <listener-class>org.opendaylight.phoenix.web.ControllerUISessionManager</listener-class>
+  </listener>
+
+  <!-- <session-config> // needs further testing
+    <cookie-config>
+      <path>/</path>
+    </cookie-config>
+  </session-config>-->
+  
+  <!-- northbound -->
+  <servlet>
+    <servlet-name>AppNorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppNorthbound</servlet-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </filter-mapping>
+
+</web-app>
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/app.js b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/app.js
new file mode 100644 (file)
index 0000000..2bf36b6
--- /dev/null
@@ -0,0 +1,46 @@
+// Filename: app.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',                                    // lib/jquery/jquery
+  'underscore',                                // lib/underscore/underscore
+  'backbone',                                  // lib/backbone/backbone
+  '/app/js/views/DeviceView.js'        // app
+], function($, _, Backbone, DeviceView){
+  var initialize = function() {
+    console.log('init');
+    // load apps into menu
+    $.getJSON('/web.json', function(apps) {
+      console.log(apps);
+      $.each(apps, function(key, app) {
+        var $li = $(document.createElement('li'));
+        var $a = $(document.createElement('a'));
+        $a.append(app.name).attr('href', '#');
+        //$a.attr('href', '/'+key);
+        $a.click(function() {
+          $(this).closest('ul').find('li').removeClass('pure-menu-selected');
+          $(this).closest('li').addClass('pure-menu-selected');
+          $('#main').load('/'+key);
+        });
+        $li.append($a);
+
+        $('#menu ul').append($li);
+      });
+    });
+    $('#main').text('OpenDaylight Phoenix App');
+    $('#menu .pure-menu-selected').click(function() {
+      $(this).closest('ul').find('li').removeClass('pure-menu-selected');
+      $(this).closest('li').addClass('pure-menu-selected');
+      $('#main').empty();
+      $('#main').text('OpenDaylight Phoenix');
+    });
+
+    // test backbone
+    new DeviceView().render();
+  }
+
+  return {
+    initialize : initialize
+  };
+});
+
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/collections/DevicesCollection.js
new file mode 100644 (file)
index 0000000..30d3316
--- /dev/null
@@ -0,0 +1,6 @@
+define(['backbone','underscore','/app/js/models/DeviceModel.js'], function(Backbone, _, DeviceModel) {
+       var DevicesCollection = Backbone.Collection.extend({
+               model: DeviceModel
+       });
+       return DevicesCollection;
+});
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/main.js b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/main.js
new file mode 100644 (file)
index 0000000..6543d5c
--- /dev/null
@@ -0,0 +1,17 @@
+// Filename: main.js
+
+require.config({
+  paths: {
+    "jquery": "/js/ext/jquery/dist/jquery.min",
+    "underscore": "/js/ext/underscore/underscore",
+    "backbone": "/js/ext/backbone/backbone",
+    "models": "/app/js/models",                        // app
+    "views": "/app/js/views",                          // app
+    "collections": "/app/js/collections"       // app
+  }
+});
+require([
+  'app'
+], function(App) {
+  new App.initialize();
+});
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/models/DeviceModel.js
new file mode 100644 (file)
index 0000000..f9b2e29
--- /dev/null
@@ -0,0 +1,11 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+    var DeviceModel = Backbone.Model.extend({
+        defaults: {
+               name: "New device"
+        },
+        initialize: function() {
+               console.log("initialize of DeviceModel called");
+        }
+       });
+       return DeviceModel;
+});
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/templates/device.html
new file mode 100644 (file)
index 0000000..d835a08
--- /dev/null
@@ -0,0 +1,13 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!DOCTYPE html>
+<div id="devicecontainer">
+       <p>App</p>
+    <div>
+        <label>Name: </label> <label><%=device_name%></label>
+    </div>
+    <div>
+        <label>IP Address: </label> <label><%=device_ip%></label>
+    </div>
+</div>
diff --git a/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js b/main/archetypes/archetype-app/src/main/resources/archetype-resources/src/main/resources/js/views/DeviceView.js
new file mode 100644 (file)
index 0000000..99377b6
--- /dev/null
@@ -0,0 +1,30 @@
+define(
+    [
+        'jquery',
+        'backbone',
+        'underscore',
+        '/app/js/collections/DevicesCollection.js',
+        '/app/js/models/DeviceModel.js',
+        '/js/ext/text/text.js!/app/js/templates/device.html'
+    ], function($, Backbone, _, DevicesCollection, DeviceModel, DeviceTemplate) {
+
+    var DeviceView = Backbone.View.extend({
+        el: $("#main"),
+        render: function() {
+            console.log("DevicesView initialize called");
+            this.collection = new DevicesCollection();
+            this.deviceModel = new DeviceModel({
+                'name': 'device1',
+                'ipAddress': '1.2.3.4'
+            });
+            this.collection.add(this.deviceModel);
+            var templateVariables = {
+                'device_name': this.deviceModel.get('name'),
+                'device_ip': this.deviceModel.get('ipAddress')
+            };
+            var compiledTemplate = _.template(DeviceTemplate, templateVariables);
+            $(this.el).append(compiledTemplate);
+        }
+    });
+    return DeviceView;
+});
diff --git a/main/archetypes/archetype-app/src/test/resources/projects/basic/archetype.properties b/main/archetypes/archetype-app/src/test/resources/projects/basic/archetype.properties
new file mode 100644 (file)
index 0000000..689052a
--- /dev/null
@@ -0,0 +1,5 @@
+#Wed Mar 12 23:55:08 CDT 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
diff --git a/main/archetypes/archetype-app/src/test/resources/projects/basic/goal.txt b/main/archetypes/archetype-app/src/test/resources/projects/basic/goal.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/dev.js b/main/dev.js
new file mode 100644 (file)
index 0000000..8dac41b
--- /dev/null
@@ -0,0 +1,21 @@
+var fs = require('fs')
+
+process.argv.forEach(function(val, index, array) {
+  if (index === 2) {
+    if (val == 'init') {
+      init();
+    } else if (val == 'teardown') {
+      teardown();
+    } else {
+      console.log('invalid argument');
+    }
+  }
+});
+
+function init() {
+  console.log('initializing ui dev environment');
+}
+
+function teardown() {
+  console.log('tearing down ui dev environment');
+}
diff --git a/main/opendaylight-local.target b/main/opendaylight-local.target
new file mode 100644 (file)
index 0000000..a7780fe
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target name="opendaylight-local" sequenceNumber="6">
+<locations>
+<location path="${workspace_loc:/distribution.opendaylight/}/../p2site/target/repository" type="Directory"/>
+</locations>
+</target>
diff --git a/main/opendaylight.target b/main/opendaylight.target
new file mode 100644 (file)
index 0000000..7ae309c
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target name="opendaylight" sequenceNumber="4">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.apache.jasper" version="7.0.32.v201211201952"/>
+<unit id="javax.servlet.jsp.jstl.impl" version="1.2.0.v201210211230"/>
+<unit id="org.springframework.context" version="3.1.3.RELEASE"/>
+<unit id="org.eclipse.gemini.web.extender" version="2.2.0.RELEASE"/>
+<unit id="jackson-jaxrs" version="1.9.8"/>
+<unit id="com.sun.jersey.jersey-server" version="1.17.0"/>
+<unit id="org.eclipse.jdt.core.compiler.batch" version="3.8.0.I20120518-2145"/>
+<unit id="org.springframework.web" version="3.1.3.RELEASE"/>
+<unit id="com.google.gson" version="2.1.0"/>
+<unit id="org.springframework.security.config" version="3.1.3.RELEASE"/>
+<unit id="org.springframework.transaction" version="3.1.3.RELEASE"/>
+<unit id="org.eclipse.virgo.util.math" version="3.6.0.RELEASE"/>
+<unit id="org.apache.el" version="7.0.32.v201211081135"/>
+<unit id="org.springframework.web.servlet" version="3.1.3.RELEASE"/>
+<unit id="org.apache.felix.dependencymanager.shell" version="3.0.1"/>
+<unit id="log4j.over.slf4j" version="1.7.2"/>
+<unit id="com.springsource.org.aopalliance" version="1.0.0"/>
+<unit id="javax.annotation" version="1.1.0.v201209060031"/>
+<unit id="jcl.over.slf4j" version="1.7.2"/>
+<unit id="javax.mail.glassfish" version="1.4.1.v201108011116"/>
+<unit id="slf4j.api" version="1.7.2"/>
+<unit id="org.springframework.expression" version="3.1.3.RELEASE"/>
+<unit id="jackson-mapper-asl" version="1.9.8"/>
+<unit id="org.eclipse.gemini.web.tomcat" version="2.2.0.RELEASE"/>
+<unit id="org.apache.felix.gogo.command" version="0.8.0.v201108120515"/>
+<unit id="org.springframework.asm" version="3.1.3.RELEASE"/>
+<unit id="org.eclipse.equinox.ds" version="1.4.0.v20120522-1841"/>
+<unit id="org.eclipse.equinox.console" version="1.0.0.v20120522-1841"/>
+<unit id="org.apache.catalina" version="7.0.32.v201211201336"/>
+<unit id="chameleon-mbeans" version="1.0.0"/>
+<unit id="javax.servlet.jsp.jstl" version="1.2.0.v201105211821"/>
+<unit id="org.apache.felix.gogo.runtime" version="0.8.0.v201108120515"/>
+<unit id="org.apache.tomcat.util" version="7.0.32.v201211201952"/>
+<unit id="jackson-core-asl" version="1.9.8"/>
+<unit id="javax.activation" version="1.1.0.v201211130549"/>
+<unit id="org.eclipse.gemini.web.core" version="2.2.0.RELEASE"/>
+<unit id="org.eclipse.virgo.util.osgi" version="3.6.0.RELEASE"/>
+<unit id="org.apache.commons.io" version="2.3.0"/>
+<unit id="javax.servlet.jsp" version="2.2.0.v201112011158"/>
+<unit id="org.apache.tomcat.api" version="7.0.32.v201211081135"/>
+<unit id="com.sun.jersey.core" version="1.17.0"/>
+<unit id="org.springframework.security.taglibs" version="3.1.3.RELEASE"/>
+<unit id="org.springframework.security.web" version="3.1.3.RELEASE"/>
+<unit id="com.sun.jersey.client" version="1.17.0"/>
+<unit id="org.springframework.aop" version="3.1.3.RELEASE"/>
+<unit id="org.apache.coyote" version="7.0.32.v201211201952"/>
+<unit id="org.eclipse.virgo.kernel.equinox.extensions" version="3.6.0.RELEASE"/>
+<unit id="org.eclipse.osgi.services" version="3.3.100.v20120522-1822"/>
+<unit id="org.eclipse.virgo.util.common" version="3.6.0.RELEASE"/>
+<unit id="org.eclipse.equinox.util" version="1.0.400.v20120522-2049"/>
+<unit id="org.springframework.core" version="3.1.3.RELEASE"/>
+<unit id="org.apache.commons.fileupload" version="1.2.2"/>
+<unit id="org.codehaus.jettison.jettison" version="1.3.3"/>
+<unit id="org.eclipse.virgo.util.io" version="3.6.0.RELEASE"/>
+<unit id="org.apache.felix.gogo.shell" version="0.8.0.v201110170705"/>
+<unit id="org.apache.commons.lang3" version="3.1.0"/>
+<unit id="org.eclipse.equinox.cm" version="1.0.400.v20120522-1841"/>
+<unit id="org.springframework.beans" version="3.1.3.RELEASE"/>
+<unit id="javax.servlet" version="3.0.0.v201112011016"/>
+<unit id="org.eclipse.equinox.launcher" version="1.3.0.v20120522-1813"/>
+<unit id="javax.persistence" version="2.0.4.v201112161009"/>
+<unit id="org.eclipse.osgi" version="3.8.1.v20120830-144521"/>
+<unit id="ch.qos.logback.core" version="1.0.9"/>
+<unit id="javax.ejb" version="3.1.1.v201204261316"/>
+<unit id="org.apache.catalina.ha" version="7.0.32.v201211201952"/>
+<unit id="org.springframework.context.support" version="3.1.3.RELEASE"/>
+<unit id="org.eclipse.virgo.util.osgi.manifest" version="3.6.0.RELEASE"/>
+<unit id="javax.xml.rpc" version="1.1.0.v201005080400"/>
+<unit id="ch.qos.logback.classic" version="1.0.9"/>
+<unit id="org.springframework.security.core" version="3.1.3.RELEASE"/>
+<unit id="javax.el" version="2.2.0.v201108011116"/>
+<unit id="org.apache.juli.extras" version="7.0.32.v201211081135"/>
+<unit id="org.jboss.spec.javax.transaction.jboss-transaction-api_1.1_spec" version="1.0.1.Final"/>
+<unit id="org.apache.catalina.tribes" version="7.0.32.v201211201952"/>
+<unit id="org.eclipse.virgo.util.parser.manifest" version="3.6.0.RELEASE"/>
+<unit id="org.apache.felix.dependencymanager" version="3.1.0"/>
+<repository location="http://nexus.opendaylight.org/content/repositories/controllerp2site/"/>
+</location>
+</locations>
+</target>
diff --git a/main/pom.xml b/main/pom.xml
new file mode 100644 (file)
index 0000000..14a8d4a
--- /dev/null
@@ -0,0 +1,747 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.opendaylight.toolkit</groupId>
+    <artifactId>common</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>../common</relativePath>
+  </parent>
+
+  <artifactId>main</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+
+  <properties>
+    <!-- Maven Compiler Plugin Version -->
+    <compiler.version>3.1</compiler.version>
+    <!-- Java Versions -->
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
+    <!-- ODL repository / plugin repository -->
+    <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <virgo.version>3.6.0.RELEASE</virgo.version>
+    <slf4j.version>1.7.2</slf4j.version>
+    <logback.version>1.0.9</logback.version>
+    <jersey.version>1.17</jersey.version>
+    <surefire.version>2.15</surefire.version>
+    <checkstyle.version>2.10</checkstyle.version>
+    <enforcer.version>1.3.1</enforcer.version>
+    <commons.lang.version>3.1</commons.lang.version>
+    <spring-security.version>3.1.3.RELEASE</spring-security.version>
+    <spring.version>3.1.3.RELEASE</spring.version>
+    <spring.current.version>4.0.2.RELEASE</spring.current.version>
+  </properties>
+
+  <dependencies>
+    <!-- OpenDaylight Toolkit -->
+    <dependency>
+      <groupId>org.opendaylight.toolkit</groupId>
+      <artifactId>web</artifactId>
+    </dependency>
+
+    <!-- ODL Mirror -->
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>arphandler</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services-implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.test</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>configuration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>configuration.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>appauth</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>forwarding.staticrouting</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>routing.dijkstra_implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>forwardingrulesmanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>forwardingrulesmanager.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>hosttracker</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>hosttracker.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>switchmanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>switchmanager.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>statisticsmanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>statisticsmanager.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>topologymanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>usermanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>usermanager.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>protocol_plugins.openflow</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>logging.bridge</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>security</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.connection</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>connectionmanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>connectionmanager.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.connection.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller.thirdparty</groupId>
+      <artifactId>org.openflow.openflowj</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller.thirdparty</groupId>
+      <artifactId>net.sf.jung2</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller.thirdparty</groupId>
+      <artifactId>com.sun.jersey.jersey-servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller.thirdparty</groupId>
+      <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.networkconfiguration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.networkconfiguration.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb</artifactId>
+    </dependency>
+
+    <!-- ODL Northbound -->
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>commons.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>connectionmanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>controllermanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>flowprogrammer.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>forwarding.staticrouting.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>hosttracker.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>statistics.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>subnets.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>switchmanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>topology.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>usermanager.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>bundlescanner.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>bundlescanner</artifactId>
+    </dependency>
+
+    <!-- enunciate -->
+    <dependency>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
+    </dependency>
+
+    <!-- javax -->
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>javax.servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>javax.servlet.jsp</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.el</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>eclipselink</groupId>
+      <artifactId>javax.resource</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.spec.javax.transaction</groupId>
+      <artifactId>jboss-transaction-api_1.1_spec</artifactId>
+    </dependency>
+
+    <!-- objectweb -->
+    <dependency>
+      <groupId>org.ow2.asm</groupId>
+      <artifactId>asm-all</artifactId>
+    </dependency>
+
+    <!-- equinox + felix -->
+    <dependency>
+      <groupId>org.eclipse.equinox.http</groupId>
+      <artifactId>servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.gogo.command</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.runtime</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.dependencymanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.dependencymanager.shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.console</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.launcher</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.ds</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi.services</artifactId>
+    </dependency>
+
+    <!-- virgomirror -->
+    <dependency>
+      <groupId>virgomirror</groupId>
+      <artifactId>org.eclipse.jdt.core.compiler.batch</artifactId>
+    </dependency>
+
+    <!-- felix -->
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.fileinstall</artifactId>
+    </dependency>
+
+    <!-- Spring Framework -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-websocket</artifactId>
+    </dependency>
+
+    <!-- Spring Framework ODL -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.asm</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.aop</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.context</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.context.support</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.beans</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.expression</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.aopalliance</groupId>
+      <artifactId>com.springsource.org.aopalliance</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.web.servlet</artifactId>
+    </dependency>
+
+    <!-- Spring security -->
+    <dependency>
+      <groupId>org.springframework.security</groupId>
+      <artifactId>spring-security-config</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.security</groupId>
+      <artifactId>spring-security-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.security</groupId>
+      <artifactId>spring-security-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.security</groupId>
+      <artifactId>spring-security-taglibs</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.transaction</artifactId>
+    </dependency>
+
+    <!-- slf4j -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>log4j-over-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+    </dependency>
+
+    <!-- apache -->
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+
+    <!-- logback -->
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+
+    <!-- Jersey for JAXRS -->
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency>
+
+    <!-- JUnit -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- Web -->
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.servlet.jsp.jstl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.servlet.jsp.jstl.impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-base</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-json-provider</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.module</groupId>
+      <artifactId>jackson-module-jaxb-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>org.apache.catalina</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.annotation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.ejb</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.xml.rpc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.mail.glassfish</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>javax.activation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>eclipselink</groupId>
+      <artifactId>javax.persistence</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>org.apache.coyote</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>org.apache.juli.extras</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>org.apache.tomcat.api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>org.apache.tomcat.util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>org.apache.jasper</artifactId>
+    </dependency>
+    <!-- Gemini Web -->
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.gemini.web.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.gemini.web.extender</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.gemini.web.tomcat</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.virgo.kernel.equinox.extensions</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.virgo.util.common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.virgo.util.io</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.virgo.util.math</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.virgo.util.osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.virgo.util.osgi.manifest</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>geminiweb</groupId>
+      <artifactId>org.eclipse.virgo.util.parser.manifest</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>orbit</groupId>
+      <artifactId>org.apache.el</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+
+    <!--Netty-->
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-handler</artifactId>
+      </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-codec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-buffer</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-transport</artifactId>
+    </dependency>
+      <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-codec-http</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <id>distro-assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <descriptors>
+                <descriptor>src/assemble/bin.xml</descriptor>
+              </descriptors>
+              <finalName>${project.artifactId}</finalName>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+        <configuration>
+          <systemProperties>
+            <property>
+              <name>logback.configurationFile</name>
+              <value>logback.xml</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+      <!--
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${checkstyle.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>0.0.3-SNAPSHOT</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <phase>process-sources</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <failsOnError>true</failsOnError>
+          <configLocation>controller/checkstyle.xml</configLocation>
+          <consoleOutput>true</consoleOutput>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+          <sourceDirectory>${project.basedir}</sourceDirectory>
+          <includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</includes>
+          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/</excludes>
+        </configuration>
+      </plugin>
+      -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>${enforcer.version}</version>
+        <executions>
+          <execution>
+            <id>enforce-java</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireJavaVersion>
+                  <version>1.7.0</version>
+                </requireJavaVersion>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>${compiler.version}</version>
+          <configuration>
+            <source>${maven.compiler.source}</source>
+            <target>${maven.compiler.target}</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/main/src/assemble/bin.xml b/main/src/assemble/bin.xml
new file mode 100644 (file)
index 0000000..f371417
--- /dev/null
@@ -0,0 +1,86 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+  <id>osgipackage</id>
+  <formats>
+    <format>zip</format>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>opendaylight/plugins</outputDirectory>
+      <excludes>
+        <exclude>equinoxSDK381:org.eclipse.osgi</exclude>
+        <exclude>equinoxSDK381:org.eclipse.equinox.console</exclude>
+        <exclude>equinoxSDK381:org.eclipse.equinox.launcher</exclude>
+        <exclude>equinoxSDK381:org.eclipse.equinox.ds</exclude>
+        <exclude>equinoxSDK381:org.eclipse.equinox.util</exclude>
+        <exclude>equinoxSDK381:org.eclipse.osgi.services</exclude>
+        <exclude>virgomirror:org.eclipse.jdt.core.compiler.batch</exclude>
+        <exclude>org.apache.felix:org.apache.felix.fileinstall</exclude>
+        <exclude>geminiweb:org.eclipse.virgo.kernel.equinox.extensions</exclude>
+        <exclude>org.slf4j:slf4j-api</exclude>
+        <exclude>ch.qos.logback:logback-core</exclude>
+        <exclude>ch.qos.logback:logback-classic</exclude>
+        <exclude>com.sun.jersey:jersey-core</exclude>
+        <exclude>com.sun.jersey:jersey-server</exclude>
+        <exclude>org.opendaylight.controller:logging.bridge</exclude>
+      </excludes>
+      <outputFileNameMapping>
+        ${artifact.groupId}.${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}
+      </outputFileNameMapping>
+      <unpack>false</unpack>
+      <scope>runtime</scope>
+      <useTransitiveDependencies>false</useTransitiveDependencies>
+      <useProjectArtifact>false</useProjectArtifact>
+    </dependencySet>
+    <dependencySet>
+      <outputDirectory>opendaylight/lib</outputDirectory>
+      <includes>
+        <include>equinoxSDK381:org.eclipse.osgi</include>
+        <include>equinoxSDK381:org.eclipse.equinox.console</include>
+        <include>equinoxSDK381:org.eclipse.equinox.launcher</include>
+        <include>equinoxSDK381:org.eclipse.equinox.ds</include>
+        <include>equinoxSDK381:org.eclipse.equinox.util</include>
+        <include>equinoxSDK381:org.eclipse.osgi.services</include>
+        <include>virgomirror:org.eclipse.jdt.core.compiler.batch</include>
+        <include>org.apache.felix:org.apache.felix.fileinstall</include>
+        <include>geminiweb:org.eclipse.virgo.kernel.equinox.extensions</include>
+        <include>org.slf4j:slf4j-api</include>
+        <include>ch.qos.logback:logback-core</include>
+        <include>ch.qos.logback:logback-classic</include>
+        <include>com.sun.jersey:jersey-core</include>
+        <include>com.sun.jersey:jersey-server</include>
+        <include>org.opendaylight.controller:logging.bridge</include>
+      </includes>
+      <outputFileNameMapping>
+        ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}
+      </outputFileNameMapping>
+      <unpack>false</unpack>
+      <scope>runtime</scope>
+      <useTransitiveDependencies>false</useTransitiveDependencies>
+      <useProjectArtifact>false</useProjectArtifact>
+    </dependencySet>
+  </dependencySets>
+  <fileSets>
+    <fileSet>
+      <directory>
+        src/main/resources/
+      </directory>
+      <excludes>
+        <exclude>version.properties</exclude>
+      </excludes>
+      <outputDirectory>
+        opendaylight/
+      </outputDirectory>
+    </fileSet>
+  </fileSets>
+  <files>
+    <file>
+      <source>src/main/resources/version.properties</source>
+      <outputDirectory>opendaylight</outputDirectory>
+      <filtered>true</filtered>
+    </file>
+  </files>
+</assembly>
diff --git a/main/src/main/resources/configuration/RSA.pk b/main/src/main/resources/configuration/RSA.pk
new file mode 100644 (file)
index 0000000..c0266c7
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAuC9hbEacpewvylI0mwFwjy3Wou2hpr/ncN9BBiFDSaG5yW2k
+3Oy+SCAcFCL+ZKWb6cc6Ch4gUeCwyEHRojZguuhliKtak9YQf6qbvpPLe00842Lx
+iqNAGurMpzizCDsGFq8ChaAkBZQI3TvcHuPoSUWSMJ+K8xHpRyUdVr6g2yEjezKJ
+sTXBtWaeCCh6YUafFujuDJk7fvYcPW7Je5KRBBStIKvxcMW0zB+7eq04deTHwGbJ
+gGjKWilQ72hsDDP3Hbp5CJMAYg1r4GlCmFx3KyHRGztgWgNgaD7nNpKCkTLjtmA6
+b4x7TA+jrzZ6Af2z5TMrI4dv5w1SrxHaZ+ziLQIDAQABAoIBAHTndeGgq/rQf8De
+Do+4CTaHtK0zQSAyu/azbXUzlZ7drKuCEVs8VMY4wzmwwGEnkF+A2YDkgEUX5X0l
+8aYQ97KKoS9u+43MGCrAIhyDeGrpqlT1TzRcy+qJz53v6gq2U/X/3QztiQ+VV078
+mIluxNgE9XYxPaNsYfGLSCTv1+9c8y/hjGVX2kwFK+u4ut0ZZETggNa8UxfaHVDS
+fIJQX9Gm3J3GSUV30fDGMBIUW6ESLc2L8b7u8Mp9TRP39ZeQSuEUjBe8MYKv0Rel
+oEpjZvcnniMTpFbLpndBYn7/AoIiEBvtCN8faVTuRRcvvLcsRm09IctzKQYnMh6M
+6PLKV+ECgYEA8HFRYaKHUzxpzE/fyon82GQbzqFFY0/bbWrfWICMfNbIgshJUie6
+FmH5iUFMfeqaT7v557HFM0GB9FeIeSbvd88YmiBAcRopZ3DfMkDH+DT73yJ+/TKG
+2nrQtdhyuTIs4bwHqeS2BBJYs7PK9R2rratF3l34Tf7mjlvyOgygHdUCgYEAxBo2
+8hEBlAVNcNb1hTYUxe1w1B6675/mFlmw98Xmj9dRYfICXNhahs8tX3/lsBEd+vBu
+fI0oyHaff8m5bPgGzD1ZMybfeROujNrgxaKVk7Ef0FDRRCop4bm18OroFlFAt9l8
+wMp++ToACbdvQvL/mjWMPYlIxhB/YxHswICZZvkCgYAexxKYwdo6sGAGlC7cWT9x
+X5cjowcjyEQZRHXkeUgCbufpvcOM7aLnXJE5nY8yCwbHsBM0MlBA2GDPKylAANjk
+aDEJAZneIHAuWodngl1Wi0m2bU7+ECqs6s2uiU9eH2sZVh1RBQK7kLGkBx6ys6KX
+L3ZZGYRAT6GplWFzRsx0JQKBgCeVlxPD5QqpC1nEumi6YvUVGdpnnZpzL3HBhxxs
+wT612wKnZFyze4qM1X7ahVXGDsQxtkvD/sCAWW/lG13orw6ZL6FIroF1PJ3ILOkY
+CZN3hJF7TtKwpCWhZB2OfWzL2AGEkE8mUP0j/Q/5DCd6f6f0OSvOw3bfq6cm3iB5
+lP2ZAoGAXsRN5TZTX4AQ2xTlrDQ8A5XgcvyWQpJOmEXMTyHV7VaJVzmNWFVAvndK
+5UIq8ALDwB2t7vjmMUW6euvIwqtXiop7G79UOb3e3NhzeyWFGQyBLqCRznGaXQTT
+dlFy73xhukZMhFnj006bjKCYvOPnwuGl3+0fuWil5Rq3jOuY5c8=
+-----END RSA PRIVATE KEY-----
diff --git a/main/src/main/resources/configuration/config.ini b/main/src/main/resources/configuration/config.ini
new file mode 100644 (file)
index 0000000..8ff8204
--- /dev/null
@@ -0,0 +1,116 @@
+osgi.bundles=\
+    reference\:file\:../lib/org.apache.felix.fileinstall-3.1.6.jar@1:start,\
+    reference\:file\:../lib/org.eclipse.jdt.core.compiler.batch-3.8.0.I20120518-2145.jar@1:start,\
+    reference\:file\:../lib/org.eclipse.equinox.ds-1.4.0.v20120522-1841.jar@2:start,\
+    reference\:file\:../lib/org.eclipse.equinox.util-1.0.400.v20120522-2049.jar@2:start,\
+    reference\:file\:../lib/org.eclipse.osgi.services-3.3.100.v20120522-1822@2:start,\
+    reference\:file\:../lib/org.eclipse.equinox.console-1.0.0.v20120522-1841.jar@start,\
+    reference\:file\:../lib/slf4j-api-1.7.2.jar@1:start,\
+    reference\:file\:../lib/logback-classic-1.0.9.jar@1:start,\
+    reference\:file\:../lib/logback-core-1.0.9.jar@1:start,\
+    reference\:file\:../lib/logging.bridge-0.4.1-SNAPSHOT@1:start,\
+    reference\:file\:../lib/jersey-core-1.17.jar@2:start,\
+    reference\:file\:../lib/jersey-server-1.17.jar@2:start
+
+# Set Default start level for framework
+osgi.bundles.defaultStartLevel=4
+# Extra packages to import from the boot class loader
+org.osgi.framework.system.packages.extra=sun.reflect,sun.reflect.misc,sun.misc
+# This is not Eclipse App
+eclipse.ignoreApp=true
+# Don't shutdown equinox if the eclipse App has ended,
+# which is our case because we are not running any eclipse application
+osgi.noShutdown=true
+# Clean any cached data on restart of the framework
+osgi.clean=true
+# Extend the framework to avoid the resources to be presented with
+# a URL of type bundleresource: but to be presented as file:
+osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator
+# Directory from where the fileinstall will monitor for new bundles
+felix.fileinstall.dir=./plugins
+# Immediately learn new bundles at startup
+felix.fileinstall.noInitialDelay=true
+# Auto start the bundles at level 4
+felix.fileinstall.start.level=4
+# Avoid to auto-install following bundles, that means those need
+# to be started manually or in other way like osgi.bundles
+felix.fileinstall.filter=^(?!org.apache.felix.fileinstall).*
+
+# logback configuration
+logback.configurationFile=configuration/logback.xml
+
+# Container configuration
+container.profile = Container
+
+# Connection manager configuration
+connection.scheme = ANY_CONTROLLER_ONE_MASTER
+
+# Embedded Tomcat configuration File
+org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml
+org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
+
+# Open Flow related system parameters
+# TCP port on which the controller is listening (default 6633)
+# of.listenPort=6633
+# IP address of the controller (default: wild card)
+# of.address = 127.0.0.1
+# The time (in milliseconds) the controller will wait for a response after sending a Barrier Request or a Statistic Request message (default 2000 msec)
+# of.messageResponseTimer=2000
+# The switch liveness timeout value (default 60500 msec)
+# of.switchLivenessTimeout=60500
+# The size of the queue holding pending statistics requests (default 64). For large networks of n switches, it is recommended to set the queue size to n
+# of.statsQueueSize = 64
+# The flow statistics polling interval in second (default 10 sec)
+# of.flowStatsPollInterval=10
+# The port statistics polling interval in second (default 5 sec)
+# of.portStatsPollInterval=5
+# The description statistics polling interval in second (default 60 sec)
+# of.descStatsPollInterval=60
+# The table statistics polling interval in second (default 10 sec)
+# of.tableStatsPollInterval=10
+# The maximum number of asynchronous messages can be sent before sending a Barrier Request (default 100)
+# of.barrierMessagePriorCount=100
+# The interval which determines how often the discovery packets should be sent (default 300 sec)
+# of.discoveryInterval=300
+# The timeout multiple of discovery interval
+# of.discoveryTimeoutMultiple=2
+# For newly added ports, allow one more retry if the elapsed time exceeds this threshold (default 30 sec)
+# of.discoveryThreshold=30
+# The maximum number of ports handled in one discovery batch (default 512)
+# of.discoveryBatchMaxPorts=512
+
+# OVSDB configuration
+# ovsdb plugin supports both active and passive connections. It listens on port 6640 by default for Active connections.
+ovsdb.listenPort=6640
+
+# ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version.
+# default Openflow version = 1.0, we also support 1.3.
+# ovsdb.of.version=1.3
+
+# TLS configuration
+# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files.
+# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate
+# entries, including switches' Certification Authority (CA) certificates. For example,
+# secureChannelEnabled=true
+# controllerKeyStore=./configuration/ctlKeyStore
+# controllerKeyStorePassword=xxxxxxxx (this password should match the password used for KeyStore generation and at least 6 characters)
+# controllerTrustStore=./configuration/ctlTrustStore
+# controllerTrustStorePassword=xxxxxxxx (this password should match the password used for TrustStore generation and at least 6 characters)
+
+secureChannelEnabled=false
+controllerKeyStore=
+controllerKeyStorePassword=
+controllerTrustStore=
+controllerTrustStorePassword=
+
+# User Manager configurations
+enableStrongPasswordCheck = false
+
+#Jolokia configurations
+org.jolokia.listenForHttpService=false
+
+# Logging configuration for Tomcat-JUL logging
+java.util.logging.config.file=configuration/tomcat-logging.properties
+
+#Hosttracker hostsdb key scheme setting
+hosttracker.keyscheme=IP
diff --git a/main/src/main/resources/configuration/context.xml b/main/src/main/resources/configuration/context.xml
new file mode 100644 (file)
index 0000000..90b9ddf
--- /dev/null
@@ -0,0 +1 @@
+<Context crossContext="true" sessionCookiePath="/" useHttpOnly="false"/>
diff --git a/main/src/main/resources/configuration/logback.xml b/main/src/main/resources/configuration/logback.xml
new file mode 100644 (file)
index 0000000..b326d89
--- /dev/null
@@ -0,0 +1,83 @@
+ <configuration scan="true">
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
+    </encoder>
+  </appender>
+  <appender name="opendaylight.log" class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>logs/opendaylight.log</file>
+
+    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+      <fileNamePattern>logs/opendaylight.%d.log.zip</fileNamePattern>
+      <maxHistory>1</maxHistory>
+    </rollingPolicy>
+
+    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>10MB</maxFileSize>
+    </triggeringPolicy>
+
+    <encoder>
+      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{35} - %msg%n</pattern>
+    </encoder>
+  </appender>
+  <appender name="audit-file" class="ch.qos.logback.core.FileAppender">
+        <file>logs/audit.log</file>
+        <append>true</append>
+        <encoder>
+            <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} %msg %n</pattern>
+        </encoder>
+  </appender>
+  <root level="error">
+    <appender-ref ref="STDOUT" />
+    <appender-ref ref="opendaylight.log" />
+  </root>
+
+  <!--  Base log level  -->
+  <logger name="org.opendaylight" level="INFO"/>
+
+
+  <!-- Controller log level -->
+  <logger name="org.opendaylight.controller" level="INFO"/>
+
+  <!-- OSGi logging bridge -->
+  <logger name="org.opendaylight.controller.logging.bridge" level="WARN"/>
+  <logger name="org.opendaylight.controller.logging.bridge.internal" level="WARN"/>
+
+  <!-- Netty -->
+  <logger name="io.netty" level="WARN"/>
+
+  <!-- Openflow Protocol Plugin -->
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.internal.DiscoveryService" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.internal.InventoryService" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.internal.InventoryServiceShim" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.internal.TopologyServices" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.internal.TopologyServiceShim" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.core.internal.Controller" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.core.internal.SwitchHandler" level="INFO"/>
+  <logger name="org.opendaylight.controller.protocol_plugin.openflow.core.internal.SwitchIOSecureService" level="INFO"/>
+  <!-- SAL  -->
+  <logger name="org.opendaylight.controller.sal" level="INFO"/>
+  <logger name="org.opendaylight.controller.sal.implementation" level="INFO"/>
+  <logger name="org.opendaylight.controller.sal.implementation.internal.Inventory" level="INFO"/>
+  <logger name="org.opendaylight.controller.sal.implementation.internal.Topology" level="INFO"/>
+     <!-- remoterpc router and remoterpc routing table -->
+  <logger name="org.opendaylight.controller.sal.connector.remoterpc" level="INFO" />
+  <!-- Functional Modules -->
+  <logger name="org.opendaylight.controller.arphandler" level="INFO"/>
+  <logger name="org.opendaylight.controller.hosttracker" level="INFO"/>
+  <logger name="org.opendaylight.controller.routing" level="INFO"/>
+  <logger name="org.opendaylight.controller.forwardingrulesmanager" level="INFO"/>
+  <logger name="org.opendaylight.controller.forwarding.ipswitch" level="INFO"/>
+  <logger name="org.opendaylight.controller.switchmanager" level="INFO"/>
+  <logger name="org.opendaylight.controller.topologymanager" level="INFO"/>
+  <logger name="org.opendaylight.controller.usermanager" level="INFO"/>
+  <!-- Web modules -->
+  <logger name="org.opendaylight.controller.web" level="INFO"/>
+
+  <!-- additivity=false ensures analytics data only goes to the analytics log -->
+  <logger name="audit" level="INFO" additivity="false">
+       <appender-ref ref="audit-file"/>
+  </logger>
+</configuration>
diff --git a/main/src/main/resources/configuration/startup/README b/main/src/main/resources/configuration/startup/README
new file mode 100644 (file)
index 0000000..2da70ff
--- /dev/null
@@ -0,0 +1 @@
+Directory where the opendaylight controller modules store their configuration files
diff --git a/main/src/main/resources/configuration/tomcat-logging.properties b/main/src/main/resources/configuration/tomcat-logging.properties
new file mode 100644 (file)
index 0000000..3dbd992
--- /dev/null
@@ -0,0 +1,42 @@
+############################################################
+# Configuration file for tomcat logging
+############################################################
+# Handlers:
+# "handlers" specifies a comma separated list of log Handler
+# classes.  These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# Following line configures a ConsoleHandler and a FileHandler
+
+handlers= java.util.logging.FileHandler,java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties
+# Describes specific configuration info for Handlers
+# JUL does not support rolling file handler based on date
+# For now we will keep count of files to 5 with rolling size of 10MB
+############################################################
+
+java.util.logging.FileHandler.pattern = logs/tomcat%g.log
+java.util.logging.FileHandler.limit = 104857600
+java.util.logging.FileHandler.count = 5
+java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
+java.util.logging.FileHandler.append = true
+java.util.logging.FileHandler.level = INFO
+
+# Limit the message that are printed on the console to SEVERE and above.
+java.util.logging.ConsoleHandler.level = WARNING
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# SimpleFormatter output format to print one-line log message like this:
+# <YYYY>-<MM>-<DD> <HH>:<MM>:<SS> <TimeZone> [<SOURCE>] ><LOG_LEVEL> <LOGGER> <MESSAGE> <THROWABLE>
+#
+java.util.logging.SimpleFormatter.format=%1$tF %1$tT %1$tZ [%3$s] %4$s %2$s %5$s%6$s%n
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages
+#org.apache.catalina = SEVERE
diff --git a/main/src/main/resources/configuration/tomcat-server.xml b/main/src/main/resources/configuration/tomcat-server.xml
new file mode 100644 (file)
index 0000000..56d469b
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Server>
+  <!--APR library loader. Documentation at /docs/apr.html -->
+  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
+  <Listener className="org.apache.catalina.core.JasperListener" />
+  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
+  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+  <Service name="Catalina">
+    <Connector port="8080" protocol="HTTP/1.1"
+               connectionTimeout="20000"
+               redirectPort="8443" />
+
+<!--
+        Please remove the comments around the following Connector tag to enable HTTPS Authentication support.
+        Remember to add a valid keystore in the configuration folder.
+        More info : http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration
+-->
+
+ <!--
+    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
+               maxThreads="150" scheme="https" secure="true"
+               clientAuth="false" sslProtocol="TLS"
+               keystoreFile="configuration/keystore"
+               keystorePass="changeit"/>
+ -->
+
+    <Engine name="Catalina" defaultHost="localhost">
+      <Host name="localhost" appBase=""
+            unpackWARs="false" autoDeploy="false"
+            deployOnStartup="false" createDirs="false">
+        <Realm className="org.opendaylight.controller.security.ControllerCustomRealm" />
+            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+                        prefix="web_access_log_" suffix=".txt" resolveHosts="false"
+                        rotatable="true" fileDateFormat="yyyy-MM"
+                        pattern="%{yyyy-MM-dd HH:mm:ss.SSS z}t - [%a] - %r"/>
+
+      </Host>
+    </Engine>
+  </Service>
+</Server>
diff --git a/main/src/main/resources/run.sh b/main/src/main/resources/run.sh
new file mode 100755 (executable)
index 0000000..64f2c87
--- /dev/null
@@ -0,0 +1,244 @@
+#!/bin/bash
+
+platform='unknown'
+unamestr=`uname`
+if [[ "$unamestr" == 'Linux' ]]; then
+   platform='linux'
+elif [[ "$unamestr" == 'Darwin' ]]; then
+   platform='osx'
+fi
+
+if [[ $platform == 'linux' ]]; then
+   fullpath=`readlink -f $0`
+
+   if [[ -z ${JAVA_HOME} ]]; then
+      # Find the actual location of the Java launcher:
+      java_launcher=`which java`
+      java_launcher=`readlink -f "${java_launcher}"`
+
+      # Compute the Java home from the location of the Java launcher:
+      export JAVA_HOME="${java_launcher%/bin/java}"
+    fi
+elif [[ $platform == 'osx' ]]; then
+   TARGET_FILE=$0
+   cd `dirname "$TARGET_FILE"`
+   TARGET_FILE=`basename $TARGET_FILE`
+
+   # Iterate down a (possible) chain of symlinks
+   while [ -L "$TARGET_FILE" ]
+   do
+       TARGET_FILE=`readlink "$TARGET_FILE"`
+       cd `dirname "$TARGET_FILE"`
+       TARGET_FILE=`basename "$TARGET_FILE"`
+   done
+
+   # Compute the canonicalized name by finding the physical path
+   # for the directory we're in and appending the target file.
+   PHYS_DIR=`pwd -P`
+   RESULT=$PHYS_DIR/$TARGET_FILE
+   fullpath=$RESULT
+
+   [[ -z ${JAVA_HOME} ]] && [[ -x "/usr/libexec/java_home" ]] && export JAVA_HOME=`/usr/libexec/java_home -v 1.7`;
+
+fi
+
+[[ -z ${JAVA_HOME} ]] && echo "Need to set JAVA_HOME environment variable" && exit -1;
+[[ ! -x ${JAVA_HOME}/bin/java ]] && echo "Cannot find an executable \
+JVM at path ${JAVA_HOME}/bin/java check your JAVA_HOME" && exit -1;
+
+if [ -z ${ODL_BASEDIR} ]; then
+    basedir=`dirname "${fullpath}"`
+else
+    basedir=${ODL_BASEDIR}
+fi
+
+if [ -z ${ODL_DATADIR} ]; then
+    datadir=`dirname "${fullpath}"`
+else
+    datadir=${ODL_DATADIR}
+fi
+
+function usage {
+    echo "Usage: $0 [-jmx] [-jmxport <num>] [-debug] [-debugsuspend] [-debugport <num>] [-start [<console port>]] [-stop] [-status] [-console] [-help] [-agentpath:<path to lib>] [<other args will automatically be used for the JVM>]"
+    exit 1
+}
+
+if [ -z ${TMP} ]; then
+    pidfile="/tmp/opendaylight.PID"
+else
+    pidfile="${TMP}/opendaylight.PID"
+fi
+debug=0
+debugsuspend=0
+debugport=8000
+debugportread=""
+startdaemon=0
+daemonport=2400
+daemonportread=""
+jmxport=1088
+jmxportread=""
+startjmx=0
+stopdaemon=0
+statusdaemon=0
+consolestart=1
+dohelp=0
+extraJVMOpts=""
+agentPath=""
+unknown_option=0
+while true ; do
+    case "$1" in
+        -debug) debug=1; shift ;;
+        -jmx) startjmx=1; shift ;;
+        -debugsuspend) debugsuspend=1; shift ;;
+        -debugport) shift; debugportread="$1"; if [[ "${debugportread}" =~ ^[0-9]+$ ]] ; then debugport=${debugportread}; shift; else echo "-debugport expects a number but was not found"; exit -1; fi;;
+        -jmxport) shift; jmxportread="$1"; if [[ "${jmxportread}" =~ ^[0-9]+$ ]] ; then jmxport=${jmxportread}; shift; else echo "-jmxport expects a number but was not found"; exit -1; fi;;
+        -start) startdaemon=1; shift; daemonportread="$1"; if [[ "${daemonportread}" =~ ^[0-9]+$ ]] ; then daemonport=${daemonportread}; shift; fi;;
+        -stop) stopdaemon=1; shift ;;
+        -status) statusdaemon=1; shift ;;
+        -console) shift ;;
+        -help) dohelp=1; shift;;
+        -D*) extraJVMOpts="${extraJVMOpts} $1"; shift;;
+        -X*) extraJVMOpts="${extraJVMOpts} $1"; shift;;
+        -agentpath:*) agentPath="$1"; shift;;
+        "") break ;;
+        *) echo "Unknown option $1"; unknown_option=1; shift ;;
+    esac
+done
+
+# Unknown Options and help
+if [ "${unknown_option}" -eq 1 ]; then
+    usage
+fi
+
+if [ "${dohelp}" -eq 1 ]; then
+    usage
+fi
+
+# Validate debug port
+if [[ "${debugport}" -lt 1024 ]] || [[ "${debugport}" -gt 65535 ]]; then
+    echo "Debug Port not in the range [1024,65535] ${debugport}"
+    exit -1
+fi
+
+# Validate daemon console port
+if [[ "${daemonport}" -lt 1024 ]] || [[ "${daemonport}" -gt 65535 ]]; then
+    echo "Daemon console Port not in the range [1024,65535] value is ${daemonport}"
+    exit -1
+fi
+
+# Validate jmx port
+if [[ "${jmxport}" -lt 1024 ]] || [[ "${jmxport}" -gt 65535 ]]; then
+    echo "JMX Port not in the range [1024,65535] value is ${jmxport}"
+    exit -1
+fi
+
+# Debug options
+if [ "${debugsuspend}" -eq 1 ]; then
+    extraJVMOpts="${extraJVMOpts} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debugport}"
+elif [ "${debug}" -eq 1 ]; then
+    extraJVMOpts="${extraJVMOpts} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${debugport}"
+fi
+
+# Add JMX support
+if [ "${startjmx}" -eq 1 ]; then
+    extraJVMOpts="${extraJVMOpts} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=${jmxport} -Dcom.sun.management.jmxremote"
+fi
+
+########################################
+# Now add to classpath the OSGi JAR
+########################################
+CLASSPATH="${basedir}"/lib/org.eclipse.osgi-3.8.1.v20120830-144521.jar
+FWCLASSPATH=file:"${basedir}"/lib/org.eclipse.osgi-3.8.1.v20120830-144521.jar
+
+########################################
+# Now add the extensions
+########################################
+
+# Extension 1: this is used to be able to convert all the
+# bundleresouce: URL in file: so packages that are not OSGi ready can
+# still work. Notably this is the case for spring classes
+CLASSPATH=${CLASSPATH}:${basedir}/lib/org.eclipse.virgo.kernel.equinox.extensions-3.6.0.RELEASE.jar
+FWCLASSPATH=${FWCLASSPATH},file:${basedir}/lib/org.eclipse.virgo.kernel.equinox.extensions-3.6.0.RELEASE.jar
+
+########################################
+# Now add the launcher
+########################################
+CLASSPATH=${CLASSPATH}:${basedir}/lib/org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar
+FWCLASSPATH=${FWCLASSPATH},file:${basedir}/lib/org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar
+
+cd $basedir
+
+if [ "${stopdaemon}" -eq 1 ]; then
+    if [ -e "${pidfile}" ]; then
+        daemonpid=`cat "${pidfile}"`
+        kill "${daemonpid}"
+        rm -f "${pidfile}"
+        echo "Controller with PID: ${daemonpid} -- Stopped!"
+        exit 0
+    else
+        echo "Doesn't seem any Controller daemon is currently running"
+        exit -1
+    fi
+fi
+
+if [ "${statusdaemon}" -eq 1 ]; then
+    if [ -e "${pidfile}" ]; then
+        daemonpid=`cat "${pidfile}"`
+        ps -p ${daemonpid} > /dev/null
+        daemonexists=$?
+        if [ "${daemonexists}" -eq 0 ]; then
+            echo "Controller with PID: ${daemonpid} -- Running!"
+            exit 0
+        else
+            echo "Controller with PID: ${daemonpid} -- Doesn't seem to exist"
+            rm -f "${pidfile}"
+            exit 1
+        fi
+    else
+        echo "Doesn't seem any Controller daemon is currently running, at least no PID file has been found"
+        exit -1
+    fi
+fi
+
+iotmpdir=`echo "${datadir}" | sed 's/ /\\ /g'`
+bdir=`echo "${basedir}" | sed 's/ /\\ /g'`
+confarea=`echo "${datadir}" | sed 's/ /\\ /g'`
+fwclasspath=`echo "${FWCLASSPATH}" | sed 's/ /\\ /g'`
+
+if [ "${startdaemon}" -eq 1 ]; then
+    if [ -e "${pidfile}" ]; then
+        echo "Another instance of controller running, check with $0 -status"
+        exit -1
+    fi
+    $JAVA_HOME/bin/java ${extraJVMOpts} \
+        ${agentPath} \
+        -Djava.io.tmpdir="${iotmpdir}/work/tmp" \
+        -Dosgi.install.area="${bdir}" \
+        -Dosgi.configuration.area="${confarea}/configuration" \
+        -Dosgi.frameworkClassPath="${fwclasspath}" \
+        -Dosgi.framework=file:"${bdir}/lib/org.eclipse.osgi-3.8.1.v20120830-144521.jar" \
+        -Djava.awt.headless=true \
+        -classpath "${CLASSPATH}" \
+        org.eclipse.equinox.launcher.Main \
+        -console ${daemonport} \
+        -consoleLog &
+    daemonpid=$!
+    echo ${daemonpid} > ${pidfile}
+elif [ "${consolestart}" -eq 1 ]; then
+    if [ -e "${pidfile}" ]; then
+        echo "Another instance of controller running, check with $0 -status"
+        exit -1
+    fi
+    $JAVA_HOME/bin/java ${extraJVMOpts} \
+        ${agentPath} \
+        -Djava.io.tmpdir="${iotmpdir}/work/tmp" \
+        -Dosgi.install.area="${bdir}" \
+        -Dosgi.configuration.area="${confarea}/configuration" \
+        -Dosgi.frameworkClassPath="${fwclasspath}" \
+        -Dosgi.framework=file:"${bdir}/lib/org.eclipse.osgi-3.8.1.v20120830-144521.jar" \
+        -Djava.awt.headless=true \
+        -classpath "${CLASSPATH}" \
+        org.eclipse.equinox.launcher.Main \
+        -console \
+        -consoleLog
+fi
diff --git a/main/src/main/resources/version.properties b/main/src/main/resources/version.properties
new file mode 100644 (file)
index 0000000..90af49d
--- /dev/null
@@ -0,0 +1,6 @@
+org.opendaylight.controller.version = 0.1
+org.opendaylight.controller.build.scm.version = ${buildNumber}
+org.opendaylight.controller.build.user = ${env.USER}
+org.opendaylight.controller.build.workspace = **********
+org.opendaylight.controller.build.timestamp = ${timestamp}
+org.opendaylight.controller.build.machine = **********
diff --git a/main/templates/app-archetype-device-template/pom.xml b/main/templates/app-archetype-device-template/pom.xml
new file mode 100644 (file)
index 0000000..78a1f2e
--- /dev/null
@@ -0,0 +1,113 @@
+<?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>
+    <groupId>org.opendaylight.phoenix</groupId>
+    <artifactId>common</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>../common</relativePath>
+  </parent>
+
+  <artifactId>device</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <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>
+              org.opendaylight.phoenix.web,
+              org.opendaylight.controller.sal.authorization,
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.utils,
+              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,
+              org.osgi.framework,
+              org.slf4j,
+              org.springframework.beans,
+              org.springframework.beans.factory.xml,
+              org.springframework.context.config,
+              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.filter,
+              org.springframework.web.context,
+
+              org.opendaylight.controller.northbound.commons,
+              com.sun.jersey.spi.container.servlet,
+              com.fasterxml.jackson.annotation,
+              javax.ws.rs,
+              javax.ws.rs.core,
+              javax.xml.bind,
+              javax.xml.bind.annotation,
+              org.apache.catalina.filters,
+              com.fasterxml.jackson.jaxrs.base,
+              com.fasterxml.jackson.jaxrs.json,
+              !org.codehaus.enunciate.jaxrs
+            </Import-Package>
+            <Export-Package>
+            </Export-Package>
+            <Web-ContextPath>/device</Web-ContextPath>
+            <Jaxrs-Resources>,${classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.phoenix</groupId>
+      <artifactId>web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>commons.northbound</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/main/templates/app-archetype-device-template/src/main/java/org/opendaylight/phoenix/app/northbound/AppNorthbound.java b/main/templates/app-archetype-device-template/src/main/java/org/opendaylight/phoenix/app/northbound/AppNorthbound.java
new file mode 100644 (file)
index 0000000..d6acc00
--- /dev/null
@@ -0,0 +1,67 @@
+package org.opendaylight.phoenix.app.northbound;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ *
+ * This entire web class can be accessed via /northbound prefix as specified in
+ * web.xml
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+@Path("/")
+public class AppNorthbound {
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     *
+     * Sample REST API call
+     *
+     * @return A response string
+     *
+     * <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/app/northbound/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - app";
+        return result;
+    }
+}
diff --git a/main/templates/app-archetype-device-template/src/main/java/org/opendaylight/phoenix/app/web/AppWeb.java b/main/templates/app-archetype-device-template/src/main/java/org/opendaylight/phoenix/app/web/AppWeb.java
new file mode 100644 (file)
index 0000000..e3b5a5f
--- /dev/null
@@ -0,0 +1,58 @@
+package org.opendaylight.phoenix.app.web;
+
+import javax.servlet.http.HttpServletRequest;
+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.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * This entire web class can be accessed via /web prefix as specified in web.xml
+ */
+@Controller
+@RequestMapping("/")
+public class AppWeb implements IDaylightWeb {
+    private static final String WEB_NAME = "Devices App";
+    private static final String WEB_ID = "device";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public AppWeb() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/templates/app-archetype-device-template/src/main/resources/META-INF/spring.factories b/main/templates/app-archetype-device-template/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/templates/app-archetype-device-template/src/main/resources/META-INF/spring.handlers b/main/templates/app-archetype-device-template/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/templates/app-archetype-device-template/src/main/resources/META-INF/spring.schemas b/main/templates/app-archetype-device-template/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/templates/app-archetype-device-template/src/main/resources/META-INF/spring.tooling b/main/templates/app-archetype-device-template/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/templates/app-archetype-device-template/src/main/resources/WEB-INF/AppWeb-servlet.xml b/main/templates/app-archetype-device-template/src/main/resources/WEB-INF/AppWeb-servlet.xml
new file mode 100644 (file)
index 0000000..51006c4
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="org.opendaylight.phoenix.app"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/templates/app-archetype-device-template/src/main/resources/WEB-INF/jsp/main.jsp b/main/templates/app-archetype-device-template/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..1adf0cb
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>App</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <!-- style -->
+    <link rel="stylesheet" href="/css/ext/pure/pure.css"/>
+    <link rel="stylesheet" href="/css/phoenix.css"/>
+
+    <!-- style app -->
+
+    <!-- scripts -->
+    <script data-main="/device/js/main" src="/js/ext/requirejs/require.js"></script>
+  </head>
+  <body>
+    <div id="main"></div>
+  </body>
+</html>
diff --git a/main/templates/app-archetype-device-template/src/main/resources/WEB-INF/web.xml b/main/templates/app-archetype-device-template/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..0d7d3b4
--- /dev/null
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+
+  <security-constraint>
+    <display-name>App</display-name>
+    <web-resource-collection>
+      <web-resource-name>AppWeb</web-resource-name>
+      <url-pattern>/web/js/*</url-pattern>
+      <url-pattern>/web/images/*</url-pattern>
+      <url-pattern>/web/css/*</url-pattern>
+      <url-pattern>/web/favicon.ico</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>App</web-resource-name>
+      <url-pattern>/*</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>AppNorthbound</web-resource-name>
+      <url-pattern>/northbound/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <!-- <login-config> // enabling this auto directs to login page, considering removing this
+    <auth-method>FORM</auth-method>
+    <form-login-config>
+      <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+      <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+    </form-login-config>
+  </login-config>-->
+  
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+
+  <!-- <error-page>
+    <error-code>403</error-code>
+    <location>/WEB-INF/jsp/autherror.jsp</location>
+  </error-page> -->
+
+  <!-- web -->
+  <servlet>
+    <servlet-name>AppWeb</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppWeb</servlet-name>
+    <url-pattern>/web/*</url-pattern>
+  </servlet-mapping>
+  
+  <listener>
+    <listener-class>org.opendaylight.phoenix.web.ControllerUISessionManager</listener-class>
+  </listener>
+
+  <!-- <session-config> // needs further testing
+    <cookie-config>
+      <path>/</path>
+    </cookie-config>
+  </session-config>-->
+  
+  <!-- northbound -->
+  <servlet>
+    <servlet-name>AppNorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppNorthbound</servlet-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </filter-mapping>
+
+</web-app>
diff --git a/main/templates/app-archetype-device-template/src/main/resources/app/js b/main/templates/app-archetype-device-template/src/main/resources/app/js
new file mode 120000 (symlink)
index 0000000..f1cfafe
--- /dev/null
@@ -0,0 +1 @@
+../js/
\ No newline at end of file
diff --git a/main/templates/app-archetype-device-template/src/main/resources/dev/css b/main/templates/app-archetype-device-template/src/main/resources/dev/css
new file mode 120000 (symlink)
index 0000000..a88749e
--- /dev/null
@@ -0,0 +1 @@
+../../../../../../../web/src/main/resources/css
\ No newline at end of file
diff --git a/main/templates/app-archetype-device-template/src/main/resources/dev/dev.sh b/main/templates/app-archetype-device-template/src/main/resources/dev/dev.sh
new file mode 100755 (executable)
index 0000000..82cd901
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+node node/server.js
diff --git a/main/templates/app-archetype-device-template/src/main/resources/dev/device/js b/main/templates/app-archetype-device-template/src/main/resources/dev/device/js
new file mode 120000 (symlink)
index 0000000..4696177
--- /dev/null
@@ -0,0 +1 @@
+../../js
\ No newline at end of file
diff --git a/main/templates/app-archetype-device-template/src/main/resources/dev/img b/main/templates/app-archetype-device-template/src/main/resources/dev/img
new file mode 120000 (symlink)
index 0000000..527c25a
--- /dev/null
@@ -0,0 +1 @@
+../../../../../../../web/src/main/resources/img
\ No newline at end of file
diff --git a/main/templates/app-archetype-device-template/src/main/resources/dev/index.html b/main/templates/app-archetype-device-template/src/main/resources/dev/index.html
new file mode 120000 (symlink)
index 0000000..58fadc4
--- /dev/null
@@ -0,0 +1 @@
+../WEB-INF/jsp/main.jsp
\ No newline at end of file
diff --git a/main/templates/app-archetype-device-template/src/main/resources/dev/js b/main/templates/app-archetype-device-template/src/main/resources/dev/js
new file mode 120000 (symlink)
index 0000000..1af2d6b
--- /dev/null
@@ -0,0 +1 @@
+../../../../../../../web/src/main/resources/js
\ No newline at end of file
diff --git a/main/templates/app-archetype-device-template/src/main/resources/dev/node b/main/templates/app-archetype-device-template/src/main/resources/dev/node
new file mode 120000 (symlink)
index 0000000..a71b917
--- /dev/null
@@ -0,0 +1 @@
+../../../../../../../web/src/main/resources/node
\ No newline at end of file
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/app.js b/main/templates/app-archetype-device-template/src/main/resources/js/app.js
new file mode 100644 (file)
index 0000000..cb06b37
--- /dev/null
@@ -0,0 +1,17 @@
+// Filename: app.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',                                    // lib/jquery/jquery
+  'underscore',                                // lib/underscore/underscore
+  'backbone',                                  // lib/backbone/backbone
+  '/device/js/views/DeviceView.js'     // app
+], function($, _, Backbone, DeviceView){
+  var initialize = function() {
+    var deviceView = new DeviceView(); // this calls initialize which in turn calls render
+  }
+
+  return {
+    initialize : initialize
+  };
+});
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/collections/DevicePropertiesCollection.js b/main/templates/app-archetype-device-template/src/main/resources/js/collections/DevicePropertiesCollection.js
new file mode 100644 (file)
index 0000000..6370a1c
--- /dev/null
@@ -0,0 +1,4 @@
+define(['backbone','underscore'], function(Backbone, _) {
+       var DevicePropertiesCollection = Backbone.Collection.extend();
+       return DevicePropertiesCollection;
+});
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/collections/DevicesCollection.js b/main/templates/app-archetype-device-template/src/main/resources/js/collections/DevicesCollection.js
new file mode 100644 (file)
index 0000000..6e853c5
--- /dev/null
@@ -0,0 +1,6 @@
+define(['backbone','underscore','/device/js/models/DeviceModel.js'], function(Backbone, _, DeviceModel) {
+       var DevicesCollection = Backbone.Collection.extend({
+               model: DeviceModel
+       });
+       return DevicesCollection;
+});
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/main.js b/main/templates/app-archetype-device-template/src/main/resources/js/main.js
new file mode 100644 (file)
index 0000000..fece933
--- /dev/null
@@ -0,0 +1,18 @@
+// Filename: main.js
+
+require.config({
+  paths: {
+    "jquery": "/js/ext/jquery/dist/jquery.min",
+    "underscore": "/js/ext/underscore/underscore",
+    "backbone": "/js/ext/backbone/backbone",
+    "models": "/device/js/models",                     // app
+    "views": "/device/js/views",                               // app
+    "collections": "/device/js/collections"    // app
+  }
+});
+require([
+  'app', '/js/phoenix.js'
+], function(App, Phoenix) {
+  new App.initialize();
+  new Phoenix.initialize();
+});
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/models/DeviceModel.js b/main/templates/app-archetype-device-template/src/main/resources/js/models/DeviceModel.js
new file mode 100644 (file)
index 0000000..f9b2e29
--- /dev/null
@@ -0,0 +1,11 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+    var DeviceModel = Backbone.Model.extend({
+        defaults: {
+               name: "New device"
+        },
+        initialize: function() {
+               console.log("initialize of DeviceModel called");
+        }
+       });
+       return DeviceModel;
+});
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/templates/device.html b/main/templates/app-archetype-device-template/src/main/resources/js/templates/device.html
new file mode 100644 (file)
index 0000000..f93f251
--- /dev/null
@@ -0,0 +1,28 @@
+<script type="text/template" id="devicescontainer">
+<div id="deviceDiv" style="margin-left:20px; float: left;">
+    <h3>Devices</h3>
+    <table class="pure-table pure-table-bordered">
+    <thead>
+        <tr>
+        <th>Node ID</th>
+        <th>Type</th>
+        <th>Properties</th>
+        </tr>
+    </thead>
+    <tbody>
+    <% _.each(devices, function(device) { %>
+        <tr data-nodeType="<%= device.node.type%>" data-nodeId="<%= device.node.id%>" style="cursor:pointer;">
+            <td><%= device.node.id %></td>
+            <td><%= device.node.type %></td>
+            <td>
+                <div>Mac Address: <%= device.properties.macAddress.value %></div>
+                <div>Description: <%= device.properties.description.value %></div>
+                <div>Mac Address: <%= device.properties.macAddress.value %></div>
+            </td>
+        </tr>
+    <% }); %>
+    </tbody>
+    </table>
+
+</div>
+</script>
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/templates/deviceProperties.html b/main/templates/app-archetype-device-template/src/main/resources/js/templates/deviceProperties.html
new file mode 100644 (file)
index 0000000..2a8e536
--- /dev/null
@@ -0,0 +1,33 @@
+<script type="text/template">
+<div id="deviceProperties" style="float: left; margin-left: 20px;">
+       <h3>Device Properties - <%=nodeId %></h3>
+       <table class="pure-table pure-table-bordered">
+               <thead>
+                       <tr>
+                               <th>Property Name</th>
+                               <th>Property Value</th>
+                       </tr>
+               </thead>
+               <tbody>
+                       <% _.each(deviceProps, function(prop) { %>
+                               <tr>
+                                       <td>Bandwidth</td>
+                                       <td><%= prop.properties.bandwidth ? prop.properties.bandwidth.value : '' %></td>
+                               </tr>
+                               <tr>
+                                       <td>config</td>
+                                       <td><%= prop.properties.config.value%></td>
+                               </tr>
+                               <tr>
+                                       <td>name</td>
+                                       <td><%= prop.properties.name.value%></td>
+                               </tr>
+                               <tr>
+                                       <td>state</td>
+                                       <td><%= prop.properties.state.value%></td>
+                               </tr>
+                       <% }); %>
+               </tbody>
+       </table>
+</div>
+</script>
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/views/DevicePropertiesView.js b/main/templates/app-archetype-device-template/src/main/resources/js/views/DevicePropertiesView.js
new file mode 100644 (file)
index 0000000..d29b2b1
--- /dev/null
@@ -0,0 +1,30 @@
+define(
+    [
+        'jquery',
+        'backbone',
+        'underscore',
+        '/device/js/collections/DevicePropertiesCollection.js',
+        '/js/ext/text/text.js!/device/js/templates/deviceProperties.html'
+    ], function($, Backbone, _, DevicePropertiesCollection, DevicePropertiesTemplate) {
+
+    var DevicePropertiesView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+            console.log("initialize of DevicePropertiesView called");
+        },
+        render: function() {
+            var self = this;
+            $(self.el).find("#deviceProperties").remove();
+            this.collection = new DevicePropertiesCollection();
+            this.collection.url = "/controller/nb/v2/switchmanager/default/node/OF/" + self.nodeId;
+            this.collection.fetch({success: function(coll, response) {
+                var compiledTemplate = _.template(DevicePropertiesTemplate, {
+                    deviceProps: response.nodeConnectorProperties,
+                    nodeId: self.nodeId
+                });
+                $(self.el).append($(compiledTemplate).html());
+            }});
+        }
+    }); // DevicePropertiesView extend ends here
+    return DevicePropertiesView;
+});
diff --git a/main/templates/app-archetype-device-template/src/main/resources/js/views/DeviceView.js b/main/templates/app-archetype-device-template/src/main/resources/js/views/DeviceView.js
new file mode 100644 (file)
index 0000000..eb67b31
--- /dev/null
@@ -0,0 +1,41 @@
+define(
+           [
+               'jquery',
+               'backbone',
+               'underscore',
+               '/device/js/collections/DevicesCollection.js',
+               '/device/js/models/DeviceModel.js',
+               '/device/js/views/DevicePropertiesView.js',
+               '/js/ext/text/text.js!/device/js/templates/device.html'
+           ], function($, Backbone, _, DevicesCollection, DeviceModel, DevicePropertiesView, DeviceTemplate) {
+           var DeviceView = Backbone.View.extend({
+               el: $("#main"),
+               initialize: function() {
+                   var self = this;
+                   this.collection = new DevicesCollection();
+                   this.collection.url = "/controller/nb/v2/switchmanager/default/nodes";
+                   this.collection.fetch({
+                       success: function(coll, response) {
+                           console.log("passed collection call to get devices", response);
+                           self.render();
+                       }
+                   });
+               },
+               render: function() {
+                   console.log("DevicesView initialize called");
+                   var that = this;
+                   var compiledTemplate = _.template(DeviceTemplate, {devices: that.collection.models[0].get('nodeProperties')});
+                   $(this.el).append($(compiledTemplate).html());
+               },
+               events: {
+                   "click tr": "getNodeProperties"
+               },
+               getNodeProperties: function(evt) {
+                   var $tr = $(evt.currentTarget);
+                   var devicePropsView = new DevicePropertiesView();
+                   devicePropsView.nodeId = $tr.attr("data-nodeId");
+                   devicePropsView.render();
+               }
+           });
+           return DeviceView;
+       });
diff --git a/main/templates/app-archetype-northbound-template/pom.xml b/main/templates/app-archetype-northbound-template/pom.xml
new file mode 100644 (file)
index 0000000..dc31307
--- /dev/null
@@ -0,0 +1,62 @@
+<?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>
+    <groupId>org.opendaylight.phoenix</groupId>
+    <artifactId>common</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>../common</relativePath>
+  </parent>
+
+  <artifactId>northbound</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <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>
+            <Export-Package></Export-Package>
+            <Import-Package>org.opendaylight.controller.northbound.commons,
+              com.sun.jersey.spi.container.servlet,
+              com.fasterxml.jackson.annotation,
+              javax.ws.rs,
+              javax.ws.rs.core,
+              javax.xml.bind,
+              javax.xml.bind.annotation,
+              org.slf4j,
+              org.apache.catalina.filters,
+              com.fasterxml.jackson.jaxrs.base,
+              com.fasterxml.jackson.jaxrs.json,
+              !org.codehaus.enunciate.jaxrs</Import-Package>
+            <Web-ContextPath>/northbound/northbound</Web-ContextPath>
+            <Jaxrs-Resources>,${classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>commons.northbound</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/main/templates/app-archetype-northbound-template/src/main/java/org/opendaylight/phoenix/northbound/Northbound.java b/main/templates/app-archetype-northbound-template/src/main/java/org/opendaylight/phoenix/northbound/Northbound.java
new file mode 100644 (file)
index 0000000..c2c5bd4
--- /dev/null
@@ -0,0 +1,67 @@
+package org.opendaylight.phoenix.northbound;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ * 
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+
+@Path("/")
+public class Northbound {
+
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     * 
+     * Sample REST API call
+     * 
+     * @return A response string
+     * 
+     *         <pre>
+     * Example:
+     * 
+     * Request URL:
+     * http://localhost:8080/northbound/northbound/api
+     * 
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     * 
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - northbound";
+        return result;
+    }
+
+}
diff --git a/main/templates/app-archetype-northbound-template/src/main/resources/WEB-INF/web.xml b/main/templates/app-archetype-northbound-template/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..4998f88
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+  <servlet>
+    <servlet-name>JAXRSnorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>JAXRSnorthbound</servlet-name>
+    <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <security-constraint>
+    <web-resource-collection>
+      <web-resource-name>northbound</web-resource-name>
+      <url-pattern>/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+</web-app>
diff --git a/main/templates/app-archetype-template/pom.xml b/main/templates/app-archetype-template/pom.xml
new file mode 100644 (file)
index 0000000..d02b620
--- /dev/null
@@ -0,0 +1,113 @@
+<?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>
+    <groupId>org.opendaylight.phoenix</groupId>
+    <artifactId>common</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>../common</relativePath>
+  </parent>
+
+  <artifactId>app</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <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>
+              org.opendaylight.phoenix.web,
+              org.opendaylight.controller.sal.authorization,
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.utils,
+              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,
+              org.osgi.framework,
+              org.slf4j,
+              org.springframework.beans,
+              org.springframework.beans.factory.xml,
+              org.springframework.context.config,
+              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.filter,
+              org.springframework.web.context,
+
+              org.opendaylight.controller.northbound.commons,
+              com.sun.jersey.spi.container.servlet,
+              com.fasterxml.jackson.annotation,
+              javax.ws.rs,
+              javax.ws.rs.core,
+              javax.xml.bind,
+              javax.xml.bind.annotation,
+              org.apache.catalina.filters,
+              com.fasterxml.jackson.jaxrs.base,
+              com.fasterxml.jackson.jaxrs.json,
+              !org.codehaus.enunciate.jaxrs
+            </Import-Package>
+            <Export-Package>
+            </Export-Package>
+            <Web-ContextPath>/app</Web-ContextPath>
+            <Jaxrs-Resources>,${classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory> <!-- TODO use pom var -->
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.phoenix</groupId>
+      <artifactId>web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>commons.northbound</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/main/templates/app-archetype-template/src/main/java/org/opendaylight/phoenix/app/northbound/AppNorthbound.java b/main/templates/app-archetype-template/src/main/java/org/opendaylight/phoenix/app/northbound/AppNorthbound.java
new file mode 100644 (file)
index 0000000..d6acc00
--- /dev/null
@@ -0,0 +1,67 @@
+package org.opendaylight.phoenix.app.northbound;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+
+/**
+ * Northbound REST API
+ *
+ * This entire web class can be accessed via /northbound prefix as specified in
+ * web.xml
+ *
+ * <br>
+ * <br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default.
+ */
+@Path("/")
+public class AppNorthbound {
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        if (context != null && context.getUserPrincipal() != null) {
+            username = context.getUserPrincipal().getName();
+        }
+    }
+
+    /**
+     *
+     * Sample REST API call
+     *
+     * @return A response string
+     *
+     * <pre>
+     * Example:
+     *
+     * Request URL:
+     * http://localhost:8080/app/northbound/api
+     *
+     * Response body in XML:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * Sample Northbound API
+     *
+     * Response body in JSON:
+     * Sample Northbound API
+     * </pre>
+     */
+    @Path("/api")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(String.class)
+    @StatusCodes()
+    public String getWidget() {
+        String result = "Sample Northbound API - app";
+        return result;
+    }
+}
diff --git a/main/templates/app-archetype-template/src/main/java/org/opendaylight/phoenix/app/web/AppWeb.java b/main/templates/app-archetype-template/src/main/java/org/opendaylight/phoenix/app/web/AppWeb.java
new file mode 100644 (file)
index 0000000..7281d26
--- /dev/null
@@ -0,0 +1,58 @@
+package org.opendaylight.phoenix.app.web;
+
+import javax.servlet.http.HttpServletRequest;
+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.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * This entire web class can be accessed via /web prefix as specified in web.xml
+ */
+@Controller
+@RequestMapping("/")
+public class AppWeb implements IDaylightWeb {
+    private static final String WEB_NAME = "App";
+    private static final String WEB_ID = "app";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public AppWeb() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "/main")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/templates/app-archetype-template/src/main/resources/META-INF/spring.factories b/main/templates/app-archetype-template/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/templates/app-archetype-template/src/main/resources/META-INF/spring.handlers b/main/templates/app-archetype-template/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/templates/app-archetype-template/src/main/resources/META-INF/spring.schemas b/main/templates/app-archetype-template/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/templates/app-archetype-template/src/main/resources/META-INF/spring.tooling b/main/templates/app-archetype-template/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/templates/app-archetype-template/src/main/resources/WEB-INF/AppWeb-servlet.xml b/main/templates/app-archetype-template/src/main/resources/WEB-INF/AppWeb-servlet.xml
new file mode 100644 (file)
index 0000000..51006c4
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="org.opendaylight.phoenix.app"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/templates/app-archetype-template/src/main/resources/WEB-INF/jsp/main.jsp b/main/templates/app-archetype-template/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..32421bd
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>App</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <!-- style -->
+    <!-- <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"/> -->
+    <link rel="stylesheet" href="/css/ext/pure/pure.css"/>
+    <link rel="stylesheet" href="/css/global.css"/>
+    <link rel="stylesheet" href="/css/header.css"/>
+    <link rel="stylesheet" href="/css/menu.css"/>
+    <link rel="stylesheet" href="/css/core.css"/>
+
+    <!-- scripts -->
+    <script data-main="/app/js/main" src="/js/ext/requirejs/require.js"></script>
+  </head>
+  <body>
+    <h3>App</h3>
+    <div id="main"></div>
+  </body>
+</html>
diff --git a/main/templates/app-archetype-template/src/main/resources/WEB-INF/web.xml b/main/templates/app-archetype-template/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..0d7d3b4
--- /dev/null
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+
+  <security-constraint>
+    <display-name>App</display-name>
+    <web-resource-collection>
+      <web-resource-name>AppWeb</web-resource-name>
+      <url-pattern>/web/js/*</url-pattern>
+      <url-pattern>/web/images/*</url-pattern>
+      <url-pattern>/web/css/*</url-pattern>
+      <url-pattern>/web/favicon.ico</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>App</web-resource-name>
+      <url-pattern>/*</url-pattern>
+    </web-resource-collection>
+    <web-resource-collection>
+      <web-resource-name>AppNorthbound</web-resource-name>
+      <url-pattern>/northbound/*</url-pattern>
+      <http-method>POST</http-method>
+      <http-method>GET</http-method>
+      <http-method>PUT</http-method>
+      <http-method>PATCH</http-method>
+      <http-method>DELETE</http-method>
+      <http-method>HEAD</http-method>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>System-Admin</role-name>
+      <role-name>Network-Admin</role-name>
+      <role-name>Network-Operator</role-name>
+      <role-name>Container-User</role-name>
+    </auth-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>System-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Network-Operator</role-name>
+  </security-role>
+  <security-role>
+    <role-name>Container-User</role-name>
+  </security-role>
+
+  <!-- <login-config> // enabling this auto directs to login page, considering removing this
+    <auth-method>FORM</auth-method>
+    <form-login-config>
+      <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+      <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+    </form-login-config>
+  </login-config>-->
+  
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>opendaylight</realm-name>
+  </login-config>
+
+  <!-- <error-page>
+    <error-code>403</error-code>
+    <location>/WEB-INF/jsp/autherror.jsp</location>
+  </error-page> -->
+
+  <!-- web -->
+  <servlet>
+    <servlet-name>AppWeb</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppWeb</servlet-name>
+    <url-pattern>/web/*</url-pattern>
+  </servlet-mapping>
+  
+  <listener>
+    <listener-class>org.opendaylight.phoenix.web.ControllerUISessionManager</listener-class>
+  </listener>
+
+  <!-- <session-config> // needs further testing
+    <cookie-config>
+      <path>/</path>
+    </cookie-config>
+  </session-config>-->
+  
+  <!-- northbound -->
+  <servlet>
+    <servlet-name>AppNorthbound</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AppNorthbound</servlet-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </servlet-mapping>
+
+  <filter>
+    <filter-name>CorsFilter</filter-name>
+    <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+    <init-param>
+      <param-name>cors.allowed.origins</param-name>
+      <param-value>*</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.methods</param-name>
+      <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.allowed.headers</param-name>
+      <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.exposed.headers</param-name>
+      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.support.credentials</param-name>
+      <param-value>true</param-value>
+    </init-param>
+    <init-param>
+      <param-name>cors.preflight.maxage</param-name>
+      <param-value>10</param-value>
+    </init-param>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>CorsFilter</filter-name>
+    <url-pattern>/northbound/*</url-pattern>
+  </filter-mapping>
+
+</web-app>
diff --git a/main/templates/app-archetype-template/src/main/resources/app/js b/main/templates/app-archetype-template/src/main/resources/app/js
new file mode 120000 (symlink)
index 0000000..f1cfafe
--- /dev/null
@@ -0,0 +1 @@
+../js/
\ No newline at end of file
diff --git a/main/templates/app-archetype-template/src/main/resources/js/app.js b/main/templates/app-archetype-template/src/main/resources/js/app.js
new file mode 100644 (file)
index 0000000..2bf36b6
--- /dev/null
@@ -0,0 +1,46 @@
+// Filename: app.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',                                    // lib/jquery/jquery
+  'underscore',                                // lib/underscore/underscore
+  'backbone',                                  // lib/backbone/backbone
+  '/app/js/views/DeviceView.js'        // app
+], function($, _, Backbone, DeviceView){
+  var initialize = function() {
+    console.log('init');
+    // load apps into menu
+    $.getJSON('/web.json', function(apps) {
+      console.log(apps);
+      $.each(apps, function(key, app) {
+        var $li = $(document.createElement('li'));
+        var $a = $(document.createElement('a'));
+        $a.append(app.name).attr('href', '#');
+        //$a.attr('href', '/'+key);
+        $a.click(function() {
+          $(this).closest('ul').find('li').removeClass('pure-menu-selected');
+          $(this).closest('li').addClass('pure-menu-selected');
+          $('#main').load('/'+key);
+        });
+        $li.append($a);
+
+        $('#menu ul').append($li);
+      });
+    });
+    $('#main').text('OpenDaylight Phoenix App');
+    $('#menu .pure-menu-selected').click(function() {
+      $(this).closest('ul').find('li').removeClass('pure-menu-selected');
+      $(this).closest('li').addClass('pure-menu-selected');
+      $('#main').empty();
+      $('#main').text('OpenDaylight Phoenix');
+    });
+
+    // test backbone
+    new DeviceView().render();
+  }
+
+  return {
+    initialize : initialize
+  };
+});
+
diff --git a/main/templates/app-archetype-template/src/main/resources/js/collections/DevicesCollection.js b/main/templates/app-archetype-template/src/main/resources/js/collections/DevicesCollection.js
new file mode 100644 (file)
index 0000000..30d3316
--- /dev/null
@@ -0,0 +1,6 @@
+define(['backbone','underscore','/app/js/models/DeviceModel.js'], function(Backbone, _, DeviceModel) {
+       var DevicesCollection = Backbone.Collection.extend({
+               model: DeviceModel
+       });
+       return DevicesCollection;
+});
diff --git a/main/templates/app-archetype-template/src/main/resources/js/main.js b/main/templates/app-archetype-template/src/main/resources/js/main.js
new file mode 100644 (file)
index 0000000..6543d5c
--- /dev/null
@@ -0,0 +1,17 @@
+// Filename: main.js
+
+require.config({
+  paths: {
+    "jquery": "/js/ext/jquery/dist/jquery.min",
+    "underscore": "/js/ext/underscore/underscore",
+    "backbone": "/js/ext/backbone/backbone",
+    "models": "/app/js/models",                        // app
+    "views": "/app/js/views",                          // app
+    "collections": "/app/js/collections"       // app
+  }
+});
+require([
+  'app'
+], function(App) {
+  new App.initialize();
+});
diff --git a/main/templates/app-archetype-template/src/main/resources/js/models/DeviceModel.js b/main/templates/app-archetype-template/src/main/resources/js/models/DeviceModel.js
new file mode 100644 (file)
index 0000000..f9b2e29
--- /dev/null
@@ -0,0 +1,11 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+    var DeviceModel = Backbone.Model.extend({
+        defaults: {
+               name: "New device"
+        },
+        initialize: function() {
+               console.log("initialize of DeviceModel called");
+        }
+       });
+       return DeviceModel;
+});
diff --git a/main/templates/app-archetype-template/src/main/resources/js/templates/device.html b/main/templates/app-archetype-template/src/main/resources/js/templates/device.html
new file mode 100644 (file)
index 0000000..110ca60
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<div id="devicecontainer">
+       <p>App</p>
+    <div>
+        <label>Name: </label> <label><%=device_name%></label>
+    </div>
+    <div>
+        <label>IP Address: </label> <label><%=device_ip%></label>
+    </div>
+</div>
diff --git a/main/templates/app-archetype-template/src/main/resources/js/views/DeviceView.js b/main/templates/app-archetype-template/src/main/resources/js/views/DeviceView.js
new file mode 100644 (file)
index 0000000..99377b6
--- /dev/null
@@ -0,0 +1,30 @@
+define(
+    [
+        'jquery',
+        'backbone',
+        'underscore',
+        '/app/js/collections/DevicesCollection.js',
+        '/app/js/models/DeviceModel.js',
+        '/js/ext/text/text.js!/app/js/templates/device.html'
+    ], function($, Backbone, _, DevicesCollection, DeviceModel, DeviceTemplate) {
+
+    var DeviceView = Backbone.View.extend({
+        el: $("#main"),
+        render: function() {
+            console.log("DevicesView initialize called");
+            this.collection = new DevicesCollection();
+            this.deviceModel = new DeviceModel({
+                'name': 'device1',
+                'ipAddress': '1.2.3.4'
+            });
+            this.collection.add(this.deviceModel);
+            var templateVariables = {
+                'device_name': this.deviceModel.get('name'),
+                'device_ip': this.deviceModel.get('ipAddress')
+            };
+            var compiledTemplate = _.template(DeviceTemplate, templateVariables);
+            $(this.el).append(compiledTemplate);
+        }
+    });
+    return DeviceView;
+});
diff --git a/main/templates/app-archetype-template/src/main/resources/node/app/js b/main/templates/app-archetype-template/src/main/resources/node/app/js
new file mode 120000 (symlink)
index 0000000..4696177
--- /dev/null
@@ -0,0 +1 @@
+../../js
\ No newline at end of file
diff --git a/main/templates/app-archetype-template/src/main/resources/node/css b/main/templates/app-archetype-template/src/main/resources/node/css
new file mode 120000 (symlink)
index 0000000..a285af4
--- /dev/null
@@ -0,0 +1 @@
+../../../../../web/src/main/resources/css
\ No newline at end of file
diff --git a/main/templates/app-archetype-template/src/main/resources/node/index.html b/main/templates/app-archetype-template/src/main/resources/node/index.html
new file mode 120000 (symlink)
index 0000000..58fadc4
--- /dev/null
@@ -0,0 +1 @@
+../WEB-INF/jsp/main.jsp
\ No newline at end of file
diff --git a/main/templates/app-archetype-template/src/main/resources/node/js b/main/templates/app-archetype-template/src/main/resources/node/js
new file mode 120000 (symlink)
index 0000000..4910ed7
--- /dev/null
@@ -0,0 +1 @@
+../../../../../web/src/main/resources/js
\ No newline at end of file
diff --git a/main/templates/app-bare-archetype-template/pom.xml b/main/templates/app-bare-archetype-template/pom.xml
new file mode 100644 (file)
index 0000000..7ec3af8
--- /dev/null
@@ -0,0 +1,90 @@
+<?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>
+    <groupId>org.opendaylight.phoenix</groupId>
+    <artifactId>common</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>../common</relativePath>
+  </parent>
+
+  <artifactId>app</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>
+              org.opendaylight.phoenix.web,
+              org.opendaylight.controller.sal.authorization,
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.utils,
+              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,
+              org.osgi.framework,
+              org.slf4j,
+              org.springframework.beans,
+              org.springframework.beans.factory.xml,
+              org.springframework.context.config,
+              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.filter,
+              org.springframework.web.context
+            </Import-Package>
+            <Export-Package>
+            </Export-Package>
+            <Web-ContextPath>/app</Web-ContextPath>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+          <buildDirectory>../main/target/main-osgipackage/opendaylight/plugins/</buildDirectory>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.phoenix</groupId>
+      <artifactId>web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/main/templates/app-bare-archetype-template/src/main/java/org/opendaylight/phoenix/app/App.java b/main/templates/app-bare-archetype-template/src/main/java/org/opendaylight/phoenix/app/App.java
new file mode 100644 (file)
index 0000000..198ae04
--- /dev/null
@@ -0,0 +1,55 @@
+package org.opendaylight.phoenix.app;
+
+import javax.servlet.http.HttpServletRequest;
+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.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("/")
+public class App implements IDaylightWeb {
+    private static final String WEB_NAME = "App";
+    private static final String WEB_ID = "app";
+    private static final short WEB_ORDER = 1;
+    private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
+
+    public App() {
+        ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null);
+    }
+
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        return "main";
+    }
+
+    @Override
+    public String getWebName() {
+        return WEB_NAME;
+    }
+
+    @Override
+    public String getWebId() {
+        return WEB_ID;
+    }
+
+    @Override
+    public short getWebOrder() {
+        return WEB_ORDER;
+    }
+
+    @Override
+    public boolean isAuthorized(UserLevel userLevel) {
+        return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
+    }
+
+    @RequestMapping(value = "login")
+    public String login(final HttpServletRequest request, final HttpServletResponse response) {
+        return "forward:" + "/";
+    }
+
+}
diff --git a/main/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.factories b/main/templates/app-bare-archetype-template/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/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.handlers b/main/templates/app-bare-archetype-template/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/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.schemas b/main/templates/app-bare-archetype-template/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/templates/app-bare-archetype-template/src/main/resources/META-INF/spring.tooling b/main/templates/app-bare-archetype-template/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/templates/app-bare-archetype-template/src/main/resources/WEB-INF/App-servlet.xml b/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/App-servlet.xml
new file mode 100644 (file)
index 0000000..51006c4
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:context="http://www.springframework.org/schema/context"\r
+  xmlns:mvc="http://www.springframework.org/schema/mvc"\r
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\r
+                      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\r
+                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">\r
+\r
+  <context:component-scan base-package="org.opendaylight.phoenix.app"/>\r
+\r
+  <mvc:resources mapping="/js/**" location="/js/" />\r
+  <mvc:resources mapping="/css/**" location="/css/" />\r
+  <mvc:resources mapping="/img/**" location="/img/" />\r
+  <mvc:annotation-driven/>\r
+\r
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">\r
+        <property name="prefix" value="/WEB-INF/jsp/"/>\r
+        <property name="suffix" value=".jsp"/>\r
+  </bean>\r
+</beans>\r
diff --git a/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/autherror.jsp b/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/autherror.jsp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/error.jsp b/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/error.jsp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/login.jsp b/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/login.jsp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/main.jsp b/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..7a0b7f0
--- /dev/null
@@ -0,0 +1 @@
+app
\ No newline at end of file
diff --git a/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/web.xml b/main/templates/app-bare-archetype-template/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..a543f0c
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<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">
+        <security-constraint>
+                <web-resource-collection>
+                        <web-resource-name>free access</web-resource-name>
+                        <url-pattern>/js/*</url-pattern>
+                        <url-pattern>/images/*</url-pattern>
+                        <url-pattern>/css/*</url-pattern>
+                        <url-pattern>/favicon.ico</url-pattern>
+                </web-resource-collection>
+        </security-constraint>
+
+        <security-constraint>
+                <display-name>App</display-name>
+                <web-resource-collection>
+                        <web-resource-name>AppGUI</web-resource-name>
+                        <url-pattern>/*</url-pattern>
+                </web-resource-collection>
+                <auth-constraint>
+                        <role-name>System-Admin</role-name>
+                        <role-name>Network-Admin</role-name>
+                        <role-name>Network-Operator</role-name>
+                        <role-name>Container-User</role-name>
+                </auth-constraint>
+        </security-constraint>
+
+        <security-role>
+                <role-name>System-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Operator</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Container-User</role-name>
+        </security-role>
+
+        <login-config>
+                <auth-method>FORM</auth-method>
+                <form-login-config>
+                        <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+                        <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+                </form-login-config>
+        </login-config>
+
+    <error-page>
+            <error-code>403</error-code>
+            <location>/WEB-INF/jsp/autherror.jsp</location>
+    </error-page>
+
+        <servlet>
+                <servlet-name>App</servlet-name>
+                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+                <load-on-startup>1</load-on-startup>
+        </servlet>
+
+        <servlet-mapping>
+                <servlet-name>App</servlet-name>
+                <url-pattern>/</url-pattern>
+        </servlet-mapping>
+
+        <listener>
+                <listener-class>org.opendaylight.phoenix.web.ControllerUISessionManager</listener-class>
+        </listener>
+        <session-config>
+                <cookie-config>
+                        <path>/</path>
+                </cookie-config>
+        </session-config>
+
+</web-app>
diff --git a/main/templates/app-bare-archetype-template/src/main/resources/js/sample.js b/main/templates/app-bare-archetype-template/src/main/resources/js/sample.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/main/templates/main b/main/templates/main
new file mode 120000 (symlink)
index 0000000..a96aa0e
--- /dev/null
@@ -0,0 +1 @@
+..
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644 (file)
index 0000000..b64afc8
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,36 @@
+<?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>
+
+  <groupId>org.opendaylight.toolkit</groupId>
+  <artifactId>releasepom</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+
+  <name>opendaylight-toolkit</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <releaseplugin.version>2.4.2</releaseplugin.version>
+  </properties>
+
+  <modules>
+    <module>common</module>
+    <module>main</module>
+    <module>web</module>
+  </modules>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-release-plugin</artifactId>
+        <version>${releaseplugin.version}</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/web/.gitignore b/web/.gitignore
new file mode 100644 (file)
index 0000000..e0a59f3
--- /dev/null
@@ -0,0 +1,2 @@
+/target-ide
+/target
diff --git a/web/pom.xml b/web/pom.xml
new file mode 100644 (file)
index 0000000..04b46b6
--- /dev/null
@@ -0,0 +1,149 @@
+<?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>
+    <groupId>org.opendaylight.toolkit</groupId>
+    <artifactId>common</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <relativePath>../common</relativePath>
+  </parent>
+
+  <artifactId>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>
+              org.opendaylight.controller.configuration,
+              org.opendaylight.controller.sal.authorization,
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.utils,
+              org.opendaylight.controller.usermanager,
+              org.opendaylight.controller.containermanager,
+              org.opendaylight.controller.clustering.services,
+              org.opendaylight.controller.connectionmanager,
+              org.opendaylight.controller.switchmanager,
+              com.google.gson,
+              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>
+              org.opendaylight.toolkit.web
+            </Export-Package>
+            <Web-ContextPath>/</Web-ContextPath>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>connectionmanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>configuration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>usermanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>switchmanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>org.springframework.web</artifactId>
+    </dependency>
+    <!--
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-websocket</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-mock</artifactId>
+    </dependency>
+    -->
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>javax.servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/ClusterNodeBean.java b/web/src/main/java/org/opendaylight/toolkit/web/ClusterNodeBean.java
new file mode 100644 (file)
index 0000000..84bcb34
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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.toolkit.web;
+
+import java.net.InetAddress;
+
+/**
+ * Information about a clustered controller to send to the UI frontend
+ * @author andrekim
+ */
+public class ClusterNodeBean {
+    private final byte[] address;
+    private final String name;
+    private final Boolean me;
+    private final Boolean coordinator;
+    private final Integer numConnectedNodes;
+
+    public static class Builder {
+        // required params
+        private final byte[] address;
+        private final String name;
+
+        // optional params
+        private Boolean me = null;
+        private Boolean coordinator = null;
+        private Integer numConnectedNodes = null;
+
+        public Builder(InetAddress address) {
+            this.address = address.getAddress();
+            this.name = address.getHostAddress();
+        }
+
+        public Builder highlightMe() {
+            this.me = true;
+            return this;
+        }
+
+        public Builder iAmCoordinator() {
+            this.coordinator = true;
+            return this;
+        }
+
+        public Builder nodesConnected(int numNodes) {
+            this.numConnectedNodes = numNodes;
+            return this;
+        }
+
+        public ClusterNodeBean build() {
+            return new ClusterNodeBean(this);
+        }
+    }
+
+    private ClusterNodeBean(Builder builder) {
+        this.address = builder.address;
+        this.name = builder.name;
+        this.me = builder.me;
+        this.coordinator = builder.coordinator;
+        this.numConnectedNodes = builder.numConnectedNodes;
+    }
+}
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/ControllerUISessionManager.java b/web/src/main/java/org/opendaylight/toolkit/web/ControllerUISessionManager.java
new file mode 100644 (file)
index 0000000..f4c5cf4
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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 org.opendaylight.toolkit.web;
+
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.usermanager.IUserManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ControllerUISessionManager implements HttpSessionListener {
+
+    private static final Logger logger = LoggerFactory.getLogger(ControllerUISessionManager.class);
+
+    @Override
+    public void sessionCreated(HttpSessionEvent se) {
+        IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this);
+        if (userManager != null) {
+            ((HttpSessionListener) userManager.getSessionManager()).sessionCreated(se);
+        } else {
+            logger.warn("User Manager is currently unavailable. Unable to register UI session.");
+        }
+    }
+
+    @Override
+    public void sessionDestroyed(HttpSessionEvent se) {
+        IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this);
+        if (userManager != null) {
+            ((HttpSessionListener) userManager.getSessionManager()).sessionDestroyed(se);
+        } else {
+            logger.warn("User Manager is currently unavailable. Unable to destroy UI session.");
+        }
+    }
+
+}
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/DaylightWeb.java b/web/src/main/java/org/opendaylight/toolkit/web/DaylightWeb.java
new file mode 100644 (file)
index 0000000..ea75192
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * 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 org.opendaylight.toolkit.web;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.usermanager.IUserManager;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+@RequestMapping("/")
+public class DaylightWeb {
+    @RequestMapping(value = "")
+    public String index(Model model, HttpServletRequest request) {
+        IUserManager userManager = (IUserManager) ServiceHelper
+                .getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return "User Manager is not available";
+        }
+
+        String username = request.getUserPrincipal().getName();
+
+        model.addAttribute("username", username);
+        model.addAttribute("role", userManager.getUserLevel(username)
+                .toNumber());
+
+        return "main";
+    }
+
+    @RequestMapping(value = "web.json")
+    @ResponseBody
+    public Map<String, Map<String, Object>> bundles(HttpServletRequest request) {
+        Object[] instances = ServiceHelper.getGlobalInstances(
+                IDaylightWeb.class, this, null);
+        Map<String, Map<String, Object>> bundles = new HashMap<String, Map<String, Object>>();
+        if (instances == null) {
+            return bundles;
+        }
+        Map<String, Object> entry;
+        IDaylightWeb bundle;
+        String username = request.getUserPrincipal().getName();
+        IUserManager userManger = (IUserManager) ServiceHelper
+                .getGlobalInstance(IUserManager.class, this);
+        for (Object instance : instances) {
+            bundle = (IDaylightWeb) instance;
+            if (userManger != null
+                    && bundle.isAuthorized(userManger.getUserLevel(username))) {
+                entry = new HashMap<String, Object>();
+                entry.put("name", bundle.getWebName());
+                entry.put("order", bundle.getWebOrder());
+                bundles.put(bundle.getWebId(), entry);
+            }
+        }
+        return bundles;
+    }
+
+    @RequestMapping(value = "logout")
+    public String logout(Map<String, Object> model, final HttpServletRequest request) {
+
+        IUserManager userManager = (IUserManager) ServiceHelper
+                .getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return "User Manager is not available";
+        }
+        String username = request.getUserPrincipal().getName();
+        HttpSession session = request.getSession(false);
+        if (session != null) {
+            if (username != null) {
+                userManager.userLogout(username);
+            }
+            session.invalidate();
+
+        }
+        return "redirect:" + "/";
+    }
+
+    @RequestMapping(value = "login")
+    public String login(Model model, final HttpServletRequest request,
+            final HttpServletResponse response) {
+        // response.setHeader("X-Page-Location", "/login");
+        IUserManager userManager = (IUserManager) ServiceHelper
+                .getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return "User Manager is not available";
+        }
+
+        String username = request.getUserPrincipal().getName();
+
+        model.addAttribute("username", username);
+        model.addAttribute("role", userManager.getUserLevel(username)
+                .toNumber());
+        return "forward:" + "/";
+    }
+
+}
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/DaylightWebAdmin.java b/web/src/main/java/org/opendaylight/toolkit/web/DaylightWebAdmin.java
new file mode 100644 (file)
index 0000000..d8c2cc4
--- /dev/null
@@ -0,0 +1,348 @@
+/*
+ * 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 org.opendaylight.toolkit.web;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
+import org.opendaylight.controller.connectionmanager.IConnectionManager;
+import org.opendaylight.controller.sal.authorization.UserLevel;
+import org.opendaylight.controller.sal.core.Description;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.controller.usermanager.IUserManager;
+import org.opendaylight.controller.usermanager.UserConfig;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.google.gson.Gson;
+
+@Controller
+@RequestMapping("/admin")
+public class DaylightWebAdmin {
+    Gson gson = new Gson();
+
+    /**
+     * Returns list of clustered controllers. Highlights "this" controller and
+     * if controller is coordinator
+     *
+     * @return List<ClusterBean>
+     */
+    @RequestMapping("/cluster")
+    @ResponseBody
+    public String getClusteredControllers() {
+        IClusterGlobalServices clusterServices = (IClusterGlobalServices) ServiceHelper.getGlobalInstance(
+                IClusterGlobalServices.class, this);
+        if (clusterServices == null) {
+            return null;
+        }
+        IConnectionManager connectionManager = (IConnectionManager) ServiceHelper.getGlobalInstance(
+                IConnectionManager.class, this);
+        if (connectionManager == null) {
+            return null;
+        }
+
+        List<ClusterNodeBean> clusterNodes = new ArrayList<ClusterNodeBean>();
+
+        List<InetAddress> controllers = clusterServices.getClusteredControllers();
+        for (InetAddress controller : controllers) {
+            ClusterNodeBean.Builder clusterBeanBuilder = new ClusterNodeBean.Builder(controller);
+
+            // get number of connected nodes
+            Set<Node> connectedNodes = connectionManager.getNodes(controller);
+            int numNodes = connectedNodes == null ? 0 : connectedNodes.size();
+            clusterBeanBuilder.nodesConnected(numNodes);
+
+            // determine if this is the executing controller
+            if (controller.equals(clusterServices.getMyAddress())) {
+                clusterBeanBuilder.highlightMe();
+            }
+
+            // determine whether this is coordinator
+            if (clusterServices.getCoordinatorAddress().equals(controller)) {
+                clusterBeanBuilder.iAmCoordinator();
+            }
+            clusterNodes.add(clusterBeanBuilder.build());
+        }
+
+        return gson.toJson(clusterNodes);
+    }
+
+    /**
+     * Return nodes connected to controller {controller}
+     *
+     * @param controller
+     *            - byte[] of the address of the controller
+     * @return List<NodeBean>
+     */
+    @RequestMapping("/cluster/controller/{controller}")
+    @ResponseBody
+    public String getNodesConnectedToController(@PathVariable("controller") String controller) {
+        IClusterGlobalServices clusterServices = (IClusterGlobalServices) ServiceHelper.getGlobalInstance(
+                IClusterGlobalServices.class, this);
+        if (clusterServices == null) {
+            return null;
+        }
+        IConnectionManager connectionManager = (IConnectionManager) ServiceHelper.getGlobalInstance(
+                IConnectionManager.class, this);
+        if (connectionManager == null) {
+            return null;
+        }
+        ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class,
+                GlobalConstants.DEFAULT.toString(), this);
+        if (switchManager == null) {
+            return null;
+        }
+
+        byte[] address = gson.fromJson(controller, byte[].class);
+        InetAddress controllerAddress = null;
+        try {
+            controllerAddress = InetAddress.getByAddress(address);
+        } catch (UnknownHostException e) {
+            return null;
+        }
+
+        List<NodeBean> result = new ArrayList<NodeBean>();
+
+        Set<Node> nodes = connectionManager.getNodes(controllerAddress);
+        if (nodes == null) {
+            return gson.toJson(result);
+        }
+        for (Node node : nodes) {
+            Description description = (Description) switchManager.getNodeProp(node, Description.propertyName);
+            NodeBean nodeBean;
+            if (description == null || description.getValue().equals("None")) {
+                nodeBean = new NodeBean(node);
+            } else {
+                nodeBean = new NodeBean(node, description.getValue());
+            }
+            result.add(nodeBean);
+        }
+
+        return gson.toJson(result);
+    }
+
+    @RequestMapping(value = "/users", method = RequestMethod.GET)
+    @ResponseBody
+    public List<UserBean> getUsers() {
+        IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return null;
+        }
+
+        List<UserBean> result = new ArrayList<UserBean>();
+        List<UserConfig> configs = userManager.getLocalUserList();
+        for (UserConfig config : configs) {
+            UserBean bean = new UserBean(config);
+            result.add(bean);
+        }
+
+        return result;
+    }
+
+    /*
+     * Password in clear text, moving to HTTP/SSL soon
+     */
+    @RequestMapping(value = "/users", method = RequestMethod.POST)
+    @ResponseBody
+    public Status saveLocalUserConfig(@RequestParam(required = true) String json,
+            @RequestParam(required = true) String action, HttpServletRequest request) {
+
+        IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return new Status(StatusCode.NOSERVICE, "User Manager unavailable");
+        }
+
+        if (!authorize(userManager, UserLevel.NETWORKADMIN, request)) {
+            return new Status(StatusCode.UNAUTHORIZED, "Operation not permitted");
+        }
+
+        Gson gson = new Gson();
+        UserConfig plainConfig = gson.fromJson(json, UserConfig.class);
+        // Recreate using the proper constructor which will hash the password
+        UserConfig config = new UserConfig(plainConfig.getUser(), plainConfig.getPassword(), plainConfig.getRoles());
+
+        Status result = (action.equals("add")) ? userManager.addLocalUser(config) : userManager.removeLocalUser(config);
+        if (result.isSuccess()) {
+            if (action.equals("add")) {
+                DaylightWebUtil.auditlog("User", request.getUserPrincipal().getName(), "added", config.getUser()
+                        + " as " + config.getRoles().toString());
+            } else {
+                DaylightWebUtil.auditlog("User", request.getUserPrincipal().getName(), "removed", config.getUser());
+            }
+        }
+        return result;
+    }
+
+    @RequestMapping(value = "/user/modify", method = RequestMethod.POST)
+    @ResponseBody
+    public Status modifyUser(@RequestParam(required = true) String json,
+            @RequestParam(required = true) String action, HttpServletRequest request) {
+
+        IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return new Status(StatusCode.NOSERVICE, "User Manager unavailable");
+        }
+
+        if (!authorize(userManager, UserLevel.NETWORKADMIN, request)) {
+            return new Status(StatusCode.UNAUTHORIZED, "Operation not permitted");
+        }
+
+        UserConfig newConfig = gson.fromJson(json, UserConfig.class);
+        List<UserConfig> currentUserConfig = userManager.getLocalUserList();
+        String password = null;
+        byte[] salt = null;
+        String user = newConfig.getUser();
+        for (UserConfig userConfig : currentUserConfig) {
+            if(userConfig.getUser().equals(user)){
+                password = userConfig.getPassword();
+                salt = userConfig.getSalt();
+                break;
+            }
+        }
+        if (password == null) {
+            String msg = String.format("User %s not found in configuration database", user);
+            return new Status(StatusCode.NOTFOUND, msg);
+        }
+
+        //While modifying a user role, the password is not provided from GUI for any user.
+        //The password is stored in hash mode, hence it cannot be retrieved and added to UserConfig object
+        //The hashed password is injected below to the json string containing username and new roles before
+        //converting to UserConfig object.
+        Gson gson = new Gson();
+        json = json.replace("\"roles\"", "\"salt\":" + gson.toJson(salt, salt.getClass()) + ",\"password\":\""+ password + "\",\"roles\"");
+
+        newConfig = gson.fromJson(json, UserConfig.class);
+
+        Status result = userManager.modifyLocalUser(newConfig);
+        if (result.isSuccess()) {
+            DaylightWebUtil.auditlog("Roles of", request.getUserPrincipal().getName(), "updated", newConfig.getUser()
+                    + " to " + newConfig.getRoles().toString());
+        }
+        return result;
+    }
+
+
+    @RequestMapping(value = "/users/{username}", method = RequestMethod.POST)
+    @ResponseBody
+    public Status removeLocalUser(@PathVariable("username") String userName, HttpServletRequest request) {
+
+        String loggedInUser = request.getUserPrincipal().getName();
+        if (loggedInUser.equals(userName)) {
+            String msg = "Invalid Request: User cannot delete itself";
+            return new Status(StatusCode.NOTALLOWED, msg);
+        }
+
+        IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return new Status(StatusCode.NOSERVICE, "User Manager unavailable");
+        }
+
+        if (!authorize(userManager, UserLevel.NETWORKADMIN, request)) {
+            return new Status(StatusCode.UNAUTHORIZED, "Operation not permitted");
+        }
+
+        Status status = userManager.removeLocalUser(userName);
+        if (status.isSuccess()) {
+            DaylightWebUtil.auditlog("User", request.getUserPrincipal().getName(), "removed", userName);
+            return status;
+        }
+        return status;
+    }
+
+    @RequestMapping(value = "/users/password/{username}", method = RequestMethod.POST)
+    @ResponseBody
+    public Status changePassword(
+            @PathVariable("username") String username, HttpServletRequest request,
+            @RequestParam(value = "currentPassword", required=false) String currentPassword,
+            @RequestParam("newPassword") String newPassword) {
+        IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this);
+        if (userManager == null) {
+            return new Status(StatusCode.NOSERVICE, "User Manager unavailable");
+        }
+
+        Status status;
+        String requestingUser = request.getUserPrincipal().getName();
+
+        //changing own password
+        if (requestingUser.equals(username) ) {
+            status = userManager.changeLocalUserPassword(username, currentPassword, newPassword);
+            //enforce the user to re-login with new password
+            if (status.isSuccess() && !newPassword.equals(currentPassword)) {
+                userManager.userLogout(username);
+                HttpSession session = request.getSession(false);
+                if ( session != null) {
+                    session.invalidate();
+                }
+            }
+
+        //admin level user resetting other's password
+        } else if (authorize(userManager, UserLevel.NETWORKADMIN, request)) {
+
+            //Since User Manager doesn't have an unprotected password change API,
+            //we re-create the user with the new password (and current roles).
+            List<String> roles = userManager.getUserRoles(username);
+            UserConfig newConfig = new UserConfig(username, newPassword, roles);
+
+            //validate before removing existing config, so we don't remove but fail to add
+            status = newConfig.validate();
+            if (!status.isSuccess()) {
+                return status;
+            }
+
+            userManager.userLogout(username);
+            status = userManager.removeLocalUser(username);
+            if (!status.isSuccess()) {
+                return status;
+            }
+            if (userManager.addLocalUser(newConfig).isSuccess()) {
+                status = new Status(StatusCode.SUCCESS, "Password for user " + username + " reset successfully.");
+            } else {
+                //unexpected
+                status = new Status(StatusCode.INTERNALERROR, "Failed resetting password for user " + username + ". User is now removed.");
+            }
+
+        //unauthorized
+        } else {
+            status = new Status(StatusCode.UNAUTHORIZED, "Operation not permitted");
+        }
+
+        if (status.isSuccess()) {
+            DaylightWebUtil.auditlog("User", request.getUserPrincipal().getName(), "changed password for",
+                    username);
+        }
+        return status;
+    }
+
+    /**
+     * Is the operation permitted for the given level
+     *
+     * @param level
+     */
+    private boolean authorize(IUserManager userManager, UserLevel level, HttpServletRequest request) {
+        String username = request.getUserPrincipal().getName();
+        UserLevel userLevel = userManager.getUserLevel(username);
+        return userLevel.toNumber() <= level.toNumber();
+    }
+}
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/DaylightWebUtil.java b/web/src/main/java/org/opendaylight/toolkit/web/DaylightWebUtil.java
new file mode 100644 (file)
index 0000000..1b7a56b
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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.toolkit.web;
+
+import org.opendaylight.controller.containermanager.IContainerAuthorization;
+import org.opendaylight.controller.sal.authorization.Privilege;
+import org.opendaylight.controller.sal.core.Description;
+import org.opendaylight.controller.sal.core.Name;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.controller.usermanager.IUserManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DaylightWebUtil {
+
+    private static final String AUDIT = "audit";
+    private static final Logger logger = LoggerFactory.getLogger(AUDIT);
+
+    /**
+     * Returns the access privilege the user has on the specified container
+     *
+     * @param userName
+     *            The user name
+     * @param container
+     *            The container name. If null, the default container will be assumed
+     * @param bundle
+     *            The bundle originating the request
+     * @return The access privilege the user is granted on the container
+     */
+    public static Privilege getContainerPrivilege(String userName,
+            String container, Object bundle) {
+        // Derive the target resource
+        String resource = (container == null) ? GlobalConstants.DEFAULT.toString() : container;
+
+        // Retrieve the Container Authorization service
+        IContainerAuthorization auth = (IContainerAuthorization) ServiceHelper
+                .getGlobalInstance(IContainerAuthorization.class, bundle);
+        if (auth != null) {
+            return auth.getResourcePrivilege(userName, resource);
+        }
+
+        /*
+         * Container Authorization service not available. We can only derive the
+         * access privilege to the default container based on user level
+         */
+        if (resource.equals(GlobalConstants.DEFAULT.toString())) {
+            IUserManager userManager = (IUserManager) ServiceHelper
+                    .getGlobalInstance(IUserManager.class, bundle);
+            if (userManager != null) {
+                switch (userManager.getUserLevel(userName)) {
+                case NETWORKADMIN:
+                    return Privilege.WRITE;
+                case NETWORKOPERATOR:
+                    return Privilege.READ;
+                default:
+                    return Privilege.NONE;
+                }
+            }
+        }
+
+        return Privilege.NONE;
+    }
+
+    public static void auditlog(String moduleName, String user, String action, String resource,
+            String containerName) {
+        String auditMsg = "";
+        String mode = "UI";
+        if (containerName != null) {
+            auditMsg = "Mode: " + mode + " User " + user + " "  + action + " " + moduleName + " " + resource + " in container "
+                    + containerName;
+        } else {
+            auditMsg = "Mode: " + mode + " User " + user + " "  + action + " " + moduleName + " " + resource;
+        }
+        logger.trace(auditMsg);
+    }
+
+    public static void auditlog(String moduleName, String user, String action, String resource) {
+        auditlog(moduleName, user, action, resource, null);
+    }
+
+    public static String getNodeDesc(Node node, ISwitchManager switchManager) {
+        Description desc = (Description) switchManager.getNodeProp(node,
+                Description.propertyName);
+        String description = (desc == null) ? "" : desc.getValue();
+        return (description.isEmpty() || description.equalsIgnoreCase("none")) ? node
+                .toString() : description;
+    }
+
+    public static String getNodeDesc(Node node, String containerName,
+            Object bundle) {
+        ISwitchManager switchManager = (ISwitchManager) ServiceHelper
+                .getInstance(ISwitchManager.class, containerName, bundle);
+        if (switchManager == null) {
+            return null;
+        }
+
+        return getNodeDesc(node, switchManager);
+    }
+
+    public static String getNodeDesc(Node node, Object bundle) {
+        ISwitchManager switchManager = (ISwitchManager) ServiceHelper
+                .getInstance(ISwitchManager.class,
+                        GlobalConstants.DEFAULT.toString(), bundle);
+        if (switchManager == null) {
+            return null;
+        }
+
+        return getNodeDesc(node, switchManager);
+    }
+
+    public static String getPortName(NodeConnector nodeConnector,
+            String container, Object bundle) {
+        ISwitchManager switchManager = (ISwitchManager) ServiceHelper
+                .getInstance(ISwitchManager.class, container, bundle);
+        return getPortName(nodeConnector, switchManager);
+    }
+
+    public static String getPortName(NodeConnector nodeConnector, Object bundle) {
+        return getPortName(nodeConnector, GlobalConstants.DEFAULT.toString(), bundle);
+    }
+
+    public static String getPortName(NodeConnector nodeConnector,
+            ISwitchManager switchManager) {
+        Name ncName = ((Name) switchManager.getNodeConnectorProp(nodeConnector,
+                Name.NamePropName));
+        String nodeConnectorName = (ncName != null) ? ncName.getValue() : nodeConnector.getNodeConnectorIdAsString();
+        nodeConnectorName = nodeConnectorName + "@"
+                + getNodeDesc(nodeConnector.getNode(), switchManager);
+        return nodeConnectorName.substring(0, nodeConnectorName.length());
+    }
+}
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/IDaylightWeb.java b/web/src/main/java/org/opendaylight/toolkit/web/IDaylightWeb.java
new file mode 100644 (file)
index 0000000..239bcb9
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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 org.opendaylight.toolkit.web;
+
+import org.opendaylight.controller.sal.authorization.UserLevel;
+
+public interface IDaylightWeb {
+    /**
+     * Returns the name of the bundle. In the GUI, this name will be displayed
+     * on the tab.
+     *
+     * @return Name assigned to the bundle.
+     */
+    public String getWebName();
+
+    /**
+     * Returns the Id assigned to the web bundle.
+     *
+     * @return Id assigned to the web bundle.
+     */
+    public String getWebId();
+
+    /**
+     * Returns the position where the bundle tab will be placed in the GUI.
+     *
+     * @return Position number for the bundle tab.
+     */
+    public short getWebOrder();
+
+    /**
+     * This method checks if the user is authorized to access the bundle.
+     *
+     * @param userLevel
+     *            user role level in the controller space.
+     *
+     * @return true, if user is authorized to access the bundle, else false.
+     */
+    public boolean isAuthorized(UserLevel userLevel);
+}
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/NodeBean.java b/web/src/main/java/org/opendaylight/toolkit/web/NodeBean.java
new file mode 100644 (file)
index 0000000..5fc09e9
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.toolkit.web;
+
+import org.opendaylight.controller.sal.core.Node;
+
+/**
+ * Information about a node connected to a controller to send to the UI frontend
+ * @author andrekim
+ */
+public class NodeBean {
+    private final String node;
+    private final String description;
+
+    public NodeBean(Node node) {
+        this(node, node.toString());
+    }
+
+    public NodeBean(Node node, String description) {
+        this.node = node.toString();
+        this.description = description;
+    }
+}
diff --git a/web/src/main/java/org/opendaylight/toolkit/web/UserBean.java b/web/src/main/java/org/opendaylight/toolkit/web/UserBean.java
new file mode 100644 (file)
index 0000000..9eb1cb2
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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.toolkit.web;
+
+import java.util.List;
+
+import org.opendaylight.controller.usermanager.UserConfig;
+
+public class UserBean {
+    private String user;
+    private List<String> roles;
+
+    public UserBean(String user, List<String> roles) {
+        this.user = user;
+        this.roles = roles;
+    }
+
+    public UserBean(UserConfig config) {
+        this(config.getUser(), config.getRoles());
+    }
+
+    public String getUser() {
+        return user;
+    }
+
+    public List<String> getRoles() {
+        return roles;
+    }
+}
diff --git a/web/src/main/resources/META-INF/spring.factories b/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/web/src/main/resources/META-INF/spring.handlers b/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/web/src/main/resources/META-INF/spring.schemas b/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/web/src/main/resources/META-INF/spring.tooling b/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/web/src/main/resources/WEB-INF/RootGUI-servlet.xml b/web/src/main/resources/WEB-INF/RootGUI-servlet.xml
new file mode 100644 (file)
index 0000000..8fa36e6
--- /dev/null
@@ -0,0 +1,21 @@
+<?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.toolkit.web"/>
+
+  <mvc:resources mapping="/js/**" location="/js/" />
+  <mvc:resources mapping="/css/**" location="/css/" />
+  <mvc:resources mapping="/img/**" location="/img/" />
+  <mvc:annotation-driven/>
+
+  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+        <property name="prefix" value="/WEB-INF/jsp/"/>
+        <property name="suffix" value=".jsp"/>
+  </bean>
+</beans>
diff --git a/web/src/main/resources/WEB-INF/jsp/autherror.jsp b/web/src/main/resources/WEB-INF/jsp/autherror.jsp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/src/main/resources/WEB-INF/jsp/error.jsp b/web/src/main/resources/WEB-INF/jsp/error.jsp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/src/main/resources/WEB-INF/jsp/login.jsp b/web/src/main/resources/WEB-INF/jsp/login.jsp
new file mode 100644 (file)
index 0000000..75ec77d
--- /dev/null
@@ -0,0 +1,37 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+pageEncoding="UTF-8"%>
+<%@ page import="java.net.URL"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>OpenDaylight Toolkit - Login</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    
+    <!-- style -->
+    <link rel="icon" href="/img/favicon.ico"/>
+    <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"/>
+    <link rel="stylesheet" href="/css/login.css"/>
+    
+    <!-- scripts -->
+    <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
+  </head>
+  <body>
+    <div id="header"></div>
+    <div id="container">
+      <form action="<c:url value='j_security_check' />" id="form" method="post" class="pure-form">
+        <fieldset>
+          <input type="text" name="j_username" placeholder="Username">
+          <input type="password" name="j_password" placeholder="Password">
+          <button class="pure-button pure-button-primary" type="submit">Log In</button>
+        </fieldset>
+      </form>
+    </div>
+    <script type="text/javascript">
+      $('input').first().focus();
+    </script>
+  </body>
+</html>
diff --git a/web/src/main/resources/WEB-INF/jsp/main.jsp b/web/src/main/resources/WEB-INF/jsp/main.jsp
new file mode 100644 (file)
index 0000000..ecea9aa
--- /dev/null
@@ -0,0 +1 @@
+<!DOCTYPE html>\r  <head>\r    <meta charset="utf-8">\r    <meta http-equiv="X-UA-Compatible" content="IE=edge">\r    <title>OpenDaylight Toolkit</title>\r    <meta name="description" content="">\r    <meta name="viewport" content="width=device-width, initial-scale=1">\r\r    <!-- style -->\r    <link rel="icon" href="/img/favicon.ico"/>\r    <link rel="stylesheet" href="/css/ext/pure/pure.css"/>\r    <link rel="stylesheet" href="/css/phoenix.css"/>\r\r    <!-- this style -->\r    <link rel="stylesheet" href="/css/global.css"/>\r    <link rel="stylesheet" href="/css/header.css"/>\r    <link rel="stylesheet" href="/css/core.css"/>\r    <link rel="stylesheet" href="/css/flows.css"/>\r\r    <!-- scripts -->\r    <script data-main="js/main" src="/js/ext/requirejs/require.js"></script>\r  </head>\r  <body>\r    <div id="main"></div>\r  </body>\r</html>\r
\ No newline at end of file
diff --git a/web/src/main/resources/WEB-INF/spring/servlet/security.xml b/web/src/main/resources/WEB-INF/spring/servlet/security.xml
new file mode 100644 (file)
index 0000000..600ae30
--- /dev/null
@@ -0,0 +1,120 @@
+<beans:beans xmlns="http://www.springframework.org/schema/security"
+        xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+           http://www.springframework.org/schema/security
+           http://www.springframework.org/schema/security/spring-security-3.1.xsd">
+
+
+        <http pattern="/css/**" security="none" />
+        <http pattern="/js/**" security="none" />
+        <http pattern="/images/**" security="none" />
+        <http pattern="/favicon.ico" security="none" />
+        <http pattern="/controller/web/css/**" security="none" />
+        <http pattern="/controller/web/js/**" security="none" />
+        <http pattern="/controller/web/images/**" security="none" />
+
+
+        <http auto-config="false" authentication-manager-ref="authenticationManager"
+                security-context-repository-ref="securityContextRepo" entry-point-ref="loginUrlAuthenticationEntryPoint">
+                <intercept-url pattern="/login*" access="IS_AUTHENTICATED_ANONYMOUSLY" />
+                <intercept-url pattern="/logout*" access="IS_AUTHENTICATED_ANONYMOUSLY" />
+
+
+                <intercept-url pattern="/**"
+                        access="ROLE_SYSTEM-ADMIN, ROLE_NETWORK-ADMIN, ROLE_NETWORK-OPERATOR, ROLE_CONTAINER-USER" />
+                <custom-filter ref="authenticationFilter" position="FORM_LOGIN_FILTER" />
+                <custom-filter position="LOGOUT_FILTER" ref="logoutFilter" />
+                <custom-filter position="LAST" ref="controllerFilter" />
+                <remember-me services-ref="rememberMeServices" key="SDN" />
+        </http>
+
+        <beans:bean id="controllerFilter"
+                class="org.opendaylight.toolkit.web.ControllerCustomFilter" />
+
+        <authentication-manager id="authenticationManager">
+                <authentication-provider ref="authenticationProviderWrapper" />
+        </authentication-manager>
+
+        <beans:bean id="authenticationFilter"
+                class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
+                <beans:property name="authenticationManager" ref="authenticationManager" />
+                <beans:property name="authenticationFailureHandler"
+                        ref="authenticationFailureHandler" />
+                <beans:property name="authenticationSuccessHandler">
+                        <beans:bean
+                                class="org.opendaylight.toolkit.web.ControllerAuthenticationSuccessHandler">
+                                <beans:property name="targetUrlParameter" value="x-page-url" />
+                                <beans:property name="defaultTargetUrl" value="/" />
+                        </beans:bean>
+                </beans:property>
+                <beans:property name="rememberMeServices" ref="rememberMeServices" />
+        </beans:bean>
+
+        <beans:bean id="securityContextRepo"
+                class="org.opendaylight.toolkit.web.ControllerWebSecurityContextRepository" />
+
+        <beans:bean id="authenticationFailureHandler"
+                class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
+                <beans:property name="useForward" value="false" />
+                <beans:property name="defaultFailureUrl" value="/login" />
+        </beans:bean>
+
+        <beans:bean id="loginUrlAuthenticationEntryPoint"
+                class="org.opendaylight.toolkit.web.ControllerLoginUrlAuthEntryPoint">
+                <beans:property name="loginFormUrl" value="/login" />
+        </beans:bean>
+
+        <beans:bean id="authenticationProviderWrapper"
+                class="org.opendaylight.toolkit.web.AuthenticationProviderWrapper" />
+
+    <!-- logout related -->
+
+    <beans:bean id="logoutHandler"
+        class="org.opendaylight.toolkit.web.ControllerLogoutHandler" />
+
+    <beans:bean id="securityContextLogoutHandler"
+        class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" />
+
+
+    <beans:bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter">
+        <!-- if logout succeed then this is the URL -->
+        <beans:constructor-arg value="/login" />
+        <beans:constructor-arg>
+            <beans:list>
+                <beans:ref bean="logoutHandler"/>
+                <beans:ref bean="rememberMeServices"/>
+                <beans:ref bean="securityContextLogoutHandler"/>
+            </beans:list>
+        </beans:constructor-arg>
+        <beans:property name="filterProcessesUrl" value="/logout" />
+    </beans:bean>
+
+
+
+
+        <!-- remember me related -->
+        <beans:bean id="rememberMeFilter"
+                class="org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter">
+                <beans:property name="rememberMeServices" ref="rememberMeServices" />
+                <beans:property name="authenticationManager" ref="authenticationManager" />
+        </beans:bean>
+
+        <beans:bean id="rememberMeServices"
+                class="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices">
+                <beans:property name="userDetailsService" ref="userDetailsServiceRef" />
+                <beans:property name="key" value="SDN" />
+                <beans:property name="alwaysRemember" value="true"></beans:property>
+                <beans:property name="tokenValiditySeconds" value="3600" />
+                <beans:property name="cookieName" value="SDN-Controller" />
+        </beans:bean>
+
+        <beans:bean id="userDetailsServiceRef" class="org.opendaylight.toolkit.web.ControllerUserDetailsService" />
+
+
+        <beans:bean id="rememberMeAuthenticationProvider"
+                class="org.springframework.security.authentication.RememberMeAuthenticationProvider">
+                <beans:property name="key" value="SDN" />
+        </beans:bean>
+
+</beans:beans>
diff --git a/web/src/main/resources/WEB-INF/web.xml b/web/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..06ebe15
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+        version="2.4"> -->
+<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">
+
+        <filter>
+          <filter-name>CorsFilter</filter-name>
+          <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+          <init-param>
+            <param-name>cors.allowed.origins</param-name>
+            <param-value>*</param-value>
+          </init-param>
+          <init-param>
+            <param-name>cors.allowed.methods</param-name>
+            <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
+          </init-param>
+          <init-param>
+            <param-name>cors.allowed.headers</param-name>
+            <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+          </init-param>
+          <init-param>
+            <param-name>cors.exposed.headers</param-name>
+            <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+          </init-param>
+          <init-param>
+            <param-name>cors.support.credentials</param-name>
+            <param-value>true</param-value>
+          </init-param>
+          <init-param>
+            <param-name>cors.preflight.maxage</param-name>
+            <param-value>10</param-value>
+          </init-param>
+        </filter>
+        <filter-mapping>
+          <filter-name>CorsFilter</filter-name>
+          <url-pattern>/*</url-pattern>
+        </filter-mapping>
+
+        <security-constraint>
+          <web-resource-collection>
+             <web-resource-name>free access</web-resource-name>
+             <url-pattern>/js/*</url-pattern>
+             <url-pattern>/img/*</url-pattern>
+             <url-pattern>/css/*</url-pattern>
+             <url-pattern>/favicon.ico</url-pattern>
+             <url-pattern>/versionProperty/*</url-pattern>
+          </web-resource-collection>
+        </security-constraint>
+
+        <security-constraint>
+           <display-name>RootApp</display-name>
+           <web-resource-collection>
+              <web-resource-name>RootGUI</web-resource-name>
+              <url-pattern>/*</url-pattern>
+              <http-method>POST</http-method>
+              <http-method>GET</http-method>
+              <http-method>PUT</http-method>
+              <http-method>DELETE</http-method>
+              <http-method>HEAD</http-method>
+           </web-resource-collection>
+           <auth-constraint>
+               <role-name>System-Admin</role-name>
+               <role-name>Network-Admin</role-name>
+               <role-name>Network-Operator</role-name>
+               <role-name>Container-User</role-name>
+           </auth-constraint>
+        </security-constraint>
+
+        <security-role>
+                <role-name>System-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Operator</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Container-User</role-name>
+        </security-role>
+
+
+        <login-config>
+                <auth-method>FORM</auth-method>
+                <form-login-config>
+                        <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
+                        <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
+                </form-login-config>
+        </login-config>
+
+    <error-page>
+            <error-code>403</error-code>
+            <location>/WEB-INF/jsp/autherror.jsp</location>
+    </error-page>
+
+        <servlet>
+                <servlet-name>RootGUI</servlet-name>
+                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+                <load-on-startup>1</load-on-startup>
+        </servlet>
+
+        <servlet-mapping>
+                <servlet-name>RootGUI</servlet-name>
+                <url-pattern>/</url-pattern>
+        </servlet-mapping>
+
+        <display-name>OpenDaylight Toolkit</display-name>
+        <description>OpenDaylight Toolkit</description>
+
+        <listener>
+                <listener-class>org.opendaylight.toolkit.web.ControllerUISessionManager</listener-class>
+        </listener>
+
+        <session-config>
+                <cookie-config>
+                        <path>/</path>
+                </cookie-config>
+        </session-config>
+
+</web-app>
diff --git a/web/src/main/resources/boilerplate.js b/web/src/main/resources/boilerplate.js
new file mode 100644 (file)
index 0000000..3bc2c8a
--- /dev/null
@@ -0,0 +1,13 @@
+// Filename: boilerplate.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',     // lib/jquery/jquery
+  'underscore', // lib/underscore/underscore
+  'backbone'    // lib/backbone/backbone
+], function($, _, Backbone){
+  // Above we have passed in jQuery, Underscore and Backbone
+  // They will not be accessible in the global scope
+  return {};
+  // What we return here will be used by other modules
+});
diff --git a/web/src/main/resources/css/.bowerrc b/web/src/main/resources/css/.bowerrc
new file mode 100644 (file)
index 0000000..d361767
--- /dev/null
@@ -0,0 +1,3 @@
+{
+  "directory" : "ext"
+}
diff --git a/web/src/main/resources/css/bower.json b/web/src/main/resources/css/bower.json
new file mode 100644 (file)
index 0000000..87e64a2
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "name" : "OpenDaylight Phoenix External CSS",
+  "version" : "0.0.1",
+  "dependencies" : {
+    "pure" : "v0.4.2"
+  }
+}
diff --git a/web/src/main/resources/css/core.css b/web/src/main/resources/css/core.css
new file mode 100644 (file)
index 0000000..3722424
--- /dev/null
@@ -0,0 +1,21 @@
+body {
+  background: #fff;
+}
+
+h2 {
+  padding-top: 25px;
+  padding-left: 20px;
+  color: #646464;
+}
+
+ol > li {
+  padding: 2px 0;
+}
+
+code {
+  background: #F3F781;
+  padding: 2px 4px;
+  font-weight: bold;
+  color: #000;
+  border-radius: 2px;
+}
diff --git a/web/src/main/resources/css/flows.css b/web/src/main/resources/css/flows.css
new file mode 100644 (file)
index 0000000..8d4c4e0
--- /dev/null
@@ -0,0 +1,28 @@
+.selectedrow {
+    background: #F3F781
+}
+
+.button-success {
+    background: rgb(28, 184, 65); /* this is a green */
+}
+
+.button-error {
+    background: rgb(202, 60, 60); /* this is a maroon */
+}
+
+.button-warning {
+    background: rgb(223, 117, 20); /* this is an orange */
+}
+
+.button-secondary {
+    background: rgb(66, 184, 221); /* this is a light blue */
+}
+
+.button-success,
+.button-error,
+.button-warning,
+.button-secondary {
+    color: white;
+    border-radius: 4px;
+    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
+}
diff --git a/web/src/main/resources/css/global.css b/web/src/main/resources/css/global.css
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/src/main/resources/css/header.css b/web/src/main/resources/css/header.css
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/src/main/resources/css/login.css b/web/src/main/resources/css/login.css
new file mode 100644 (file)
index 0000000..9288c31
--- /dev/null
@@ -0,0 +1,51 @@
+body {
+  background: #eee;
+}
+
+#header {
+  height: 25px;
+  background: url('/img/opendaylight.png') left center no-repeat #ddd;
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+}
+
+#container {
+  width: 100%;
+  height: 100%;
+  text-align: center;
+  position: absolute;
+  display: block;
+}
+
+#container:before {
+  content: '';
+  display: inline-block;
+  height: 100%;
+  vertical-align: middle;
+  margin-right: -0.25em;
+  margin-bottom: 100px;
+}
+
+#form {
+  width: 500px;
+  height: 300px;
+  border-radius: 10px;
+  display: inline-block;
+  background: url('/img/logo.png') center top 10px no-repeat;
+  font-size: 0.9em;
+}
+
+#form fieldset {
+  margin-top: 220px;
+}
+
+#form fieldset input {
+  margin-right: 5px;
+  box-shadow: 0 0 50px #646464;
+}
+
+#form fieldset button {
+  box-shadow: 0 0 50px #646464;
+}
diff --git a/web/src/main/resources/css/menu.css b/web/src/main/resources/css/menu.css
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/web/src/main/resources/css/phoenix.css b/web/src/main/resources/css/phoenix.css
new file mode 100644 (file)
index 0000000..3f7d9db
--- /dev/null
@@ -0,0 +1,65 @@
+body {
+  margin-top: 25px;
+}
+
+#phoenix-overlay {
+  font-size: 0.7em;
+  position: absolute;
+  height: 25px;
+  top: -25px;
+  right: 0;
+  left: 0;
+  -webkit-transition: -webkit-top 1s;
+  transition: top 1s;
+  box-shadow: 0 0 10px #646464;
+}
+
+#phoenix-overlay:hover {
+  top: 0;
+}
+
+#phoenix-brand {
+  width: 150px;
+  height: 45px;
+  background: url('/img/opendaylight.png') bottom center no-repeat #ddd;
+  border-radius: 0 0 4px 4px;
+  position: absolute;
+  top: 0;
+  left: 10px;
+  z-index: 100;
+  box-shadow: 0 0 10px #646464;
+}
+
+#phoenix-menu {
+  width: 100%;
+  height: 25px;
+  display: block;
+  position: relative;
+  text-align: left;
+  background-image: linear-gradient(to bottom, #eee, #ddd);
+  z-index: 101;
+  text-shadow: #bbb 0 0 2px;
+}
+
+#phoenix-menu > ul > li > a {
+  padding: 0 10px;
+  border-radius: 0 0 2px 2px;
+}
+
+#phoenix-menu > ul > li > a:hover {
+  background: #ccc;
+}
+
+#phoenix-menu > ul > .pure-menu-selected {
+}
+
+#phoenix-menu > ul > .pure-menu-selected:hover {
+}
+
+#phoenix-menu > ul > .pure-menu-selected > a {
+  cursor: default;
+}
+
+#phoenix-menu > ul > .pure-menu-selected > a:hover {
+  background: transparent;
+}
diff --git a/web/src/main/resources/dev/css b/web/src/main/resources/dev/css
new file mode 120000 (symlink)
index 0000000..d2d7c52
--- /dev/null
@@ -0,0 +1 @@
+../css
\ No newline at end of file
diff --git a/web/src/main/resources/dev/dev.sh b/web/src/main/resources/dev/dev.sh
new file mode 100755 (executable)
index 0000000..5ac4811
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+node ../node/server.js
diff --git a/web/src/main/resources/dev/images b/web/src/main/resources/dev/images
new file mode 120000 (symlink)
index 0000000..5e67573
--- /dev/null
@@ -0,0 +1 @@
+../images
\ No newline at end of file
diff --git a/web/src/main/resources/dev/index.html b/web/src/main/resources/dev/index.html
new file mode 120000 (symlink)
index 0000000..58fadc4
--- /dev/null
@@ -0,0 +1 @@
+../WEB-INF/jsp/main.jsp
\ No newline at end of file
diff --git a/web/src/main/resources/dev/js b/web/src/main/resources/dev/js
new file mode 120000 (symlink)
index 0000000..f662e4e
--- /dev/null
@@ -0,0 +1 @@
+../js
\ No newline at end of file
diff --git a/web/src/main/resources/img/favicon.ico b/web/src/main/resources/img/favicon.ico
new file mode 100644 (file)
index 0000000..7b927f2
Binary files /dev/null and b/web/src/main/resources/img/favicon.ico differ
diff --git a/web/src/main/resources/img/logo.png b/web/src/main/resources/img/logo.png
new file mode 100644 (file)
index 0000000..2ddf85b
Binary files /dev/null and b/web/src/main/resources/img/logo.png differ
diff --git a/web/src/main/resources/img/opendaylight.png b/web/src/main/resources/img/opendaylight.png
new file mode 100644 (file)
index 0000000..aeefc90
Binary files /dev/null and b/web/src/main/resources/img/opendaylight.png differ
diff --git a/web/src/main/resources/js/.bowerrc b/web/src/main/resources/js/.bowerrc
new file mode 100644 (file)
index 0000000..d361767
--- /dev/null
@@ -0,0 +1,3 @@
+{
+  "directory" : "ext"
+}
diff --git a/web/src/main/resources/js/app.js b/web/src/main/resources/js/app.js
new file mode 100644 (file)
index 0000000..d930cad
--- /dev/null
@@ -0,0 +1,17 @@
+// Filename: app.js
+
+define([
+  // These are path alias that we configured in our bootstrap
+  'jquery',     // lib/jquery/jquery
+  'underscore', // lib/underscore/underscore
+  'backbone',    // lib/backbone/backbone
+  'views/HomeView'
+], function($, _, Backbone, HomeView){
+  var initialize = function() {
+    var view = new HomeView(); // this calls initialize which in turn calls render
+  }
+
+  return {
+    initialize : initialize
+  };
+});
diff --git a/web/src/main/resources/js/assets/phoenix-topology.js b/web/src/main/resources/js/assets/phoenix-topology.js
new file mode 100644 (file)
index 0000000..8b827b9
--- /dev/null
@@ -0,0 +1,73 @@
+phoenix = {}
+
+phoenix.topology = {
+  graph : {},
+  canvas : undefined,
+  width : undefined,
+  height : undefined,
+}
+
+phoenix.topology.init = function(data, canvas) {
+  phoenix.topology.graph = data;
+  phoenix.topology.canvas = canvas ;
+  phoenix.topology.width = $(canvas).width() 
+  phoenix.topology.height = $(canvas).height()
+}
+
+phoenix.topology.build = function(data, canvas){
+  phoenix.topology.init(data, canvas);
+  var color = d3.scale.category20();
+
+  var force = d3.layout.force()
+  .charge(-120)
+  .linkDistance(200)
+  .size([phoenix.topology.width, phoenix.topology.height ]);
+
+  var svg = d3.select(phoenix.topology.canvas).append("svg")
+  .attr("width", phoenix.topology.width)
+  .attr("height", phoenix.topology.height);
+
+  force
+  .nodes(phoenix.topology.graph.nodes)
+  .links(phoenix.topology.graph.links)
+  .size([phoenix.topology.width, phoenix.topology.height])
+  .start();
+
+  var link = svg.selectAll(".link")
+  .data(phoenix.topology.graph.links)
+  .enter().append("line")
+  .attr("class", "link")
+  .style("stroke-width", function(d) { return Math.sqrt(d.value); });
+
+  var node = svg.selectAll(".node")
+  .data(phoenix.topology.graph.nodes)
+  .enter().append("circle")
+  .attr("class", "node")
+  .attr("r", 15)
+  .style("fill", function(d) { return color(d.group); })
+  .call(force.drag);
+
+  var text = svg.append("svg:g").selectAll("g")
+  .data(force.nodes())
+  .enter().append("svg:g");
+
+  text.append("svg:text")
+  .text(function(d) { return d.id; });
+
+  node.append("title")
+  .text(function(d) { return d.id; });
+
+
+
+  force.on("tick", function() {
+    link.attr("x1", function(d) { return d.source.x; })
+    .attr("y1", function(d) { return d.source.y; })
+    .attr("x2", function(d) { return d.target.x; })
+    .attr("y2", function(d) { return d.target.y; });
+
+    text.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });    
+
+    node.attr("cx", function(d) { return d.x; })
+    .attr("cy", function(d) { return d.y; });
+  });
+}
diff --git a/web/src/main/resources/js/bower.json b/web/src/main/resources/js/bower.json
new file mode 100644 (file)
index 0000000..888e21f
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "name" : "OpenDaylight Phoenix External JS",
+  "version" : "0.0.1",
+  "dependencies" : {
+    "jquery" : "2.1.0",
+    "backbone" : "1.1.2",
+    "underscore" : "1.6.0",
+    "requirejs" : "2.1.11",
+    "text" : "2.0.10"
+  }
+}
diff --git a/web/src/main/resources/js/collections/DevicePropertiesCollection.js b/web/src/main/resources/js/collections/DevicePropertiesCollection.js
new file mode 100644 (file)
index 0000000..6370a1c
--- /dev/null
@@ -0,0 +1,4 @@
+define(['backbone','underscore'], function(Backbone, _) {
+       var DevicePropertiesCollection = Backbone.Collection.extend();
+       return DevicePropertiesCollection;
+});
diff --git a/web/src/main/resources/js/collections/DevicesCollection.js b/web/src/main/resources/js/collections/DevicesCollection.js
new file mode 100644 (file)
index 0000000..cd7852a
--- /dev/null
@@ -0,0 +1,8 @@
+define([ 'backbone', 'underscore', 'models/DeviceModel' ], function(Backbone,
+               _, DeviceModel) {
+       var DevicesCollection = Backbone.Collection.extend({
+               model : DeviceModel,
+               url : "/controller/nb/v2/switchmanager/default/nodes"
+       });
+       return DevicesCollection;
+});
diff --git a/web/src/main/resources/js/collections/FlowsCollection.js b/web/src/main/resources/js/collections/FlowsCollection.js
new file mode 100644 (file)
index 0000000..98a8d7e
--- /dev/null
@@ -0,0 +1,7 @@
+define([ 'backbone', 'underscore', 'models/FlowsModel' ], function(Backbone, _,
+        FlowsModel) {
+    var FlowsCollection = Backbone.Collection.extend({
+        model : FlowsModel
+    });
+    return FlowsCollection;
+});
diff --git a/web/src/main/resources/js/main.js b/web/src/main/resources/js/main.js
new file mode 100644 (file)
index 0000000..c53e075
--- /dev/null
@@ -0,0 +1,18 @@
+// Filename: main.js
+
+require.config({
+  paths: {
+    "jquery": "/js/ext/jquery/dist/jquery.min",
+    "underscore": "/js/ext/underscore/underscore",
+    "backbone": "/js/ext/backbone/backbone",
+    "models": "/js/models",
+    "views": "/js/views",
+    "collections": "/js/collections"
+  }
+});
+require([
+  'app', '/js/phoenix.js'
+], function(App, Phoenix) {
+  new App.initialize();
+  new Phoenix.initialize();
+});
diff --git a/web/src/main/resources/js/models/DeviceModel.js b/web/src/main/resources/js/models/DeviceModel.js
new file mode 100644 (file)
index 0000000..f9b2e29
--- /dev/null
@@ -0,0 +1,11 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+    var DeviceModel = Backbone.Model.extend({
+        defaults: {
+               name: "New device"
+        },
+        initialize: function() {
+               console.log("initialize of DeviceModel called");
+        }
+       });
+       return DeviceModel;
+});
diff --git a/web/src/main/resources/js/models/FlowsModel.js b/web/src/main/resources/js/models/FlowsModel.js
new file mode 100644 (file)
index 0000000..b5b4cce
--- /dev/null
@@ -0,0 +1,27 @@
+define(['backbone', 'underscore'], function(Backbone, _) {
+    var FlowsModel = Backbone.Model.extend({
+        defaults: {
+            id: 'NewFlow',
+            installInHw: "false",
+            node: {
+                id: '',
+                type: 'OF'
+            },
+            ingressPort: "1",
+            priority: "500",
+            etherType: "0x800",
+            nwSrc: "9.9.1.1",
+            actions: ["OUTPUT=2"]
+        },
+        initialize: function() {
+            console.log("FlowsModel initialize called");
+        },
+        setUrlRoot: function() {
+            this.urlRoot="/controller/nb/v2/flowprogrammer/default/node/";
+            this.urlRoot += this.get("node").type + "/";
+            this.urlRoot += this.get("node").id + "/";
+            this.urlRoot += "staticFlow/";
+        }
+    });
+    return FlowsModel;
+});
diff --git a/web/src/main/resources/js/phoenix.js b/web/src/main/resources/js/phoenix.js
new file mode 100644 (file)
index 0000000..b89df79
--- /dev/null
@@ -0,0 +1,60 @@
+// Filename: phoenix.js
+
+define([
+  'jquery',
+  'underscore',
+  'backbone'
+], function($, _, Backbone) {
+  var initialize = function() {
+    // attach phoenix overlay bar
+    var $overlay = $(document.createElement('div'))
+    .attr('id', 'phoenix-overlay');
+    var $brand = $(document.createElement('div'))
+    .attr('id', 'phoenix-brand');
+    var $menu = $(document.createElement('div'))
+    .attr('id', 'phoenix-menu')
+    .addClass('pure-menu pure-menu-open pure-menu-horizontal');
+    var $ul = $(document.createElement('ul'));
+    var $li = $(document.createElement('li'));
+    var $a = $(document.createElement('a'))
+    .attr('href', '/')
+    .append('Home');
+    $li.append($a);
+    $ul.append($li);
+    $menu.append($ul);
+
+    $overlay.append($brand).append($menu);
+    $('body').prepend($overlay);
+
+    // determine which app we are in
+    var path = window.location.pathname;
+    path = path.split('/');
+    var current = undefined;
+    if (path.length > 1) {
+      if (path[1] === '') {
+        $li.addClass('pure-menu-selected');
+      } else {
+        current = path[1];
+      }
+    }
+
+    // load apps into menu
+    $.getJSON('/web.json', function(apps) {
+      $.each(apps, function(key, app) {
+        var $li = $(document.createElement('li'));
+        if (key === current) {
+          $li.addClass('pure-menu-selected');
+        }
+        var $a = $(document.createElement('a'));
+        $a.append(app.name).attr('href', '/'+key+'/web/');
+        $li.append($a);
+
+        $('#phoenix-menu ul').append($li);
+      });
+    });
+  }
+
+  return {
+    initialize : initialize
+  };
+});
diff --git a/web/src/main/resources/js/templates/device.html b/web/src/main/resources/js/templates/device.html
new file mode 100644 (file)
index 0000000..f93f251
--- /dev/null
@@ -0,0 +1,28 @@
+<script type="text/template" id="devicescontainer">
+<div id="deviceDiv" style="margin-left:20px; float: left;">
+    <h3>Devices</h3>
+    <table class="pure-table pure-table-bordered">
+    <thead>
+        <tr>
+        <th>Node ID</th>
+        <th>Type</th>
+        <th>Properties</th>
+        </tr>
+    </thead>
+    <tbody>
+    <% _.each(devices, function(device) { %>
+        <tr data-nodeType="<%= device.node.type%>" data-nodeId="<%= device.node.id%>" style="cursor:pointer;">
+            <td><%= device.node.id %></td>
+            <td><%= device.node.type %></td>
+            <td>
+                <div>Mac Address: <%= device.properties.macAddress.value %></div>
+                <div>Description: <%= device.properties.description.value %></div>
+                <div>Mac Address: <%= device.properties.macAddress.value %></div>
+            </td>
+        </tr>
+    <% }); %>
+    </tbody>
+    </table>
+
+</div>
+</script>
diff --git a/web/src/main/resources/js/templates/deviceProperties.html b/web/src/main/resources/js/templates/deviceProperties.html
new file mode 100644 (file)
index 0000000..2a8e536
--- /dev/null
@@ -0,0 +1,33 @@
+<script type="text/template">
+<div id="deviceProperties" style="float: left; margin-left: 20px;">
+       <h3>Device Properties - <%=nodeId %></h3>
+       <table class="pure-table pure-table-bordered">
+               <thead>
+                       <tr>
+                               <th>Property Name</th>
+                               <th>Property Value</th>
+                       </tr>
+               </thead>
+               <tbody>
+                       <% _.each(deviceProps, function(prop) { %>
+                               <tr>
+                                       <td>Bandwidth</td>
+                                       <td><%= prop.properties.bandwidth ? prop.properties.bandwidth.value : '' %></td>
+                               </tr>
+                               <tr>
+                                       <td>config</td>
+                                       <td><%= prop.properties.config.value%></td>
+                               </tr>
+                               <tr>
+                                       <td>name</td>
+                                       <td><%= prop.properties.name.value%></td>
+                               </tr>
+                               <tr>
+                                       <td>state</td>
+                                       <td><%= prop.properties.state.value%></td>
+                               </tr>
+                       <% }); %>
+               </tbody>
+       </table>
+</div>
+</script>
diff --git a/web/src/main/resources/js/templates/flow.html b/web/src/main/resources/js/templates/flow.html
new file mode 100644 (file)
index 0000000..a084f5d
--- /dev/null
@@ -0,0 +1,69 @@
+<script type="text/template">
+    <div id="flowFormContainer"
+        style="margin-top: 20px; margin-left: 20px; padding: 10px;">
+        <fieldset>
+            <legend><%= flowAction %> Flow</legend>
+            <table>
+                <tr>
+                    <td><label>Flow Name:</label></td>
+                    <td><input type="text" id="flowName" name="flowName" value="<%= flowModel.get('id') %>" <%= flowAction =='Edit' ? 'disabled' : '' %> ></td>
+                </tr>
+                <tr>
+                    <td><label>Node ID:</label></td>
+                    <td>
+                        <select id="nodeId" name="nodeId" value="" <%= flowAction =='Edit' ? 'disabled' : '' %> >
+                            <% _.each(devices, function(device){ %>
+                            <option <%= flowModel.get('node').id == device.node.id ? 'selected' : '' %>  > <%= device.node.id %> </option>
+                            <% }); %>
+                        </select>
+                    </td>
+                </tr>
+                <tr>
+                    <td><label>Ingress Port:</label></td>
+                    <td><input type="text" id="ingressPort" name="ingressPort"
+                        value="<%= flowModel.get('ingressPort') %>"></td>
+                </tr>
+                <tr>
+                    <td><label>Priority:</label></td>
+                    <td><input type="text" id="priority" name="priority" value="<%= flowModel.get('priority') %>"></td>
+                </tr>
+                <tr>
+                    <td><label>Ether Type:</label></td>
+                    <td><input type="text" id="etherType" name="etherType" value="<%= flowModel.get('etherType') %>"></td>
+                </tr>
+                <tr>
+                    <td><label>Network Source:</label></td>
+                    <td><input type="text" id="nwSrc" name="nwSrc" value="<%= flowModel.get('nwSrc') %>"></td>
+                </tr>
+                <tr>
+                    <td><label>Actions:</label></td>
+                    <td>
+                        <select id="actions" name="actions">
+<option value="DROP">Drop</option>
+<option value="LOOPBACK">Loopback</option>
+<option value="FLOOD">Flood</option>
+<option value="SW_PATH">Software Path</option>
+<option value="HW_PATH">Hardware Path</option>
+<option value="CONTROLLER">Controller</option>
+<option value="OUTPUT">Add Output Ports</option>
+<option value="SET_VLAN_ID">Set VLAN ID</option>
+<option value="SET_VLAN_PCP">Set VLAN Priority</option>
+<option value="POP_VLAN">Strip VLAN Header</option>
+<option value="SET_DL_SRC">Modify Datalayer Source Address</option>
+<option value="SET_DL_DST">Modify Datalayer Destination Address</option>
+<option value="SET_NW_SRC">Modify Network Source Address</option>
+<option value="SET_NW_DST">Modify Network Destination Address</option>
+<option value="SET_NW_TOS">Modify ToS Bits</option>
+<option value="SET_TP_SRC">Modify Transport Source Port</option>
+<option value="SET_TP_DST">Modify Transport Destination Port</option>
+                        </select>
+                    </td>
+                </tr>
+            </table>
+        </fieldset>
+        <div id="flowFormButtonsContainer" style="margin-top:10px;">
+            <button id="saveFlowButton" class="pure-button button-success">Save</button>
+            <button id="cancelFlowButton" class="pure-button">Cancel</button>
+        </div>
+    </div>
+</script>
diff --git a/web/src/main/resources/js/templates/flows.html b/web/src/main/resources/js/templates/flows.html
new file mode 100644 (file)
index 0000000..8199b7e
--- /dev/null
@@ -0,0 +1,43 @@
+<script type="text/template">
+       <div id="flowsContainer" style="margin-left: 20px;">
+               <h3>Flows</h3>
+               <div id="flowsTableButtonsContainer" style="margin-bottom: 10px;">
+                       <button id="createFlowButton" class="pure-button pure-button-primary">Create
+                               Flow</button>
+                       <button id="editFlowButton" class="pure-button pure-button-primary">Edit
+                               Flow</button>
+                       <button id="deleteFlowButton" class="pure-button button-error">Delete
+                               Flow</button>
+               </div>
+               <table class="pure-table pure-table-bordered">
+                       <thead>
+                               <tr>
+                                       <th>Flow Name</th>
+                                       <th>Node ID</th>
+                                       <th>Type</th>
+                                       <th>Install in Hardware</th>
+                                       <th>Ingress Port</th>
+                                       <th>Priority</th>
+                                       <th>Ether Type</th>
+                                       <th>Network Source</th>
+                                       <th>Actions</th>
+                               </tr>
+                       </thead>
+                       <tbody>
+                               <% _.each(flows, function(flow) { %>
+                               <tr data-flowName="<%= flow.name%>" style="cursor: pointer;">
+                                       <td><%= flow.name %></td>
+                                       <td><%= flow.node.id %></td>
+                                       <td><%= flow.node.type %></td>
+                                       <td><%= flow.installInHw %></td>
+                                       <td><%= flow.ingressPort %></td>
+                                       <td><%= flow.priority %></td>
+                                       <td><%= flow.etherType %></td>
+                                       <td><%= flow.nwSrc %></td>
+                                       <td><%= actionsMap[flow.actions.toString()] %></td>
+                               </tr>
+                               <% }); %>
+                       </tbody>
+               </table>
+       </div>
+</script>
diff --git a/web/src/main/resources/js/templates/home.html b/web/src/main/resources/js/templates/home.html
new file mode 100644 (file)
index 0000000..5bd0852
--- /dev/null
@@ -0,0 +1,9 @@
+<script type="text/template">
+  <h2>OpenDaylight Toolkit</h2>
+  <ol>
+    <li>Install archetype templates located at <code>main/archetype</code></li>
+    <li>Generate archetypes in the root directory using <code>mvn archetype:generate -DarchetypeCatalog</code></li>
+    <li>Install the bundle by running <code>mvn clean install</code> inside of the newly generated bundle</li>
+    <li>Refresh this page and the app will be displayed in the omnibar</li>
+  </ol>
+</script>
diff --git a/web/src/main/resources/js/views/DevicePropertiesView.js b/web/src/main/resources/js/views/DevicePropertiesView.js
new file mode 100644 (file)
index 0000000..ccfcf79
--- /dev/null
@@ -0,0 +1,30 @@
+define(
+    [
+        'jquery',
+        'backbone',
+        'underscore',
+        'collections/DevicePropertiesCollection',
+        'ext/text/text!templates/deviceProperties.html'
+    ], function($, Backbone, _, DevicePropertiesCollection, DevicePropertiesTemplate) {
+
+    var DevicePropertiesView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+            console.log("initialize of DevicePropertiesView called");
+        },
+        render: function() {
+            var self = this;
+            $(self.el).find("#deviceProperties").remove();
+            this.collection = new DevicePropertiesCollection();
+            this.collection.url = "controller/nb/v2/switchmanager/default/node/OF/" + self.nodeId;
+            this.collection.fetch({success: function(coll, response) {
+                var compiledTemplate = _.template(DevicePropertiesTemplate, {
+                    deviceProps: response.nodeConnectorProperties,
+                    nodeId: self.nodeId
+                });
+                $(self.el).append($(compiledTemplate).html());
+            }});
+        }
+    }); // DevicePropertiesView extend ends here
+    return DevicePropertiesView;
+});
diff --git a/web/src/main/resources/js/views/DeviceView.js b/web/src/main/resources/js/views/DeviceView.js
new file mode 100644 (file)
index 0000000..77526d1
--- /dev/null
@@ -0,0 +1,41 @@
+define(
+    [
+        'jquery',
+        'backbone',
+        'underscore',
+        'collections/DevicesCollection',
+        'models/DeviceModel',
+        'views/DevicePropertiesView',
+        'ext/text/text!templates/device.html'
+    ], function($, Backbone, _, DevicesCollection, DeviceModel, DevicePropertiesView, DeviceTemplate) {
+    var DeviceView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+            var self = this;
+            this.collection = new DevicesCollection();
+            this.collection.url = "/controller/nb/v2/switchmanager/default/nodes";
+            this.collection.fetch({
+                success: function(coll, response) {
+                    console.log("passed collection call to get devices", response);
+                    self.render();
+                }
+            });
+        },
+        render: function() {
+            console.log("DevicesView initialize called");
+            var that = this;
+            var compiledTemplate = _.template(DeviceTemplate, {devices: that.collection.models[0].get('nodeProperties')});
+            $(this.el).append($(compiledTemplate).html());
+        },
+        events: {
+            "click tr": "getNodeProperties"
+        },
+        getNodeProperties: function(evt) {
+            var $tr = $(evt.currentTarget);
+            var devicePropsView = new DevicePropertiesView();
+            devicePropsView.nodeId = $tr.attr("data-nodeId");
+            devicePropsView.render();
+        }
+    });
+    return DeviceView;
+});
diff --git a/web/src/main/resources/js/views/FlowView.js b/web/src/main/resources/js/views/FlowView.js
new file mode 100644 (file)
index 0000000..27b4f55
--- /dev/null
@@ -0,0 +1,88 @@
+define(
+        [
+         'jquery',
+         'backbone',
+         'underscore',
+         'models/FlowsModel',
+         'collections/DevicesCollection',
+         'ext/text/text!templates/flow.html'
+        ], function($, Backbone, _, FlowsModel, DevicesCollection, FlowTemplate) {
+    var FlowView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+        },
+        render: function() {
+            // remove any existing form
+            $("#flowFormContainer").remove();
+            var self = this;
+            var devicesCollection = new DevicesCollection();
+            devicesCollection.fetch({
+               success: function(coll, response) {
+                    var flowModel = self.flowModel;
+                    var flowAction = "Edit";
+                    if(!flowModel) {
+                       flowAction = "Create";
+                       flowModel = {
+                               get: function(arg1) {
+                                       return "";
+                               }
+                        };
+                    }
+                    var compiledTemplate = _.template(FlowTemplate, 
+                       {
+                               "flowAction": flowAction,
+                               "devices": response.nodeProperties,
+                               "flowModel": flowModel
+                       });
+                    $(self.el).append($(compiledTemplate).html());
+                    // hack to set the actions value in case of edit
+                    if(flowAction == "Edit") {
+                       $("#actions option[value='" + flowModel.get('actions') + "']")[0].selected =  true;
+                    }
+                }
+            });
+        },
+        events: {
+            "click div#flowFormButtonsContainer button": "handleFlowFormButtons"
+        },
+        handleFlowFormButtons: function(evt) {
+            var self = this;
+            var $button = $(evt.currentTarget);
+            if($button.attr("id") == "saveFlowButton") {
+                // create FlowModel and save it.
+                var flowModel = new FlowsModel({
+                    id: $("#flowName").val(),
+                    installInHw: "true",
+                    name: $("#flowName").val(),
+                    node: {
+                        id: $("#nodeId").val(),
+                        type: "OF"
+                    },
+                    ingressPort: $("#ingressPort").val(),
+                    priority: $("#priority").val(),
+                    etherType: $("#etherType").val(),
+                    nwSrc: $("#nwSrc").val(),
+                    actions: [$("#actions").val()]
+                });
+                flowModel.urlRoot="/controller/nb/v2/flowprogrammer/default/node/OF/";
+                flowModel.urlRoot += $("#nodeId").val() + "/";
+                flowModel.urlRoot += "staticFlow/";
+                flowModel.save(null, {
+                    // REST call does not return JSON. so we need this, else 
+                    // the success callback wont get called
+                    dataType: "text",
+                    success: function(model, response) {
+                        console.log("Flow Created.");
+                        $("#flowFormContainer").remove();
+                        self.parentListView.updateView();
+                    }
+                });
+
+            } else {
+               // cancel button
+               $("#flowFormContainer").remove();
+            }
+        }
+    });
+    return FlowView;
+});
diff --git a/web/src/main/resources/js/views/FlowsListView.js b/web/src/main/resources/js/views/FlowsListView.js
new file mode 100644 (file)
index 0000000..7d41b8e
--- /dev/null
@@ -0,0 +1,124 @@
+define(
+    [
+        'jquery',
+        'backbone',
+        'underscore',
+        'collections/FlowsCollection',
+        'models/FlowsModel',
+        'views/FlowView',
+        'ext/text/text!templates/flows.html'
+    ], function($, Backbone, _, FlowsCollection, FlowsModel, FlowView, FlowsTemplate) {
+    var FlowsView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+            var self = this;
+            this.collection = new FlowsCollection();
+            this.collection.url = "/controller/nb/v2/flowprogrammer/default";
+            this.collection.fetch({
+                success: function(coll, response) {
+                    self.render();
+                }
+            });
+        },
+        render: function() {
+            var self = this;
+            // populate collection with models
+            var flowObjectsArr = self.collection.models[0].get('flowConfig');
+            $(flowObjectsArr).each(function(index, flowObject) {
+                var flowsModel = new FlowsModel({
+                    id: flowObject.name,
+                    installInHw: flowObject.installInHw,
+                    name: flowObject.name,
+                    node: {
+                        id: flowObject.node.id,
+                        type: flowObject.node.type
+                    },
+                    priority: flowObject.priority,
+                    ingressPort: flowObject.ingressPort,
+                    etherPort: flowObject.etherPort,
+                    nwSrc: flowObject.nwSrc,
+                    actions: flowObject.actions
+                });
+                self.collection.add(flowsModel);
+            });
+            var compiledTemplate = _.template(FlowsTemplate,
+                {
+                       flows: self.collection.models[0].get('flowConfig'),
+                       actionsMap: self.actionsMap
+               });
+            $(this.el).append($(compiledTemplate).html());
+        },
+        events: {
+            "click div#flowsTableButtonsContainer button": "handleFlowCrud",
+            "click div#flowsContainer table tbody tr": "tableRowClicked"
+        },
+        handleFlowCrud: function(evt) {
+            var self = this;
+            var $button = $(evt.currentTarget);
+            if($button.attr("id") == "createFlowButton") {
+                self.flowView = self.flowView || new FlowView();
+                self.flowView.parentListView = self;
+                delete self.flowView.flowModel;
+                self.flowView.render();
+            } else if($button.attr("id") == "editFlowButton") {
+               self.flowView = self.flowView || new FlowView();
+                self.flowView.parentListView = self;
+                // get data for selected model
+                var flowName = $("div#flowsContainer tbody tr.selectedrow").attr("data-flowName");
+                var flowModel = self.collection.get(flowName);
+                self.flowView.flowModel = flowModel;
+                self.flowView.render();
+            } else {
+                // delete flow
+                var id = $("div#flowsContainer tbody tr.selectedrow").attr("data-flowName");
+                var flowModel = self.collection.get(id);
+                flowModel.setUrlRoot();
+                flowModel.destroy({
+                    dataType: "text",
+                    success: function() {
+                        console.log("delete succeeded!");
+                        $("#flowFormContainer").remove();
+                        self.updateView();
+                    },
+                    error: function() {
+                        console.log("delete error callback called");
+                        $("#flowFormContainer").remove();
+                        self.updateView();
+                    }
+                });
+            }
+        },
+        tableRowClicked: function(evt) {
+            $("div#flowsContainer tbody tr.selectedrow").removeClass("selectedrow");
+            var $tr = $(evt.currentTarget);
+            $tr.addClass("selectedrow");
+        },
+        updateView: function() {
+            $("#flowsContainer").remove();
+            this.initialize();
+        },
+        /*
+         * temporary map of actions
+         */
+        actionsMap: {
+               "DROP" : "Drop",
+            "LOOPBACK" : "Loopback",
+            "FLOOD" : "Flood",
+            "SW_PATH" : "Software Path",
+            "HW_PATH" : "Hardware Path",
+            "CONTROLLER" : "Controller",
+            "OUTPUT" : "Add Output Ports",
+            "SET_VLAN_ID" : "Set VLAN ID",
+            "SET_VLAN_PCP" : "Set VLAN Priority",
+            "POP_VLAN" : "Strip VLAN Header",
+            "SET_DL_SRC" : "Modify Datalayer Source Address",
+            "SET_DL_DST" : "Modify Datalayer Destination Address",
+            "SET_NW_SRC" : "Modify Network Source Address",
+            "SET_NW_DST" :"Modify Network Destination Address",
+            "SET_NW_TOS" : "Modify ToS Bits",
+            "SET_TP_SRC" : "Modify Transport Source Port",
+            "SET_TP_DST" : "Modify Transport Destination Port"
+        }
+    });
+    return FlowsView;
+});
diff --git a/web/src/main/resources/js/views/HomeView.js b/web/src/main/resources/js/views/HomeView.js
new file mode 100644 (file)
index 0000000..fcc3f76
--- /dev/null
@@ -0,0 +1,21 @@
+define(
+  [
+    'jquery',
+    'backbone',
+    'underscore',
+    'ext/text/text!templates/home.html'
+    ], function($, Backbone, _, HomeTemplate) {
+      var HomeView = Backbone.View.extend({
+        el: $("#main"),
+        initialize: function() {
+          var self = this;
+          self.render();
+        },
+        render: function() {
+          var self = this;
+          var compiledTemplate = _.template(HomeTemplate,{});
+          $(self.el).append($(compiledTemplate).html());
+        }
+      });
+      return HomeView;
+    });
diff --git a/web/src/main/resources/node/README b/web/src/main/resources/node/README
new file mode 100644 (file)
index 0000000..bb87469
--- /dev/null
@@ -0,0 +1,3 @@
+ensure you install node modules (npm install <module>)
+`node server.js`
+go to <your-ip>:8000
diff --git a/web/src/main/resources/node/relay.js b/web/src/main/resources/node/relay.js
new file mode 100644 (file)
index 0000000..f801f86
--- /dev/null
@@ -0,0 +1,26 @@
+var http = require('http');
+
+var Relay = function(req, res) {
+  //res.writeHead(200, {'content-type': 'text/plain'});
+  //res.end('Simple');
+  var options = {
+    headers : req.headers,
+    method : req.method,
+    port : '8080',
+    //path : '/controller/nb/v2/switchmanager/default/nodes'
+    path : req.url
+  };
+  var request = http.request(options, function(response) {
+    var str = '';
+    response.on('data', function(chunk) {
+      str += chunk;
+    });
+    response.on('end', function() {
+      res.writeHead(response.statusCode, response.headers);
+      res.end(str);
+    });
+  });
+  request.end();
+}
+
+module.exports = Relay;
diff --git a/web/src/main/resources/node/routing.js b/web/src/main/resources/node/routing.js
new file mode 100644 (file)
index 0000000..e4960d7
--- /dev/null
@@ -0,0 +1,56 @@
+var Routing = function() {
+  var _routes = [];
+  var _roots = [];
+  var _addRoute = function(url, action) {
+    var route = {
+      Url: url,
+      Action: action
+    };
+    _routes.push(route);
+  };
+  var _addRoot = function(root, action) {
+    var root = {
+      Root: root,
+      Action: action
+    };
+    _roots.push(root);
+  };
+  var _process = function(req, res) {
+    var route = _getRoute(req);
+    if (route && route.Action) {
+      route.Action(req, res);
+      return true;
+    }
+    var root = _getRoot(req);
+    if (root && root.Action) {
+      root.Action(req, res);
+      return true;
+    }
+    return false;
+  };
+  var _getRoute = function(req) {
+    for(var i = 0, length = _routes.length; i < length; i++) {
+      if (req.url === _routes[i].Url) {
+        return _routes[i];
+      }
+    }
+  };
+  var _getRoot = function(req) {
+    var elements = req.url.split('/');
+    if (elements.length > 1) {
+      var root = elements[1];
+      for(var i = 0, length = _roots.length; i < length; i++) {
+        if (root === _roots[i].Root) {
+          return _roots[i];
+        }
+      }
+    }
+  };
+  return {
+    AddRoute: _addRoute,
+    AddRoot: _addRoot,
+    Process: _process
+  };
+}();
+
+module.exports = Routing;
diff --git a/web/src/main/resources/node/server.js b/web/src/main/resources/node/server.js
new file mode 100644 (file)
index 0000000..3038216
--- /dev/null
@@ -0,0 +1,17 @@
+var http = require('http'),
+routing = require('./routing'),
+relay = require('./relay'),
+static = require('./static');
+
+/* Routing (Route or Root) */
+
+//routing.AddRoute('/simple', relay);
+routing.AddRoot('controller', relay);
+routing.AddRoot('web.json', relay);
+
+/* Server start */
+var server = http.createServer(function(req, res) {
+  if (routing.Process(req, res) === false) {
+    static(req, res); // if no matches, then serve a static file
+  }
+}).listen(8000);
diff --git a/web/src/main/resources/node/static.js b/web/src/main/resources/node/static.js
new file mode 100644 (file)
index 0000000..cea6653
--- /dev/null
@@ -0,0 +1,33 @@
+var url = require('url'),
+path = require('path'),
+fs = require('fs'),
+mime = require('mime');
+
+var Static = function(request, response) {
+  var uri = url.parse(request.url).pathname, filename = path.join(process.cwd(), uri);
+  fs.exists(filename, function(exists) {
+    if(!exists) {
+      response.writeHead(404, {"Content-Type": "text/plain"});
+      response.write("404 Not Found\n");
+      response.end();
+      return;
+    }
+
+    if (fs.statSync(filename).isDirectory()) filename += '/index.html';
+
+    fs.readFile(filename, "binary", function(err, file) {
+      if(err) {
+        response.writeHead(500, {"Content-Type": "text/plain"});
+        response.write(err + "\n");
+        response.end();
+        return;
+      }
+
+      response.writeHead(200, {"Content-Type": mime.lookup(filename)});
+      response.write(file, "binary");
+      response.end();
+    });
+  });
+}
+
+module.exports = Static;