http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/get-edgent-jars-project/pom.xml.template ---------------------------------------------------------------------- diff --git a/samples/get-edgent-jars-project/pom.xml.template b/samples/get-edgent-jars-project/pom.xml.template deleted file mode 100644 index f8c9f1a..0000000 --- a/samples/get-edgent-jars-project/pom.xml.template +++ /dev/null @@ -1,148 +0,0 @@ -<?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. - ---> -<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> - - <!-- standalone project --> - <!--parent> - <groupId>org.apache.edgent</groupId> - <artifactId>edgent-parent</artifactId> - <version>1.2.0</version> - </parent--> - - <groupId>org.apache.edgent</groupId> - <artifactId>get-edgent-jars-project</artifactId> - <version>1.3.0-SNAPSHOT</version> - - <name>Apache Edgent get-edgent-jars-project ${samples.projname.platform}</name> - - <properties> - <samples.projname.platform> (Java 8)</samples.projname.platform> <!-- tweaked by -Pplatform-* --> - <edgent.platform>java8</edgent.platform> <!-- tweaked by -Pplatform-* --> - <edgent.groupId.platform/> <!-- tweaked by -Pplatform-* --> - <edgent.base.groupId>org.apache.edgent${edgent.groupId.platform}</edgent.base.groupId> - <!-- at least for now, the samples version is lockstep with the core - so default to using the same core as the this project. - get-edgent-jars.sh overrides via -Dedgent.runtime.version=... - --> - <edgent.runtime.version>${project.version}</edgent.runtime.version> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <version>2.5.3</version> - <configuration> - <finalName>edgent-${edgent.platform}-jars-${edgent.runtime.version}</finalName> - </configuration> - </plugin> - </plugins> - </pluginManagement> - - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-remote-resources-plugin</artifactId> - <version>1.5</version><!--$NO-MVN-MAN-VER$--> - <executions> - <execution> - <id>process-resource-bundles</id> - <goals> - <goal>process</goal> - </goals> - <configuration> - <resourceBundles> - <!-- Will generate META-INF/{DEPENDENCIES,LICENSE,NOTICE} --> - <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle> - <!-- Will generate META-INF/DISCLAIMER (incubator version) --> - <resourceBundle>org.apache:apache-incubator-disclaimer-resource-bundle:1.1</resourceBundle> - </resourceBundles> - <!-- Content in this directory will be appended to generated resources --> - <appendedResourcesDirectory>${remote-resources-maven-plugin.remote-resources.dir}</appendedResourcesDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptor>src/assembly/distribution.xml</descriptor> - </configuration> - <executions> - <execution> - <id>create-archive</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - <!-- We don't need any jars as output in this module --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <id>default-jar</id> - <phase>none</phase> - </execution> - <execution> - <id>default</id> - <phase>none</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>platform-java7</id> - <properties> - <edgent.platform>java7</edgent.platform> - <edgent.groupId.platform>.${edgent.platform}</edgent.groupId.platform> - <platform.java7>true</platform.java7> - <samples.projname.platform> (Java 7)</samples.projname.platform> - </properties> - </profile> - <profile> - <id>platform-android</id> - <properties> - <edgent.platform>android</edgent.platform> - <edgent.groupId.platform>.${edgent.platform}</edgent.groupId.platform> - <platform.android>true</platform.android> - <samples.projname.platform> (Android)</samples.projname.platform> - </properties> - </profile> - </profiles> - - <dependencies> -<!-- INJECT_DEPENDENCIES_HERE --> - </dependencies> - -</project>
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/get-edgent-jars-project/src/assembly/distribution.xml ---------------------------------------------------------------------- diff --git a/samples/get-edgent-jars-project/src/assembly/distribution.xml b/samples/get-edgent-jars-project/src/assembly/distribution.xml deleted file mode 100644 index 2f6da23..0000000 --- a/samples/get-edgent-jars-project/src/assembly/distribution.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?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. - ---> -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - - <!-- - NOTE: each platform (platforms/java7 and platforms/android) have their - own distribution project and a copy of this configuration file that - must be manually kept in sync. - --> - - <id>bin</id> - - <formats> - <format>tar.gz</format> - <format>tar.bz2</format> - <format>zip</format> - </formats> - - <fileSets> - <fileSet> - <directory>${project.build.outputDirectory}/META-INF</directory> - <includes> - <include>DISCLAIMER</include> - <include>DEPENDENCIES</include> - </includes> - <outputDirectory/> - </fileSet> - - <fileSet> - <directory>${project.build.outputDirectory}</directory> - <includes> - <include>README</include> - </includes> - <outputDirectory/> - </fileSet> - - </fileSets> - - <dependencySets> - <!-- Any edgent libs --> - <dependencySet> - <outputDirectory>libs</outputDirectory> - <scope>runtime</scope> - <includes> - <include>org.apache.edgent*</include> - </includes> - <excludes> - <exclude>org.apache.edgent*:get-edgent-jars-project</exclude> - </excludes> - </dependencySet> - - <!-- All other libs are treated as external libs --> - <dependencySet> - <outputDirectory>ext</outputDirectory> - <scope>runtime</scope> - <excludes> - <exclude>org.apache.edgent*</exclude> - </excludes> - </dependencySet> - </dependencySets> - -</assembly> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/get-edgent-jars-project/src/main/resources/README ---------------------------------------------------------------------- diff --git a/samples/get-edgent-jars-project/src/main/resources/README b/samples/get-edgent-jars-project/src/main/resources/README deleted file mode 100644 index d91c7ff..0000000 --- a/samples/get-edgent-jars-project/src/main/resources/README +++ /dev/null @@ -1,12 +0,0 @@ -This bundle includes a number of artifacts with separate -copyright notices and license terms. Your use of an artifact -is subject to that artifactâs licensing terms and conditions. - -The Apache Edgent artifacts (everything in lib) all have the -license âApache License Version 2.0â. - -Edgentâs dependent artifacts in âextâ have all been evaluated -to be compatible with Edgentâs license. - -A bundled artifact's advertised license information may be -found in the DEPENDENCIES file in this bundle. http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/mvnw ---------------------------------------------------------------------- diff --git a/samples/mvnw b/samples/mvnw deleted file mode 100755 index 53d9860..0000000 --- a/samples/mvnw +++ /dev/null @@ -1,268 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" -else - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - - jarUrl="https://repo1.maven.org/maven2/io/takari/maven-wrapper/0.2.1/maven-wrapper-0.2.1.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - echo "Downloading from: $jarUrl" - - if command -v wget > /dev/null; then - echo "Found wget ... using wget" - wget -O "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" "$jarUrl" - elif command -v curl > /dev/null; then - echo "Found curl ... using curl" - curl -o "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" "$jarUrl" - else - echo "Falling back to using Java to download" - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - echo " - Running MavenWrapperDownloader.java ..." - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/mvnw.cmd ---------------------------------------------------------------------- diff --git a/samples/mvnw.cmd b/samples/mvnw.cmd deleted file mode 100644 index 898fb06..0000000 --- a/samples/mvnw.cmd +++ /dev/null @@ -1,159 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo1.maven.org/maven2/io/takari/maven-wrapper/0.2.1/maven-wrapper-0.2.1.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% -) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% -) -@REM End of extension - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/package-app.sh ---------------------------------------------------------------------- diff --git a/samples/package-app.sh b/samples/package-app.sh deleted file mode 100755 index c27edcc..0000000 --- a/samples/package-app.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh -# -# 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. -# - -## Create a self contained application specific tar bundle that can be -## brought to a system, unpacked and run. -## -## Run from the Application project's top level directory. - -USAGE="usage: `basename $0` [--platform {java8|java7|android}] [--mainClass classname] [--appjar jarname] [--add csv-paths] [--mvn mvn-cmd]" - -## --platform the platform the app was built for (default: java8. options: java7, android) -## This controls which Edgent platform jars are collected. -## E.g., use "--platform java7" when the app is built using -## the profile "-Pplatform-java7". -## --mainClass the main class name (default: com.mycompany.app.App) -## --appjar the application jar name (default: my-app-1.0-SNAPSHOT.jar) -## --add additional csv paths to include in the tarball (default: none) -## Works best for paths in/under the App's project dir. -## NOTE: anything in the App's src/main/resources dir generally -## gets included in the App's jar. -## --mvn mvn-cmd use mvn-cmd instead of "./mvnw" - -set -e - -SAMPLES_DIR=`(cd $(dirname $0); pwd)` -MVN_CMD=${SAMPLES_DIR}/mvnw - -MAIN_CLASS=com.mycompany.app.App -APP_JAR=my-app-1.0-SNAPSHOT.jar -ADD_PATHS= -PLATFORM= - -if [ "${1}" = "--platform" -a $# -gt 1 ] ; then - PLATFORM=${2}; shift; shift - if [ "${PLATFORM}" = "java8" ] ; then - PLATFORM= - fi -fi -if [ "${1}" = "--mainClass" -a $# -gt 1 ] ; then - MAIN_CLASS=${2}; shift; shift -fi -if [ "${1}" = "--appjar" -a $# -gt 1 ] ; then - APP_JAR=${2}; shift; shift -fi -if [ "${1}" = "--add" -a $# -gt 1 ] ; then - ADD_PATHS=${2}; shift; shift - ADD_PATHS=`echo ${ADD_PATHS} | sed -e 's/,/ /g'` -fi -if [ $# != 0 ]; then - echo "$USAGE" - exit 1 -fi - -TGT_REL_APP_JAR=`basename ${APP_JAR}` # support spec like target/my.jar - -echo -echo "##### get the app specific dependencies..." -PROFILES= -if [ "${PLATFORM}" ] ; then - PROFILES="-Pplatform-${PLATFORM}" -fi -rm -rf target/dependency -# if someone screws up j7 or android deps, uncomment the following and -# it will help identify wrong jars that are getting included / copied. -#DEBUG_DEPS=-Dmdep.prependGroupId=true -${MVN_CMD} dependency:copy-dependencies -DincludeScope=runtime ${PROFILES} ${DEBUG_DEPS} - -echo -echo "##### create target/app-run.sh..." -cat >target/app-run.sh <<EOF -#!/bin/sh - -set -e - -USAGE="usage: \`basename \$0\` [ args ... ]" - -CP=${TGT_REL_APP_JAR} -for i in dependency/\*; do - CP=\${CP}:\${i} -done - -export CLASSPATH=\${CP} -java ${MAIN_CLASS} "\$@" -EOF -chmod +x target/app-run.sh - -echo -echo "##### create target/app-pkg.tar..." -D=`pwd` -tar cf target/app-pkg.tar -C target app-run.sh ${TGT_REL_APP_JAR} dependency -C ${D} ${ADD_PATHS} - -echo -echo "##### Copy target/app-pkg.tar to the destination system" -echo "##### To run the app:" -echo "##### mkdir app-pkg" -echo "##### tar xf app-pkg.tar -C app-pkg" -echo "##### (cd app-pkg; ./app-run.sh)" http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/pom.xml ---------------------------------------------------------------------- diff --git a/samples/pom.xml b/samples/pom.xml deleted file mode 100644 index a10e91c..0000000 --- a/samples/pom.xml +++ /dev/null @@ -1,289 +0,0 @@ -<?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. - ---> -<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.apache</groupId> - <artifactId>apache</artifactId> - <version>18</version> - </parent> - - <groupId>org.apache.edgent.samples</groupId> - <artifactId>edgent-samples</artifactId> - <version>1.3.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <name>Apache Edgent Samples ${samples.projname.platform}:</name> - - <properties> - <samples.projname.platform>(Java 8)</samples.projname.platform> <!-- tweaked by -Pplatform-* --> - <edgent.runtime.platform/> <!-- set by -Pplatform-* --> - <edgent.runtime.groupId>org.apache.edgent${edgent.runtime.platform}</edgent.runtime.groupId> - <!-- at least for now, the samples version is lockstep with the core --> - <edgent.runtime.version>${project.version}</edgent.runtime.version> - - <java.version>1.8</java.version> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputencoding>UTF-8</project.reporting.outputencoding> - <maven.version>3.3.1</maven.version> - - <jetty.version>9.3.6.v20151106</jetty.version> - <gson.version>2.2.4</gson.version> - <slf4j.version>1.7.12</slf4j.version> - <retrolambda.version>2.5.1</retrolambda.version> - </properties> - - <modules> - <module>apps</module> - <module>connectors</module> - <module>console</module> - <!-- <module>get-edgent-jars-project</module> intentionally omitted --> - <module>scenarios</module> - <!-- <module>template</module> intentionally omitted --> - <module>topology</module> - <module>utils</module> - </modules> - - <profiles> - <profile> - <id>platform-java7</id> - <properties> - <edgent.runtime.platform>.java7</edgent.runtime.platform> - <platform.java7>true</platform.java7> - <samples.projname.platform>(Java 7)</samples.projname.platform> - </properties> - <build> - <plugins> - <plugin> - <groupId>net.orfjackal.retrolambda</groupId> - <artifactId>retrolambda-maven-plugin</artifactId> - <version>${retrolambda.version}</version> - <executions> - <execution> - <goals> - <goal>process-main</goal> - <goal>process-test</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - <!-- We don't currently support building samples for Android as many - depend on the Development provider / Edgent Console - --> - </profiles> - - <dependencies> - <!-- - In the examples we want this lib to be included, - so we change the scope from 'provided' to 'compile'. - --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4j.version}</version> - <scope>compile</scope> - </dependency> - - <!-- an SLF4J runtime implementation to use --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-jdk14</artifactId> - <version>${slf4j.version}</version> - <scope>runtime</scope> - </dependency> - - <!-- Other common sample dependencies --> - <dependency> - <groupId>${edgent.runtime.groupId}</groupId> - <artifactId>edgent-providers-direct</artifactId> - <version>${edgent.runtime.version}</version> - </dependency> - <dependency> - <groupId>${edgent.runtime.groupId}</groupId> - <artifactId>edgent-providers-development</artifactId> - <version>${edgent.runtime.version}</version> - </dependency> - <dependency> - <groupId>${edgent.runtime.groupId}</groupId> - <artifactId>edgent-providers-iot</artifactId> - <version>${edgent.runtime.version}</version> - </dependency> - - </dependencies> - - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.6.1</version> - <configuration> - <source>${java.version}</source> - <target>${java.version}</target> - <testSource>${java.version}</testSource> - <testTarget>${java.version}</testTarget> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <version>3.0.1</version> - <executions> - <execution> - <id>attach-sources</id> - <phase>verify</phase> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - - <!-- Inject the "incubating" into the output filename --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <finalName>apache-edgent-${project.version}-incubating-samples</finalName> - <formats> - <format>zip</format> - <format>tar.gz</format> - </formats> - </configuration> - </plugin> - - <!-- - This is a fake plugin which is used to tell m2e (Eclipse) how - to process this maven project. - --> - <plugin> - <groupId>org.eclipse.m2e</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>1.0.0</version> - <configuration> - <lifecycleMappingMetadata> - <pluginExecutions> - <pluginExecution> - <pluginExecutionFilter> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <versionRange>[1.0.0,)</versionRange> - <goals> - <goal>copy</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore/> - </action> - </pluginExecution> - <pluginExecution> - <pluginExecutionFilter> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-remote-resources-plugin</artifactId> - <versionRange>[1.0.0,)</versionRange> - <goals> - <goal>process</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore/> - </action> - </pluginExecution> - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> - </plugins> - </pluginManagement> - - <plugins> - - <!-- Make sure the DISCLAIMER contains the incubator version --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-remote-resources-plugin</artifactId> - <version>1.5</version><!--$NO-MVN-MAN-VER$--> - <executions> - <execution> - <id>process-resource-bundles</id> - <goals> - <goal>process</goal> - </goals> - <configuration> - <resourceBundles> - <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle> - <!-- Will generate META-INF/DISCLAIMER --> - <resourceBundle>org.apache.apache.resources:apache-incubator-disclaimer-resource-bundle:1.2-SNAPSHOT</resourceBundle> - </resourceBundles> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <!-- build an uber JAR --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>3.0.0</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <!-- avoid things like the following when running the uber: - java.lang.NoClassDefFoundError: org.eclipse.paho.client.mqttv3.logging.JSR47Logger - e.g., connectors.iotp uses watson-iot which uses - paho.mqtt. Apparently watson-iot or paho.mqtt - has some behind the scenes depedency that's not - captured in the uber jar when minimize is true. - --> - <!-- <minimizeJar>true</minimizeJar> --> - <shadedArtifactAttached>true</shadedArtifactAttached> - <shadedClassifierName>uber</shadedClassifierName> - <!-- avoid "Invalid signature file digest for Manifest - main attributes" when running the uber jar. - An included jar's signed manifest isn't valid in the uber. - --> - <filters> - <filter> - <artifact>*:*</artifact> - <excludes> - <exclude>META-INF/*.SF</exclude> - <exclude>META-INF/*.DSA</exclude> - <exclude>META-INF/*.RSA</exclude> - </excludes> - </filter> - </filters> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/README.md ---------------------------------------------------------------------- diff --git a/samples/scenarios/README.md b/samples/scenarios/README.md deleted file mode 100644 index da1d9e3..0000000 --- a/samples/scenarios/README.md +++ /dev/null @@ -1,69 +0,0 @@ -<!-- - - 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. - ---> -# edgent.IoTFRangeSensor - -See the Recipe this was created for [here](https://developer.ibm.com/recipes/tutorials/apache-quarks-on-pi-to-watson-iot-foundation/). If that link doesn't work, try [here](https://developer.ibm.com/recipes/tutorials/apache-edgent-on-pi-to-watson-iot-foundation/). - -See the README.md in the samples root directory for information on building the samples. - -The build generated uber jar contains all of the dependent -Edgent jars and their transitive dependencies. - -The desired sample can be run using the run-sample.sh script. e.g., - -```sh -cd scenarios -./run-sample.sh IotpRangeSensor quickstart true true # see below -``` - -For usage information: - -```sh -./run-sample.sh -./run-sample.sh --list -``` - -If you want to run a sample from the standard jar there are two options: -a) get a local copy of all of the Edgent jars and their dependencies. - Form a CLASSPATH to the jars and run the sample's main class. - The get-edgent-jars.sh script can be used to get the jars from - a maven repository (local or remote). -b) create an application package bundle. The bundle includes the - sample(s) jar and a copy of all of the dependent Edgent jars - and their dependencies. The package-app.sh script can be - used to create this bundle. - The package-app.sh script also creates a run-app.sh script. - The run-app.sh script configures the CLASSPATH and runs the main class. - - -## Requirements: -* You will need to have an HC-SR04 Range sensor hooked up with your EchoPin set to pin 18 and your TripPin at pin 16 (see these instructions on hardware setup: http://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi). To use a simulated sensor, pass in true as your second argument. -* You will need to have an LED hooked up to pin 12 (See these instructions to set up an LED, however use pin 12 as your control pin: https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/). To use a simulated LED, pass in true as your third argument. -* You will need to have your device registered with Watson IoTF and a device.cfg file, or you can use a quickstart version by passing in "quickstart" as your first argument. - - -`./run-sample.sh IotpRangeSensor <device cfg file> <simulatedSensor?> <simulatedLED?>` - -To run with a device.cfg file, range sensor, and LED: - -`./run-sample.sh IotpRangeSensor device.cfg false false` - -To run in fully simulated mode (no sensors and using IoTF quickstart): - -`./run-sample.sh IotpRangeSensor quickstart true true` http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/pom.xml ---------------------------------------------------------------------- diff --git a/samples/scenarios/pom.xml b/samples/scenarios/pom.xml deleted file mode 100644 index 1bfcbe5..0000000 --- a/samples/scenarios/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ -<?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. - ---> -<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.apache.edgent.samples</groupId> - <artifactId>edgent-samples</artifactId> - <version>1.3.0-SNAPSHOT</version> - </parent> - - <artifactId>edgent-samples-scenarios</artifactId> - - <name>Apache Edgent Samples ${samples.projname.platform}: Scenarios</name> - - <build> - <plugins> - <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <executions> - <execution> - <id>license-check</id> - <phase>verify</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - <configuration> - <excludes combine.children="append"> - <exclude>src/main/resources/**/*.cfg</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - <!-- parent pom has Providers and SLF4J dependencies --> - - <dependency> - <groupId>${edgent.runtime.groupId}</groupId> - <artifactId>edgent-connectors-iotp</artifactId> - <version>${edgent.runtime.version}</version> - </dependency> - <dependency> - <groupId>${edgent.runtime.groupId}</groupId> - <artifactId>edgent-analytics-math3</artifactId> - <version>${edgent.runtime.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.edgent.samples</groupId> - <artifactId>edgent-samples-connectors</artifactId> - <version>1.3.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>com.pi4j</groupId> - <artifactId>pi4j-core</artifactId> - <version>1.1</version> - </dependency> - </dependencies> - -</project> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/run-sample.sh ---------------------------------------------------------------------- diff --git a/samples/scenarios/run-sample.sh b/samples/scenarios/run-sample.sh deleted file mode 100755 index 99536c1..0000000 --- a/samples/scenarios/run-sample.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -# -# 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. -# - -USAGE="usage: `basename $0` [--list] simple-main-class-name [sample-args]" - -CATEGORY=scenarios - -UBER_JAR=target/edgent-samples-${CATEGORY}-*-uber.jar - -SAMPLE_PACKAGE_BASE=org.apache.edgent.samples.${CATEGORY} -SAMPLES_FQ=`cat <<EOF -${SAMPLE_PACKAGE_BASE}.iotp.IotpFullScenario -${SAMPLE_PACKAGE_BASE}.iotp.range.sensor.IotpRangeSensor -EOF -` - -if [ "$1" = "--list" ] ; then - SAMPLES= - for i in ${SAMPLES_FQ}; do - SAMPLE=`echo ${i} | sed -e 's/.*\.//'` - SAMPLES="${SAMPLES} ${SAMPLE}" - done - echo ${SAMPLES} - exit 0 -fi -if [ "$1" = "" ] ; then - echo $USAGE - exit 1 -fi - -SAMPLE_NAME=$1 -shift - -SAMPLE_FQ= -for i in ${SAMPLES_FQ}; do - SAMPLE_FQ=`echo $i | grep -- "\.${SAMPLE_NAME}\$"` - if [ "${SAMPLE_FQ}" != "" ]; then - break - fi -done -if [ "${SAMPLE_FQ}" = "" ]; then - echo unrecognized sample name \"${SAMPLE_NAME}\" - echo ${USAGE} - exit 1 -fi - -set -x -java -cp ${UBER_JAR} "${SAMPLE_FQ}" "$@" - http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/IotpFullScenario.java ---------------------------------------------------------------------- diff --git a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/IotpFullScenario.java b/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/IotpFullScenario.java deleted file mode 100644 index 5fd37d9..0000000 --- a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/IotpFullScenario.java +++ /dev/null @@ -1,92 +0,0 @@ -/* -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. -*/ -package org.apache.edgent.samples.scenarios.iotp; - - -import java.io.File; - -import org.apache.edgent.connectors.iotp.IotpDevice; -import org.apache.edgent.providers.iot.IotProvider; -import org.apache.edgent.samples.connectors.iotp.IotpSensors; - -/** - * Sample IotProvider scenario using IBM Watson IoT Platform. - * <BR> - * IotProvider with three registered applications that - * are not started but can be started by a a remote - * application sending device commands through - * IBM Watson IoT Platform. - * <P> - * This is equivalent to the {@link IotpSensors} application - * but executing as three separate applications using - * {@link IotProvider} rather than the lower level - * {@link org.apache.edgent.providers.direct.DirectProvider}. - * - * </P> - * - * @see org.apache.edgent.topology.mbeans.ApplicationServiceMXBean - * @see <a href="{@docRoot}/org/apache/edgent/topology/mbeans/package-summary.html">org.apache.edgent.topology.mbeans</a> - */ -public class IotpFullScenario { - - /** - * Run the IotpFullScenario application. - * - * Takes a single argument that is the path to the - * device configuration file containing the connection - * authentication information. - * - * @param args Must contain the path to the device configuration file. - * @throws Exception on failure - * @see IotpDevice#IotpDevice(org.apache.edgent.topology.Topology, File) - */ - public static void main(String[] args) throws Exception { - String deviceCfg = args[0]; - - // Create an IotProvider that will use - // an IotpDevice as the connectivity to - // the IBM Watson IoT Platform message hub. - IotProvider provider = new IotProvider( - topology -> new IotpDevice(topology, new File(deviceCfg))); - - // Register three applications - registerHeartbeat(provider); - registerSensors(provider); - registerDisplay(provider); - - // Start this provider - // the three applications will not start - provider.start(); - } - - public static void registerHeartbeat(IotProvider provider) { - provider.registerTopology("Heartbeat", - (iotDevice,config) -> IotpSensors.heartBeat(iotDevice, true)); - } - - public static void registerSensors(IotProvider provider) { - provider.registerTopology("Sensors", - (iotDevice,config) -> IotpSensors.simulatedSensors(iotDevice, true)); - } - public static void registerDisplay(IotProvider provider) { - provider.registerTopology("Display", - (iotDevice,config) -> IotpSensors.displayMessages(iotDevice, true)); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/IotpRangeSensor.java ---------------------------------------------------------------------- diff --git a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/IotpRangeSensor.java b/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/IotpRangeSensor.java deleted file mode 100644 index b75be33..0000000 --- a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/IotpRangeSensor.java +++ /dev/null @@ -1,219 +0,0 @@ -/* -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. -*/ -package org.apache.edgent.samples.scenarios.iotp.range.sensor; - -import static org.apache.edgent.analytics.math3.stat.Statistic.MAX; -import static org.apache.edgent.analytics.math3.stat.Statistic.MEAN; -import static org.apache.edgent.analytics.math3.stat.Statistic.MIN; -import static org.apache.edgent.analytics.math3.stat.Statistic.STDDEV; - -import java.io.File; -import java.util.Date; -import java.util.Random; -import java.util.concurrent.TimeUnit; - -import org.apache.edgent.analytics.math3.json.JsonAnalytics; -import org.apache.edgent.connectors.iot.IotDevice; -import org.apache.edgent.connectors.iot.QoS; -import org.apache.edgent.connectors.iotp.IotpDevice; -import org.apache.edgent.function.Supplier; -import org.apache.edgent.providers.direct.DirectProvider; -import org.apache.edgent.providers.direct.DirectTopology; -import org.apache.edgent.topology.TStream; -import org.apache.edgent.topology.TWindow; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.pi4j.io.gpio.Pin; -import com.pi4j.io.gpio.RaspiPin; - -public class IotpRangeSensor { - private static final Pin echoPin = RaspiPin.GPIO_05; // PI4J custom - // numbering (pin 18 on - // RPi2) - private static final Pin trigPin = RaspiPin.GPIO_04; // PI4J custom - // numbering (pin 16 on - // RPi2) - private static final Pin ledPin = RaspiPin.GPIO_01; // PI4J custom numbering - // (pin 12 on RPi2) - - public static void main(String[] args) { - - if (args.length != 3) { - System.out.println("Proper Usage is:\n " + " java program device.cfg sensorIsSimulated LEDIsSimulated\n" - + "Example: \n" - + " java -cp $EDGENT/build/distributions/java8/samples/lib/edgent.samples.scenarios.jar org.apache.edgent.samples.scenarios.iotp.range.sensor.IotpRangeSensor device.cfg false true"); - System.exit(0); - } - - String deviceCfg = args[0]; - Boolean simulatedRange = Boolean.parseBoolean(args[1]); - Boolean simulatedLED = Boolean.parseBoolean(args[2]); - - DirectProvider tp = new DirectProvider(); - DirectTopology topology = tp.newTopology("IotpRangeSensor"); - - IotDevice device = getIotDevice(deviceCfg, topology); - - // HC-SR04 Range sensor for this device. - rangeSensor(device, simulatedRange, true); - - // In addition create a heart beat event to - // ensure there is some immediate output and - // the connection to IoTF happens as soon as possible. - TStream<Date> hb = topology.poll(() -> new Date(), 1, TimeUnit.MINUTES); - - // Convert to JSON - TStream<JsonObject> hbj = hb.map(d -> { - JsonObject j = new JsonObject(); - j.addProperty("when", d.toString()); - j.addProperty("hearbeat", d.getTime()); - return j; - }); - hbj.print(); - device.events(hbj, "heartbeat", QoS.FIRE_AND_FORGET); - - // Subscribe to commands of id "display" for this - // device and print them to standard out - TStream<String> statusMsgs = displayMessages(device); - statusMsgs.print(); - - // Flash an LED for 1second when we receive commands from IoTF - if (!simulatedLED) { - LED led = new LED(ledPin); - statusMsgs.sink(j -> led.flash(1000)); - } else { - statusMsgs.sink(j -> System.out.println("*******Simulated LED Flash!*******")); - } - - tp.submit(topology); - } - - /* - * Returns an IotDevice based on the device config parameter. If the type is - * "quickstart" then we also output the URL to view the data. - */ - private static IotDevice getIotDevice(String deviceCfg, DirectTopology topology) { - IotDevice device; - - if (deviceCfg.equalsIgnoreCase("quickstart")) { - // Declare a connection to IoTF Quickstart service - String deviceId = "qs" + Long.toHexString(new Random().nextLong()); - device = IotpDevice.quickstart(topology, deviceId); - - System.out.println("Quickstart device type:" + IotpDevice.QUICKSTART_DEVICE_TYPE); - System.out.println("Quickstart device id :" + deviceId); - System.out.println("https://quickstart.internetofthings.ibmcloud.com/#/device/" + deviceId); - } else { - // Declare a connection to IoTF - device = new IotpDevice(topology, new File(deviceCfg)); - } - - return device; - } - - /** - * Connect to an HC-SR04 Range Sensor - * - * @param device - * IoTF device - * @param print - * True if the data submitted as events should also be printed to - * standard out. - * @param simulated - * boolean flag - */ - public static void rangeSensor(IotDevice device, boolean simulated, boolean print) { - - Supplier<Double> sensor; - - if (simulated) { - sensor = new SimulatedRangeSensor(); - } else { - sensor = new RangeSensor(echoPin, trigPin); - } - - TStream<Double> distanceReadings = device.topology().poll(sensor, 1, TimeUnit.SECONDS); - distanceReadings.print(); - - // filter out bad readings that are out of the sensor's 4m range - distanceReadings = distanceReadings.filter(j -> j < 400.0); - - TStream<JsonObject> sensorJSON = distanceReadings.map(v -> { - JsonObject j = new JsonObject(); - j.addProperty("name", "rangeSensor"); - j.addProperty("reading", v); - return j; - }); - - // Create a window on the stream of the last 10 readings partitioned - // by sensor name. In this case we only have one range sensor so there - // will be one partition. - TWindow<JsonObject, JsonElement> sensorWindow = sensorJSON.last(10, j -> j.get("name")); - - // Aggregate the windows calculating the min, max, mean and standard - // deviation - // across each window independently. - sensorJSON = JsonAnalytics.aggregate(sensorWindow, "name", "reading", MIN, MAX, MEAN, STDDEV); - - // Filter so that only when the mean sensor reading is that an object is - // closer than 30cm send data. - sensorJSON = sensorJSON - .filter(j -> Math.abs(j.get("reading").getAsJsonObject().get("MEAN").getAsDouble()) < 30.0); - - if (print) - sensorJSON.print(); - - // Send the device streams as IoTF device events - // with event identifier "sensors". - device.events(sensorJSON, "sensors", QoS.FIRE_AND_FORGET); - } - - /** - * Subscribe to IoTF device commands with identifier {@code display}. - * Subscribing to device commands returns a stream of JSON objects that - * include a timestamp ({@code tsms}), command identifier ({@code command}) - * and payload ({@code payload}). Payload is the application specific - * portion of the command. <BR> - * In this case the payload is expected to be a JSON object containing a - * {@code msg} key with a string display message. <BR> - * The returned stream consists of the display message string extracted from - * the JSON payload. - * <P> - * Note to receive commands a analytic application must exist that generates - * them through IBM Watson IoT Platform. - * </P> - * - * @param device IoTF device - * @return JSON object includes tsms(timestamp) and payload.msg(status) - * - * @see IotDevice#commands(String...) - */ - public static TStream<String> displayMessages(IotDevice device) { - // Subscribe to commands of id "status" for this device - TStream<JsonObject> statusMsgs = device.commands("display"); - - // The returned JSON object includes several fields - // tsms - Timestamp in milliseconds (this is generic to a command) - // payload.msg - Status message (this is specific to this application) - - // Map to a String object containing the message - return statusMsgs.map(j -> j.getAsJsonObject("payload").getAsJsonPrimitive("msg").getAsString()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/LED.java ---------------------------------------------------------------------- diff --git a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/LED.java b/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/LED.java deleted file mode 100644 index 30507d9..0000000 --- a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/LED.java +++ /dev/null @@ -1,52 +0,0 @@ -/* -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. -*/ -package org.apache.edgent.samples.scenarios.iotp.range.sensor; - -import com.pi4j.io.gpio.GpioController; -import com.pi4j.io.gpio.GpioFactory; -import com.pi4j.io.gpio.GpioPinDigitalOutput; -import com.pi4j.io.gpio.Pin; -import com.pi4j.io.gpio.PinState; - -public class LED { - private final GpioController gpio = GpioFactory.getInstance(); - private GpioPinDigitalOutput pin; - - public LED(Pin pin) { - this.pin = gpio.provisionDigitalOutputPin(pin, "LED", PinState.HIGH); - this.pin.setShutdownOptions(true, PinState.LOW); - this.pin.low(); - } - - public void on() { - this.pin.high(); - } - - public void off() { - this.pin.low(); - } - - public void toggle() { - this.pin.toggle(); - } - - public void flash(long ms) { - this.pin.pulse(ms); - } -} http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/RangeSensor.java ---------------------------------------------------------------------- diff --git a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/RangeSensor.java b/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/RangeSensor.java deleted file mode 100644 index da749bc..0000000 --- a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/RangeSensor.java +++ /dev/null @@ -1,104 +0,0 @@ -/* -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. -*/ -package org.apache.edgent.samples.scenarios.iotp.range.sensor; - -import org.apache.edgent.function.Supplier; - -import com.pi4j.io.gpio.GpioController; -import com.pi4j.io.gpio.GpioFactory; -import com.pi4j.io.gpio.GpioPinDigitalInput; -import com.pi4j.io.gpio.GpioPinDigitalOutput; -import com.pi4j.io.gpio.Pin; - -public class RangeSensor implements Supplier<Double> { - /** - * - */ - private static final long serialVersionUID = 1L; - private final static Double SPEED_OF_SOUND = 340.29; // speed of sound - private final GpioPinDigitalInput echoPin; - private final GpioPinDigitalOutput trigPin; - private final int MAX_CYCLES = 3000; - - private final static GpioController gpio = GpioFactory.getInstance(); - - public RangeSensor(Pin echoPin, Pin trigPin) { - this.echoPin = gpio.provisionDigitalInputPin(echoPin); - this.trigPin = gpio.provisionDigitalOutputPin(trigPin); - this.trigPin.low(); - } - - /* - * Get the distance in cm. Distance is (timeOfSignal * SpeedOfSound) / 2 - * (divide by 10000 is for units) - */ - public Double getDistance() { - triggerSensor(); - - long reboundTimeMicroSeconds = getSignalDuration(); - Double distance = reboundTimeMicroSeconds * SPEED_OF_SOUND / (2 * 10000); // gives - // distance - // in - // cm - return distance; - } - - /* - * Send signal for 10 microseconds - */ - private void triggerSensor() { - this.trigPin.high(); - try { - Thread.sleep(0, 10000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - this.trigPin.low(); - } - - /* - * Measure signal duration - */ - private long getSignalDuration() { - int cycles = 0; - long start = System.nanoTime(); - - while (this.echoPin.isLow() && cycles < MAX_CYCLES) { - // only iterate through MAX_CYCLES times before giving up - start = System.nanoTime(); - cycles++; - } - - cycles = 0; - - while (this.echoPin.isHigh() && cycles < MAX_CYCLES) { - // only iterate through MAX_CYCLES times before giving up - cycles++; - } - long end = System.nanoTime(); - long microSeconds = (long) Math.ceil((end - start) / 1000.0); - return microSeconds; - } - - @Override - public Double get() { - return getDistance(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/SimulatedRangeSensor.java ---------------------------------------------------------------------- diff --git a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/SimulatedRangeSensor.java b/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/SimulatedRangeSensor.java deleted file mode 100644 index f7b8f22..0000000 --- a/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/range/sensor/SimulatedRangeSensor.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -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. -*/ -package org.apache.edgent.samples.scenarios.iotp.range.sensor; - -import java.util.Random; - -import org.apache.edgent.function.Supplier; - -public class SimulatedRangeSensor implements Supplier<Double> { - /** - * - */ - private static final long serialVersionUID = 1L; - Random rand; - - public SimulatedRangeSensor() { - rand = new Random(); - } - - @Override - public Double get() { - Double distance = 20 + rand.nextDouble() * 20; - return distance; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/samples/scenarios/src/main/resources/META-INF/NOTICE b/samples/scenarios/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 2f9c926..0000000 --- a/samples/scenarios/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ - -Apache Edgent: Samples: Scenarios -Copyright 2016-2017 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/scenarios/src/main/resources/org/apache/edgent/samples/scenarios/iotp/range/sensor/device.cfg ---------------------------------------------------------------------- diff --git a/samples/scenarios/src/main/resources/org/apache/edgent/samples/scenarios/iotp/range/sensor/device.cfg b/samples/scenarios/src/main/resources/org/apache/edgent/samples/scenarios/iotp/range/sensor/device.cfg deleted file mode 100644 index 1d9bd6a..0000000 --- a/samples/scenarios/src/main/resources/org/apache/edgent/samples/scenarios/iotp/range/sensor/device.cfg +++ /dev/null @@ -1,5 +0,0 @@ -org = <org-name> -type = <device-type> -id = <device-id> -auth-method = token -auth-token = <auth-token> http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/src/main/xslt/classpath.xsl ---------------------------------------------------------------------- diff --git a/samples/src/main/xslt/classpath.xsl b/samples/src/main/xslt/classpath.xsl deleted file mode 100644 index bc601eb..0000000 --- a/samples/src/main/xslt/classpath.xsl +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<!-- - - 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. - ---> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:grphml="http://graphml.graphdrawing.org/xmlns" - xmlns:yFiles="http://www.yworks.com/xml/graphml" - exclude-result-prefixes="grphml yFiles" - version="1.0"> - - <xsl:param name="groupId"/> - <xsl:param name="artifactId"/> - <xsl:param name="version"/> - - <xsl:output media-type="text" omit-xml-declaration="yes"/> - <!--xsl:output indent="yes"/--> - - <xsl:template match="/grphml:graphml"> - <!-- Calculate the name of the current module. This will help find the starting point --> - <xsl:variable name="nodeName" select="concat($groupId,':', $artifactId, ':jar:', $version)"/> - <!-- Start outputting the classpath starting with the current modules node --> - <xsl:variable name="rootNode" select="grphml:graph/grphml:node[grphml:data/yFiles:ShapeNode/yFiles:NodeLabel = $nodeName]"/> - - <xsl:call-template name="processNode"> - <xsl:with-param name="currentNode" select="$rootNode"/> - <xsl:with-param name="addedNodeIds"/> - </xsl:call-template> - </xsl:template> - - <xsl:template name="processNode"> - <xsl:param name="currentNode"/> - <xsl:param name="addedNodeIds"/> - <xsl:variable name="currentNodeId" select="$currentNode/@id"/> - <xsl:if test="not(contains($addedNodeIds, concat('|', $currentNodeId, '|')))"> - <xsl:variable name="newAddedNodeIds"><xsl:if test="string-length($addedNodeIds) = 0">|</xsl:if><xsl:value-of select="$addedNodeIds"/><xsl:value-of select="$currentNodeId"/>|</xsl:variable> - <xsl:variable name="outgoingCompileDependencyIds" select="//grphml:edge[(@source = $currentNodeId) and ((grphml:data/yFiles:PolyLineEdge/yFiles:EdgeLabel = 'compile') or (grphml:data/yFiles:PolyLineEdge/yFiles:EdgeLabel = 'provided'))]/@target"/> - <xsl:variable name="outgoingCompileDependencyName" select="$currentNode/grphml:data/yFiles:ShapeNode/yFiles:NodeLabel/text()"/> - <xsl:variable name="outgoingCompileDependencyGroupId" select="substring-before($outgoingCompileDependencyName, ':')"/> - <xsl:variable name="outgoingCompileDependencyArtifactId" select="substring-before(substring-after($outgoingCompileDependencyName, ':'), ':')"/> - <xsl:variable name="outgoingCompileDependencyVersion" select="substring-before(substring-after(substring-after(substring-after($outgoingCompileDependencyName, ':'), ':'), ':'), ':')"/> - <xsl:if test="not(starts-with($outgoingCompileDependencyGroupId, 'org.apache.edgent.'))">ext/</xsl:if><xsl:value-of select="concat($outgoingCompileDependencyArtifactId, '-', $outgoingCompileDependencyVersion, '.jar')"/>,<xsl:for-each select="$outgoingCompileDependencyIds"> - <xsl:variable name="currentDependentNodeId" select="."/> - <xsl:variable name="currentDependentNode" select="//grphml:node[@id = $currentDependentNodeId]"/> - <xsl:call-template name="processNode"> - <xsl:with-param name="currentNode" select="$currentDependentNode"/> - <xsl:with-param name="addedNodeIds" select="$newAddedNodeIds"/> - </xsl:call-template> - </xsl:for-each> - </xsl:if> - </xsl:template> - -</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/template/.mvn/wrapper/MavenWrapperDownloader.java ---------------------------------------------------------------------- diff --git a/samples/template/.mvn/wrapper/MavenWrapperDownloader.java b/samples/template/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index 44f8e00..0000000 --- a/samples/template/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,110 +0,0 @@ -/* -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. -*/ - -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.Properties; - -public class MavenWrapperDownloader { - - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = - "https://repo1.maven.org/maven2/io/takari/maven-wrapper/0.2.1/maven-wrapper-0.2.1.jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if(mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if(mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: : " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if(!outputFile.getParentFile().exists()) { - if(!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/template/.mvn/wrapper/maven-wrapper.properties ---------------------------------------------------------------------- diff --git a/samples/template/.mvn/wrapper/maven-wrapper.properties b/samples/template/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index 7e8f382..0000000 --- a/samples/template/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip - -#wrapperUrl=https://repo1.maven.org/maven2/io/takari/maven-wrapper/0.2.1/maven-wrapper-0.2.1.jar http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/template/README.md ---------------------------------------------------------------------- diff --git a/samples/template/README.md b/samples/template/README.md deleted file mode 100644 index 365dc46..0000000 --- a/samples/template/README.md +++ /dev/null @@ -1,45 +0,0 @@ -An Edgent Application template project. - -Clone this template project folder to create your Edgent application project. - -The project's pom supports - -- building for java8, java7 or android execution environments -- building a standard jar and uber jar - -Edit the pom for your application. Adjust it for your application's maven coordinates. -The pom has potential Edgent dependenacies present and commented out. -Include the Edgent Providers, Analytics, Utils, and Connectors used by your application. - -Read `../README.md` for general information about Edgent Application development. - -The template includes a maven wrapper script to eliminate the need to -manually download and install maven. - -# Building the project -```sh -./mvnw clean package # add -Pplatform-java7 or -Pplatform-android as needed -``` - -# Running the application - -You can copy `app-run.sh` and the generated `target/*-uber.jar` to the -edge device and then run it -```sh -./app-run.sh -``` - -# Using package-app.sh with the project - -Adjust the main class name and application jar path below for your application. -```sh -PLATFORM= # add "--platform java7" or "--platform android" as appropriate -../package-app.sh $PLATFORM --mainClass com.mycompany.app.TemplateApp --appjar target/my-app-1.0-SNAPSHOT.jar -``` - -# Using get-edgent-jars-project - -If you don't want to use the generated uber jar or `package-app.sh` -approaches, you can copy the application's standard jar and a -`get-edgent-jars-project` generated jar bundle to the edge device. -See `samples/get-edgent-jars-project`. http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/a7aeb2b4/samples/template/app-run.sh ---------------------------------------------------------------------- diff --git a/samples/template/app-run.sh b/samples/template/app-run.sh deleted file mode 100755 index 8437275..0000000 --- a/samples/template/app-run.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# 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. -# - -APP_DIR=. - -UBER_JAR=`echo ${APP_DIR}/target/*-uber.jar` - -FQ_MAIN_CLASS=com.mycompany.app.TemplateApp - -USAGE="usage: [--main <main-class>] [<args...>]" - -if [ "$1" = "--main" ]; then - shift; - if [ $# = 0 ]; then - echo ${USAGE} - exit 1; - fi - FQ_MAIN_CLASS=$1; shift -fi - -# Runs the application -# -# ./app-run.sh - -export CLASSPATH=${UBER_JAR} - -java ${FQ_MAIN_CLASS} "$*"