Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Felix Remote Shell support #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
.vscode
*.swp
*.swo
*.sublime-*
*.pyc
jmeter.log
__pycache__
tmp/
package-lock.json
node_modules/
sftp-config.json
.DS_Store
*.iml
*.ipr
*.iws
*.idea
~$*.xls*
~$*.ppt*
~$*.doc*
nohup.out

CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
build
build-*
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
.env
.fid
_build

HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>org.apache.felix.fileinstall,org.osgi.util.function,org.osgi.util.promise,org.apache.felix.scr,org.osgi.service.cm</includeArtifactIds>
<includeArtifactIds>org.apache.felix.fileinstall,org.apache.felix.shell,org.apache.felix.shell.remote,org.osgi.util.function,org.osgi.util.promise,org.apache.felix.scr,org.osgi.service.cm</includeArtifactIds>
<outputDirectory>${project.build.directory}/internal-bundles</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ public void destroy() throws BundleException, InterruptedException {
}

/**
* Felix provides an isolated classloader to each bundle. Bundles need to declare what packages they need in there manifest. If a Bundle needs e.g. something from org.slf4j it either needs to have it as classes itself or another bundle must export this packages. java.* packages will be provided by the framework from the classloader it was created with. We can modify this, by giving the framework a list of additional packages, that are provided by the spring boot container (should include e.g.slf4j)
* Felix provides an isolated classloader to each bundle. Bundles need to declare what packages they need in there manifest.
* If a Bundle needs e.g. something from org.slf4j it either needs to have it as classes itself or another bundle must
* export this packages. java.* packages will be provided by the framework from the classloader it was created with.
* We can modify this, by giving the framework a list of additional packages, that are provided by the spring boot
* container (should include e.g.slf4j)
*/
protected String findPackageNamesStartingWith(List<String> packages) {
return packages.stream().map(this::getPackages)
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# --------------------------------
# Felix Framework settings
# https://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-configuration-properties.html
# --------------------------------
# If true will configure a shutdown hook to shutdown the framework on JVM shutdown
config.felix.shutdown.hook=true
Expand Down
285 changes: 148 additions & 137 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,147 +1,158 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>core</module>
<module>commons</module>
<module>sample-bundle</module>
<module>sample-bundle-scr</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mornati.sample</groupId>
<artifactId>sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample</name>
<description>Sample OGGi / SpringBoot integration</description>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>core</module>
<module>commons</module>
<module>sample-bundle</module>
<module>sample-bundle-scr</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mornati.sample</groupId>
<artifactId>sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample</name>
<description>Sample OGGi / SpringBoot integration</description>

<properties>
<java.version>17</java.version>
<osgi.version>8.0.0</osgi.version>
<felix.version>7.0.3</felix.version>
<bundle.plugin.version>5.1.1</bundle.plugin.version>
<jacoco.maven.plugin.version>0.8.7</jacoco.maven.plugin.version>
</properties>
<properties>
<java.version>17</java.version>
<osgi.version>8.0.0</osgi.version>
<felix.version>7.0.3</felix.version>
<bundle.plugin.version>5.1.1</bundle.plugin.version>
<jacoco.maven.plugin.version>0.8.7</jacoco.maven.plugin.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>${osgi.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.framework -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>${felix.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.main -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.main</artifactId>
<version>${felix.version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>${osgi.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.framework -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>${felix.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.main -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.main</artifactId>
<version>${felix.version}</version>
</dependency>

<!-- Core Bundles. Declared here to use maven to download and package them -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.fileinstall</artifactId>
<version>3.6.8</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.scr -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.1.24</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.util.promise -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.util.promise</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.util.function -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.util.function</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.service.cm -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.cm</artifactId>
<version>1.5.0</version>
<scope>provided</scope>
</dependency>
<!-- Core Bundles. Declared here to use maven to download and package them -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.fileinstall</artifactId>
<version>3.6.8</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.scr -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.1.24</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.util.promise -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.util.promise</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.util.function -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.util.function</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.service.cm -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.cm</artifactId>
<version>1.5.0</version>
<scope>provided</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.shell -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.shell</artifactId>
<version>1.4.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.shell.remote -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.shell.remote</artifactId>
<version>1.2.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.jqwik</groupId>
<artifactId>jqwik</artifactId>
<version>1.6.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.jqwik</groupId>
<artifactId>jqwik</artifactId>
<version>1.6.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
20 changes: 20 additions & 0 deletions scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/bash
###########################################
#
###########################################

# constants
baseDir=$(cd `dirname "$0"`;pwd)
cwdDir=$PWD
export PYTHONUNBUFFERED=1
export PATH=/opt/miniconda3/envs/venv-py3/bin:$PATH
export TS=$(date +%Y%m%d%H%M%S)
export DATE=`date "+%Y%m%d"`
export DATE_WITH_TIME=`date "+%Y%m%d-%H%M%S"` #add %3N as we want millisecond too

# functions

# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/..
java -jar core/target/core-0.0.1-SNAPSHOT.jar
Loading