Commits

Micha Kops committed 868f351

dependency wiring example added

Comments (0)

Files changed (18)

blueprint-service-export/.classpath

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" 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>

blueprint-service-export/.project

+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>blueprint-service-export</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>

blueprint-service-export/nbactions.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+    <action>
+        <actionName>run</actionName>
+        <goals>
+            <goal>package</goal>
+            <goal>antrun:run</goal>
+        </goals>
+        <activatedProfiles>
+            <activatedProfile>run-on-felix</activatedProfile>
+        </activatedProfiles>
+    </action>
+    <action>
+        <actionName>debug</actionName>
+        <goals>
+            <goal>package</goal>
+            <goal>antrun:run</goal>
+        </goals>
+        <properties>
+            <vm.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</vm.args>
+            <jpda.listen>true</jpda.listen>
+        </properties>
+        <activatedProfiles>
+            <activatedProfile>run-on-felix</activatedProfile>
+        </activatedProfiles>
+    </action>
+    <action>
+        <actionName>profile</actionName>
+        <goals>
+            <goal>package</goal>
+            <goal>antrun:run</goal>
+        </goals>
+        <properties>
+            <vm.args>${profiler.args}</vm.args>
+            <!-- XXX <java jvm="${profiler.java}" ...> -->
+            <profiler.action>profile</profiler.action>
+        </properties>
+        <activatedProfiles>
+            <activatedProfile>run-on-felix</activatedProfile>
+        </activatedProfiles>
+    </action>
+</actions>

blueprint-service-export/pom.xml

+<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.hascode.tutorial</groupId>
+    <artifactId>blueprint-service-export</artifactId>
+    <version>0.0.1</version>
+    <packaging>bundle</packaging>
+
+    <name>blueprint-service-export OSGi Bundle</name>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>1.4.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.2.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Activator>com.hascode.tutorial.blueprint_service_export.Activator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>build-for-felix</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.main</artifactId>
+                    <version>3.0.7</version>
+                    <scope>provided</scope>
+                </dependency>
+                <!-- To include a shell:
+                <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.gogo.shell</artifactId>
+                    <version>0.6.1</version>
+                </dependency>
+                -->
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <version>1.6</version>
+                        <executions>
+                            <execution>
+                                <id>compile</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <target>
+                                        <pathconvert property="plugins.jars" pathsep="${path.separator}">
+                                            <path refid="maven.runtime.classpath"/>
+                                            <map from="${project.build.directory}${file.separator}classes" to=""/>
+                                        </pathconvert>
+                                        <pathconvert pathsep=" " property="bundles">
+                                            <path path="${plugins.jars}"/>
+                                            <mapper>
+                                                <chainedmapper>
+                                                    <flattenmapper/>
+                                                    <globmapper from="*" to="file:modules/*" casesensitive="no"/>
+                                                </chainedmapper>
+                                            </mapper>
+                                        </pathconvert>
+                                        <propertyfile file="${project.build.directory}/config.properties">
+                                            <entry key="felix.auto.start" value="${bundles} file:modules/${project.build.finalName}.jar"/>
+                                            <entry key="org.osgi.framework.bootdelegation" value="*"/>
+                                        </propertyfile>
+                                        <copy file="${maven.dependency.org.apache.felix.org.apache.felix.main.jar.path}" tofile="${project.build.directory}/felix.jar"/>
+                                    </target>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-assembly-plugin</artifactId>
+                        <version>2.2</version>
+                        <executions>
+                            <execution>
+                                <id>create-executable-jar</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>single</goal>
+                                </goals>
+                                <configuration>
+                                    <descriptors>
+                                        <descriptor>${basedir}/src/main/assembly/felix.xml</descriptor>
+                                    </descriptors>
+                                    <finalName>${project.build.finalName}</finalName>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>run-on-felix</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.main</artifactId>
+                    <version>3.0.7</version>
+                    <scope>provided</scope>
+                </dependency>
+                <!-- org.apache.felix:org.apache.felix.gogo.shell:0.6.1 useless from Maven since stdin is swallowed -->
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <version>1.6</version>
+                        <configuration>
+                            <target>
+                                <property name="vm.args" value=""/>
+                                <pathconvert property="plugins.jars" pathsep="${path.separator}">
+                                    <path refid="maven.runtime.classpath"/>
+                                    <map from="${project.build.directory}${file.separator}classes" to=""/>
+                                </pathconvert>
+                                <makeurl property="urls" separator=" ">
+                                    <path path="${plugins.jars}"/>
+                                    <path location="${project.build.directory}/${project.build.finalName}.jar"/>
+                                </makeurl>
+                                <propertyfile file="${project.build.directory}/run.properties">
+                                    <entry key="felix.auto.start" value="${urls}"/>
+                                    <entry key="felix.auto.deploy.action" value="uninstall,install,update,start"/>
+                                    <entry key="org.osgi.framework.storage" value="${project.build.directory}${file.separator}felix-cache"/>
+                                    <entry key="org.osgi.framework.bootdelegation" value="*"/>
+                                </propertyfile>
+                                <makeurl property="run.properties.url" file="${project.build.directory}/run.properties"/>
+                                <java fork="true" jar="${maven.dependency.org.apache.felix.org.apache.felix.main.jar.path}">
+                                    <sysproperty key="felix.config.properties" value="${run.properties.url}"/>
+                                    <jvmarg line="${vm.args}"/>
+                                </java>
+                            </target>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

blueprint-service-export/src/main/assembly/felix.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<assembly>
+ <id>all</id>
+  <formats>
+    <format>zip</format>
+  </formats>
+  <dependencySets>
+    <dependencySet>
+        <useProjectArtifact>false</useProjectArtifact>
+        <outputDirectory>modules</outputDirectory>
+    </dependencySet>
+  </dependencySets>
+  <files>
+    <file>
+      <source>${project.build.directory}/${project.build.finalName}.jar</source>
+      <outputDirectory>modules</outputDirectory>
+    </file>
+    <file>
+      <source>${project.build.directory}/felix.jar</source>
+      <outputDirectory>bin</outputDirectory>
+    </file>
+    <file>
+      <source>${project.build.directory}/config.properties</source>
+      <outputDirectory>conf</outputDirectory>
+    </file>
+  </files>
+</assembly>

blueprint-service-export/src/main/java/com/hascode/tutorial/blueprint_service_export/Activator.java

+package com.hascode.tutorial.blueprint_service_export;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+    public void start(BundleContext context) throws Exception {
+        // TODO add activation code here
+    }
+
+    public void stop(BundleContext context) throws Exception {
+        // TODO add deactivation code here
+    }
+
+}

blueprint-service-export/src/main/java/com/hascode/tutorial/blueprint_service_export/SimpleTimeService.java

+package com.hascode.tutorial.blueprint_service_export;
+
+public interface SimpleTimeService {
+	String getTime();
+}

blueprint-service-export/src/main/java/com/hascode/tutorial/blueprint_service_export/SimpleTimeServiceImpl.java

+package com.hascode.tutorial.blueprint_service_export;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class SimpleTimeServiceImpl implements SimpleTimeService {
+
+	public String getTime() {
+		return String.format("the time is: %s",
+				new SimpleDateFormat("hh:mm:ss").format(new Date()));
+	}
+}

blueprint-service-export/src/main/resources/OSGI-INF/blueprint/blueprint.xml

+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd" >
+
+    <service
+        id="simpleTimeService"
+        interface="com.hascode.tutorial.blueprint_service_export.SimpleTimeService"
+        ref="timeService" />
+
+    <bean
+        id="timeService"
+        class="com.hascode.tutorial.blueprint_service_export.SimpleTimeServiceImpl" />
+
+</blueprint>

blueprint-wiring-example/.classpath

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" 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>

blueprint-wiring-example/.project

+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>blueprint-wiring-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>

blueprint-wiring-example/nbactions.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+    <action>
+        <actionName>run</actionName>
+        <goals>
+            <goal>package</goal>
+            <goal>antrun:run</goal>
+        </goals>
+        <activatedProfiles>
+            <activatedProfile>run-on-felix</activatedProfile>
+        </activatedProfiles>
+    </action>
+    <action>
+        <actionName>debug</actionName>
+        <goals>
+            <goal>package</goal>
+            <goal>antrun:run</goal>
+        </goals>
+        <properties>
+            <vm.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</vm.args>
+            <jpda.listen>true</jpda.listen>
+        </properties>
+        <activatedProfiles>
+            <activatedProfile>run-on-felix</activatedProfile>
+        </activatedProfiles>
+    </action>
+    <action>
+        <actionName>profile</actionName>
+        <goals>
+            <goal>package</goal>
+            <goal>antrun:run</goal>
+        </goals>
+        <properties>
+            <vm.args>${profiler.args}</vm.args>
+            <!-- XXX <java jvm="${profiler.java}" ...> -->
+            <profiler.action>profile</profiler.action>
+        </properties>
+        <activatedProfiles>
+            <activatedProfile>run-on-felix</activatedProfile>
+        </activatedProfiles>
+    </action>
+</actions>

blueprint-wiring-example/pom.xml

+<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.hascode.tutorial</groupId>
+    <artifactId>blueprint-wiring-example</artifactId>
+    <version>0.0.1</version>
+    <packaging>bundle</packaging>
+
+    <name>blueprint-wiring-example OSGi Bundle</name>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>1.4.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+        	<groupId>com.hascode.tutorial</groupId>
+        	<artifactId>blueprint-service-export</artifactId>
+        	<version>0.0.1</version>
+        	<type>bundle</type>
+        </dependency>
+        <dependency>
+        	<groupId>com.hascode.tutorial</groupId>
+        	<artifactId>hascode-osgi-service</artifactId>
+        	<version>0.0.1</version>
+        	<type>bundle</type>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.2.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Activator>com.hascode.tutorial.blueprint_wiring_example.Activator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>build-for-felix</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.main</artifactId>
+                    <version>3.0.7</version>
+                    <scope>provided</scope>
+                </dependency>
+                <!-- To include a shell:
+                <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.gogo.shell</artifactId>
+                    <version>0.6.1</version>
+                </dependency>
+                -->
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <version>1.6</version>
+                        <executions>
+                            <execution>
+                                <id>compile</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <target>
+                                        <pathconvert property="plugins.jars" pathsep="${path.separator}">
+                                            <path refid="maven.runtime.classpath"/>
+                                            <map from="${project.build.directory}${file.separator}classes" to=""/>
+                                        </pathconvert>
+                                        <pathconvert pathsep=" " property="bundles">
+                                            <path path="${plugins.jars}"/>
+                                            <mapper>
+                                                <chainedmapper>
+                                                    <flattenmapper/>
+                                                    <globmapper from="*" to="file:modules/*" casesensitive="no"/>
+                                                </chainedmapper>
+                                            </mapper>
+                                        </pathconvert>
+                                        <propertyfile file="${project.build.directory}/config.properties">
+                                            <entry key="felix.auto.start" value="${bundles} file:modules/${project.build.finalName}.jar"/>
+                                            <entry key="org.osgi.framework.bootdelegation" value="*"/>
+                                        </propertyfile>
+                                        <copy file="${maven.dependency.org.apache.felix.org.apache.felix.main.jar.path}" tofile="${project.build.directory}/felix.jar"/>
+                                    </target>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-assembly-plugin</artifactId>
+                        <version>2.2</version>
+                        <executions>
+                            <execution>
+                                <id>create-executable-jar</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>single</goal>
+                                </goals>
+                                <configuration>
+                                    <descriptors>
+                                        <descriptor>${basedir}/src/main/assembly/felix.xml</descriptor>
+                                    </descriptors>
+                                    <finalName>${project.build.finalName}</finalName>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>run-on-felix</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>org.apache.felix.main</artifactId>
+                    <version>3.0.7</version>
+                    <scope>provided</scope>
+                </dependency>
+                <!-- org.apache.felix:org.apache.felix.gogo.shell:0.6.1 useless from Maven since stdin is swallowed -->
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <version>1.6</version>
+                        <configuration>
+                            <target>
+                                <property name="vm.args" value=""/>
+                                <pathconvert property="plugins.jars" pathsep="${path.separator}">
+                                    <path refid="maven.runtime.classpath"/>
+                                    <map from="${project.build.directory}${file.separator}classes" to=""/>
+                                </pathconvert>
+                                <makeurl property="urls" separator=" ">
+                                    <path path="${plugins.jars}"/>
+                                    <path location="${project.build.directory}/${project.build.finalName}.jar"/>
+                                </makeurl>
+                                <propertyfile file="${project.build.directory}/run.properties">
+                                    <entry key="felix.auto.start" value="${urls}"/>
+                                    <entry key="felix.auto.deploy.action" value="uninstall,install,update,start"/>
+                                    <entry key="org.osgi.framework.storage" value="${project.build.directory}${file.separator}felix-cache"/>
+                                    <entry key="org.osgi.framework.bootdelegation" value="*"/>
+                                </propertyfile>
+                                <makeurl property="run.properties.url" file="${project.build.directory}/run.properties"/>
+                                <java fork="true" jar="${maven.dependency.org.apache.felix.org.apache.felix.main.jar.path}">
+                                    <sysproperty key="felix.config.properties" value="${run.properties.url}"/>
+                                    <jvmarg line="${vm.args}"/>
+                                </java>
+                            </target>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

blueprint-wiring-example/src/main/assembly/felix.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<assembly>
+ <id>all</id>
+  <formats>
+    <format>zip</format>
+  </formats>
+  <dependencySets>
+    <dependencySet>
+        <useProjectArtifact>false</useProjectArtifact>
+        <outputDirectory>modules</outputDirectory>
+    </dependencySet>
+  </dependencySets>
+  <files>
+    <file>
+      <source>${project.build.directory}/${project.build.finalName}.jar</source>
+      <outputDirectory>modules</outputDirectory>
+    </file>
+    <file>
+      <source>${project.build.directory}/felix.jar</source>
+      <outputDirectory>bin</outputDirectory>
+    </file>
+    <file>
+      <source>${project.build.directory}/config.properties</source>
+      <outputDirectory>conf</outputDirectory>
+    </file>
+  </files>
+</assembly>

blueprint-wiring-example/src/main/java/com/hascode/tutorial/blueprint_wiring_example/Activator.java

+package com.hascode.tutorial.blueprint_wiring_example;
+
+import java.util.Map;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+	public void start(final BundleContext context) throws Exception {
+	}
+
+	public void stop(final BundleContext context) throws Exception {
+	}
+
+	public void onRegisterService(final TimeGreetService service,
+			final Map properties) {
+		System.out.println("TimeGreetService registered - output: "
+				+ service.print());
+	}
+
+	public void onUnregisterService(final TimeGreetService service,
+			final Map properties) {
+
+	}
+}

blueprint-wiring-example/src/main/java/com/hascode/tutorial/blueprint_wiring_example/TimeGreetService.java

+package com.hascode.tutorial.blueprint_wiring_example;
+
+public interface TimeGreetService {
+	String print();
+}

blueprint-wiring-example/src/main/java/com/hascode/tutorial/blueprint_wiring_example/TimeGreetServiceImpl.java

+package com.hascode.tutorial.blueprint_wiring_example;
+
+import com.hascode.tutorial.blueprint_service_export.SimpleTimeService;
+import com.hascode.tutorial.hascode_osgi_service.api.SampleService;
+
+public class TimeGreetServiceImpl implements TimeGreetService {
+	private final SimpleTimeService timeService;
+	private final SampleService sampleService;
+
+	public TimeGreetServiceImpl(final SimpleTimeService timeService,
+			final SampleService sampleService) {
+		this.timeService = timeService;
+		this.sampleService = sampleService;
+	}
+
+	public String print() {
+		return timeService.getTime() + ":" + sampleService.getGreeting("tim");
+	}
+
+}

blueprint-wiring-example/src/main/resources/OSGI-INF/blueprint/blueprint.xml

+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd" >
+
+    <bean
+        id="timeGreetServiceImpl"
+        class="com.hascode.tutorial.blueprint_wiring_example.TimeGreetServiceImpl" >
+        <argument ref="timeService"/>
+        <argument ref="sampleService"/>
+    </bean>
+    
+    <bean id="activator" class="com.hascode.tutorial.blueprint_wiring_example.Activator"/>
+    
+    <reference
+        id="sampleService"
+        activation="eager"
+        availability="mandatory"
+        interface="com.hascode.tutorial.hascode_osgi_service.api.SampleService" >
+    </reference>
+
+    <reference
+        id="timeService"
+        activation="eager"
+        availability="mandatory"
+        interface="com.hascode.tutorial.blueprint_service_export.SimpleTimeService" >
+    </reference>
+
+    <service
+        id="timeGreetService"
+        interface="com.hascode.tutorial.blueprint_wiring_example.TimeGreetService"
+        ref="timeGreetServiceImpl">
+        <registration-listener ref="activator" registration-method="onRegisterService" unregistration-method="onUnregisterService"></registration-listener>
+    </service>
+
+</blueprint>