Skip to content

Commit

Permalink
Project example using Bndtools 1.1.0-rc2 and m2e 1.1 with Tycho conne…
Browse files Browse the repository at this point in the history
…ctor
  • Loading branch information
rkrzewski committed Jun 21, 2012
1 parent 334d6e9 commit 4d8bab6
Show file tree
Hide file tree
Showing 31 changed files with 461 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bndtools-m2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.obrcache/
.cache/
cache/
target/
.settings/
.project
.classpath
18 changes: 18 additions & 0 deletions bndtools-m2e/cnf/build.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Place your specific settings here.


## Default settings are in ext/*.bnd and they will be overridden by anything
## you specify in this file.


## Properties from ext/*.bnd can be referenced in order to extend them.
## For example, to add one addtional plugin to the list defined in ext/repositories.bnd:
# -plugin: ${ext.repositories.-plugin}, org.example.MyPlugin


## If you use git, you might want to uncomment the following lines:
# Git-Descriptor: ${system-allow-fail;git describe --dirty --always}
# Git-SHA: ${system-allow-fail;git rev-list -1 HEAD}

bin: target/classes
target-dir: target/bnd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29 changes: 29 additions & 0 deletions bndtools-m2e/cnf/ext/defaults.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# General Options
project.dependson = ${p-dependson;:}
project.bootclasspath = ${p-bootclasspath;:}
project.buildpath = ${p-buildpath;:}
project.sourcepath = ${p-sourcepath;:}
project.allsourcepath = ${p-allsourcepath;:}
project.output = ${p-output}
project.testpath = ${p-testpath;:}

-verbose: true
project: ${basedir}
src: src
bin: bin
target-dir: generated
target: ${project}/${target-dir}
build: ${workspace}/cnf
p: ${basename;${project}}
project.name: ${p}

# Java Compiler Options
java: java
javac: javac
javac.source: 1.5
javac.target: 1.5
javac.debug: on

# Bnd Options
-sources: true
-sourcepath: ${project}/src
13 changes: 13 additions & 0 deletions bndtools-m2e/cnf/ext/repositories.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugindir: ${workspace}/cnf/plugins

-pluginpath:\
${plugindir}/biz.aQute.repository/biz.aQute.repository-1.0.0.jar,\
${plugindir}/org.osgi.impl.bundle.bindex/org.osgi.impl.bundle.bindex-2.2.0.jar

-plugin:\
aQute.lib.deployer.repository.LocalIndexedRepo; name=Release; local=${workspace}/cnf/releaserepo;type=OBR,\
aQute.lib.deployer.FileRepo; name=Build; location=${workspace}/cnf/buildrepo,\
aQute.lib.deployer.repository.LocalIndexedRepo; name=Local; local=${workspace}/cnf/localrepo;type=OBR,\
aQute.lib.deployer.repository.FixedIndexedRepo; name=Bndtools Hub; locations=http://bundles.bndtools.org/repository.xml;type=OBR

-releaserepo: Release
Binary file not shown.
46 changes: 46 additions & 0 deletions bndtools-m2e/cnf/localrepo/repository.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type='text/xsl' href='http://www.osgi.org/www/obr2html.xsl'?>

<repository lastmodified='20120622001235.432' name='Untitled'>
<resource id='org.apache.felix.http.whiteboard/2.2.0' presentationname='Apache Felix Http Whiteboard' symbolicname='org.apache.felix.http.whiteboard' uri='org.apache.felix.http.whiteboard/org.apache.felix.http.whiteboard-2.2.0.jar' version='2.2.0'>
<description>
Apache Felix is an OSGi implementation.
</description>
<size>
75171
</size>
<license>
http://www.apache.org/licenses/LICENSE-2.0.txt
</license>
<documentation>
http://www.apache.org/
</documentation>
<capability name='bundle'>
<p n='manifestversion' v='2'/>
<p n='presentationname' v='Apache Felix Http Whiteboard'/>
<p n='symbolicname' v='org.apache.felix.http.whiteboard'/>
<p n='version' t='version' v='2.2.0'/>
</capability>
<require extend='false' filter='(&amp;(package=javax.servlet)(version&gt;=0.0.0))' multiple='false' name='package' optional='false'>
Import package javax.servlet
</require>
<require extend='false' filter='(&amp;(package=javax.servlet.http)(version&gt;=0.0.0))' multiple='false' name='package' optional='false'>
Import package javax.servlet.http
</require>
<require extend='false' filter='(&amp;(package=org.apache.felix.http.api)(version&gt;=2.0.0))' multiple='false' name='package' optional='true'>
Import package org.apache.felix.http.api ;version=2.0.0
</require>
<require extend='false' filter='(&amp;(package=org.osgi.framework)(version&gt;=1.3.0))' multiple='false' name='package' optional='true'>
Import package org.osgi.framework ;version=1.3.0
</require>
<require extend='false' filter='(&amp;(package=org.osgi.service.http)(version&gt;=1.2.0))' multiple='false' name='package' optional='false'>
Import package org.osgi.service.http ;version=1.2.0
</require>
<require extend='false' filter='(&amp;(package=org.osgi.service.log)(version&gt;=1.3.0))' multiple='false' name='package' optional='true'>
Import package org.osgi.service.log ;version=1.3.0
</require>
<require extend='false' filter='(&amp;(package=org.osgi.util.tracker)(version&gt;=1.3.0))' multiple='false' name='package' optional='true'>
Import package org.osgi.util.tracker ;version=1.3.0
</require>
</resource>
</repository>
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions bndtools-m2e/cnf/releaserepo/repository.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<repository name='Release' lastmodified='0' xmlns='http://www.osgi.org/xmlns/obr/v1.0.0'/>
2 changes: 2 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.api/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bundle-Version: 1.0.0
Export-Package: pl.caltha.osgi.bndtools.m2e.api
21 changes: 21 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<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>
<artifactId>api</artifactId>
<name>API module</name>
<parent>
<groupId>pl.caltha.osgi.bndtools-m2e</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
<relativePath>../pl.caltha.osgi.bndtools-m2e</relativePath>
</parent>
<packaging>bundle</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package pl.caltha.osgi.bndtools.m2e.api;

public interface Greeting {
String sayHello(String name);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version 1.0
3 changes: 3 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.cmd/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bundle-Version: 1.0.0
Private-Package: pl.caltha.osgi.bndtools.m2e.cmd
Service-Component: *
35 changes: 35 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.cmd/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<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>pl.caltha.osgi.bndtools-m2e</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
<relativePath>../pl.caltha.osgi.bndtools-m2e</relativePath>
</parent>
<artifactId>cmd</artifactId>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
</dependency>
<dependency>
<groupId>pl.caltha.osgi.bndtools-m2e</groupId>
<artifactId>api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.shell</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
17 changes: 17 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.cmd/run.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-runfw: org.apache.felix.framework;version='[4,5)'
-runee: JavaSE-1.6

-runrequire: bundle:(symbolicname=pl.caltha.osgi.bndtools-m2e.cmd),\
bundle:(symbolicname=pl.caltha.osgi.bndtools-m2e.impl),\
bundle:(symbolicname=org.apache.felix.shell.tui),\
bundle:(symbolicname=org.apache.felix.scr),\
bundle:(symbolicname=org.apache.felix.configadmin)

-runbundles: pl.caltha.osgi.bndtools-m2e.cmd;version=latest,\
pl.caltha.osgi.bndtools-m2e.api;version=latest,\
org.apache.felix.scr;version='[1.6.0,1.6.1)',\
pl.caltha.osgi.bndtools-m2e.impl;version=latest,\
org.apache.felix.shell.tui;version='[1.4.1,1.4.2)',\
org.apache.felix.shell;version='[1.4.2,1.4.3)',\
org.apache.felix.configadmin;version='[1.2.8,1.2.9)'

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package pl.caltha.osgi.bndtools.m2e.cmd;

import java.io.PrintStream;
import java.util.StringTokenizer;

import org.apache.felix.shell.Command;

import pl.caltha.osgi.bndtools.m2e.api.Greeting;
import aQute.bnd.annotation.component.Component;
import aQute.bnd.annotation.component.Reference;

@Component
public class GreetingCommand implements Command {

private Greeting greetingSvc;

@Reference
public void setGreeting(Greeting greetingSvc) {
this.greetingSvc = greetingSvc;
}

public void execute(String line, PrintStream out, PrintStream err) {
StringTokenizer tokenizer = new StringTokenizer(line);
tokenizer.nextToken(); // discard first token

String name = "";
if (tokenizer.hasMoreTokens())
name = tokenizer.nextToken();

System.out.println(greetingSvc.sayHello(name));
}

public String getName() {
return "greet";
}

public String getShortDescription() {
return "Example command";
}

public String getUsage() {
return "greet <name>";
}
}
4 changes: 4 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.impl/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bundle-Version: 1.0.0
Private-Package: pl.caltha.osgi.bndtools.m2e.impl
Service-Component: *

33 changes: 33 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<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>
<artifactId>impl</artifactId>
<name>Implementation module</name>
<parent>
<groupId>pl.caltha.osgi.bndtools-m2e</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
<relativePath>../pl.caltha.osgi.bndtools-m2e</relativePath>
</parent>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
</dependency>
<dependency>
<groupId>pl.caltha.osgi.bndtools-m2e</groupId>
<artifactId>api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package pl.caltha.osgi.bndtools.m2e.impl;

import pl.caltha.osgi.bndtools.m2e.api.Greeting;
import aQute.bnd.annotation.component.Component;

@Component
public class GreetingImpl implements Greeting {
public String sayHello(String name) {
return "Hello " + name + "!";
}
}
3 changes: 3 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.web/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bundle-Version: 1.0.0
Private-Package: pl.caltha.osgi.bndtools.m2e.web
Service-Component: *
35 changes: 35 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.web/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<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>pl.caltha.osgi.bndtools-m2e</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
<relativePath>../pl.caltha.osgi.bndtools-m2e</relativePath>
</parent>
<artifactId>web</artifactId>
<packaging>bundle</packaging>
<name>Web module</name>
<dependencies>
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
</dependency>
<dependency>
<groupId>pl.caltha.osgi.bndtools-m2e</groupId>
<artifactId>api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
35 changes: 35 additions & 0 deletions bndtools-m2e/pl.caltha.osgi.bndtools-m2e.web/run.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-runfw: org.apache.felix.framework;version='[4,5)'
-runee: JavaSE-1.6

-runbundles: org.apache.felix.gogo.command;version='[0.12.0,0.12.1)',\
org.apache.felix.http.jetty;version='[2.2.0,2.2.1)',\
org.apache.felix.metatype;version='[1.0.4,1.0.5)',\
osgi.cmpn;version='[4.2.1,4.2.2)',\
aQute.xray.plugin;version='[1.0.0,1.0.1)',\
org.apache.felix.shell;version='[1.4.2,1.4.3)',\
org.apache.felix.configadmin;version='[1.2.8,1.2.9)',\
pl.caltha.osgi.bndtools-m2e.api;version=latest,\
org.apache.felix.gogo.runtime;version='[0.10.0,0.10.1)',\
org.apache.felix.scr;version='[1.6.0,1.6.1)',\
pl.caltha.osgi.bndtools-m2e.impl;version=latest,\
org.apache.felix.webconsole;version='[3.1.8,3.1.9)',\
org.apache.felix.http.whiteboard;version='[2.2.0,2.2.1)',\
org.apache.felix.bundlerepository;version='[1.6.7,1.6.8)',\
pl.caltha.osgi.bndtools-m2e.web;version=latest,\
org.apache.felix.log;version='[1.0.1,1.0.2)',\
org.apache.felix.gogo.shell;version='[0.10.0,0.10.1)'

## Uncomment if you need to change the HTTP port
#-runproperties: org.osgi.service.http.port=8080

-runrequire: bundle:(symbolicname=org.apache.felix.gogo.shell),\
bundle:(symbolicname=org.apache.felix.gogo.command),\
bundle:(symbolicname=org.apache.felix.webconsole),\
bundle:(symbolicname=org.apache.felix.configadmin),\
bundle:(symbolicname=org.apache.felix.metatype),\
bundle:(symbolicname=org.apache.felix.log),\
bundle:(&(symbolicname=osgi.cmpn)(version>=4.2)),\
bundle:(&(symbolicname=org.apache.felix.scr)(version>=1.6.0)),\
bundle:(symbolicname=pl.caltha.osgi.bndtools-m2e.impl),\
bundle:(symbolicname=pl.caltha.osgi.bndtools-m2e.web),\
bundle:(symbolicname=org.apache.felix.http.whiteboard)
Loading

0 comments on commit 4d8bab6

Please sign in to comment.