Skip to content

Commit

Permalink
add odlux feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack committed Dec 19, 2018
1 parent 1d8540b commit 6182f0b
Show file tree
Hide file tree
Showing 124 changed files with 15,146 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.pydevproject
.recommenders
.settings
.fbExcludeFilterFile
target
target-ide
*.iml
Expand All @@ -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
Expand All @@ -33,3 +34,4 @@ yang-gen-sal/
yang-gen-config/
models/tools/src/main/odl-yang-to-sources/src/main/yang/[email protected]
wireless-transport/
yarn-error.log
2 changes: 1 addition & 1 deletion bin/odl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions code-Oxygen-SR3/apps/odlux-core/LICENSE
Original file line number Diff line number Diff line change
@@ -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===============================================================================================================
*
*/
1 change: 1 addition & 0 deletions code-Oxygen-SR3/apps/odlux-core/features/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target-ide/
73 changes: 73 additions & 0 deletions code-Oxygen-SR3/apps/odlux-core/features/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<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.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
<version>3.1.3</version>
<relativePath/>
</parent>
<groupId>com.highstreet.technologies.odlux</groupId>
<artifactId>odlux-core-features</artifactId>
<version>0.7.3-SNAPSHOT</version>
<name>${project.artifactId}</name>

<prerequisites>
<maven>3.3.3</maven>
</prerequisites>

<build>
<resources>
<resource>
<directory>src/main/features</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
</configuration>
<executions>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/features.xml</file>
<type>xml</type>
<classifier>features</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="odlux-core-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">

<feature name="odl-ht-odlux" version="${project.version}" description="OpenDaylight :: ODLUX :: Core">
<feature>http</feature>
<bundle>mvn:com.highstreet.technologies.odlux/odlux-core-impl/${project.version}</bundle>
</feature>

</features>
59 changes: 59 additions & 0 deletions code-Oxygen-SR3/apps/odlux-core/impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.highstreet.technologies.odlux</groupId>
<artifactId>odlux-core-impl</artifactId>
<packaging>bundle</packaging>

<parent>
<groupId>com.highstreet.technologies.odlux-core</groupId>
<artifactId>odlux-core-parent</artifactId>
<version>0.7.3-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20131018</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package> org.json.json;resolution:=optional,*;
</Import-Package>
<Embed-Dependency>json*</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading

0 comments on commit 6182f0b

Please sign in to comment.