geronimo-osgi-support-1.0.orig/0000755000000000000000000000000011400013473013460 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/0000755000000000000000000000000011400013473017526 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/0000755000000000000000000000000011400013473020315 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/0000755000000000000000000000000011400013473021241 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/0000755000000000000000000000000011400013473023253 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/0000755000000000000000000000000011400013473024426 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/0000755000000000000000000000000011400013473026443 5ustar ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget2geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000202411361326165030406 0ustar # 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. # Tests normal class mapping...NOTE: this uses # TestTarget2 to ensure we're picking up the # services version, not the providers one. org.apache.geronimo.osgi.itestb.TestTargetTwo # Used as an override to map TestTarget to TestTargetTwo ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTargetgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000177111361326165030416 0ustar # 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. # Tests normal class mapping...NOTE: this uses # TestTarget2 to ensure we're picking up the # services version, not the providers one. # Tests normal class mapping.... org.apache.geronimo.osgi.itestb.TestTarget ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget4geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000213611361326165030412 0ustar # 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. # Tests normal class mapping...NOTE: this uses # TestTarget2 to ensure we're picking up the # services version, not the providers one. # Tests normal class mapping.... org.apache.geronimo.osgi.itestb.TestTarget # using multiple provider definitions for a single key org.apache.geronimo.osgi.itestb.TestTarget2 geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/META-INF/0000755000000000000000000000000011400013473024413 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/META-INF/services/0000755000000000000000000000000011400013473026236 5ustar ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.MultiTargetgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000165611361326165030271 0ustar # 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. # Tests normal class mapping for multiple providers org.apache.geronimo.osgi.itestb.TestTarget org.apache.geronimo.osgi.itestb.TestTarget2 ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.TestTargetgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000173011361326165030262 0ustar # 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. # Tests normal class mapping...NOTE: this uses # TestTarget2 to ensure we're picking up the # services version, not the providers one. org.apache.geronimo.osgi.itestb.TestTarget2 geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/0000755000000000000000000000000011400013473022162 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/0000755000000000000000000000000011400013473022751 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/0000755000000000000000000000000011400013473024172 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/0000755000000000000000000000000011400013473026011 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013473026752 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/0000755000000000000000000000000011400013473030244 5ustar ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/Te0000644000000000000000000000235311350204263030545 0ustar /** * 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.geronimo.osgi.itestb; public class TestTargetTwo { public TestTargetTwo() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTargetTwo"; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/Te0000644000000000000000000000234511350204263030546 0ustar /** * 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.geronimo.osgi.itestb; public class TestTarget2 { public TestTarget2() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget2"; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/Te0000644000000000000000000000234511350204263030546 0ustar /** * 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.geronimo.osgi.itestb; public class TestTarget3 { public TestTarget3() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget3"; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/Te0000644000000000000000000000234211350204263030543 0ustar /** * 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.geronimo.osgi.itestb; public class TestTarget { public TestTarget() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } geronimo-osgi-support-1.0.orig/geronimo-osgi-itestb/pom.xml0000644000000000000000000000445411364013573021064 0ustar 4.0.0 org.apache.geronimo.specs geronimo-osgi-support 1.0 org.apache.geronimo.specs geronimo-osgi-itestb bundle Geronimo OSGi integration tests 1.0 Separately built test bundle for use in the various integration tests. This bundle will have provider and services definitions used to test different class provider resolution scenarios. org.apache.felix maven-bundle-plugin ${groupId}.${artifactId};singleton=true org.apache.geronimo.osgi.testb geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/0000755000000000000000000000000011400013473021415 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/0000755000000000000000000000000011400013473022204 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/0000755000000000000000000000000011400013473023163 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/0000755000000000000000000000000011400013473024104 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/0000755000000000000000000000000011400013473024673 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/0000755000000000000000000000000011400013473026114 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/0000755000000000000000000000000011400013473027733 5ustar ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013473030674 5ustar ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013473030674 5ustar ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013473030674 5ustar ././@LongLink0000000000000000000000000000023000000000000011560 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000001470211350204263030705 0ustar /* * 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.geronimo.osgi.registry.itest; import java.io.File; import java.io.IOException; import java.io.InputStream; import org.apache.geronimo.osgi.locator.Activator; import org.apache.geronimo.osgi.locator.ProviderLocator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.CoreOptions; import static org.ops4j.pax.exam.CoreOptions.equinox; import static org.ops4j.pax.exam.CoreOptions.felix; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.bundle; import static org.ops4j.pax.exam.CoreOptions.wrappedBundle; import org.ops4j.pax.exam.Customizer; import org.ops4j.pax.exam.Inject; import org.ops4j.pax.exam.Option; import static org.ops4j.pax.exam.OptionUtils.combine; import org.ops4j.pax.exam.junit.JUnit4TestRunner; import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.*; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; @RunWith(JUnit4TestRunner.class) public class OSGiLocatorMultipleProviderTest { @Inject protected BundleContext bundleContext; @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() throws Exception { Option[] options = options( // the target code we're testing mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-registry"), mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itesta"), mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itestb"), mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), felix(), equinox().version("3.5.0"), // we want to specify an activator for the test probe bundle that // is the standard one for adding the locator service to a spec // bundle. We'll use our activator instance to perform class lookups new Customizer() { @Override public InputStream customizeTestProbe( InputStream testProbe ) throws IOException { return modifyBundle(testProbe) // these two classes need to be in every participating bundle .add(org.apache.geronimo.osgi.locator.Activator.class) .add(org.apache.geronimo.osgi.locator.ProviderLocator.class) // set the required activator also .set(Constants.BUNDLE_ACTIVATOR, org.apache.geronimo.osgi.locator.Activator.class.getName()) // we need an import for activator to function properly. .set(Constants.IMPORT_PACKAGE, "org.apache.geronimo.osgi.registry.api") .build(); } } ); options = updateOptions(options); return options; } @Test public void testLocator() throws Exception { Bundle bundle1 = getInstalledBundle("org.apache.geronimo.specs.geronimo-osgi-itesta"); Bundle bundle2 = getInstalledBundle("org.apache.geronimo.specs.geronimo-osgi-itestb"); // check for the target class a verify we got the correct one Class target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName()); // now stop the first bundle, which should shuffle the deck bundle1.stop(); // The returned class should now be from the second provisioned bundle target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itestb.TestTarget", target.getName()); // now stop the the second bundle. There should not be anything registred with that name now. bundle2.stop(); // The returned class should now be null since there are no registered providers target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget"); assertNull(target); } protected Bundle getInstalledBundle(String symbolicName) { for (Bundle b : bundleContext.getBundles()) { if (b.getSymbolicName().equals(symbolicName)) { return b; } } return null; } public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) { return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject(); } protected static Option[] updateOptions(Option[] options) { // We need to add pax-exam-junit here when running with the ibm // jdk to avoid the following exception during the test run: // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration if ("IBM Corporation".equals(System.getProperty("java.vendor"))) { Option[] ibmOptions = options( wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit")) ); options = combine(ibmOptions, options); } return options; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTargetTwo.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000000236311350204263030705 0ustar /** * 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.geronimo.osgi.registry.itest; public class TestTargetTwo { public TestTargetTwo() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTargetTwo"; } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000003072711353120551030712 0ustar /* * 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.geronimo.osgi.registry.itest; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.List; import org.apache.geronimo.osgi.locator.Activator; import org.apache.geronimo.osgi.locator.ProviderLocator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.CoreOptions; import static org.ops4j.pax.exam.CoreOptions.bundle; import static org.ops4j.pax.exam.CoreOptions.equinox; import static org.ops4j.pax.exam.CoreOptions.felix; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.wrappedBundle; import org.ops4j.pax.exam.Customizer; import org.ops4j.pax.exam.Inject; import org.ops4j.pax.exam.Option; import static org.ops4j.pax.exam.OptionUtils.combine; import org.ops4j.pax.exam.junit.JUnit4TestRunner; import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.*; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; @RunWith(JUnit4TestRunner.class) public class OSGiLocatorTest { @Inject protected BundleContext bundleContext; @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() throws Exception { Option[] options = options( // the target code we're testing... mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-registry"), // bundle containing test resources mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itesta"), mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), felix(), equinox().version("3.5.0"), // we want to specify an activator for the test probe bundle that // is the standard one for adding the locator service to a spec // bundle. We'll use our activator instance to perform class lookups new Customizer() { @Override public InputStream customizeTestProbe( InputStream testProbe ) throws IOException { return modifyBundle(testProbe) // these two classes need to be in every participating bundle .add(org.apache.geronimo.osgi.locator.Activator.class) .add(org.apache.geronimo.osgi.locator.ProviderLocator.class) // we don't have any direct references to this class, so force it to be // included. .add(org.apache.geronimo.osgi.registry.itest.TestTargetLocal.class) // set the required activator also .set(Constants.BUNDLE_ACTIVATOR, org.apache.geronimo.osgi.locator.Activator.class.getName()) // we need an import for activator to function properly. .set(Constants.IMPORT_PACKAGE, "org.apache.geronimo.osgi.registry.api") .build(); } } ); options = updateOptions(options); return options; } @Test public void testLocator() throws Exception { Bundle bundle1 = getInstalledBundle("org.apache.geronimo.specs.geronimo-osgi-itesta"); // check for the target class a verify we got the correct one Class target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName()); List> targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget"); // should return one entry and it should be the same class mapping assertEquals(1, targets.size()); assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", targets.get(0).getName()); // now load the second target interface. This is really the same as the first, but // uses a different commenting style. target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget2"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTargetTwo", target.getName()); targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget2"); // should return one entry and it should be the same class mapping assertEquals(1, targets.size()); assertEquals("org.apache.geronimo.osgi.itesta.TestTargetTwo", targets.get(0).getName()); // this class is defined using the header form. It should map back to itself. target = ProviderLocator.locate("org.apache.geronimo.osgi.itesta.TestTarget2"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", target.getName()); targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.itesta.TestTarget2"); // should return one entry and it should be the same class mapping assertEquals(1, targets.size()); assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", targets.get(0).getName()); // This is not in the provider registry, so it should just return null. target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.ClassNotFound"); assertNull(target); // This is in the provider registry, but the class cannot be loaded. This should still // return null. target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.NoClass"); assertNull(target); // This is defined as a header, but the class cannot be loaded. This should still // return null. target = ProviderLocator.locate("org.apache.geronimo.osgi.itesta..NoClass"); assertNull(target); // Now test some of the class loading support. This will search the provider registry first, // then the classpath. We should still get the registered class returned. target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass()); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName()); // similar to the above, but since the context class is not provided, this will fail to resolve the // locally resident class. target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.TestTarget", null); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName()); // And just a straight load class of a bundle-local class. target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.TestTargetTwo", this.getClass()); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.registry.itest.TestTargetTwo", target.getName()); // this one should be handled from the provider registry and resolve to a class // defined in the test bundle. target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.TestTarget4", this.getClass()); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName()); // this should not be located at all try { target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.ClassNotFound", this.getClass()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // this is in the registry, but there is an error resolving the class try { target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // this is defined with a header, but there is an error resolving the class try { target = ProviderLocator.loadClass("org.apache.geronimo.osgi.itesta.NoClass", this.getClass()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // this mapping defines multiple classes for the single key. The first should be returned for // a singleton request, the locate all should return in definition order target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget4"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName()); targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget4"); // should return one entry and it should be the same class mapping assertEquals(2, targets.size()); assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", targets.get(0).getName()); assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", targets.get(1).getName()); // now stop the first bundle, which should shuffle the deck bundle1.stop(); // The returned class should now be null since there are no registered providers target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget"); assertNull(target); targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget"); // should return an empty list assertNotNull(targets); assertEquals(0, targets.size()); // The returned class should now be null since there are no registered providers target = ProviderLocator.locate("org.apache.geronimo.osgi.itesta.TestTarget2"); assertNull(target); // This is in the provider registry, but the class cannot be loaded. This should still // return null. target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.NoClass"); assertNull(target); } protected Bundle getInstalledBundle(String symbolicName) { for (Bundle b : bundleContext.getBundles()) { if (b.getSymbolicName().equals(symbolicName)) { return b; } } return null; } public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) { return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject(); } protected static Option[] updateOptions(Option[] options) { // We need to add pax-exam-junit here when running with the ibm // jdk to avoid the following exception during the test run: // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration if ("IBM Corporation".equals(System.getProperty("java.vendor"))) { Option[] ibmOptions = options( wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit")) ); options = combine(ibmOptions, options); } return options; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000000235511350204263030706 0ustar /** * 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.geronimo.osgi.registry.itest; public class TestTarget2 { public TestTarget2() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget2"; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000000235511350204263030706 0ustar /** * 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.geronimo.osgi.registry.itest; public class TestTarget3 { public TestTarget3() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget3"; } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTargetLocal.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000000236411350204263030706 0ustar /** * 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.geronimo.osgi.registry.itest; public class TestTargetLocal { public TestTargetLocal() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiNoRegistryTest.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000001705511353120551030711 0ustar /* * 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.geronimo.osgi.registry.itest; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.List; import org.apache.geronimo.osgi.locator.Activator; import org.apache.geronimo.osgi.locator.ProviderLocator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.CoreOptions; import static org.ops4j.pax.exam.CoreOptions.bundle; import static org.ops4j.pax.exam.CoreOptions.equinox; import static org.ops4j.pax.exam.CoreOptions.felix; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.wrappedBundle; import org.ops4j.pax.exam.Customizer; import org.ops4j.pax.exam.Inject; import org.ops4j.pax.exam.Option; import static org.ops4j.pax.exam.OptionUtils.combine; import org.ops4j.pax.exam.junit.JUnit4TestRunner; import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.*; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; @RunWith(JUnit4TestRunner.class) public class OSGiNoRegistryTest { @Inject protected BundleContext bundleContext; @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() throws Exception { Option[] options = options( // NOTE: This test is supposed to test that the ProviderLocator // does not raise exceptions if the provider registry is not // available and the ProviderRegistry api class is not resolvable. // mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-registry"), // bundle containing test resources mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itesta"), mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), felix(), equinox().version("3.5.0"), // we want to specify an activator for the test probe bundle that // is the standard one for adding the locator service to a spec // bundle. We'll use our activator instance to perform class lookups new Customizer() { @Override public InputStream customizeTestProbe( InputStream testProbe ) throws IOException { return modifyBundle(testProbe) // these two classes need to be in every participating bundle .add(org.apache.geronimo.osgi.locator.Activator.class) .add(org.apache.geronimo.osgi.locator.ProviderLocator.class) // we don't have any direct references to this class, so force it to be // included. .add(org.apache.geronimo.osgi.registry.itest.TestTargetLocal.class) // set the required activator also .set(Constants.BUNDLE_ACTIVATOR, org.apache.geronimo.osgi.locator.Activator.class.getName()) // we need an import for activator to function properly...make sure the resolution // is optional, which is the typical way of dealing with this .set(Constants.IMPORT_PACKAGE, "org.apache.geronimo.osgi.registry.api;resolution:=optional") .build(); } } ); options = updateOptions(options); return options; } @Test public void testLocator() throws Exception { // Ok, just a few quick tests to make sure things fail gracefully. Class target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget"); assertNull(target); List> targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget"); // should return an empty list assertNotNull(targets); assertEquals(0, targets.size()); // this should not be located at all try { target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.ClassNotFound", this.getClass()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // now some service tests Object service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNull(service); // now testing a multiple instances get. This should only pick up the definition from the // bundle that includes the SPI-Provider header (testa) List services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(0, services.size()); // same set of tests, but this time we're looking for classes, not instances target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNull(target); List> classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertEquals(0, classes.size()); } protected Bundle getInstalledBundle(String symbolicName) { for (Bundle b : bundleContext.getBundles()) { if (b.getSymbolicName().equals(symbolicName)) { return b; } } return null; } public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) { return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject(); } protected static Option[] updateOptions(Option[] options) { // We need to add pax-exam-junit here when running with the ibm // jdk to avoid the following exception during the test run: // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration if ("IBM Corporation".equals(System.getProperty("java.vendor"))) { Option[] ibmOptions = options( wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit")) ); options = combine(ibmOptions, options); } return options; } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiServiceLocatorTest.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000003435611353120551030714 0ustar /* * 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.geronimo.osgi.registry.itest; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.List; import org.apache.geronimo.osgi.locator.Activator; import org.apache.geronimo.osgi.locator.ProviderLocator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.CoreOptions; import static org.ops4j.pax.exam.CoreOptions.bundle; import static org.ops4j.pax.exam.CoreOptions.equinox; import static org.ops4j.pax.exam.CoreOptions.felix; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.wrappedBundle; import org.ops4j.pax.exam.Customizer; import org.ops4j.pax.exam.Inject; import org.ops4j.pax.exam.Option; import static org.ops4j.pax.exam.OptionUtils.combine; import org.ops4j.pax.exam.junit.JUnit4TestRunner; import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.*; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; @RunWith(JUnit4TestRunner.class) public class OSGiServiceLocatorTest { @Inject protected BundleContext bundleContext; @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() throws Exception { Option[] options = options( // the target code we're testing... mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-registry"), // bundle containing test resources mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itesta"), // this bundle opts out of the SPI-Provider status mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itestb"), mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), felix(), equinox().version("3.5.0"), // we want to specify an activator for the test probe bundle that // is the standard one for adding the locator service to a spec // bundle. We'll use our activator instance to perform class lookups new Customizer() { @Override public InputStream customizeTestProbe( InputStream testProbe ) throws IOException { return modifyBundle(testProbe) // these two classes need to be in every participating bundle .add(org.apache.geronimo.osgi.locator.Activator.class) .add(org.apache.geronimo.osgi.locator.ProviderLocator.class) // we don't have any direct references to this class, so force it to be // included. .add(org.apache.geronimo.osgi.registry.itest.TestTargetLocal.class) // set the required activator also .set(Constants.BUNDLE_ACTIVATOR, org.apache.geronimo.osgi.locator.Activator.class.getName()) // we need an import for activator to function properly. .set(Constants.IMPORT_PACKAGE, "org.apache.geronimo.osgi.registry.api") .build(); } } ); options = updateOptions(options); return options; } @Test public void testServiceLocator() throws Exception { Bundle bundle1 = getInstalledBundle("org.apache.geronimo.specs.geronimo-osgi-itesta"); // now testing the services lookup and instantiation mechanism. These should all be satisfied by // the extender rather than loaded from the classpath. Object service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(service); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", service.getClass().getName()); // we expect a new instance on each call. Verify that the instances are different Object service2 = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(service2); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", service2.getClass().getName()); assertNotSame(service, service2); // now testing a multiple instances get. This should only pick up the definition from the // bundle that includes the SPI-Provider header (testa) List services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(1, services.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", services.get(0).getClass().getName()); // these should be different instances assertNotSame(service, services.get(0)); // this is multiple instances defined in a single services file. services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itesta.MultiTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(2, services.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", services.get(0).getClass().getName()); assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", services.get(1).getClass().getName()); // this should not be found service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNull(service); // again, not found. Should return an empty list services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(0, services.size()); // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // this should return an empty list services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertTrue(services.isEmpty()); // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.BadClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (NullPointerException e) { } // but this should just give an empty list again services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.BadClass", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertTrue(services.isEmpty()); // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoConstructor", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (InstantiationException e) { } // and again, an empty list services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoConstructor", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertTrue(services.isEmpty()); // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoAccess", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (IllegalAccessException e) { } // empty list services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoAccess", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertTrue(services.isEmpty()); // same set of tests, but this time we're looking for classes, not instances Class target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(target); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", target.getName()); // now testing a multiple instances get. This should pick up a definition from both // jars on the class path List> classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertEquals(1, classes.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", classes.get(0).getName()); // this is multiple instances defined in a single services file. classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itesta.MultiTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertEquals(2, classes.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", classes.get(0).getName()); assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", classes.get(1).getName()); // this should not be found target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNull(target); // again, not found. Should return an empty list classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertEquals(0, classes.size()); // this should result in an exception try { target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // an empty list again classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertTrue(classes.isEmpty()); // now stop the first bundle, which should remove the service defintions. bundle1.stop(); // repeat the first queries, which should fail now service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNull(service); // this should revert to an empty list now. services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(0, services.size()); } protected Bundle getInstalledBundle(String symbolicName) { for (Bundle b : bundleContext.getBundles()) { if (b.getSymbolicName().equals(symbolicName)) { return b; } } return null; } public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) { return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject(); } protected static Option[] updateOptions(Option[] options) { // We need to add pax-exam-junit here when running with the ibm // jdk to avoid the following exception during the test run: // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration if ("IBM Corporation".equals(System.getProperty("java.vendor"))) { Option[] ibmOptions = options( wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit")) ); options = combine(ibmOptions, options); } return options; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/0000644000000000000000000000235211350204263030703 0ustar /** * 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.geronimo.osgi.registry.itest; public class TestTarget { public TestTarget() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } geronimo-osgi-support-1.0.orig/geronimo-osgi-registry-itests/pom.xml0000644000000000000000000001431311364013573022746 0ustar 4.0.0 org.apache.geronimo.specs geronimo-osgi-support 1.0 org.apache.geronimo.specs geronimo-osgi-registry-itests Tests for the OSGi provider registry inside of an OSGi framework. org.apache.geronimo.specs geronimo-osgi-registry test org.apache.geronimo.specs geronimo-osgi-locator test org.apache.geronimo.specs geronimo-osgi-itesta test org.apache.geronimo.specs geronimo-osgi-itestb test org.osgi org.osgi.core test org.osgi org.osgi.compendium test org.ops4j.pax.exam pax-exam test org.ops4j.pax.exam pax-exam-junit test org.ops4j.pax.exam pax-exam-container-default test org.ops4j.pax.exam pax-exam-junit-extender-impl test org.ops4j.pax.swissbox pax-swissbox-tinybundles test org.ops4j.pax.logging pax-logging-api test org.apache.felix org.apache.felix.configadmin test org.apache.servicemix.tooling depends-maven-plugin 1.1 generate-depends-file generate-depends-file org.apache.maven.plugins maven-surefire-plugin true false **/OSGi*.java org.codehaus.mojo failsafe-maven-plugin 2.4.3-alpha-1 integration-test integration-test verify verify true false **/OSGiLocatorTest.java **/OSGiNoRegistryTest.java **/OSGiLocatorMultipleProviderTest.java **/OSGiServiceLocatorTest.java geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/0000755000000000000000000000000011400013473021210 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/0000755000000000000000000000000011400013473021777 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/0000755000000000000000000000000011400013473022756 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/0000755000000000000000000000000011400013473023677 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/0000755000000000000000000000000011400013473024466 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/0000755000000000000000000000000011400013473025707 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/0000755000000000000000000000000011400013473027526 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013473030467 5ustar ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/l0000755000000000000000000000000011400013473030643 5ustar ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/l0000755000000000000000000000000011400013473030643 5ustar ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.javageronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/l0000644000000000000000000002656611350204263030667 0ustar /* * 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.geronimo.osgi.loader.itest; import java.io.InputStream; import java.io.IOException; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; import org.apache.geronimo.osgi.locator.ProviderLocator; public class NonOSGiLocatorTest { @Test public void testLocator() throws Exception { // this is verifying that the ProviderLocater can be called when used outside of // an OSGi framework without causing an exception. This will verify that the OSGi // classes are not on the classpath before attempting this. try { this.getClass().getClassLoader().loadClass("org.osgi.util.tracker.ServiceTracker"); fail("OSGi framework classes must not be on the class path for this test"); } catch (ClassNotFoundException e) { // this should happen if the test is run correctly. } // Run outside of an OSGi framework, this should just return null without // causing an error Class target = ProviderLocator.locate("org.apache.geronimo.osgi.locator.itest.TestTarget"); assertNull(target); // this should be located on our local classpath, so it should get a good return target = ProviderLocator.loadClass("org.apache.geronimo.osgi.locator.itest.TestTarget"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.locator.itest.TestTarget", target.getName()); // this will be on our dependency class path, so it should still be located. target = ProviderLocator.loadClass("org.apache.geronimo.osgi.itesta.TestTarget"); assertNotNull(target); // this should return the given class instance assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName()); // this should not be located at all try { target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.ClassNotFound"); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // now testing the services lookup and instantiation mechanism Object service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(service); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", service.getClass().getName()); // we expect a new instance on each call. Verify that the instances are different Object service2 = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(service2); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", service2.getClass().getName()); assertNotSame(service, service2); // now testing a multiple instances get. This should pick up a definition from both // jars on the class path List services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(2, services.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", services.get(0).getClass().getName()); assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", services.get(1).getClass().getName()); assertNotSame(service, services.get(0)); // this is multiple instances defined in a single services file. services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.MultiTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(2, services.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itestb.TestTarget", services.get(0).getClass().getName()); assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", services.get(1).getClass().getName()); // this should not be found service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNull(service); // again, not found. Should return an empty list services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(services); assertEquals(0, services.size()); // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // as should this try { services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.BadClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (NullPointerException e) { } // as should this try { services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.BadClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (NullPointerException e) { } // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoConstructor", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (InstantiationException e) { } // as should this try { services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoConstructor", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (InstantiationException e) { } // this should result in an exception try { service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoAccess", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (IllegalAccessException e) { } // as should this try { services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoAccess", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected Exception not thrown"); } catch (IllegalAccessException e) { } // same set of tests, but this time we're looking for classes, not instances target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(target); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", target.getName()); // now testing a multiple instances get. This should pick up a definition from both // jars on the class path List> classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertEquals(2, classes.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", classes.get(0).getName()); assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", classes.get(1).getName()); // this is multiple instances defined in a single services file. classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.MultiTarget", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertEquals(2, classes.size()); // this should return an instance created from the services definition assertEquals("org.apache.geronimo.osgi.itestb.TestTarget", classes.get(0).getName()); assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", classes.get(1).getName()); // this should not be found target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNull(target); // again, not found. Should return an empty list classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader()); assertNotNull(classes); assertEquals(0, classes.size()); // this should result in an exception try { target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } // as should this try { classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader()); fail("Expected ClassNotFoundException not thrown"); } catch (ClassNotFoundException e) { } } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.javageronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/l0000644000000000000000000000235111350204263030651 0ustar /** * 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.geronimo.osgi.locator.itest; public class TestTarget { public TestTarget() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } geronimo-osgi-support-1.0.orig/geronimo-osgi-locator-itests/pom.xml0000644000000000000000000000560011364013573022540 0ustar 4.0.0 org.apache.geronimo.specs geronimo-osgi-support 1.0 org.apache.geronimo.specs geronimo-osgi-locator-itests This project contains integration tests to ensure that the code in the locator will function correctly if used outside of an OSGi framework. These tests will have no dependnecies on any OSGi classes when run, and should function without error. org.apache.geronimo.specs geronimo-osgi-locator test org.apache.geronimo.specs geronimo-osgi-itesta test org.apache.geronimo.specs geronimo-osgi-itestb test junit junit test org.apache.maven.plugins maven-surefire-plugin true false geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/0000755000000000000000000000000011400013473020104 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/0000755000000000000000000000000011400013472020672 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/0000755000000000000000000000000011400013472021616 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/0000755000000000000000000000000011400013472022537 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/0000755000000000000000000000000011400013472023326 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/0000755000000000000000000000000011400013472024547 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/0000755000000000000000000000000011400013472026366 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013472027327 5ustar ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registr0000755000000000000000000000000011400013473030730 5ustar ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/ProviderRegistryImpl.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registr0000644000000000000000000006204611353120551030745 0ustar /** * 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.geronimo.osgi.registry; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.osgi.framework.Bundle; import org.osgi.service.log.LogService; /** * The implementation of the provider registry used to store * the bundle registrations. */ public class ProviderRegistryImpl implements org.apache.geronimo.osgi.registry.api.ProviderRegistry { // indicates a bundle wishes to opt in to the META-INF/services registration and tracking. public static final String OPT_IN_HEADER = "SPI-Provider"; // provider classes exported via a header. public static final String EXPORT_PROVIDER_HEADER = "Export-SPI-Provider"; // our mapping between a provider id and the implementation information. There // might be a one-to-many relationship between the ids and implementing classes. private SPIRegistry providers = new SPIRegistry(); // our mapping between an interface name and a META-INF/services SPI implementation. There // might be a one-to-many relationship between the ids and implementing classes. private SPIRegistry serviceProviders = new SPIRegistry(); // our base Activator (used as a service source) private Activator activator; public ProviderRegistryImpl(Activator activator) { this.activator = activator; } /** * Add a bundle to the provider registry. This searches * for services information in the OSGI-INF/providers * directory of the bundle and registers this information * in a provider registry. Bundles that need to locate * class instances can use the provider registry to * locate classes that might reside in other bundles. * * @param bundle The source bundle. * * @return A map of the located registrations. Returns null if * this bundle does not contain any providers. */ public Object addBundle(Bundle bundle) { log(LogService.LOG_DEBUG, "adding bundle " + bundle); // create a tracker item for this bundle. This will record all of the information // that's relevent to this bundle BundleResources tracker = new BundleResources(bundle); // if the tracker found information of interest, return it to the // BundleTracker to let it know we need to watch this one. return tracker.needsTracking() ? tracker : null; } /** * Remove a bundle from the registry. * * @param bundle The target bundle. */ public void removeBundle(Bundle bundle, Object obj) { log(LogService.LOG_DEBUG, "removing bundle " + bundle); BundleResources tracker = (BundleResources)obj; if (tracker != null) { tracker.remove(); } } /** * Register an individual provivider item by its provider identifier. * * @param id The provider id. * @param provider The loader used to resolve the provider class. */ protected void registerProvider(BundleProviderLoader provider) { log(LogService.LOG_DEBUG, "registering provider " + provider); providers.register(provider); } /** * Removed a provider registration for a named provider id. * * @param id The target id * @param provider The provider registration instance */ protected void unregisterProvider(BundleProviderLoader provider) { log(LogService.LOG_DEBUG, "unregistering provider " + provider); providers.unregister(provider); } /** * Register an individual provivider item by its provider identifier. * * @param id The provider id. * @param provider The loader used to resolve the provider class. */ protected void registerService(BundleProviderLoader provider) { log(LogService.LOG_DEBUG, "registering service " + provider); serviceProviders.register(provider); } /** * Removed a provider registration for a named provider id. * * @param id The target id * @param provider The provider registration instance */ protected void unregisterService(BundleProviderLoader provider) { log(LogService.LOG_DEBUG, "unregistering service " + provider); serviceProviders.unregister(provider); } /** * Locate a class by its provider id indicator. . * * @param providerId The provider id (generally, a fully qualified class name). * * @return The Class corresponding to this provider id. Returns null * if this is not registered or the indicated class can't be * loaded. */ public Class locate(String providerId) { // see if we have a registered match for this...getting just the first instance BundleProviderLoader loader = providers.getLoader(providerId); if (loader != null) { try { // try to load this. We always return null return loader.loadClass(); } catch (Exception e) { e.printStackTrace(); // just swallow this and return null. The exception has already // been logged. } } // no match to return return null; } /** * Locate all class files that match a given provider id. * * @param providerId The target provider identifier. * * @return A List containing the class objects corresponding to the * provider identifier. Returns an empty list if no * matching classes can be located. */ public List> locateAll(String providerId) { List> classes = new ArrayList>(); List l = providers.getLoaders(providerId); // this returns null if nothing is found. if (l != null) { for (BundleProviderLoader c : l) { try { classes.add(c.loadClass()); } catch (Exception e) { // just swallow this and proceed to the next. The exception has // already been logged. } } } return classes; } /** * Locate and instantiate an instance of a service provider * defined in the META-INF/services directory of tracked bundles. * * @param providerId The name of the target interface class. * * @return The service instance. Returns null if no service defintions * can be located. * @exception Exception Any classloading or other exceptions thrown during * the process of creating this service instance. */ public Object getService(String providerId) throws Exception { // see if we have a registered match for this...getting just the first instance BundleProviderLoader loader = serviceProviders.getLoader(providerId); if (loader != null) { // try to load this and create an instance. Any/all exceptions get // thrown here return loader.createInstance(); } // no match to return return null; } /** * Locate all services that match a given provider id and create instances. * * @param providerId The target provider identifier. * * @return A List containing the instances corresponding to the * provider identifier. Returns an empty list if no * matching classes can be located or created */ public List getServices(String providerId) { List instances = new ArrayList(); List l = serviceProviders.getLoaders(providerId); // this returns null for nothing found if (l != null) { for (BundleProviderLoader c : l) { try { instances.add(c.createInstance()); } catch (Exception e) { // just swallow this and proceed to the next. The exception has // already been logged. } } } return instances; } /** * Locate all services that match a given provider id and return the implementation * classes * * @param providerId The target provider identifier. * * @return A List containing the classes corresponding to the * provider identifier. Returns an empty list if no * matching classes can be located. */ public List> getServiceClasses(String providerId) { List> classes = new ArrayList>(); List l = serviceProviders.getLoaders(providerId); // this returns null for nothing found if (l != null) { for (BundleProviderLoader c : l) { try { classes.add(c.loadClass()); } catch (Exception e) { e.printStackTrace(); // just swallow this and proceed to the next. The exception has // already been logged. } } } return classes; } /** * Locate and return the class for a service provider * defined in the META-INF/services directory of tracked bundles. * * @param providerId The name of the target interface class. * * @return The provider class. Returns null if no service defintions * can be located. * @exception Exception Any classloading or other exceptions thrown during * the process of loading this service provider class. */ public Class getServiceClass(String providerId) throws ClassNotFoundException { // see if we have a registered match for this...getting just the first instance BundleProviderLoader loader = serviceProviders.getLoader(providerId); if (loader != null) { // try to load this and create an instance. Any/all exceptions get // thrown here return loader.loadClass(); } // no match to return return null; } private void log(int level, String message) { activator.log(level, message); } private void log(int level, String message, Throwable th) { activator.log(level, message, th); } private class BundleResources { // the bundle we're attached to. private Bundle bundle; // our map of providers maintained for the META-INF/services design pattern. // this is an interface-to-provider instance mapping. private List serviceProviders; // the defined mapping for provider classes...not maintained as an // interface-to-provider mapping. private List providers; public BundleResources(Bundle b) { bundle = b; // go locate any services we need locateProviders(); locateServices(); } public boolean needsTracking() { return serviceProviders != null || providers != null; } // locate and process any providers defined in the OSGI-INF/providers directory private void locateProviders() { // we accumulate from the headers and the providers directory. The headers // are simpler if there is no class mapping and is easier to use when // converting a simple jar to a bundle. Set locatedProviders = new LinkedHashSet(); List headerProviders = locateHeaderProviderDefinitions(); if (headerProviders != null) { locatedProviders.addAll(headerProviders); } List directoryProviders = processDefinitions("OSGI-INF/providers/"); if (directoryProviders != null) { locatedProviders.addAll(directoryProviders); } // if we have anything, add to global registry if (!locatedProviders.isEmpty()) { // process the registrations for each item for (BundleProviderLoader loader: locatedProviders) { // add to the mapping table registerProvider(loader); } // remember this list so we can unregister when the bundle is stopped providers = new ArrayList(locatedProviders); } } /** * Parse the Export-Provider: header to create a list of * providers that are exported via the header syntax * rather than via a provider mapping file. * * @return A list of providers defined on the header, or null if * no providers were exported. */ private List locateHeaderProviderDefinitions() { // check the header to see if there's anything defined here. String exportedProviders = (String)bundle.getHeaders().get(EXPORT_PROVIDER_HEADER); if (exportedProviders == null) { return null; } Listproviders = new ArrayList(); // split on the separator String[] classNames = exportedProviders.split(","); for (String name : classNames) { name = name.trim(); // this is a simple mapping providers.add(new BundleProviderLoader(name, name, bundle)); } return providers; } // now process any services private void locateServices() { // we only process these if there is a header indicating this // bundle wants to opt-in to this registration process. if (bundle.getHeaders().get(OPT_IN_HEADER) == null) { return; } log(LogService.LOG_INFO, OPT_IN_HEADER + " Manifest header found in bundle: " + bundle.getSymbolicName()); serviceProviders = processDefinitions("META-INF/services/"); // if we have anything, add to global registry if (serviceProviders != null) { // process the registrations for each item for (BundleProviderLoader loader: serviceProviders) { // add to the mapping table registerService(loader); } } } /** * Remove all resources associated with this bundle from the * global registry. */ public void remove() { log(LogService.LOG_DEBUG, "removing bundle " + bundle); if (providers != null) { for (BundleProviderLoader loader : providers) { // unregistry the individual entry unregisterProvider(loader); } } if (serviceProviders != null) { for (BundleProviderLoader loader : serviceProviders) { // unregistry the individual entry unregisterService(loader); } } } /** * Process all of the service definition files in a given * target path. This is used to process both the * META-INF/services files and the OSGI-INF/providers files. * * @param path The target path location. * * @return The list of matching service definitions. Returns null if * no matches were found. */ private List processDefinitions(String path) { List mappings = new ArrayList(); // look for services definitions in the bundle...we accumulate these as provider class // definitions. Enumeration e = bundle.findEntries(path, "*", false); if (e != null) { while (e.hasMoreElements()) { final URL u = (URL) e.nextElement(); // go parse out the control file parseServiceFile(u, mappings); } } // only return this if we have something associated with this bundle return mappings.isEmpty() ? null : mappings; } /** * Parse a provider definition file and create loaders * for all definitions contained within the file. * * @param u The URL of the file * * @return A list of the defined mappings. */ private void parseServiceFile(URL u, Listmappings) { final String url = u.toString(); // ignore directories if (url.endsWith("/")) { return; } // the identifier used for the provider is the last item in the URL. final String providerId = url.substring(url.lastIndexOf("/") + 1); try { BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream(), "UTF-8")); String providerClassName = null; // the file can be multiple lines long, with comments. A single file can define multiple providers // for a single key, so we might need to create multiple entries. If the file does not contain any // definition lines, then as a default, we use the providerId as an implementation class also. String line = br.readLine(); while (line != null) { // we allow comments on these lines, and a line can be all comment int comment = line.indexOf('#'); if (comment != -1) { line = line.substring(0, comment); } line = line.trim(); // if there is nothing left on the line after stripping white space and comments, skip this if (line.length() > 0) { // add this to our list mappings.add(new BundleProviderLoader(providerId, line, bundle)); } // keep reading until the end. line = br.readLine(); } br.close(); } catch (IOException e) { // ignore errors and handle as default } } } /** * Holder class for information about a given collection of * id to provider mappings. Used for both the providers and * the services. */ private class SPIRegistry { private Map> registry; /** * Register an individual provivider item by its provider identifier. * * @param id The provider id. * @param provider The loader used to resolve the provider class. */ public synchronized void register(BundleProviderLoader provider) { // if this is the first registration, create the mapping table if (registry == null) { registry = new HashMap>(); } String providerId = provider.id(); // the providers are stored as a list...we use the first one registered // when asked to locate. List l = registry.get(providerId); if (l == null) { l = new ArrayList(); registry.put(providerId, l); } l.add(provider); } /** * Remove a provider registration for a named provider id. * * @param provider The provider registration instance */ public synchronized void unregister(BundleProviderLoader provider) { if (registry != null) { // this is stored as a list. Just remove using the registration information // This may move a different provider to the front of the list. List l = registry.get(provider.id()); if (l != null) { l.remove(provider); } } } private synchronized BundleProviderLoader getLoader(String id) { // synchronize on the registry instance if (registry != null) { // return the first match, if any List list = registry.get(id); if (list != null && !list.isEmpty()) { return list.get(0); } } // no match here return null; } private synchronized List getLoaders(String id) { if (registry != null) { // if we have matches, return a copy of what we currently have // to create a safe local copy. List list = registry.get(id); if (list != null && !list.isEmpty()) { return new ArrayList(list); } } // no match here return null; } } /** * Holder class for located services information. */ private class BundleProviderLoader { // the class name for this provider private final String providerId; // the mapped class name of the provider. private final String providerClass; // the hosting bundle. private final Bundle bundle; /** * Create a loader for this registered provider. * * @param providerId The provider ID * @param providerClass The mapped class name of the provider. * @param bundle The hosting bundle. */ public BundleProviderLoader(String providerId, String providerClass, Bundle bundle) { this.providerId = providerId; this.providerClass = providerClass; this.bundle = bundle; } /** * Load a provider class. * * @return The provider class from the target bundle. * @exception Exception */ public Class loadClass() throws ClassNotFoundException { try { log(LogService.LOG_DEBUG, "loading class for: " + this); return bundle.loadClass(providerClass); } catch (ClassNotFoundException e) { log(LogService.LOG_DEBUG, "exception caught while loading " + this, e); throw e; } } /** * Create an instance of the registred service. * * @return The created instance. A new instance is created on each call. * @exception Exception */ public Object createInstance() throws Exception { // get the class object Class cls = loadClass(); try { // just create an instance using the default constructor return cls.newInstance(); } catch (Exception e) { log(LogService.LOG_DEBUG, "exception caught while creating " + this, e); throw e; } catch (Error e) { log(LogService.LOG_DEBUG, "error caught while creating " + this, e); throw e; } } public String id() { return providerId; } @Override public String toString() { return "Provider interface=" + providerId + " , provider class=" + providerClass + ", bundle=" + bundle; } @Override public int hashCode() { return providerId.hashCode() + providerClass.hashCode() + (int)bundle.getBundleId(); } @Override public boolean equals(Object obj) { if (obj instanceof BundleProviderLoader) { return providerId.equals(((BundleProviderLoader)obj).providerId) && providerClass.equals(((BundleProviderLoader)obj).providerClass) && bundle.getBundleId() == ((BundleProviderLoader)obj).bundle.getBundleId(); } else { return false; } } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/api/geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registr0000755000000000000000000000000011400013472030727 5ustar ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/api/ProviderRegistry.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registr0000644000000000000000000000726511350204263030747 0ustar /** * 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.geronimo.osgi.registry.api; import java.util.List; /** * The implementation of the factory registry used to store * the bundle registrations. */ public interface ProviderRegistry { /** * Locate a class by its factory id indicator. . * * @param factoryId The factory id (generally, a fully qualified class name). * * @return The Class corresponding to this factory id. Returns null * if this is not registered or the indicated class can't be * loaded. */ public Class locate(String factoryId); /** * Locate all class files that match a given factory id. * * @param factoryId The target factory identifier. * * @return A List containing the class objects corresponding to the * factory identifier. Returns an empty list if no * matching classes can be located. */ public List> locateAll(String factoryId); /** * Locate and instantiate an instance of a service provider * defined in the META-INF/services directory of tracked bundles. * * @param providerId The name of the target interface class. * * @return The service instance. Returns null if no service defintions * can be located. * @exception Exception Any classloading or other exceptions thrown during * the process of creating this service instance. */ public Object getService(String providerId) throws Exception; /** * Locate all services that match a given provider id and create instances. * * @param providerId The target provider identifier. * * @return A List containing the instances corresponding to the * provider identifier. Returns an empty list if no * matching classes can be located or created */ public List getServices(String providerId); /** * Locate and return the class for a service provider * defined in the META-INF/services directory of tracked bundles. * * @param providerId The name of the target interface class. * * @return The provider class. Returns null if no service defintions * can be located. * @exception Exception Any classloading or other exceptions thrown during * the process of loading this service provider class. */ public Class getServiceClass(String providerId) throws ClassNotFoundException; /** * Locate all services that match a given provider id and return the implementation * classes * * @param providerId The target provider identifier. * * @return A List containing the classes corresponding to the * provider identifier. Returns an empty list if no * matching classes can be located. */ public List> getServiceClasses(String providerId); } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/ProviderBundleTrackerCustomizer.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registr0000644000000000000000000000506711350204263030745 0ustar /** * 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.geronimo.osgi.registry; import org.osgi.framework.Bundle; import org.osgi.framework.BundleEvent; import org.osgi.framework.ServiceRegistration; import org.osgi.service.log.LogService; import org.osgi.util.tracker.BundleTrackerCustomizer; public class ProviderBundleTrackerCustomizer implements BundleTrackerCustomizer { // our base Activator (used as a service source) private Activator activator; // the bundle hosting this registry private Bundle registryBundle; // the registry we interact with private ProviderRegistryImpl registry; public ProviderBundleTrackerCustomizer(Activator a, Bundle b, ProviderRegistryImpl r) { activator = a; registryBundle = b; registry = r; } /** * Handle the activation of a new bundle. * * @param bundle The source bundle. * @param event The bundle event information. * * @return A return object. */ @Override public Object addingBundle(Bundle bundle, BundleEvent event) { log(LogService.LOG_DEBUG, "Bundle Considered for class providers: " + bundle.getSymbolicName()); if (bundle.equals(registryBundle)) { return null; } return registry.addBundle(bundle); } @Override public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) { // nothing to do here } @Override public void removedBundle(Bundle bundle, BundleEvent event, Object object) { // have the registry process this registry.removeBundle(bundle, object); } private void log(int level, String message) { activator.log(level, message); } private void log(int level, String message, Throwable th) { activator.log(level, message, th); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/Activator.javageronimo-osgi-support-1.0.orig/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registr0000644000000000000000000001007511344176061030747 0ustar /** * 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.geronimo.osgi.registry; import java.util.ArrayList; import java.util.List; import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; import org.osgi.util.tracker.BundleTracker; import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTrackerCustomizer; import org.apache.geronimo.osgi.registry.api.ProviderRegistry; /** * The activator that starts and manages the life-cycle of * the class factory registry. */ public class Activator implements BundleActivator { // tracker to watch for bundle updates protected BundleTracker bt; // service tracker for a logging service protected ServiceTracker lst; // Our provider registry protected ProviderRegistryImpl registry; // The service registration for the provider registry protected ServiceRegistration registryRegistration; // our bundle context protected BundleContext context; // an array of all active logging services. List logServices = new ArrayList(); @Override public synchronized void start(final BundleContext context) throws Exception { this.context = context; lst = new LogServiceTracker(context, LogService.class.getName(), null); lst.open(); registry = new ProviderRegistryImpl(this); // register this as a service registryRegistration = context.registerService(ProviderRegistry.class.getName(), registry, null); org.osgi.framework.ServiceReference ref = context.getServiceReference(ProviderRegistry.class.getName()); bt = new BundleTracker(context, Bundle.ACTIVE, new ProviderBundleTrackerCustomizer(this, context.getBundle(), registry)); bt.open(); } @Override public synchronized void stop(BundleContext context) throws Exception { bt.close(); lst.close(); registryRegistration.unregister(); } void log(int level, String message) { synchronized (logServices) { for (LogService log : logServices) { log.log(level, message); } } } void log(int level, String message, Throwable th) { synchronized (logServices) { for (LogService log : logServices) { log.log(level, message, th); } } } private final class LogServiceTracker extends ServiceTracker { private LogServiceTracker(BundleContext context, String clazz, ServiceTrackerCustomizer customizer) { super(context, clazz, customizer); } @Override public Object addingService(ServiceReference reference) { Object svc = super.addingService(reference); if (svc instanceof LogService) { synchronized (logServices) { logServices.add((LogService) svc); } } return svc; } @Override public void removedService(ServiceReference reference, Object service) { synchronized (logServices) { logServices.remove(service); } super.removedService(reference, service); } } } geronimo-osgi-support-1.0.orig/geronimo-osgi-registry/pom.xml0000644000000000000000000000625011364013573021436 0ustar 4.0.0 org.apache.geronimo.specs geronimo-osgi-support 1.0 org.apache.geronimo.specs geronimo-osgi-registry bundle OSGI factory registry 1.0 This bundle contains an extender that facilitates the use of Geronimo spec providers (components typically plugged in to the JRE through META-INF/services resources). The service created by this extender will maintain a registry of factory class implementations that can be used by the spec bundles to locate factory classes that reside in other bundles. org.osgi org.osgi.core 4.2.0 provided org.osgi org.osgi.compendium 4.2.0 provided org.apache.felix maven-bundle-plugin org.apache.geronimo.osgi.registry.api;version=1.0 * org.apache.geronimo.osgi.registry ${groupId}.${artifactId};singleton=true org.apache.geronimo.osgi.registry.Activator geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/0000755000000000000000000000000011400013473017525 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/0000755000000000000000000000000011400013473020314 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/0000755000000000000000000000000011400013473021240 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/0000755000000000000000000000000011400013473023252 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/0000755000000000000000000000000011400013473024425 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/0000755000000000000000000000000011400013473026442 5ustar ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.itesta.TestTarget3geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000154511361326165030414 0ustar # 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. # Tests default class mapping...there are no class definitions here ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget2geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000161111361326165030406 0ustar # 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. org.apache.geronimo.osgi.itesta.TestTargetTwo # Used as an override to map TestTarget to TestTargetTwo ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTargetLocalgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000155611361326165030416 0ustar # 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. # Tests normal class mapping.... org.apache.geronimo.osgi.itesta.TestTarget ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTargetgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000155611361326165030416 0ustar # 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. # Tests normal class mapping.... org.apache.geronimo.osgi.itesta.TestTarget ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.NoClassgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000161711361326165030414 0ustar # 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. # This class should not be loadable...used to test error conditions. org.apache.geronimo.osgi.itesta.NoClass ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget4geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/OSGI-INF/providers/org.apache0000644000000000000000000000172311361326165030412 0ustar # 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. # Tests normal class mapping.... org.apache.geronimo.osgi.itesta.TestTarget # using multiple provider definitions for a single key org.apache.geronimo.osgi.itesta.TestTarget2 geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/0000755000000000000000000000000011400013473024412 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/0000755000000000000000000000000011400013473026235 5ustar ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itesta.MultiTargetgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000165611361326165030270 0ustar # 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. # Tests normal class mapping for multiple providers org.apache.geronimo.osgi.itesta.TestTarget org.apache.geronimo.osgi.itesta.TestTarget2 ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.BadClassgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000157611361326165030271 0ustar # 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. # This will throw an exception when instantiated. org.apache.geronimo.osgi.itesta.BadTarget ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.NoAccessgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000157711361326165030272 0ustar # 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. # private no-argument constructor for newInstance() org.apache.geronimo.osgi.itesta.NoAccess ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.TestTargetgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000173011361326165030261 0ustar # 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. # Tests normal class mapping...NOTE: this uses # TestTarget2 to ensure we're picking up the # services version, not the providers one. org.apache.geronimo.osgi.itesta.TestTarget2 ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.NoConstructorgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000157711361326165030272 0ustar # 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. # No no-argument constructor for newInstance() org.apache.geronimo.osgi.itesta.NoConstructor ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.NoClassgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/resources/META-INF/services/org.apache.0000644000000000000000000000161711361326165030265 0ustar # 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. # This class should not be loadable...used to test error conditions. org.apache.geronimo.osgi.itesta.NoClass geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/0000755000000000000000000000000011400013473022161 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/0000755000000000000000000000000011400013473022750 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/0000755000000000000000000000000011400013473024171 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/0000755000000000000000000000000011400013473026010 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013473026751 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/0000755000000000000000000000000011400013473030242 5ustar ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/NoConstructor.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/No0000644000000000000000000000247011350204263030547 0ustar /** * 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.geronimo.osgi.itesta; public class NoConstructor { public NoConstructor(int x) { // causes newInstance() to fail because no no-argument constructor } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/TestTargetTwo.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/Te0000644000000000000000000000235311350204263030543 0ustar /** * 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.geronimo.osgi.itesta; public class TestTargetTwo { public TestTargetTwo() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTargetTwo"; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/NoAccess.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/No0000644000000000000000000000241111350204263030542 0ustar /** * 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.geronimo.osgi.itesta; public class NoAccess { private NoAccess() { // This is a private contstructor } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/BadTarget.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/Ba0000644000000000000000000000251411350204263030514 0ustar /** * 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.geronimo.osgi.itesta; public class BadTarget { public BadTarget() { // causes an exception when instantiated. throw new NullPointerException("Test exception"); } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/TestTarget2.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/Te0000644000000000000000000000234511350204263030544 0ustar /** * 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.geronimo.osgi.itesta; public class TestTarget2 { public TestTarget2() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget2"; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/TestTarget3.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/Te0000644000000000000000000000234511350204263030544 0ustar /** * 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.geronimo.osgi.itesta; public class TestTarget3 { public TestTarget3() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget3"; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/TestTarget.javageronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/src/main/java/org/apache/geronimo/osgi/itesta/Te0000644000000000000000000000234211350204263030541 0ustar /** * 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.geronimo.osgi.itesta; public class TestTarget { public TestTarget() { } @Override /** * The toString method is a simple means for determining * which class has been instantiated without requiring * interface classes to be exported by the test bundles. * * @return The unique identifier for this class. */ public String toString() { return "TestTarget"; } } geronimo-osgi-support-1.0.orig/geronimo-osgi-itesta/pom.xml0000644000000000000000000000512011364013573021052 0ustar 4.0.0 org.apache.geronimo.specs geronimo-osgi-support 1.0 org.apache.geronimo.specs geronimo-osgi-itesta bundle Geronimo OSGi integration tests 1.0 Separately built test bundle for use in the various integration tests. This bundle will have provider and services definitions used to test different class provider resolution scenarios. org.apache.felix maven-bundle-plugin ${groupId}.${artifactId};singleton=true org.apache.geronimo.osgi.testa true org.apache.geronimo.osgi.itesta.TestTarget2, org.apache.geronimo.osgi.itesta.NoClass geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/0000755000000000000000000000000011400013472017676 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/0000755000000000000000000000000011400013472020465 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/0000755000000000000000000000000011400013472021411 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/0000755000000000000000000000000011400013472022332 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/0000755000000000000000000000000011400013472023121 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/0000755000000000000000000000000011400013472024342 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/0000755000000000000000000000000011400013472026161 5ustar geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/0000755000000000000000000000000011400013472027122 5ustar ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/0000755000000000000000000000000011400013472030565 5ustar ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/ProviderLocator.javageronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/0000644000000000000000000006164211353120551030604 0ustar /** * 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.geronimo.osgi.locator; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.LinkedHashSet; import java.util.List; import java.util.Properties; import java.util.Set; import org.apache.geronimo.osgi.registry.api.ProviderRegistry; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.util.tracker.ServiceTracker; public class ProviderLocator { // our bundle context static private BundleContext context; // a service tracker for the registry service // NB: This is declared as just Object to avoid classloading issues if we're running // outside of an OSGi environment. static private Object registryTracker; private ProviderLocator() { // private constructor to prevent an instance from getting created. } /** * initialize the tracker statics for this bundle * * @param c The starup BundleContext. */ public static void init(BundleContext c) { try { // just create a tracker for our lookup service // NB: We use the hard coded name in case the registry service has not // been started first. The ServiceTracker itself only uses the string name. // We need to avoid trying to load the ProviderRegistry interface until the // registry tracker returns a non-null service instance. registryTracker = new ServiceTracker(c, "org.apache.geronimo.osgi.registry.api.ProviderRegistry", null); ((ServiceTracker)registryTracker).open(); // do this last...it helps indicate if we have an initialized registry. context = c; } catch (Throwable e) { // if there were any errors, then the registry is not available. registryTracker = null; } } /** * Cleanup resources on bundle shutdown. */ public static void destroy() { if (registryTracker != null) { // shutdown our tracking of the provider registry. ((ServiceTracker)registryTracker).close(); registryTracker = null; } } /** * Locate a class by its provider id indicator. . * * @param providerId The provider id (generally, a fully qualified class name). * * @return The Class corresponding to this provider id. Returns null * if this is not registered or the indicated class can't be * loaded. */ static public Class locate(String providerId) { Object registry = getRegistry(); // if no registry service available, this is a failure if (registry == null) { return null; } // get the service, if it exists. NB, if there is a service object, // then the extender and the interface class are available, so this cast should be // safe now. // the rest of the work is done by the registry return ((ProviderRegistry)registry).locate(providerId); } /** * Locate all class files that match a given factory id. * * @param providerId The target provider identifier. * * @return A List containing the class objects corresponding to the * provider identifier. Returns an empty list if no * matching classes can be located. */ static public List> locateAll(String providerId) { Object registry = getRegistry(); // if no registry service available, this is a failure if (registry == null) { return new ArrayList>(); } // get the service, if it exists. NB, if there is a service object, // then the extender and the interface class are available, so this cast should be // safe now. // the rest of the work is done by the registry return ((ProviderRegistry)registry).locateAll(providerId); } /** * Utility class for locating a class with OSGi registry * support. Uses the thread context classloader as part of * the search order. * * @param className The name of the target class. * * @return The loaded class. * @exception ClassNotFoundException * Thrown if the class cannot be located. */ static public Class loadClass(String className) throws ClassNotFoundException { return loadClass(className, null, Thread.currentThread().getContextClassLoader()); } /** * Utility class for locating a class with OSGi registry * support. Uses the thread context classloader as part of * the search order. * * @param className The name of the target class. * * @return The loaded class. * @exception ClassNotFoundException * Thrown if the class cannot be located. */ static public Class loadClass(String className, Class contextClass) throws ClassNotFoundException { return loadClass(className, contextClass, Thread.currentThread().getContextClassLoader()); } /** * Standardized utility method for performing class lookups * with support for OSGi registry lookups. * * @param className The name of the target class. * @param loader An optional class loader. * * @return The loaded class * @exception ClassNotFoundException * Thrown if the class cannot be loaded. */ static public Class loadClass(String className, ClasscontextClass, ClassLoader loader) throws ClassNotFoundException { // ideally, this should be last. However, some of the bundles duplicate classes // found on the boot delegation, so we need to check this first to keep // from picking up one of the default implementations. Class cls = locate(className); if (cls != null) { return cls; } if (loader != null) { try { return loader.loadClass(className); } catch (ClassNotFoundException x) { } } if (contextClass != null) { loader = contextClass.getClassLoader(); } // try again using the class context loader return Class.forName(className, true, loader); } /** * Get a single service instance that matches an interface * definition. * * @param iface The name of the required interface. * @param contextClass * The class requesting the lookup (used for class resolution). * @param loader A class loader to use for searching for service definitions * and loading classes. * * @return The service instance, or null if no matching services * can be found. * @exception Exception Thrown for any classloading or exceptions thrown * trying to instantiate a service instance. */ static public Object getService(String iface, Class contextClass, ClassLoader loader) throws Exception { // if we are working in an OSGi environment, then process the service // registry first. Ideally, we would do this last, but because of boot delegation // issues with some API implementations, we must try the OSGi version first Object registry = getRegistry(); if (registry != null) { // get the service, if it exists. NB, if there is a service object, // then the extender and the interface class are available, so this cast should be // safe now. // the rest of the work is done by the registry Object service = ((ProviderRegistry)registry).getService(iface); if (service != null) { return service; } } // try for a classpath locatable instance next. If we find an appropriate class mapping, // create an instance and return it. Class cls = locateServiceClass(iface, contextClass, loader); if (cls != null) { return cls.newInstance(); } // a provider was not found return null; } /** * Locate a service class that matches an interface * definition. * * @param iface The name of the required interface. * @param contextClass * The class requesting the lookup (used for class resolution). * @param loader A class loader to use for searching for service definitions * and loading classes. * * @return The located class, or null if no matching services * can be found. * @exception Exception Thrown for any classloading exceptions thrown * trying to load the class. */ static public Class getServiceClass(String iface, Class contextClass, ClassLoader loader) throws ClassNotFoundException { // if we are working in an OSGi environment, then process the service // registry first. Ideally, we would do this last, but because of boot delegation // issues with some API implementations, we must try the OSGi version first Object registry = getRegistry(); if (registry != null) { // get the service, if it exists. NB, if there is a service object, // then the extender and the interface class are available, so this cast should be // safe now. // If we've located stuff in the registry, then return it Class cls = ((ProviderRegistry)registry).getServiceClass(iface); if (cls != null) { return cls; } } // try for a classpath locatable instance first. If we find an appropriate class mapping, // create an instance and return it. return locateServiceClass(iface, contextClass, loader); } /** * Get a list of services that match a given interface * name. This searches both the current class path and * the global repository for matches. * * @param iface The name of the required interface. * @param contextClass * The class requesting the lookup (used for class resolution). * @param loader A class loader to use for searching for service definitions * and loading classes. * * @return A list of matching services. Returns an empty list if there * are no matches. * @exception Exception Thrown for any classloading or exceptions thrown * trying to instantiate a service instance. */ static public List getServices(String iface, Class contextClass, ClassLoader loader) throws Exception { List services = new ArrayList(); // because of boot delegation issues with some of the API implementations, it is necessary // to process the OSGi registered versions first to allow override of JRE provided APIs. Object registry = getRegistry(); if (registry != null) { // get the service, if it exists. NB, if there is a service object, // then the extender and the interface class are available, so this cast should be // safe now. // get any registered service instances now List globalServices = ((ProviderRegistry)registry).getServices(iface); // add to our list also if (globalServices != null) { services.addAll(globalServices); } } // try for a classpath locatable instance second. If we find an appropriate class mapping, // create an instance and return it. Collection> classes = locateServiceClasses(iface, contextClass, loader); if (classes != null) { // create an instance of each of these classes for (Class cls : classes) { services.add(cls.newInstance()); } } // now return the merged set return services; } /** * Get a list of service class implementations that match * an interface name. This searches both the current class path and * the global repository for matches. * * @param iface The name of the required interface. * @param contextClass * The class requesting the lookup (used for class resolution). * @param loader A class loader to use for searching for service definitions * and loading classes. * * @return A list of matching provider classes. Returns an empty list if there * are no matches. * @exception Exception Thrown for any classloading exceptions thrown * trying to load a provider class. */ static public List> getServiceClasses(String iface, Class contextClass, ClassLoader loader) throws Exception { Set> serviceClasses = new LinkedHashSet>(); // because of boot delegation issues with some of the API implementations, it is necessary // to process the OSGi registered versions first to allow override of JRE provided APIs. Object registry = getRegistry(); if (registry != null) { // get the service, if it exists. NB, if there is a service object, // then the extender and the interface class are available, so this cast should be // safe now. // get any registered service provider classes now List> globalServices = ((ProviderRegistry)registry).getServiceClasses(iface); // add to our list also if (globalServices != null) { serviceClasses.addAll(globalServices); } } // try for a classpath locatable classes second. If we find an appropriate class mapping, // add this to our return collection. Collection> classes = locateServiceClasses(iface, contextClass, loader); if (classes != null) { serviceClasses.addAll(classes); } // now return the merged set return new ArrayList(serviceClasses); } /** * Locate the first class name for a META-INF/services definition * of a given class. The first matching provider is * returned. * * @param iface The interface class name used for the match. * @param loader The classloader for locating resources. * * @return The mapped provider name, if found. Returns null if * no mapping is located. */ static private String locateServiceClassName(String iface, Class contextClass, ClassLoader loader) { // search first with the loader class path String name = locateServiceClassName(iface, loader); if (name != null) { return name; } // then with the context class, if there is one if (contextClass != null) { name = locateServiceClassName(iface, contextClass.getClassLoader()); if (name != null) { return name; } } // not found return null; } /** * Locate a classpath-define service mapping. * * @param iface The required interface name. * @param loader The ClassLoader instance to use to locate the service. * * @return The mapped class name, if one is found. Returns null if the * mapping is not located. */ static private String locateServiceClassName(String iface, ClassLoader loader) { if (loader != null) { try { // we only look at resources that match the file name, using the specified loader String service = "META-INF/services/" + iface; Enumeration providers = loader.getResources(service); while (providers.hasMoreElements()) { ListproviderNames = parseServiceDefinition(providers.nextElement()); // if there is something defined here, return the first entry if (!providerNames.isEmpty()) { return providerNames.get(0); } } } catch (IOException e) { } } // not found return null; } /** * Locate the first class for a META-INF/services definition * of a given interface class. The first matching provider is * returned. * * @param iface The interface class name used for the match. * @param loader The classloader for locating resources. * * @return The mapped provider class, if found. Returns null if * no mapping is located. */ static private Class locateServiceClass(String iface, Class contextClass, ClassLoader loader) throws ClassNotFoundException { String className = locateServiceClassName(iface, contextClass, loader); if (className == null) { return null; } // we found a name, try loading the class. This will throw an exception if there is an error return loadClass(className, contextClass, loader); } /** * Locate all class names name for a META-INF/services definition * of a given class. * * @param iface The interface class name used for the match. * @param loader The classloader for locating resources. * * @return The mapped provider name, if found. Returns null if * no mapping is located. */ static private Collection locateServiceClassNames(String iface, Class contextClass, ClassLoader loader) { Set names = new LinkedHashSet(); locateServiceClassNames(iface, loader, names); if (contextClass != null) { locateServiceClassNames(iface, contextClass.getClassLoader(), names); } return names; } /** * Locate all class names name for a META-INF/services definition * of a given class. * * @param iface The interface class name used for the match. * @param loader The classloader for locating resources. * * @return The mapped provider name, if found. Returns null if * no mapping is located. */ static void locateServiceClassNames(String iface, ClassLoader loader, Set names) { if (loader != null) { try { // we only look at resources that match the file name, using the specified loader String service = "META-INF/services/" + iface; Enumeration providers = loader.getResources(service); while (providers.hasMoreElements()) { ListproviderNames = parseServiceDefinition(providers.nextElement()); // just add all of these to the list names.addAll(providerNames); } } catch (IOException e) { } } } /** * Locate all classes that map to a given provider class definition. This will * search both the services directories, as well as the provider classes from the * OSGi provider registry. * * @param iface The interface class name used for the match. * @param loader The classloader for locating resources. * * @return A list of all mapped classes, if found. Returns an empty list if * no mappings are found. */ static private Collection> locateServiceClasses(String iface, Class contextClass, ClassLoader loader) throws ClassNotFoundException { // get the set of names from services definitions on the classpath Collection classNames = locateServiceClassNames(iface, contextClass, loader); Set> classes = new LinkedHashSet>(); // load each class and add to our return set for (String name : classNames) { classes.add(loadClass(name, contextClass, loader)); } return classes; } /** * Parse a definition file and return the names of all included implementation classes * contained within the file. * * @param u The URL of the file * * @return A list of all matching classes. Returns an empty list * if no matches are found. */ static private List parseServiceDefinition(URL u) { final String url = u.toString(); List classes = new ArrayList(); // ignore directories if (url.endsWith("/")) { return classes; } // the identifier used for the provider is the last item in the URL. final String providerId = url.substring(url.lastIndexOf("/") + 1); try { BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream(), "UTF-8")); // the file can be multiple lines long, with comments. A single file can define multiple providers // for a single key, so we might need to create multiple entries. If the file does not contain any // definition lines, then as a default, we use the providerId as an implementation class also. String line = br.readLine(); while (line != null) { // we allow comments on these lines, and a line can be all comment int comment = line.indexOf('#'); if (comment != -1) { line = line.substring(0, comment); } line = line.trim(); // if there is nothing left on the line after stripping white space and comments, skip this if (line.length() > 0) { // add this to our list classes.add(line); } // keep reading until the end. line = br.readLine(); } br.close(); } catch (IOException e) { // ignore errors and handle as default } return classes; } /** * Perform a service class discovery by looking for a * property in a target properties file located in the * java.home directory. * * @param path The relative path to the desired properties file. * @param property The name of the required property. * * @return The value of the named property within the properties file. Returns * null if the property doesn't exist or the properties file doesn't exist. */ public static String lookupByJREPropertyFile(String path, String property) throws IOException { String jreDirectory = System.getProperty("java.home"); File configurationFile = new File(jreDirectory + File.separator + path); if (configurationFile.exists() && configurationFile.canRead()) { Properties properties = new Properties(); InputStream in = null; try { in = new FileInputStream(configurationFile); properties.load(in); return properties.getProperty(property); } finally { if (in != null) { try { in.close(); } catch (Exception e) { } } } } return null; } /** * Retrieve the registry from the tracker if it is available, * all without causing the interface class to load. * * @return The registry service instance, or null if it is not * available for any reason. */ private static Object getRegistry() { // if not initialized in an OSGi environment, this is a failure if (registryTracker == null) { return null; } // get the service, if it exists. NB: it is only safe to reference the // interface class if the tracker returns a non-null service object. The // interface class will not be loaded in our bundle context until the // service class can be statisfied. Therefore, we always return this as // just an object and the call needs to perform the cast, which will // force the classload at that time. return ((ServiceTracker)registryTracker).getService(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootgeronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/Activator.javageronimo-osgi-support-1.0.orig/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/0000644000000000000000000000305011344235472030602 0ustar /** * 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.geronimo.osgi.locator; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; public class Activator implements BundleActivator { protected BundleContext bundleContext; public synchronized void start(BundleContext bundleContext) throws Exception { this.bundleContext = bundleContext; // initialize the locator ProviderLocator.init(bundleContext); } public synchronized void stop(BundleContext bundleContext) throws Exception { // shut down the locator service ProviderLocator.destroy(); this.bundleContext = null; } public void bundleChanged(BundleEvent event) { // nothing to change here } } geronimo-osgi-support-1.0.orig/geronimo-osgi-locator/pom.xml0000644000000000000000000000576311364013573021241 0ustar 4.0.0 org.apache.geronimo.specs geronimo-osgi-support 1.0 org.apache.geronimo.specs geronimo-osgi-locator bundle Geronimo OSGi-enable spec bundle locator 1.0 This bundle is not used as a standalone unit, but contains classes that should be copied into another bundle as a private package. org.apache.geronimo.specs geronimo-osgi-registry ${version} provided org.osgi org.osgi.core 4.2.0 provided org.osgi org.osgi.compendium 4.2.0 provided org.apache.felix maven-bundle-plugin * org.apache.geronimo.osgi.locator ${groupId}.${artifactId};singleton=true geronimo-osgi-support-1.0.orig/LICENSE0000644000000000000000000003446711343747340014520 0ustar Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed 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. ######################################################################### ## ADDITIONAL LICENSES ## ######################################################################### The XMLSchema.dtd included in this project was developed by the W3C Consortium (http://www.w3c.org/). Use of the source code, thus licensed, and the resultant binary are subject to the terms and conditions of the following license. W3C¨ SOFTWARE NOTICE AND LICENSE Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/ This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: Permission to use, copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make: 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © [$date-of-software] World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/" 3. Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. geronimo-osgi-support-1.0.orig/NOTICE0000644000000000000000000000136111343747340014402 0ustar Apache Geronimo Copyright 2003-2009 The Apache Software Foundation This product includes software developed by The Apache Software Foundation (http://www.apache.org/). This product includes software developed by The Object Management Group. Copyright (c) 1999-2000 Object Management Group. Unlimited rights to duplicate and use this code are hereby granted provided that this copyright notice is included. This product includes software developed by The W3C Consortium (http://www.w3.org/). Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/ geronimo-osgi-support-1.0.orig/pom.xml0000644000000000000000000001732511364013573015017 0ustar 4.0.0 org.apache.geronimo.genesis genesis-java5-flava 2.0 org.apache.geronimo.specs geronimo-osgi-support pom OSGI spec bundle support 1.0 This project is a set of bundles and integration tests for implementing OSGi-specific lookup in the Geronimo spec projects. http://geronimo.apache.org/maven/${siteId}/${version} apache-website ${site.deploy.url}/maven/${siteId}/${version} specs/${artifactId} scm:svn:http://svn.apache.org/repos/asf/geronimo/specs/tags/geronimo-osgi-support-1.0 scm:svn:https://svn.apache.org/repos/asf/geronimo/specs/tags/geronimo-osgi-support-1.0 http://svn.apache.org/viewcvs.cgi/geronimo/specs/tags/geronimo-osgi-support-1.0 org.apache.geronimo.specs geronimo-osgi-registry ${version} org.apache.geronimo.specs geronimo-osgi-locator ${version} org.apache.geronimo.specs geronimo-osgi-itesta ${version} org.apache.geronimo.specs geronimo-osgi-itestb ${version} org.osgi org.osgi.core 4.2.0 org.osgi org.osgi.compendium 4.2.0 org.ops4j.pax.exam pax-exam 1.2.0 org.ops4j.pax.exam pax-exam-junit 1.2.0 junit junit 4.5 org.ops4j.pax.exam pax-exam-container-default 1.2.0 org.ops4j.pax.exam pax-exam-junit-extender-impl 1.2.0 org.ops4j.pax.swissbox pax-swissbox-tinybundles 1.2.0 org.ops4j.pax.logging pax-logging-api 1.4 org.apache.felix org.apache.felix.configadmin 1.2.4 org.apache.servicemix.tooling depends-maven-plugin 1.1 generate-depends-file generate-depends-file org.apache.maven.plugins maven-surefire-plugin true false org.codehaus.mojo failsafe-maven-plugin 2.4.3-alpha-1 integration-test integration-test verify verify true false geronimo-osgi-registry geronimo-osgi-locator geronimo-osgi-itesta geronimo-osgi-itestb geronimo-osgi-registry-itests geronimo-osgi-locator-itests