Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
criminy committed May 29, 2011
0 parents commit b9013dd
Show file tree
Hide file tree
Showing 30 changed files with 750 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>net.sheenobu.osgi.tutorial</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Sun May 29 00:50:36 EDT 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
17 changes: 17 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Sample OSGI Application

Tested Application/OSGI container(s):

* Servicemix (karaf)


Requirements:

* Java
* Maven 2.x or 3.x


* Apache Servicemix tar.gz (if using the bootstrap script)
* expect (if using the boostrap script)
* ssh (if using the bootstrap script)

33 changes: 33 additions & 0 deletions bootstrap_test_app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# bootstraps a test version of this application using apache-servicemix

if [ 2 != $# ]
then
echo "Usage $0 path-to-servicemix-tar.gz http-port"
exit 1
fi

TAR=$1
HTTP_PORT=$2

mvn clean install
rm -rf running/
mkdir running
cd running
tar xfvz ../$TAR
cd $(basename $(basename $1 .tar.gz) .tar.bzip2)
./bin/start
sleep 5
echo "org.osgi.service.http.port=$HTTP_PORT" > etc/org.ops4j.pax.web.cfg
../../runcmd localhost smx smx "features:addUrl mvn:net.sheenobu/net.sheenobu.osgi.tutorial.modules.karaf.features/1.0/xml/features"
../../runcmd localhost smx smx "features:install net.sheenobu.osgi.springmvc.example"
touch etc/org.ops4j.pax.web.cfg

echo "Navigate to http://localhost:$HTTP_PORT/example/ to see it running!"

#./bin/stop

#echo "run $PWD/bin/start or $PWD/bin/servicemix to run"


17 changes: 17 additions & 0 deletions modules/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>net.sheenobu.osgi.tutorial.modules</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions modules/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Sun May 29 00:50:36 EDT 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
5 changes: 5 additions & 0 deletions modules/karaf.features/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<classpath>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>
17 changes: 17 additions & 0 deletions modules/karaf.features/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<projectDescription>
<name>core.karaf.features</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions modules/karaf.features/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu May 26 13:59:33 EDT 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
8 changes: 8 additions & 0 deletions modules/karaf.features/.settings/org.maven.ide.eclipse.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Thu May 26 12:25:48 EDT 2011
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1
61 changes: 61 additions & 0 deletions modules/karaf.features/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>net.sheenobu</groupId>
<artifactId>net.sheenobu.osgi.tutorial.modules</artifactId>
<version>1.0</version>
</parent>

<artifactId>net.sheenobu.osgi.tutorial.modules.karaf.features</artifactId>
<packaging>jar</packaging>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/features.xml</file>
<type>xml</type>
<classifier>features</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
12 changes: 12 additions & 0 deletions modules/karaf.features/src/main/resources/features.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<features>
<feature name="net.sheenobu.osgi.springmvc.example" version="${project.version}">
<feature>http</feature>
<bundle>mvn:org.springframework/org.springframework.web/3.0.5.RELEASE</bundle>
<bundle>mvn:org.springframework/org.springframework.web.servlet/3.0.5.RELEASE</bundle>
<bundle>mvn:org.springframework.osgi/org.springframework.osgi.web/1.2.0</bundle>


<bundle>mvn:${project.groupId}/${project.groupId}.osgi.tutorial.modules.web.spring.support.osgi/${project.version}</bundle>
<bundle>mvn:${project.groupId}/${project.groupId}.osgi.tutorial.modules.web.example/${project.version}</bundle>
</feature>
</features>
19 changes: 19 additions & 0 deletions modules/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<project>
<parent>
<groupId>net.sheenobu</groupId>
<artifactId>net.sheenobu.osgi.tutorial</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>net.sheenobu.osgi.tutorial.modules</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>

<module>karaf.features</module>

<module>web.spring.support.osgi</module>
<module>web.example</module>
</modules>
</project>

8 changes: 8 additions & 0 deletions modules/web.example/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions modules/web.example/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>net.sheenobu.osgi.tutorial.modules.web.example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions modules/web.example/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sun May 29 01:03:08 EDT 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
5 changes: 5 additions & 0 deletions modules/web.example/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Sun May 29 01:03:08 EDT 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
77 changes: 77 additions & 0 deletions modules/web.example/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<project>
<parent>
<groupId>net.sheenobu</groupId>
<artifactId>net.sheenobu.osgi.tutorial.modules</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>net.sheenobu.osgi.tutorial.modules.web.example</artifactId>
<packaging>bundle</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>

<Import-Package>
org.springframework.beans.factory.config,
org.springframework.web.servlet,
org.springframework.osgi.web.context.support
</Import-Package>
<Export-Package>net.sheenobu.osgi.web.example.controllers</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>

<dependency>
<groupId>net.sheenobu</groupId>
<artifactId>
net.sheenobu.osgi.tutorial.modules.web.spring.support.osgi
</artifactId>
<version>1.0</version>
</dependency>

<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>org.springframework.osgi.core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web.servlet</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>org.springframework.osgi.web</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>com.springsource.javax.servlet</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
</project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.sheenobu.osgi.web.example.controllers;

import java.io.IOException;
import java.io.Writer;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/")
public class IndexController {

@RequestMapping(method=RequestMethod.GET)
public void index(Writer os) throws IOException
{
os.write("Hello World From an OSGI managed controller called " + IndexController.class.getCanonicalName());
}

@RequestMapping(value="/2", method=RequestMethod.GET)
public void two(Writer os) throws IOException
{
os.write("page two!");
}

}
Loading

0 comments on commit b9013dd

Please sign in to comment.