Author: davidb
Date: Thu Sep 13 19:21:35 2012
New Revision: 1384481
URL: http://svn.apache.org/viewvc?rev=1384481&view=rev
Log:
Fix some issues with the static bundle manifest and add a demo that shows how
SPI Fly can be used with TCCL.getResource()
Added:
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/pom.xml
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Activator.java
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Foo.java
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/pom.xml
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/spifly/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/spifly/test/
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/spifly/test/blah.txt
Modified:
aries/trunk/spi-fly/spi-fly-examples/pom.xml
aries/trunk/spi-fly/spi-fly-static-bundle/pom.xml
Modified: aries/trunk/spi-fly/spi-fly-examples/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/pom.xml?rev=1384481&r1=1384480&r2=1384481&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-examples/pom.xml Thu Sep 13 19:21:35 2012
@@ -46,5 +46,7 @@
<module>spi-fly-example-client1-jar</module>
<module>spi-fly-example-client1-bundle</module>
<module>spi-fly-example-client2-bundle</module>
+ <module>spi-fly-example-resource-provider-bundle</module>
+ <module>spi-fly-example-resource-client-bundle</module>
</modules>
</project>
Added:
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/pom.xml?rev=1384481&view=auto
==============================================================================
---
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/pom.xml
(added)
+++
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/pom.xml
Thu Sep 13 19:21:35 2012
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+<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>org.apache.aries.spifly.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+
<artifactId>org.apache.aries.spifly.examples.resource.client.bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Example Resource Client Bundle</name>
+ <description>
+ A Bundle obtaining a resource from the TCCL
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Import-Package>
+ *
+ </Import-Package>
+ <Export-Package/>
+ <Private-Package>
+org.apache.aries.spifly.example.resource.client
+ </Private-Package>
+
<Bundle-Activator>org.apache.aries.spifly.example.resource.client.Activator</Bundle-Activator>
+
<SPI-Consumer>org.apache.aries.spifly.example.resource.client.Foo#doit()</SPI-Consumer>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added:
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Activator.java
URL:
http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Activator.java?rev=1384481&view=auto
==============================================================================
---
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Activator.java
(added)
+++
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Activator.java
Thu Sep 13 19:21:35 2012
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.spifly.example.resource.client;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ @Override
+ public void start(BundleContext context) throws Exception {
+ Foo.doit();
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ }
+}
Added:
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Foo.java
URL:
http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Foo.java?rev=1384481&view=auto
==============================================================================
---
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Foo.java
(added)
+++
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-client-bundle/src/main/java/org/apache/aries/spifly/example/resource/client/Foo.java
Thu Sep 13 19:21:35 2012
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.spifly.example.resource.client;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+class Foo {
+ static void doit() throws Exception {
+ System.out.println("*** About to invoke
getThreadContextClassLoader().getResource()");
+
+ URL r =
Thread.currentThread().getContextClassLoader().getResource("/org/apache/aries/spifly/test/blah.txt");
+ System.out.println("*** Found resource: " + r);
+ System.out.println("*** First line of content: " + new
BufferedReader(new InputStreamReader(r.openStream())).readLine());
+ }
+}
Added:
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/pom.xml?rev=1384481&view=auto
==============================================================================
---
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/pom.xml
(added)
+++
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/pom.xml
Thu Sep 13 19:21:35 2012
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+<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>org.apache.aries.spifly.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+
<artifactId>org.apache.aries.spifly.examples.resource.provider.bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Example Resource Provider Bundle</name>
+ <description>
+ A Bundle providing a resource that another bundle attempts to obtain
via the TCCL
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Import-Package/>
+ <Export-Package/>
+ <Private-Package/>
+
<SPI-Provider>org.apache.aries.spifly.example.resource.client.Foo</SPI-Provider>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added:
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/spifly/test/blah.txt
URL:
http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/spifly/test/blah.txt?rev=1384481&view=auto
==============================================================================
---
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/spifly/test/blah.txt
(added)
+++
aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-resource-provider-bundle/src/main/resources/org/apache/aries/spifly/test/blah.txt
Thu Sep 13 19:21:35 2012
@@ -0,0 +1 @@
+This is a test resource.
Modified: aries/trunk/spi-fly/spi-fly-static-bundle/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-static-bundle/pom.xml?rev=1384481&r1=1384480&r2=1384481&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-static-bundle/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-static-bundle/pom.xml Thu Sep 13 19:21:35 2012
@@ -49,6 +49,12 @@
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
@@ -69,6 +75,7 @@
org.apache.aries.spifly.staticbundle
</Private-Package>
<Bundle-Activator>org.apache.aries.spifly.staticbundle.StaticWeavingActivator</Bundle-Activator>
+
<Provide-Capability>osgi.extender;osgi.extender=osgi.serviceloader.registrar</Provide-Capability>
</instructions>
</configuration>
</plugin>