diff --git a/.gitignore b/.gitignore index 6472d1051b..a4ed5adb49 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ .pydevproject .recommenders .settings +.fbExcludeFilterFile target target-ide *.iml @@ -23,7 +24,7 @@ maven-metadata-local.xml *.md.html dependencies code*/dist* - +dist/ code/ux/ux-dev.sh core/store/trivial/data/ core/store/apps @@ -33,3 +34,4 @@ yang-gen-sal/ yang-gen-config/ models/tools/src/main/odl-yang-to-sources/src/main/yang/core-model@2017-12-29.yang wireless-transport/ +yarn-error.log diff --git a/bin/odl.sh b/bin/odl.sh index f25428cf4e..fe9b6f984e 100755 --- a/bin/odl.sh +++ b/bin/odl.sh @@ -30,7 +30,7 @@ Version=2.24 # ----- Constants not depending on variables specified by $CONFIG -ODLPARENT="0.5.1-SNAPSHOT" +ODLPARENT="0.7.3-SNAPSHOT" STARTFEATURE="odl-dev-all" KARAFSLEEPFORSTART=30 ODLBIN=../bin diff --git a/code-Oxygen-SR3/apps/odlux-core/LICENSE b/code-Oxygen-SR3/apps/odlux-core/LICENSE new file mode 100644 index 0000000000..3556ffa71f --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/LICENSE @@ -0,0 +1,13 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2018 highstreet-technolgies. + * =================================================================== + * Licensed 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. + * ============LICENSE_END=============================================================================================================== + * + */ \ No newline at end of file diff --git a/code-Oxygen-SR3/apps/odlux-core/features/.gitignore b/code-Oxygen-SR3/apps/odlux-core/features/.gitignore new file mode 100644 index 0000000000..eacf31a678 --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/features/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/code-Oxygen-SR3/apps/odlux-core/features/pom.xml b/code-Oxygen-SR3/apps/odlux-core/features/pom.xml new file mode 100644 index 0000000000..2c01f2ef45 --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/features/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + + org.opendaylight.odlparent + single-feature-parent + 3.1.3 + + + com.highstreet.technologies.odlux + odlux-core-features + 0.7.3-SNAPSHOT + ${project.artifactId} + + + 3.3.3 + + + + + + src/main/features + true + + **/* + + + + + + org.apache.maven.plugins + maven-resources-plugin + + false + + ${*} + + + + + filter + generate-resources + + resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + target/classes/features.xml + xml + features + + + + + + + + + diff --git a/code-Oxygen-SR3/apps/odlux-core/features/src/main/features/features.xml b/code-Oxygen-SR3/apps/odlux-core/features/src/main/features/features.xml new file mode 100644 index 0000000000..6ee5fd05d9 --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/features/src/main/features/features.xml @@ -0,0 +1,11 @@ + + + + + http + mvn:com.highstreet.technologies.odlux/odlux-core-impl/${project.version} + + + diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/pom.xml b/code-Oxygen-SR3/apps/odlux-core/impl/pom.xml new file mode 100644 index 0000000000..d82c8b7073 --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/pom.xml @@ -0,0 +1,59 @@ + + + + + 4.0.0 + com.highstreet.technologies.odlux + odlux-core-impl + bundle + + + com.highstreet.technologies.odlux-core + odlux-core-parent + 0.7.3-SNAPSHOT + + + + + javax.servlet + servlet-api + 2.5 + + + org.slf4j + slf4j-log4j12 + 1.7.25 + + + org.json + json + 20131018 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.apache.felix + maven-bundle-plugin + true + + + org.json.json;resolution:=optional,*; + + json* + + + + + + diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/IndexServlet.java b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/IndexServlet.java new file mode 100644 index 0000000000..7f0dc0ad7b --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/IndexServlet.java @@ -0,0 +1,58 @@ +package com.highstreet.technologies.odlux; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.opensymphony.xwork2.util.ClassLoaderUtil; + +public class IndexServlet extends HttpServlet { + /** + * + */ + private static final long serialVersionUID = 3039669437157215355L; + private static final String LR = "\n"; + private static Logger LOG = LoggerFactory.getLogger(IndexServlet.class); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + LOG.debug("req in indexservlet :"+req.getRequestURI()); + URL url = ClassLoaderUtil.getResource("index.html", this.getClass()); + String fileContent = this.loadFileContent(url); + if (fileContent != null) { + LOG.debug("found file in res. write to output stream"); + resp.setStatus(200); + resp.getOutputStream().write(fileContent.getBytes(java.nio.charset.StandardCharsets.UTF_8)); + } else { + LOG.debug("no file found in res."); + resp.setStatus(404); + } + } + private String loadFileContent(URL url) { + StringBuilder sb = new StringBuilder(); + BufferedReader in; + try { + in = new BufferedReader(new InputStreamReader(url.openStream())); + + String inputLine; + while ((inputLine = in.readLine()) != null) + sb.append(inputLine + LR); + in.close(); + } catch (IOException e) { + LOG.warn("could not load resfile " + url.toString() + ": " + e.getMessage()); + return null; + } + + return sb.toString(); + } + +} diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/ResFilesServlet.java b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/ResFilesServlet.java new file mode 100644 index 0000000000..dc883bf32b --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/ResFilesServlet.java @@ -0,0 +1,68 @@ +package com.highstreet.technologies.odlux; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.URL; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.opensymphony.xwork2.util.ClassLoaderUtil; + +public class ResFilesServlet extends HttpServlet { + + /** + * + */ + private static final long serialVersionUID = -6807215213921798293L; + private static final String LR = "\n"; + private static Logger LOG = LoggerFactory.getLogger(ResFilesServlet.class); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + + LOG.debug("get req: " + req.getRequestURI().toString()); + String fn = req.getRequestURI().toString(); + + URL url = ClassLoaderUtil.getResource(fn, this.getClass()); + String fileContent = this.loadFileContent(url); + if (fileContent != null) { + LOG.debug("found file in res. write to output stream"); + resp.setStatus(200); + OutputStream os=resp.getOutputStream(); + os.write(fileContent.getBytes(java.nio.charset.StandardCharsets.UTF_8)); + os.flush(); + } else { + LOG.debug("no file found in res."); + resp.setStatus(404); + + } + } + + private String loadFileContent(URL url) { + if(url==null) + return null; + StringBuilder sb = new StringBuilder(); + BufferedReader in; + try { + in = new BufferedReader(new InputStreamReader(url.openStream())); + + String inputLine; + while ((inputLine = in.readLine()) != null) + sb.append(inputLine + LR); + in.close(); + } catch (IOException e) { + LOG.warn("could not load resfile " + url.toString() + ": " + e.getMessage()); + return null; + } + + return sb.toString(); + } + +} diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/RootServlet.java b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/RootServlet.java new file mode 100644 index 0000000000..63e3aa129b --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/highstreet/technologies/odlux/RootServlet.java @@ -0,0 +1,29 @@ +package com.highstreet.technologies.odlux; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RootServlet extends HttpServlet { + + + /** + * + */ + private static final long serialVersionUID = -2622614831559561459L; + private static Logger LOG = LoggerFactory.getLogger(RootServlet.class); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + + LOG.debug("redirect to index2.html"); + resp.sendRedirect("index2.html"); + super.doGet(req, resp); + } +} diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java new file mode 100644 index 0000000000..10705b0ea6 --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java @@ -0,0 +1,235 @@ +/* + * Copyright 2002-2003,2009 The Apache Software Foundation. + * + * Licensed 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. + */ +package com.opensymphony.xwork2.util; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.*; + + +/** + * This class is extremely useful for loading resources and classes in a fault tolerant manner + * that works across different applications servers. + * + * It has come out of many months of frustrating use of multiple application servers at Atlassian, + * please don't change things unless you're sure they're not going to break in one server or another! + * + * It was brought in from oscore trunk revision 147. + * + * @author $Author$ + * @version $Revision$ + */ +public class ClassLoaderUtil { + //~ Methods //////////////////////////////////////////////////////////////// + + /** + * Load all resources with a given name, potentially aggregating all results + * from the searched classloaders. If no results are found, the resource name + * is prepended by '/' and tried again. + * + * This method will try to load the resources using the following methods (in order): + * + * + * @param resourceName The name of the resources to load + * @param callingClass The Class object of the calling object + */ + public static Iterator getResources(String resourceName, Class callingClass, boolean aggregate) throws IOException { + + AggregateIterator iterator = new AggregateIterator(); + + iterator.addEnumeration(Thread.currentThread().getContextClassLoader().getResources(resourceName)); + + if (!iterator.hasNext() || aggregate) { + iterator.addEnumeration(ClassLoaderUtil.class.getClassLoader().getResources(resourceName)); + } + + if (!iterator.hasNext() || aggregate) { + ClassLoader cl = callingClass.getClassLoader(); + + if (cl != null) { + iterator.addEnumeration(cl.getResources(resourceName)); + } + } + + if (!iterator.hasNext() && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) { + return getResources('/' + resourceName, callingClass, aggregate); + } + + return iterator; + } + + /** + * Load a given resource. + * + * This method will try to load the resource using the following methods (in order): + *
    + *
  • From Thread.currentThread().getContextClassLoader() + *
  • From ClassLoaderUtil.class.getClassLoader() + *
  • callingClass.getClassLoader() + *
+ * + * @param resourceName The name IllegalStateException("Unable to call ")of the resource to load + * @param callingClass The Class object of the calling object + */ + public static URL getResource(String resourceName, Class callingClass) { + URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName); + + if (url == null) { + url = ClassLoaderUtil.class.getClassLoader().getResource(resourceName); + } + + if (url == null) { + ClassLoader cl = callingClass.getClassLoader(); + + if (cl != null) { + url = cl.getResource(resourceName); + } + } + + if ((url == null) && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) { + return getResource('/' + resourceName, callingClass); + } + + return url; + } + + /** + * This is a convenience method to load a resource as a stream. + * + * The algorithm used to find the resource is given in getResource() + * + * @param resourceName The name of the resource to load + * @param callingClass The Class object of the calling object + */ + public static InputStream getResourceAsStream(String resourceName, Class callingClass) { + URL url = getResource(resourceName, callingClass); + + try { + return (url != null) ? url.openStream() : null; + } catch (IOException e) { + return null; + } + } + + /** + * Load a class with a given name. + * + * It will try to load the class in the following order: + *
    + *
  • From Thread.currentThread().getContextClassLoader() + *
  • Using the basic Class.forName() + *
  • From ClassLoaderUtil.class.getClassLoader() + *
  • From the callingClass.getClassLoader() + *
+ * + * @param className The name of the class to load + * @param callingClass The Class object of the calling object + * @throws ClassNotFoundException If the class cannot be found anywhere. + */ + public static Class loadClass(String className, Class callingClass) throws ClassNotFoundException { + try { + return Thread.currentThread().getContextClassLoader().loadClass(className); + } catch (ClassNotFoundException e) { + try { + return Class.forName(className); + } catch (ClassNotFoundException ex) { + try { + return ClassLoaderUtil.class.getClassLoader().loadClass(className); + } catch (ClassNotFoundException exc) { + return callingClass.getClassLoader().loadClass(className); + } + } + } + } + + /** + * Aggregates Enumeration instances into one iterator and filters out duplicates. Always keeps one + * ahead of the enumerator to protect against returning duplicates. + */ + static class AggregateIterator implements Iterator { + + LinkedList> enums = new LinkedList>(); + Enumeration cur = null; + E next = null; + Set loaded = new HashSet(); + + public AggregateIterator addEnumeration(Enumeration e) { + if (e.hasMoreElements()) { + if (cur == null) { + cur = e; + next = e.nextElement(); + loaded.add(next); + } else { + enums.add(e); + } + } + return this; + } + + public boolean hasNext() { + return (next != null); + } + + public E next() { + if (next != null) { + E prev = next; + next = loadNext(); + return prev; + } else { + throw new NoSuchElementException(); + } + } + + private Enumeration determineCurrentEnumeration() { + if (cur != null && !cur.hasMoreElements()) { + if (enums.size() > 0) { + cur = enums.removeLast(); + } else { + cur = null; + } + } + return cur; + } + + private E loadNext() { + if (determineCurrentEnumeration() != null) { + E tmp = cur.nextElement(); + int loadedSize = loaded.size(); + while (loaded.contains(tmp)) { + tmp = loadNext(); + if (tmp == null || loaded.size() > loadedSize) { + break; + } + } + if (tmp != null) { + loaded.add(tmp); + } + return tmp; + } + return null; + + } + + public void remove() { + throw new UnsupportedOperationException(); + } + } +} \ No newline at end of file diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 0000000000..10914a5ab4 --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/index.html b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/index.html new file mode 100644 index 0000000000..fdfc11f20d --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/index.html @@ -0,0 +1,24 @@ + + + + + + + + + O D L UX + + + +
+ + + + + + \ No newline at end of file diff --git a/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/odlux/apiDemo.js b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/odlux/apiDemo.js new file mode 100644 index 0000000000..bff38c0aa7 --- /dev/null +++ b/code-Oxygen-SR3/apps/odlux-core/impl/src/main/resources/odlux/apiDemo.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("app")):"function"==typeof define&&define.amd?define(["app"],t):"object"==typeof exports?exports.apiDemo=t(require("app")):e.apiDemo=t(e.app)}(window,function(n){return function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=n,r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";n.r(t);var o=n(2),r=n(4),i=n(5),u=n(6),c=n(7),s=n(8),f=n(9),a=n(12),l=void 0;function p(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}var d=function(e){var n=this;return p(this,l),o.createElement(o.Fragment,null,o.createElement("button",{onClick:e.requestModules},"Load Modules"),o.createElement("ul",null,e.modules.map(function(e,t){return p(this,n),o.createElement("li",{key:t},e.name)}.bind(this))))}.bind(void 0),m=Object(r.withRouter)(Object(c.default)(function(e){return p(this,l),{modules:e.apiDemo.modules}}.bind(void 0),function(e){var t=this;return p(this,l),{requestModules:function(){p(this,t),e.dispatch(new s.ApiAction("restconf/modules",a.ModulesRequestSuccess,!0))}.bind(this)}}.bind(void 0))(d));u.default.registerApplication({name:"apiDemo",icon:i.faNewspaper,rootComponent:m,rootActionHandler:f.apiDemoRootHandler,menuEntry:"API Demo"})},function(e,t,n){e.exports=n(3)("../../node_modules/react/index.js")},function(e,t){e.exports=n},function(e,t,n){e.exports=n(3)("../../node_modules/react-router-dom/es/index.js")},function(e,t,n){e.exports=n(3)("../../node_modules/@fortawesome/free-solid-svg-icons/index.es.js")},function(e,t,n){e.exports=n(3)("./services/applicationManager.ts")},function(e,t,n){e.exports=n(3)("./flux/connect.ts")},function(e,t,n){e.exports=n(3)("./middleware/api.ts")},function(e,t,n){"use strict";n.r(t),n.d(t,"apiDemoRootHandler",function(){return i});var o=n(10),r={modules:n(11).moduleHandler},i=Object(o.combineActionHandler)(r);t.default=i},function(e,t,n){e.exports=n(3)("./flux/middleware.ts")},function(e,t,n){"use strict";n.r(t),n.d(t,"moduleHandler",function(){return i});var o=n(12);var r=[],i=function(){var e=0