This is an automated email from the ASF dual-hosted git repository. alien11689 pushed a commit to branch ARIES-2178-remove-composite-bundle-usage-in-aries-util in repository https://gitbox.apache.org/repos/asf/aries.git
commit 363a9d6796a7c10ca3e8683cf8e90fc82ed23dfe Author: Dominik Przybysz <[email protected]> AuthorDate: Fri May 2 23:14:02 2025 +0200 ARIES-2178: Remove CompositeBundle usage in aries.util --- .github/dependabot.yaml | 3 - .github/workflows/subsystem.yml | 13 +- blueprint/blueprint-core/pom.xml | 2 +- blueprint/blueprint-parent/pom.xml | 2 +- blueprint/blueprint-repository/pom.xml | 2 +- blueprint/blueprint-web/pom.xml | 2 +- jndi/parent/pom.xml | 2 +- quiesce/quiesce-manager-itest/pom.xml | 4 +- quiesce/quiesce-manager/pom.xml | 2 +- .../assemblies/equinox-test-harness/pom.xml | 8 +- .../helloworld/helloworld-assembly/pom.xml | 9 +- subsystem/subsystem-api/pom.xml | 2 +- subsystem/subsystem-bundle/pom.xml | 2 +- subsystem/subsystem-core/pom.xml | 2 +- subsystem/subsystem-itests/pom.xml | 6 +- .../aries/subsystem/itests/SubsystemTest.java | 2 +- subsystem/subsystem-modeller/pom.xml | 11 +- .../modelling/impl/ImportedServiceImpl.java | 2 +- .../subsystem/modelling/impl/ParserProxyTest.java | 2 +- util/pom.xml | 12 +- .../util/manifest/ManifestHeaderProcessor.java | 7 +- .../tracker/InternalRecursiveBundleTracker.java | 166 --------------------- .../aries/util/tracker/RecursiveBundleTracker.java | 27 +--- .../aries/util/RecursiveBundleTrackerTest.java | 86 ----------- web/web-itests/pom.xml | 2 +- 25 files changed, 54 insertions(+), 324 deletions(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 9f997047d..9e17491aa 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -61,9 +61,6 @@ updates: - dependency-name: "org.mockito:mockito*" versions: - ">=5.0.0" # does not support java 8 - - dependency-name: "org.eclipse:osgi" # should be upgraded to org.eclipse.platform:org.eclipse.osgi - versions: - - ">=3.9.1" # higher version removed CompositeBundle used by some artifacts - dependency-name: "org.ops4j.pax.cdi:pax-cdi*" versions: - ">=1.0.0" # pax-cdi is only used in blueprint maven plugin as an optional annotation provider and it's changed in version 1.x in incompatible way - blueprint-maven-plugin-annotation should be used instead since provides annotations more focused on blueprint elements diff --git a/.github/workflows/subsystem.yml b/.github/workflows/subsystem.yml index d087695da..1bcf8288b 100644 --- a/.github/workflows/subsystem.yml +++ b/.github/workflows/subsystem.yml @@ -17,9 +17,11 @@ on: paths: - parent/** - testsupport/** + - proxy/** - versioning/** - util/** - - application/** + - quiesce/** + - blueprint/** - subsystem/** - .github/workflows/subsystem.yml push: @@ -53,12 +55,21 @@ jobs: - name: Build testsupport shell: bash run: mvn -U -e -B -ntp -Dmaven.test.skip=true clean install -f testsupport + - name: Build proxy + shell: bash + run: mvn -U -e -B -ntp -Dmaven.test.skip=true clean install -f proxy - name: Build versioning shell: bash run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f versioning - name: Build util shell: bash run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f util + - name: Build quiesce + shell: bash + run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f quiesce + - name: Build blueprint + shell: bash + run: mvn -V -U -e -B -ntp -Dmaven.test.skip=true clean install -f blueprint - name: Build subsystem shell: bash run: mvn -U -e -B -ntp clean install -f subsystem diff --git a/blueprint/blueprint-core/pom.xml b/blueprint/blueprint-core/pom.xml index e1211789b..1cdda2df6 100644 --- a/blueprint/blueprint-core/pom.xml +++ b/blueprint/blueprint-core/pom.xml @@ -108,7 +108,7 @@ <proxy.api.version>1.1.1</proxy.api.version> <proxy.impl.version>1.1.9</proxy.impl.version> <quiesce.api.version>1.0.0</quiesce.api.version> - <util.version>1.1.3</util.version> + <util.version>2.0.0-SNAPSHOT</util.version> <slf4j.version>2.0.17</slf4j.version> </properties> diff --git a/blueprint/blueprint-parent/pom.xml b/blueprint/blueprint-parent/pom.xml index f855ea3f8..660fcbfae 100644 --- a/blueprint/blueprint-parent/pom.xml +++ b/blueprint/blueprint-parent/pom.xml @@ -55,7 +55,7 @@ <blueprint.cm.dev.version>1.3.3-SNAPSHOT</blueprint.cm.dev.version> <blueprint.core.dev.version>1.10.4-SNAPSHOT</blueprint.core.dev.version> <blueprint.jexl.evaluator.dev.version>1.1.1-SNAPSHOT</blueprint.jexl.evaluator.dev.version> - <blueprint.noosgi.dev.version>1.2.0-SNAPSHOT</blueprint.noosgi.dev.version> + <blueprint.noosgi.dev.version>2.0.0-SNAPSHOT</blueprint.noosgi.dev.version> <blueprint.parser.dev.version>1.6.2-SNAPSHOT</blueprint.parser.dev.version> <blueprint.sample.dev.version>1.0.1-SNAPSHOT</blueprint.sample.dev.version> <blueprint.sample.fragment.dev.version>1.0.1-SNAPSHOT</blueprint.sample.fragment.dev.version> diff --git a/blueprint/blueprint-repository/pom.xml b/blueprint/blueprint-repository/pom.xml index 97f342971..763046f62 100644 --- a/blueprint/blueprint-repository/pom.xml +++ b/blueprint/blueprint-repository/pom.xml @@ -42,7 +42,7 @@ <bnd-indexer-maven-plugin.version>6.4.0</bnd-indexer-maven-plugin.version> <org.apache.aries.proxy.api.version>1.0.1</org.apache.aries.proxy.api.version> <org.apache.aries.proxy.impl.version>1.0.6</org.apache.aries.proxy.impl.version> - <org.apache.aries.util.version>1.1.3</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> </properties> <profiles> diff --git a/blueprint/blueprint-web/pom.xml b/blueprint/blueprint-web/pom.xml index 54f42e873..c455641fb 100644 --- a/blueprint/blueprint-web/pom.xml +++ b/blueprint/blueprint-web/pom.xml @@ -48,7 +48,7 @@ <lastReleaseVersion>1.1.1</lastReleaseVersion> <blueprint.noosgi.version>1.1.0</blueprint.noosgi.version> - <blueprint.nosgi.version>1.2.0-SNAPSHOT</blueprint.nosgi.version> + <blueprint.nosgi.version>2.0.0-SNAPSHOT</blueprint.nosgi.version> <blueprint.parser.version>1.5.0</blueprint.parser.version> <geronimo-servlet_2.5_spec.version>1.2</geronimo-servlet_2.5_spec.version> <slf4j.version>2.0.17</slf4j.version> diff --git a/jndi/parent/pom.xml b/jndi/parent/pom.xml index 5f593ca8b..24d75d40a 100644 --- a/jndi/parent/pom.xml +++ b/jndi/parent/pom.xml @@ -52,7 +52,7 @@ <jndi-rmi.dev-version>1.0.1-SNAPSHOT</jndi-rmi.dev-version> <jndi-url-itest-web.dev-version>1.0.1-SNAPSHOT</jndi-url-itest-web.dev-version> <jndi-url-itest-biz.dev-version>1.0.1-SNAPSHOT</jndi-url-itest-biz.dev-version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <org.apache.aries.proxy.api.version>1.1.1</org.apache.aries.proxy.api.version> <org.apache.aries.proxy.impl.version>1.1.14</org.apache.aries.proxy.impl.version> <org.apache.aries.blueprint.api.version>1.0.1</org.apache.aries.blueprint.api.version> diff --git a/quiesce/quiesce-manager-itest/pom.xml b/quiesce/quiesce-manager-itest/pom.xml index 0af5d788c..b701ff239 100644 --- a/quiesce/quiesce-manager-itest/pom.xml +++ b/quiesce/quiesce-manager-itest/pom.xml @@ -45,7 +45,7 @@ <org.apache.aries.quiesce.api.version>1.0.1-SNAPSHOT</org.apache.aries.quiesce.api.version> <org.apache.aries.quiesce.manager.version>1.0.1-SNAPSHOT</org.apache.aries.quiesce.manager.version> <org.apache.aries.testsupport.unit.version>2.0.0-SNAPSHOT</org.apache.aries.testsupport.unit.version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <org.eclipse.osgi.version>3.23.0</org.eclipse.osgi.version> <pax-exam.version>4.13.5</pax-exam.version> <pax-url.version>2.6.16</pax-url.version> @@ -128,8 +128,8 @@ <dependency> <groupId>org.apache.aries</groupId> <artifactId>org.apache.aries.util</artifactId> - <scope>test</scope> <version>${org.apache.aries.util.version}</version> + <scope>test</scope> </dependency> </dependencies> diff --git a/quiesce/quiesce-manager/pom.xml b/quiesce/quiesce-manager/pom.xml index 7e624fada..20d5a662e 100644 --- a/quiesce/quiesce-manager/pom.xml +++ b/quiesce/quiesce-manager/pom.xml @@ -58,7 +58,7 @@ <lastReleaseVersion>1.0.0</lastReleaseVersion> <org.apache.aries.quiesce.api.version>1.0.1-SNAPSHOT</org.apache.aries.quiesce.api.version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> </properties> <dependencies> diff --git a/samples/ariestrader/assemblies/equinox-test-harness/pom.xml b/samples/ariestrader/assemblies/equinox-test-harness/pom.xml index 892be9952..4bcd0375d 100644 --- a/samples/ariestrader/assemblies/equinox-test-harness/pom.xml +++ b/samples/ariestrader/assemblies/equinox-test-harness/pom.xml @@ -30,7 +30,7 @@ <packaging>pom</packaging> <properties> - <osgi.version>3.5.0.v20090520</osgi.version> + <org.eclipse.osgi.version>3.23.0</org.eclipse.osgi.version> </properties> <dependencies> @@ -39,9 +39,9 @@ External Dependencies --> <dependency> - <groupId>org.eclipse</groupId> - <artifactId>osgi</artifactId> - <version>${osgi.version}</version> + <groupId>org.eclipse.platform</groupId> + <artifactId>org.eclipse.osgi</artifactId> + <version>${org.eclipse.osgi.version}</version> </dependency> <dependency> <groupId>org.eclipse.equinox</groupId> diff --git a/samples/blueprint/helloworld/helloworld-assembly/pom.xml b/samples/blueprint/helloworld/helloworld-assembly/pom.xml index 9d3edbf59..00d3f795d 100644 --- a/samples/blueprint/helloworld/helloworld-assembly/pom.xml +++ b/samples/blueprint/helloworld/helloworld-assembly/pom.xml @@ -29,17 +29,16 @@ <packaging>pom</packaging> <properties> - <osgi.version>3.5.0.v20090520</osgi.version> + <org.eclipse.osgi.version>3.23.0</org.eclipse.osgi.version> <cm.version>3.2.0-v20070116</cm.version> <services.version>3.1.200-v20070605</services.version> </properties> <dependencies> - <dependency> - <groupId>org.eclipse</groupId> - <artifactId>osgi</artifactId> - <version>${osgi.version}</version> + <groupId>org.eclipse.platform</groupId> + <artifactId>org.eclipse.osgi</artifactId> + <version>${org.eclipse.osgi.version}</version> </dependency> <dependency> diff --git a/subsystem/subsystem-api/pom.xml b/subsystem/subsystem-api/pom.xml index 0b1a06850..73e3e3116 100644 --- a/subsystem/subsystem-api/pom.xml +++ b/subsystem/subsystem-api/pom.xml @@ -54,7 +54,7 @@ * </aries.osgi.import> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <osgi.annotation.version>8.1.0</osgi.annotation.version> <osgi.core.version>6.0.0</osgi.core.version> <osgi.enterprise.version>5.0.0</osgi.enterprise.version> diff --git a/subsystem/subsystem-bundle/pom.xml b/subsystem/subsystem-bundle/pom.xml index 6a503d82b..000c11a06 100644 --- a/subsystem/subsystem-bundle/pom.xml +++ b/subsystem/subsystem-bundle/pom.xml @@ -66,7 +66,7 @@ <org.apache.aries.proxy.version>1.1.0</org.apache.aries.proxy.version> <org.apache.aries.subsystem.api.version>2.0.10</org.apache.aries.subsystem.api.version> <org.apache.aries.subsystem.core.version>2.0.10</org.apache.aries.subsystem.core.version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <org.apache.felix.resolver.version>2.0.4</org.apache.felix.resolver.version> <org.eclipse.equinox.coordinator.version>1.1.0.v20120522-1841</org.eclipse.equinox.coordinator.version> <org.eclipse.equinox.region.version>1.2.101.v20150831-1342</org.eclipse.equinox.region.version> diff --git a/subsystem/subsystem-core/pom.xml b/subsystem/subsystem-core/pom.xml index a5b64961a..b410f3211 100644 --- a/subsystem/subsystem-core/pom.xml +++ b/subsystem/subsystem-core/pom.xml @@ -68,7 +68,7 @@ <org.apache.aries.subsystem.api.version>2.0.10</org.apache.aries.subsystem.api.version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <org.apache.aries.subsystem.modeller.version>1.0.0-SNAPSHOT</org.apache.aries.subsystem.modeller.version> <osgi.core.version>6.0.0</osgi.core.version> <osgi.enterprise.version>5.0.0</osgi.enterprise.version> diff --git a/subsystem/subsystem-itests/pom.xml b/subsystem/subsystem-itests/pom.xml index 353837dd8..886dfad89 100644 --- a/subsystem/subsystem-itests/pom.xml +++ b/subsystem/subsystem-itests/pom.xml @@ -46,14 +46,14 @@ <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version> <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version> <org.apache.aries.subsystem.modeller.version>1.0.0-SNAPSHOT</org.apache.aries.subsystem.modeller.version> - <org.apache.aries.blueprint.version>1.2.0</org.apache.aries.blueprint.version> - <org.apache.aries.proxy.version>1.1.0</org.apache.aries.proxy.version> + <org.apache.aries.blueprint.version>1.10.4-SNAPSHOT</org.apache.aries.blueprint.version> + <org.apache.aries.proxy.version>1.1.9</org.apache.aries.proxy.version> <org.apache.aries.subsystem.api.version>2.0.11-SNAPSHOT</org.apache.aries.subsystem.api.version> <org.apache.aries.subsystem.core.version>2.0.11-SNAPSHOT</org.apache.aries.subsystem.core.version> <org.apache.aries.subsystem.itest.interfaces.version>1.0.0-SNAPSHOT</org.apache.aries.subsystem.itest.interfaces.version> <org.apache.aries.subsystem.obr.version>1.0.5-SNAPSHOT</org.apache.aries.subsystem.obr.version> <org.apache.aries.testsupport.unit.version>2.0.0-SNAPSHOT</org.apache.aries.testsupport.unit.version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <org.apache.felix.bundlerepository.version>2.0.10</org.apache.felix.bundlerepository.version> <org.apache.felix.configadmin.version>1.9.26</org.apache.felix.configadmin.version> <org.eclipse.equinox.event.version>1.2.200.v20120522-2049</org.eclipse.equinox.event.version> diff --git a/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java b/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java index d70f15d73..ff6ead266 100644 --- a/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java +++ b/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java @@ -118,7 +118,7 @@ public abstract class SubsystemTest extends AbstractIntegrationTest { return composite( junitBundles(), addPaxLoggingBundles(), - setPaxExamLogLevel("INFO"), + setPaxExamLogLevel("DEBUG"), configurePaxUrlLocalMavenRepoIfNeeded(), setupRemoteDebugging() ); diff --git a/subsystem/subsystem-modeller/pom.xml b/subsystem/subsystem-modeller/pom.xml index 05f7e442d..16ee82702 100644 --- a/subsystem/subsystem-modeller/pom.xml +++ b/subsystem/subsystem-modeller/pom.xml @@ -57,10 +57,10 @@ <!-- <lastReleaseVersion>1.0.0</lastReleaseVersion>--> <org.apache.aries.versioning.plugin.version>0.3.2-SNAPSHOT</org.apache.aries.versioning.plugin.version> - <org.apache.aries.blueprint.core.version>1.2.0</org.apache.aries.blueprint.core.version> + <org.apache.aries.blueprint.core.version>1.10.4-SNAPSHOT</org.apache.aries.blueprint.core.version> <org.apache.aries.jndi.api.version>1.0.0</org.apache.aries.jndi.api.version> <org.apache.aries.testsupport.unit.version>2.0.0-SNAPSHOT</org.apache.aries.testsupport.unit.version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <osgi.cmpn.version>4.3.1</osgi.cmpn.version> <osgi.core.version>4.3.1</osgi.core.version> </properties> @@ -85,6 +85,11 @@ <artifactId>org.apache.aries.blueprint.core</artifactId> <version>${org.apache.aries.blueprint.core.version}</version> </dependency> + <dependency> + <groupId>org.apache.aries</groupId> + <artifactId>org.apache.aries.util</artifactId> + <version>${org.apache.aries.util.version}</version> + </dependency> <dependency> <groupId>org.osgi</groupId> @@ -111,8 +116,8 @@ <dependency> <groupId>org.apache.aries.testsupport</groupId> <artifactId>org.apache.aries.testsupport.unit</artifactId> - <scope>test</scope> <version>${org.apache.aries.testsupport.unit.version}</version> + <scope>test</scope> </dependency> </dependencies> diff --git a/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java b/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java index 4cc48d544..be9a89f68 100644 --- a/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java +++ b/subsystem/subsystem-modeller/src/main/java/org/apache/aries/subsystem/modelling/impl/ImportedServiceImpl.java @@ -102,7 +102,7 @@ public class ImportedServiceImpl implements ImportedService reducedBlueprintFilter = _blueprintFilter; } - attrsToPopulate.put(ManifestHeaderProcessor.NESTED_FILTER_ATTRIBUTE, reducedBlueprintFilter); + attrsToPopulate.put(ManifestHeaderProcessor.NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING, reducedBlueprintFilter); } if (_componentName != null) { attrsToPopulate.put ("osgi.service.blueprint.compname", _componentName); diff --git a/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java b/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java index ad20ef390..a0898b6bb 100644 --- a/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java +++ b/subsystem/subsystem-modeller/src/test/java/org/apache/aries/subsystem/modelling/impl/ParserProxyTest.java @@ -69,7 +69,7 @@ public class ParserProxyTest { BundleContext mockCtx = Skeleton.newMock(new BundleContextMock(), BundleContext.class); NamespaceHandlerRegistry nhri = new NamespaceHandlerRegistryImpl (mockCtx); - ParserService parserService = new ParserServiceImpl(nhri); + ParserService parserService = new ParserServiceImpl(nhri, true); mockCtx.registerService(ParserService.class.getName(), parserService, new Hashtable<String, String>()); ParserProxyImpl parserProxyService = new ParserProxyImpl(); diff --git a/util/pom.xml b/util/pom.xml index dbab0ca77..52d641e0a 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -30,7 +30,7 @@ <artifactId>org.apache.aries.util</artifactId> <packaging>bundle</packaging> - <version>1.2.0-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> <name>Apache Aries Util</name> <description> This bundle contains the OSGi common util for Apache Aries @@ -52,9 +52,7 @@ org.osgi.framework.launch;resolution:=optional, org.osgi.framework.wiring.*;resolution:=optional, org.osgi.service.framework;resolution:=optional, - org.eclipse.osgi.internal.loader;resolution:=optional, org.eclipse.osgi.framework.internal.core;resolution:=optional, - org.eclipse.osgi.framework.adaptor;resolution:=optional, org.osgi.service.log;resolution:=optional, * </aries.osgi.import.pkg> @@ -68,7 +66,7 @@ <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version> <org.apache.aries.testsupport.unit.version>1.0.0</org.apache.aries.testsupport.unit.version> - <osgi.version>3.9.1-v20140110-1610</osgi.version> + <org.eclipse.osgi.version>3.23.0</org.eclipse.osgi.version> </properties> <dependencies> @@ -83,9 +81,9 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.eclipse</groupId> - <artifactId>osgi</artifactId> - <version>${osgi.version}</version> + <groupId>org.eclipse.platform</groupId> + <artifactId>org.eclipse.osgi</artifactId> + <version>${org.eclipse.osgi.version}</version> <scope>provided</scope> </dependency> <dependency> diff --git a/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java b/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java index f648ff084..1bac5808b 100644 --- a/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java +++ b/util/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java @@ -36,11 +36,6 @@ import java.util.regex.Pattern; public class ManifestHeaderProcessor { - /** - * @deprecated use {@link #NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING} - */ - @Deprecated - public static final String NESTED_FILTER_ATTRIBUTE = "org.apache.aries.application.filter.attribute"; public static final String NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING = "org.apache.aries.manifestheaderprocessor.filter.attribute"; private static final Pattern FILTER_ATTR = Pattern.compile("(\\(!)?\\((.*?)([<>]?=)(.*?)\\)\\)?"); private static final String LESS_EQ_OP = "<="; @@ -569,7 +564,7 @@ public class ManifestHeaderProcessor } filter.append(")"); - } else if (NESTED_FILTER_ATTRIBUTE.equals(attribName) || NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING.equals(attribName)) { + } else if (NESTED_FILTER_ATTRIBUTE_TO_USE_WITHOUT_FORMATTING.equals(attribName)) { // Filters go in whole, no formatting needed realAttrib = true; filter.append(attrib.getValue()); diff --git a/util/src/main/java/org/apache/aries/util/tracker/InternalRecursiveBundleTracker.java b/util/src/main/java/org/apache/aries/util/tracker/InternalRecursiveBundleTracker.java deleted file mode 100644 index 4d29cb41f..000000000 --- a/util/src/main/java/org/apache/aries/util/tracker/InternalRecursiveBundleTracker.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.aries.util.tracker; - -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.service.framework.CompositeBundle; -import org.osgi.util.tracker.BundleTracker; -import org.osgi.util.tracker.BundleTrackerCustomizer; - -/** - * A BundleTracker which will track bundles in the given context, and also - * bundles in any child contexts. This should be used instead of the - * normal non-recursive BundleTracker when registering bundle tracker - * customizers. - */ -@SuppressWarnings({"rawtypes", "unchecked"}) -public class InternalRecursiveBundleTracker extends BundleTracker -{ - private final int mask; - - private final ConcurrentMap<String,String> alreadyRecursedContexts = new ConcurrentHashMap<String, String>(); - - private final BundleTrackerCustomizer customizer; - - private final boolean nested; - - public InternalRecursiveBundleTracker(BundleContext context, int stateMask, - BundleTrackerCustomizer customizer, boolean nested) - { - super(context, stateMask, null); - mask = stateMask; - this.customizer = customizer; - this.nested = nested; - } - - /* - * (non-Javadoc) - * @see org.osgi.util.tracker.BundleTracker#addingBundle(org.osgi.framework.Bundle, org.osgi.framework.BundleEvent) - */ - @Override - public Object addingBundle(Bundle b, BundleEvent event) - { - Object o = null; - - if (b instanceof CompositeBundle) { - customizedProcessBundle(this, b, event, false); - o = b; - } else if (nested) { - // Delegate to our customizer for normal bundles - if (customizer != null) { - o = customizer.addingBundle(b, event); - } - } - - return o; - } - - /* - * (non-Javadoc) - * @see org.osgi.util.tracker.BundleTracker#modifiedBundle(org.osgi.framework.Bundle, org.osgi.framework.BundleEvent, java.lang.Object) - */ - @Override - public void modifiedBundle(Bundle b, BundleEvent event, Object object) - { - if (b instanceof CompositeBundle) { - customizedProcessBundle(this, b, event, false); - } else { - // Delegate to our customizer for normal bundles - if (customizer != null) { - customizer.modifiedBundle(b, event, object); - } - } - } - - /* - * (non-Javadoc) - * @see org.osgi.util.tracker.BundleTracker#removedBundle(org.osgi.framework.Bundle, org.osgi.framework.BundleEvent, java.lang.Object) - */ - @Override - public void removedBundle(Bundle b, BundleEvent event, Object object) - { - if (b instanceof CompositeBundle) { - customizedProcessBundle(this, b, event, true); - } else { - if (customizer != null) { - customizer.removedBundle(b, event, object); - } - } - } - - protected void customizedProcessBundle(BundleTrackerCustomizer btc, Bundle b, BundleEvent event, boolean removing) - { - if (b instanceof CompositeBundle) { - CompositeBundle cb = (CompositeBundle) b; - // check if the compositeBundle is already tracked in the - // BundleTrackerFactory - String bundleScope = cb.getSymbolicName() + "_" + cb.getVersion().toString(); - List<BundleTracker> btList = BundleTrackerFactory.getBundleTrackerList(bundleScope); - - // bundle is already active and there is no event associated - // this can happen when bundle is first time added to the tracker - // or when the tracker is being closed. - if (event == null && !removing) { - if (cb.getState() == Bundle.INSTALLED || cb.getState() == Bundle.RESOLVED || cb.getState() == Bundle.STARTING || cb.getState() == Bundle.ACTIVE) { - openTracker(btc, cb, bundleScope, mask); - } - } else { - // if we are removing, or the event is of the right type then we need to shutdown. - if (removing || event.getType() == BundleEvent.STOPPED || event.getType() == BundleEvent.UNRESOLVED || event.getType() == BundleEvent.UNINSTALLED) { - // if CompositeBundle is being stopped, let's remove the bundle - // tracker(s) associated with the composite bundle - String bundleId = b.getSymbolicName()+"/"+b.getVersion(); - alreadyRecursedContexts.remove(bundleId); - - if (btList != null) { - // unregister the bundlescope off the factory and close - // bundle trackers - BundleTrackerFactory.unregisterAndCloseBundleTracker(bundleScope); - } - } else if (event.getType() == BundleEvent.INSTALLED || event.getType() == BundleEvent.RESOLVED || event.getType() == BundleEvent.STARTING) { - openTracker(btc, cb, bundleScope, mask); - } - } - } - } - - private synchronized void openTracker(BundleTrackerCustomizer btc, CompositeBundle cb, - String bundleScope, int stateMask) - { - // let's process each of the bundle in the CompositeBundle - BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext(); - - String bundleId = cb.getSymbolicName()+"/"+cb.getVersion(); - if (alreadyRecursedContexts.putIfAbsent(bundleId, bundleId) == null) { - - // let's track each of the bundle in the CompositeBundle - BundleTracker bt = new InternalRecursiveBundleTracker(compositeBundleContext, stateMask, - customizer, true); - bt.open(); - BundleTrackerFactory.registerBundleTracker(bundleScope, bt); - } - } -} diff --git a/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java b/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java index ff28570ea..ff009858b 100644 --- a/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java +++ b/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java @@ -66,37 +66,14 @@ public final class RecursiveBundleTracker { tracker = new BundleHookBundleTracker(context, stateMask, customizer); } catch (Throwable e) { } - if (areMultipleFrameworksAvailable(context)) { - compositeTracker = new InternalRecursiveBundleTracker(context, stateMask, customizer, tracker == null); - } else { - compositeTracker = null; - } - if (tracker == null && compositeTracker == null) { + compositeTracker = null; + if (tracker == null) { //R42 tracker = new BundleTracker(context, stateMask, customizer); } this.tracker = tracker; } - /* - * Checks whether or not the framework supports composite bundles. The only - * known supporting framework is Equinox. When the Equinox specific - * framework property osgi.resolverMode is set to "strict", the - * CompositeBundleFactory service is registered, but the x-internal - * org.osgi.service.framework package is not exported, thus the need for - * the additional Class.forName check. - */ - private static boolean areMultipleFrameworksAvailable(BundleContext context) { - String compositeBundleFactory = "org.osgi.service.framework.CompositeBundleFactory"; - try { - Class.forName(compositeBundleFactory); - } catch (ClassNotFoundException e) { - return false; - } - ServiceReference sr = context.getServiceReference(compositeBundleFactory); - return sr != null; - } - /** * Start tracking bundles that match the bit mask provided at creation time. * diff --git a/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java b/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java index b4e132d0c..4d881fb76 100644 --- a/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java +++ b/util/src/test/java/org/apache/aries/util/RecursiveBundleTrackerTest.java @@ -18,77 +18,18 @@ */ package org.apache.aries.util; -import org.apache.aries.unittest.mocks.MethodCall; -import org.apache.aries.unittest.mocks.Skeleton; import org.apache.aries.util.tracker.BundleTrackerFactory; -import org.apache.aries.util.tracker.InternalRecursiveBundleTracker; import org.apache.aries.util.tracker.RecursiveBundleTracker; import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.Version; -import org.osgi.service.framework.CompositeBundle; -import org.osgi.util.tracker.BundleTrackerCustomizer; - -import static org.junit.Assert.*; public class RecursiveBundleTrackerTest { - BundleContext context; - InternalRecursiveBundleTracker sut; - - @Before - public void setup() { - context = Skeleton.newMock(BundleContext.class); - Skeleton.getSkeleton(context).setReturnValue( - new MethodCall(BundleContext.class, "getServiceReference", "org.osgi.service.framework.CompositeBundleFactory"), - Skeleton.newMock(ServiceReference.class)); - } - @After public void closeTrackes() { BundleTrackerFactory.unregisterAndCloseBundleTracker("test"); } - @Test - public void testCompositeLifeCycle() { - makeSUT(); - CompositeBundle cb = composite("test.composite", "1.0.0"); - assertNoTrackers(); - - // full lifecycle - - sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb)); - assertTracker(cb); - - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.RESOLVED, cb), cb); - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.STARTING, cb), cb); - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.STARTED, cb), cb); - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.STOPPING, cb), cb); - sut.removedBundle(cb, new BundleEvent(BundleEvent.STOPPED, cb), cb); - assertNoTrackers(); - - // short lifecycle - - sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb)); - assertTracker(cb); - - sut.modifiedBundle(cb, new BundleEvent(BundleEvent.RESOLVED, cb), cb); - sut.removedBundle(cb, new BundleEvent(BundleEvent.UNRESOLVED, cb), cb); - assertNoTrackers(); - - // shortest lifecycle - - sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb)); - assertTracker(cb); - - sut.removedBundle(cb, new BundleEvent(BundleEvent.UNINSTALLED, cb), cb); - assertNoTrackers(); - } - @Test(expected=IllegalArgumentException.class) public void testMissingStopping() { @@ -104,31 +45,4 @@ public class RecursiveBundleTrackerTest { public void testMissingInstalled() { new RecursiveBundleTracker(null, Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING, null); } - - private void assertNoTrackers() { - assertTrue(BundleTrackerFactory.getAllBundleTracker().isEmpty()); - } - - private void assertTracker(CompositeBundle cb) { - assertEquals(1, BundleTrackerFactory.getAllBundleTracker().size()); - assertEquals(1, BundleTrackerFactory.getBundleTrackerList(cb.getSymbolicName()+"_"+cb.getVersion()).size()); - } - - @SuppressWarnings("rawtypes") - private void makeSUT() { - BundleTrackerCustomizer customizer = Skeleton.newMock(BundleTrackerCustomizer.class); - - sut = new InternalRecursiveBundleTracker(context, - Bundle.INSTALLED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING, customizer, true); - - sut.open(); - } - - private CompositeBundle composite(String symbolicName, String version) { - CompositeBundle cb = Skeleton.newMock(CompositeBundle.class); - Skeleton cbSkel = Skeleton.getSkeleton(cb); - cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getSymbolicName"), symbolicName); - cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getVersion"), new Version(version)); - return cb; - } } diff --git a/web/web-itests/pom.xml b/web/web-itests/pom.xml index 2ee843d39..c7e139613 100644 --- a/web/web-itests/pom.xml +++ b/web/web-itests/pom.xml @@ -46,7 +46,7 @@ <asm.version>9.8</asm.version> <depends-maven-plugin.version>1.5.0</depends-maven-plugin.version> <org.apache.aries.testsupport.unit.version>2.0.0-SNAPSHOT</org.apache.aries.testsupport.unit.version> - <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version> + <org.apache.aries.util.version>2.0.0-SNAPSHOT</org.apache.aries.util.version> <org.apache.aries.web.urlhandler.version>1.0.1-SNAPSHOT</org.apache.aries.web.urlhandler.version> <org.apache.felix.configadmin.version>1.9.26</org.apache.felix.configadmin.version> <org.eclipse.osgi.version>3.23.0</org.eclipse.osgi.version>
