blob: 4dbbfff38bfc3cca8f9dca6c9887956cacb077b6 [file] [log] [blame]
= Apache Winegrower
Apache Winegrower is an application framework supporting several programming models.
It allows you to easily create applications, with different packaging options, from standalone jar to cloud application and docker.
Apache Winegrower supports the following development frameworks:
* CDI
* Spring
* Simplified OSGi (single classloader but all the service lifecycle and activator support)
== Sample
[code,xml]
----
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.rmannibucau</groupId>
<artifactId>karaf-boot-with-shell</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.winegrower</groupId>
<artifactId>winegrower-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.core</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>org.apache.winegrower.Ripener</mainClass>
<systemProperties>
<systemProperty>
<key>org.slf4j.simpleLogger.defaultLogLevel</key>
<value>DEBUG</value>
</systemProperty>
<systemProperty>
<key>org.slf4j.simpleLogger.logFile</key>
<value>System.out</value>
</systemProperty>
<systemProperty>
<key>karaf.startLocalConsole</key>
<value>true</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>
----
You can now start Karaf with:
[source,sh]
----
mvn exec:java
----
How to add a command? Create a class with this class:
[source,java]
----
@Service
@Command(name = "hello", scope = "test")
public class MyCommand implements Action {
public Object execute() throws Exception {
System.out.println("Hello world");
return "hello world";
}
}
----
Then package it as a normal jar/exploded folder - not even a bundle - and add it
in the previous classpath. You can now run "test:hello".
Note that to shortcut the build phase you can use `@ImplicitActivator`
which to define a `BundleActivator`.
WARN: this feature is not yet supported by OSGi environment and will need `maven-bundle-plugin` to replace
the annotation by the `Bundle-Activator` manifest entry.
Here is an example:
[source,java]
----
@ImplicitActivator
public class MyBundleActivator implements BundleActivator {
// standard code
}
----