diff options
author | Thomas Watson | 2020-03-10 21:03:39 +0000 |
---|---|---|
committer | Thomas Watson | 2020-03-10 21:03:39 +0000 |
commit | 713ce018b1b2422c5a36652fad2e6c15e4e7f04e (patch) | |
tree | 55c6786083ea56a6ba96c0e989c525c9a46be99c | |
parent | e8778b43b41f312da055747ba3a06acbde9fdfae (diff) | |
download | rt.equinox.framework-713ce018b1b2422c5a36652fad2e6c15e4e7f04e.tar.gz rt.equinox.framework-713ce018b1b2422c5a36652fad2e6c15e4e7f04e.tar.xz rt.equinox.framework-713ce018b1b2422c5a36652fad2e6c15e4e7f04e.zip |
Revert "Merge branch 'master' into osgiR8"X20200311-0820I20200310-1800
This reverts commit bf506346ff2c91a60986226f0f26f5c2e7866548, reversing
changes made to dabb1b38eaf020bb0f97ea331a3f6c5e5aefe565.
98 files changed, 361 insertions, 3698 deletions
diff --git a/bundles/org.eclipse.osgi.compatibility.state/.classpath b/bundles/org.eclipse.osgi.compatibility.state/.classpath index eca7bdba8..098194ca4 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/.classpath +++ b/bundles/org.eclipse.osgi.compatibility.state/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/bundles/org.eclipse.osgi.compatibility.state/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi.compatibility.state/.settings/org.eclipse.jdt.core.prefs index d36025c85..4b36b50f9 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.osgi.compatibility.state/.settings/org.eclipse.jdt.core.prefs @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -124,27 +124,23 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -214,12 +210,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -249,8 +244,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -274,16 +267,12 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -329,8 +318,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -366,11 +353,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -393,10 +377,6 @@ org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true -org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true -org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true -org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true -org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF index 6153f317f..b456fff7c 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF @@ -2,9 +2,9 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.osgi.compatibility.state -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 1.1.700.qualifier ExtensionBundle-Activator: org.eclipse.osgi.compatibility.state.Activator Fragment-Host: org.eclipse.osgi;bundle-version="3.12.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-Vendor: %Bundle-Vendor Automatic-Module-Name: org.eclipse.osgi.compatibility.state diff --git a/bundles/org.eclipse.osgi.compatibility.state/pom.xml b/bundles/org.eclipse.osgi.compatibility.state/pom.xml index 6ea46d1b3..2533084eb 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/pom.xml +++ b/bundles/org.eclipse.osgi.compatibility.state/pom.xml @@ -19,6 +19,6 @@ </parent> <groupId>org.eclipse.osgi</groupId> <artifactId>org.eclipse.osgi.compatibility.state</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.1.700-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.osgi.tests/.classpath b/bundles/org.eclipse.osgi.tests/.classpath index 2d89fd740..cc895951b 100644 --- a/bundles/org.eclipse.osgi.tests/.classpath +++ b/bundles/org.eclipse.osgi.tests/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" output="bundle_tests/test" path="bundles_src/test"/> @@ -112,7 +112,6 @@ <classpathentry kind="src" output="bundle_tests/geturl" path="bundles_src/geturl"/> <classpathentry kind="src" output="bundle_tests/test.bug375784" path="bundles_src/test.bug375784"/> <classpathentry kind="src" output="bundle_tests/storage.hooks.a" path="bundles_src/storage.hooks.a"/> - <classpathentry kind="src" output="bundle_tests/activator.hooks.a" path="bundles_src/activator.hooks.a"/> <classpathentry kind="src" output="bundle_tests/test.bug412228" path="bundles_src/test.bug412228"/> <classpathentry kind="src" output="bundle_tests/test.uninstall.start1" path="bundles_src/test.uninstall.start1"/> <classpathentry kind="src" output="bundle_tests/test.uninstall.start2" path="bundles_src/test.uninstall.start2"/> diff --git a/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs index 25c2151a5..d6078985c 100644 --- a/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.osgi.tests/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -131,7 +131,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false diff --git a/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF index fb9722396..07995de31 100644 --- a/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Core OSGi Tests Bundle-SymbolicName: org.eclipse.osgi.tests;singleton:=true -Bundle-Version: 3.16.0.qualifier +Bundle-Version: 3.15.300.qualifier Bundle-Vendor: Eclipse.org Require-Bundle: org.eclipse.core.runtime, @@ -14,7 +14,7 @@ Bundle-Activator: org.eclipse.osgi.tests.OSGiTestsActivator Import-Package: org.osgi.service.event; resolution:="optional" Export-Package: org.eclipse.osgi.tests.bundles, org.eclipse.osgi.tests.appadmin -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 DynamicImport-Package: ext.framework.b Eclipse-BundleShape: dir Automatic-Module-Name: org.eclipse.osgi.tests diff --git a/bundles/org.eclipse.osgi.tests/build.properties b/bundles/org.eclipse.osgi.tests/build.properties index 91c0b2d8b..0054cac41 100644 --- a/bundles/org.eclipse.osgi.tests/build.properties +++ b/bundles/org.eclipse.osgi.tests/build.properties @@ -239,8 +239,6 @@ source.bundle_tests/test.bug375784.jar = bundles_src/test.bug306181b/ manifest.bundle_tests/test.bug375784.jar = META-INF/MANIFEST.MF source.bundle_tests/storage.hooks.a.jar = bundles_src/storage.hooks.a/ manifest.bundle_tests/storage.hooks.a.jar = META-INF/MANIFEST.MF -source.bundle_tests/activator.hooks.a.jar = bundles_src/activator.hooks.a/ -manifest.bundle_tests/activator.hooks.a.jar = META-INF/MANIFEST.MF source.bundle_tests/test.bug412228.jar = bundles_src/test.bug412228/ manifest.bundle_tests/test.bug412228.jar = META-INF/MANIFEST.MF source.bundle_tests/test.uninstall.start1.jar = bundles_src/test.uninstall.start1/ @@ -390,7 +388,6 @@ jars.compile.order = bundle_tests/ext.framework.b.jar,\ bundle_tests/geturl.jar,\ bundle_tests/test.bug375784.jar,\ bundle_tests/storage.hooks.a.jar,\ - bundle_tests/activator.hooks.a.jar,\ bundle_tests/test.plugins.a.jar,\ bundle_tests/test.plugins.b.jar,\ bundle_tests/test.plugins.c.jar,\ diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/META-INF/MANIFEST.MF deleted file mode 100644 index 9ced5b560..000000000 --- a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: activator.hooks.a diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator1.java b/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator1.java deleted file mode 100644 index 1c1057fe0..000000000 --- a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator1.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.hooks.framework.activator.a; - -import java.util.List; -import org.eclipse.osgi.internal.hookregistry.ActivatorHookFactory; -import org.eclipse.osgi.internal.hookregistry.HookConfigurator; -import org.eclipse.osgi.internal.hookregistry.HookRegistry; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class TestHookConfigurator1 implements HookConfigurator { - - public static volatile List<String> events; - - public void addHooks(HookRegistry hookRegistry) { - hookRegistry.addActivatorHookFactory(new ActivatorHookFactory() { - - @Override - public BundleActivator createActivator() { - return new BundleActivator() { - @Override - public void start(BundleContext context) throws Exception { - if (events != null) { - events.add("HOOK1 STARTED"); - } - } - - @Override - public void stop(BundleContext context) throws Exception { - if (events != null) { - events.add("HOOK1 STOPPED"); - } - } - }; - } - }); - } - -} diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator2.java b/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator2.java deleted file mode 100644 index b9724a59c..000000000 --- a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator2.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.hooks.framework.activator.a; - -import java.util.List; -import org.eclipse.osgi.internal.hookregistry.ActivatorHookFactory; -import org.eclipse.osgi.internal.hookregistry.HookConfigurator; -import org.eclipse.osgi.internal.hookregistry.HookRegistry; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class TestHookConfigurator2 implements HookConfigurator { - public static volatile List<String> events; - - @Override - public void addHooks(HookRegistry hookRegistry) { - hookRegistry.addActivatorHookFactory(new ActivatorHookFactory() { - - @Override - public BundleActivator createActivator() { - return new BundleActivator() { - @Override - public void start(BundleContext context) throws Exception { - if (events != null) { - events.add("HOOK2 STARTED"); - } - } - - @Override - public void stop(BundleContext context) throws Exception { - if (events != null) { - events.add("HOOK2 STOPPED"); - } - } - }; - } - }); - - } -} diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator3.java b/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator3.java deleted file mode 100644 index 85e2bfec3..000000000 --- a/bundles/org.eclipse.osgi.tests/bundles_src/activator.hooks.a/org/eclipse/osgi/tests/hooks/framework/activator/a/TestHookConfigurator3.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.hooks.framework.activator.a; - -import java.util.List; -import org.eclipse.osgi.internal.hookregistry.ActivatorHookFactory; -import org.eclipse.osgi.internal.hookregistry.HookConfigurator; -import org.eclipse.osgi.internal.hookregistry.HookRegistry; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class TestHookConfigurator3 implements HookConfigurator { - public static volatile List<String> events; - - @Override - public void addHooks(HookRegistry hookRegistry) { - hookRegistry.addActivatorHookFactory(new ActivatorHookFactory() { - - @Override - public BundleActivator createActivator() { - return new BundleActivator() { - @Override - public void start(BundleContext context) throws Exception { - if (events != null) { - events.add("HOOK3 STARTED"); - } - } - - @Override - public void stop(BundleContext context) throws Exception { - if (events != null) { - events.add("HOOK3 STOPPED"); - } - } - }; - } - }); - - } -} diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java index 367c27c11..e85f33529 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java @@ -14,12 +14,9 @@ package ext.framework.a.importer; import ext.framework.a.FrameworkExtTest; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; +import java.io.*; import java.net.URL; import org.eclipse.osgi.tests.bundles.AbstractBundleTests; -import org.eclipse.osgi.tests.bundles.ExtensionBundleTests; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -28,7 +25,6 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { AbstractBundleTests.simpleResults.addEvent(new FrameworkExtTest().testIt("success")); //$NON-NLS-1$ AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$ - ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STARTED"); } private String getURLContent(URL resource) throws IOException { @@ -41,7 +37,7 @@ public class Activator implements BundleActivator { } public void stop(BundleContext context) throws Exception { - ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STOPPED"); + // nothing } } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java index 7367f0a25..09a88fdb6 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java @@ -14,12 +14,9 @@ package ext.framework.a.requires; import ext.framework.a.FrameworkExtTest; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; +import java.io.*; import java.net.URL; import org.eclipse.osgi.tests.bundles.AbstractBundleTests; -import org.eclipse.osgi.tests.bundles.ExtensionBundleTests; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -28,7 +25,6 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { AbstractBundleTests.simpleResults.addEvent(new FrameworkExtTest().testIt("success")); //$NON-NLS-1$ AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$ - ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STARTED"); } private String getURLContent(URL resource) throws IOException { @@ -41,7 +37,7 @@ public class Activator implements BundleActivator { } public void stop(BundleContext context) throws Exception { - ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STOPPED"); + // nothing } } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper new file mode 100644 index 000000000..a3365b5b5 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper @@ -0,0 +1 @@ +org.eclipse.osgi.tests.hooks.framework.storage.a.TestHelper
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.osgi.framework.connect.FrameworkUtilHelper b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.osgi.framework.connect.FrameworkUtilHelper deleted file mode 100644 index 875f91cd6..000000000 --- a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.osgi.framework.connect.FrameworkUtilHelper +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.osgi.tests.hooks.framework.storage.a.TestHelper diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHelper.java b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHelper.java index 639865e59..35b949cc3 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHelper.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHelper.java @@ -13,19 +13,14 @@ *******************************************************************************/ package org.eclipse.osgi.tests.hooks.framework.storage.a; -import java.util.Optional; +import org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper; import org.osgi.framework.Bundle; -import org.osgi.framework.connect.FrameworkUtilHelper; -public class TestHelper implements FrameworkUtilHelper { - volatile static Bundle testBundle; +public class TestHelper extends FrameworkUtilHelper { + volatile static Bundle testBundle = null; @Override - public Optional<Bundle> getBundle(Class<?> classFromBundle) { - return Optional.ofNullable(testBundle); - } - - public static void setBundle(Bundle testBundle) { - TestHelper.testBundle = testBundle; + public Bundle getBundle(Class<?> classFromBundle) { + return testBundle; } } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java index d25cb8ab4..aa29bef72 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java @@ -184,14 +184,15 @@ public class TestHookConfigurator implements HookConfigurator { @Override public BundleActivator createActivator() { return new BundleActivator() { + @Override public void start(BundleContext context) throws Exception { - TestHelper.setBundle(context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION)); + TestHelper.testBundle = context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION); } @Override public void stop(BundleContext context) throws Exception { - TestHelper.setBundle(null); + // nothing } }; } diff --git a/bundles/org.eclipse.osgi.tests/pom.xml b/bundles/org.eclipse.osgi.tests/pom.xml index fcc58f3e4..3f24f829d 100644 --- a/bundles/org.eclipse.osgi.tests/pom.xml +++ b/bundles/org.eclipse.osgi.tests/pom.xml @@ -19,7 +19,7 @@ </parent> <groupId>org.eclipse.osgi</groupId> <artifactId>org.eclipse.osgi.tests</artifactId> - <version>3.16.0-SNAPSHOT</version> + <version>3.15.300-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java index ee2f835eb..74ad42fc7 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java @@ -278,21 +278,4 @@ public class AbstractBundleTests extends CoreTest { } } - protected static boolean delete(File file) { - if (file.exists()) { - if (file.isDirectory()) { - String list[] = file.list(); - if (list != null) { - int len = list.length; - for (int i = 0; i < len; i++) { - delete(new File(file, list[i])); - } - } - } - - return file.delete(); - } - return (true); - } - }
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java index 0f63632b6..0b497d5ba 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java @@ -19,7 +19,6 @@ import junit.framework.TestSuite; public class BundleTests { public static Test suite() { TestSuite suite = new TestSuite(BundleTests.class.getName()); - suite.addTest(ConnectTests.suite()); suite.addTest(ImportJavaSEPackagesTests.suite()); suite.addTest(MultiReleaseJarTests.suite()); suite.addTest(URLHandlerTests.suite()); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ConnectTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ConnectTests.java deleted file mode 100644 index 2fef34ec0..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ConnectTests.java +++ /dev/null @@ -1,983 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.bundles; - -import static org.junit.Assert.assertNotEquals; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Queue; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Consumer; -import java.util.jar.Attributes; -import java.util.jar.Manifest; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.eclipse.osgi.container.ModuleContainer; -import org.eclipse.osgi.launch.EquinoxFactory; -import org.eclipse.osgi.tests.OSGiTestsActivator; -import org.eclipse.osgi.tests.bundles.classes.Activator; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.Constants; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.connect.ConnectContent; -import org.osgi.framework.connect.ConnectContent.ConnectEntry; -import org.osgi.framework.connect.ConnectFrameworkFactory; -import org.osgi.framework.connect.ConnectModule; -import org.osgi.framework.connect.ModuleConnector; -import org.osgi.framework.launch.Framework; -import org.osgi.framework.namespace.BundleNamespace; -import org.osgi.framework.namespace.HostNamespace; -import org.osgi.framework.namespace.IdentityNamespace; -import org.osgi.framework.wiring.BundleCapability; -import org.osgi.framework.wiring.BundleRevision; -import org.osgi.framework.wiring.BundleWiring; -import org.osgi.framework.wiring.FrameworkWiring; -import org.osgi.resource.Namespace; - -public class ConnectTests extends AbstractBundleTests { - - public static Test suite() { - return new TestSuite(ConnectTests.class); - } - - void cleanStorage() { - delete(getContext().getDataFile(getName())); - } - - void doTestConnect(ModuleConnector moduleConnector, Map<String, String> fwkConfig, Consumer<Framework> test) { - doTestConnect(moduleConnector, fwkConfig, test, false); - } - - void doTestConnect(ModuleConnector moduleConnector, Map<String, String> fwkConfig, Consumer<Framework> test, - boolean enableRuntimeVerification) { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); - config.mkdirs(); - fwkConfig.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); - if (enableRuntimeVerification) { - fwkConfig.put("osgi.signedcontent.support", "runtime"); - } - ConnectFrameworkFactory fwkFactory = new EquinoxFactory(); - Framework framework = fwkFactory.newFramework(fwkConfig, moduleConnector); - boolean passed = false; - try { - test.accept(framework); - passed = true; - } finally { - try { - framework.stop(); - framework.waitForStop(10000); - } catch (Exception e) { - if (passed) { - sneakyThrow(e); - } - } - } - } - - public static class TestCountingModuleConnector implements ModuleConnector { - private final AtomicInteger initializeCalled = new AtomicInteger(); - private final Queue<String> getModuleCalled = new ConcurrentLinkedQueue<>(); - private final AtomicInteger createBundleActivatorCalled = new AtomicInteger(); - private final Map<String, ConnectModule> modules = new ConcurrentHashMap<>(); - - @Override - public void initialize(File storage, Map<String, String> config) { - initializeCalled.getAndIncrement(); - } - - @Override - public Optional<ConnectModule> connect(String location) throws BundleException { - getModuleCalled.add(location); - ConnectModule m = modules.get(location); - if (m == BUNDLE_EXCEPTION) { - throw new BundleException("Test fail install with getModule"); - } - return Optional.ofNullable(m); - } - - @Override - public Optional<BundleActivator> createBundleActivator() { - createBundleActivatorCalled.getAndIncrement(); - return Optional.empty(); - } - - int getInitializeCnt() { - return initializeCalled.get(); - } - - List<String> getModuleLocations() { - return new ArrayList<>(getModuleCalled); - } - - int getCreateBundleActivatorCnt() { - return createBundleActivatorCalled.get(); - } - - void setModule(String location, ConnectModule module) { - if (module == null) { - modules.remove(location); - } else { - modules.put(location, module); - } - } - } - - public static class TestConnectModule implements ConnectModule { - private volatile TestConnectContent content; - - public TestConnectModule(TestConnectContent content) { - this.content = content; - } - - @Override - public TestConnectContent getContent() { - return content; - } - - void setContent(TestConnectContent updatedContent) { - this.content = updatedContent; - } - } - - public static class TestConnectContent implements ConnectContent { - private final Map<String, String> headers; - private final Map<String, ConnectEntry> entries = new LinkedHashMap<>(); - private final ClassLoader loader; - private final AtomicBoolean isOpen = new AtomicBoolean(); - - public TestConnectContent(Map<String, String> headers, ClassLoader loader) { - this.headers = headers; - this.loader = loader; - } - - @Override - public Optional<Map<String, String>> getHeaders() { - checkOpen(); - return Optional.ofNullable(headers); - } - - @SuppressWarnings("unused") - @Override - public Iterable<String> getEntries() throws IOException { - checkOpen(); - return entries.keySet(); - } - - @Override - public Optional<ConnectEntry> getEntry(String name) { - checkOpen(); - return Optional.ofNullable(entries.get(name)); - } - - @Override - public Optional<ClassLoader> getClassLoader() { - checkOpen(); - return Optional.ofNullable(loader); - } - - @SuppressWarnings("unused") - @Override - public void open() throws IOException { - if (!isOpen.compareAndSet(false, true)) { - throw new IllegalStateException("Already Opened."); - } - } - - @SuppressWarnings("unused") - @Override - public void close() throws IOException { - if (!isOpen.compareAndSet(true, false)) { - throw new IllegalStateException("Already Closed."); - } - } - - void addEntry(String path, ConnectEntry entry) { - entries.put(path, entry); - } - - private void checkOpen() { - if (!isOpen.get()) { - throw new IllegalStateException("Not Opened."); - } - } - - boolean isOpen() { - return isOpen.get(); - } - } - - public static class TestConnectEntryBytes implements ConnectEntry { - private final String name; - private final byte[] bytes; - - public TestConnectEntryBytes(String name, byte[] bytes) { - this.name = name; - this.bytes = bytes; - } - - @Override - public String getName() { - return name; - } - - @Override - public long getContentLength() { - return bytes.length; - } - - @Override - public long getLastModified() { - return 0; - } - - @Override - public byte[] getBytes() { - return bytes.clone(); - } - - @Override - public InputStream getInputStream() { - return new ByteArrayInputStream(bytes); - } - - } - - public static class TestConnectEntryURL implements ConnectEntry { - private final String name; - private final URL content; - - public TestConnectEntryURL(String name, URL content) { - this.name = name; - this.content = content; - } - - @Override - public String getName() { - return name; - } - - @Override - public long getContentLength() { - try { - return content.openConnection().getContentLengthLong(); - } catch (IOException e) { - return 0; - } - } - - @Override - public long getLastModified() { - try { - return content.openConnection().getLastModified(); - } catch (IOException e) { - return 0; - } - } - - @Override - public InputStream getInputStream() throws IOException { - return content.openStream(); - } - - } - - static final TestConnectModule BUNDLE_EXCEPTION = new TestConnectModule(null); - - public void testConnectFactoryNoModules() { - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - f.stop(); - f.waitForStop(5000); - f.start(); - f.stop(); - f.waitForStop(5000); - } catch (Throwable t) { - sneakyThrow(t); - } - }); - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - f.stop(); - } catch (BundleException e) { - sneakyThrow(e); - } - }); - - assertEquals("Wrong number of init called.", 2, connector.getInitializeCnt()); - assertEquals("Wrong number of create activator called.", 3, connector.getCreateBundleActivatorCnt()); - } - - public void testConnectActivator() { - final AtomicInteger bundleActvatorStartCalled = new AtomicInteger(); - final AtomicInteger bundleActvatorStopCalled = new AtomicInteger(); - ModuleConnector activatorModuleConnector = new TestCountingModuleConnector() { - @Override - public Optional<BundleActivator> createBundleActivator() { - super.createBundleActivator(); - return Optional.of(new BundleActivator() { - - @Override - public void start(BundleContext context) throws Exception { - bundleActvatorStartCalled.getAndIncrement(); - } - - @Override - public void stop(BundleContext context) throws Exception { - bundleActvatorStopCalled.getAndIncrement(); - } - }); - } - }; - - doTestConnect(activatorModuleConnector, new HashMap<>(), (f) -> { - try { - f.start(); - f.stop(); - f.waitForStop(5000); - f.start(); - f.stop(); - f.waitForStop(5000); - } catch (Exception e) { - sneakyThrow(e); - } - }); - assertEquals("Wrong number of start called.", 2, bundleActvatorStartCalled.get()); - assertEquals("Wrong number of stop called.", 2, bundleActvatorStopCalled.get()); - } - - public void testConnectInit() { - final AtomicReference<File> initFile = new AtomicReference<>(); - final AtomicReference<File> storeFile = new AtomicReference<>(); - final AtomicReference<Map<String, String>> initConfig = new AtomicReference<>(); - ModuleConnector initParamsModuleConnector = new TestCountingModuleConnector() { - @Override - public void initialize(File storage, Map<String, String> config) { - super.initialize(storage, config); - initFile.set(storage); - initConfig.set(config); - } - }; - - Map<String, String> config = new HashMap<>(); - config.put("k1", "v1"); - config.put("k2", "v2"); - - doTestConnect(initParamsModuleConnector, config, (f) -> { - try { - f.init(); - BundleContext bc = f.getBundleContext(); - storeFile.set(new File(bc.getProperty(Constants.FRAMEWORK_STORAGE))); - } catch (Exception e) { - sneakyThrow(e); - } - }); - TestCase.assertEquals("Wrong init store file.", storeFile.get(), initFile.get()); - assertTrue("Did not find all init configs: " + initConfig.get(), - initConfig.get().entrySet().containsAll(config.entrySet())); - try { - initConfig.get().put("k3", "v3"); - fail("Expected unmodifiable map"); - } catch (UnsupportedOperationException e) { - // expected - } - } - - public void testConnectContentHeaders() throws IOException { - doTestConnectContentSimple(false); - } - - public void testConnectContentManifest() throws IOException { - doTestConnectContentSimple(true); - } - - void doTestConnectContentSimple(boolean withManifest) throws IOException { - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - final List<String> locations = Arrays.asList("b.1", "b.2", "b.3", "b.4"); - for (String l : locations) { - connector.setModule(l, withManifest ? createSimpleManifestModule(l) : createSimpleHeadersModule(l)); - } - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.init(); - for (String l : locations) { - Bundle b = f.getBundleContext().installBundle(l); - assertEquals("Wrong symbolic name.", l, b.getSymbolicName()); - checkConnectTag(b); - } - checkConnectTags(f, locations); - } catch (Throwable t) { - sneakyThrow(t); - } - }); - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.init(); - Bundle[] bundles = f.getBundleContext().getBundles(); - assertEquals("Wrong number of bundles from cache.", locations.size() + 1, bundles.length); - for (String l : locations) { - Bundle b = f.getBundleContext().getBundle(l); - assertNotNull("No bundle at location: " + l, b); - assertEquals("Wrong symbolic name.", l, b.getSymbolicName()); - checkConnectTag(b); - checkConnectTags(f, locations); - } - } catch (BundleException e) { - sneakyThrow(e); - } - }); - - connector.setModule("b.2", null); - connector.setModule("b.3", BUNDLE_EXCEPTION); - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.init(); - Bundle[] bundles = f.getBundleContext().getBundles(); - assertEquals("Wrong number of bundles from cache.", locations.size() - 1, bundles.length); - for (String l : locations) { - Bundle b = f.getBundleContext().getBundle(l); - if ("b.2".equals(l) || "b.3".equals(l)) { - assertNull("Found unexpected bundle.", b); - } else { - assertNotNull("No bundle at location: " + l, b); - assertEquals("Wrong symbolic name.", l, b.getSymbolicName()); - checkConnectTag(b); - } - } - } catch (BundleException e) { - sneakyThrow(e); - } - }); - } - - private static void checkConnectTag(Bundle b) { - final List<String> namespaces = new ArrayList<>(Arrays.asList(BundleNamespace.BUNDLE_NAMESPACE, - HostNamespace.HOST_NAMESPACE, IdentityNamespace.IDENTITY_NAMESPACE)); - - b.adapt(BundleRevision.class).getCapabilities(null).stream().filter(c -> namespaces.contains(c.getNamespace())) - .forEach(c -> { - List<String> tags = (List<String>) c.getAttributes() - .get(IdentityNamespace.CAPABILITY_TAGS_ATTRIBUTE); - assertNotNull("No tags found.", tags); - assertEquals("Wrong number of tags.", 1, tags.size()); - assertTrue("Connect tag not found.", tags.contains(ConnectContent.TAG_OSGI_CONNECT)); - namespaces.remove(c.getNamespace()); - }); - assertTrue("Connect tag namespaces were not removed completely. Found " + namespaces, namespaces.isEmpty()); - } - - private static void checkConnectTags(Framework f, List<String> locations) { - Collection<BundleCapability> osgiConnectTags = f.adapt(FrameworkWiring.class).findProviders( // - ModuleContainer.createRequirement(IdentityNamespace.IDENTITY_NAMESPACE, // - Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, "(tags=osgi.connect)"), // - Collections.emptyMap())); - osgiConnectTags.forEach(c -> { - assertTrue("Unexpected tag on bundle: " + c.getRevision().getBundle(), - locations.contains(c.getRevision().getBundle().getLocation())); - }); - } - - public void testConnectContentActivatorsWithFrameworkLoaders() { - doTestConnectContentActivators(false); - } - - public void testConnectContentActivatorsWithProvidedLoaders() { - doTestConnectContentActivators(true); - } - - void doTestConnectContentActivators(boolean provideLoader) { - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - final List<Integer> ids = Arrays.asList(1, 2, 3); - for (Integer id : ids) { - connector.setModule(id.toString(), createAdvancedModule(id, provideLoader)); - } - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - for (Integer id : ids) { - Bundle b = f.getBundleContext().installBundle(id.toString()); - assertEquals("Wrong symbolic name.", id.toString(), b.getSymbolicName()); - b.start(); - ServiceReference<?>[] registered = b.getRegisteredServices(); - assertNotNull("No services found.", registered); - assertEquals("Wrong number of services.", 1, registered.length); - assertEquals("Wrong service property.", Activator.class.getSimpleName() + id, - (String) registered[0].getProperty("activator")); - if (provideLoader) { - assertTrue("Expected the same classes.", - Activator.class.equals(b.loadClass(Activator.class.getName()))); - } else { - assertFalse("Expected different classes.", - Activator.class.equals(b.loadClass(Activator.class.getName()))); - } - } - } catch (Throwable t) { - sneakyThrow(t); - } - }); - } - - public void testConnectContentEntriesWithFrameworkLoaders() { - doTestConnectContentEntries(false); - } - - public void testConnectContentEntriesWithProvidedLoaders() { - doTestConnectContentEntries(true); - } - - void doTestConnectContentEntries(boolean provideLoader) { - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - final List<Integer> ids = Arrays.asList(1, 2, 3); - final Map<Integer, TestConnectModule> modules = new HashMap<>(); - for (Integer id : ids) { - TestConnectModule m = createAdvancedModule(id, provideLoader); - modules.put(id, m); - connector.setModule(id.toString(), m); - } - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - for (Integer id : ids) { - Bundle b = f.getBundleContext().installBundle(id.toString()); - assertEquals("Wrong symbolic name.", id.toString(), b.getSymbolicName()); - TestConnectModule m = modules.get(id); - List<String> entries = new ArrayList<>(); - for (String entry : m.getContent().getEntries()) { - entries.add(entry); - } - - Set<String> bundleEntryUrls = new HashSet<>(); - for (Enumeration<URL> eUrls = b.findEntries("/", "*", true); eUrls.hasMoreElements();) { - // URL paths always begin with '/', remove it - bundleEntryUrls.add(eUrls.nextElement().getPath().substring(1)); - } - assertEquals("Wrong number of bundle entry URLs.", entries.size(), bundleEntryUrls.size()); - assertTrue("Wrong bundle entry URLs: " + bundleEntryUrls, entries.containsAll(bundleEntryUrls)); - - List<String> bundleEntryPaths = new ArrayList<>(); - for (Enumeration<String> ePaths = b - .getEntryPaths("org/eclipse/osgi/tests/bundles/resources"); ePaths.hasMoreElements();) { - bundleEntryPaths.add(ePaths.nextElement()); - } - assertEquals("Wrong number of bundle entry paths from root.", 1, bundleEntryPaths.size()); - assertEquals("Wrong bundle entry found at root.", - "org/eclipse/osgi/tests/bundles/resources/" + id + ".txt", bundleEntryPaths.get(0)); - - BundleWiring wiring = b.adapt(BundleWiring.class); - assertNotNull("No wiring.", wiring); - Collection<String> wiringResourcePaths = wiring.listResources("/", "*", - BundleWiring.LISTRESOURCES_LOCAL | BundleWiring.LISTRESOURCES_RECURSE); - assertEquals("Wrong number of resource paths.", entries.size(), wiringResourcePaths.size()); - assertTrue("Wrong resource paths: " + wiringResourcePaths, - entries.containsAll(wiringResourcePaths)); - - Set<String> wiringEntryUrls = new HashSet<>(); - for (URL url : wiring.findEntries("/", "*", BundleWiring.FINDENTRIES_RECURSE)) { - // URL paths always begin with '/', remove it - wiringEntryUrls.add(url.getPath().substring(1)); - } - assertEquals("Wrong number of wiring entry URLs.", entries.size(), wiringEntryUrls.size()); - assertTrue("Wrong wiring entry URLs: " + wiringEntryUrls, entries.containsAll(wiringEntryUrls)); - - String txtPathDir = "org/eclipse/osgi/tests/bundles/resources/"; - String txtPath = txtPathDir + id + ".txt"; - Optional<ConnectEntry> txtConnectEntry = m.getContent().getEntry(txtPath); - assertTrue("Could not find text entry.", txtConnectEntry.isPresent()); - - checkEntry(txtConnectEntry.get(), b.getEntry(txtPath), id); - checkEntry(txtConnectEntry.get(), b.getResource(txtPath), id); - Enumeration<URL> found = b.findEntries(txtPathDir, "*.txt", false); - checkEntry(txtConnectEntry.get(), found.nextElement(), id); - assertFalse("More entries found.", found.hasMoreElements()); - - // now try with leading '/' - String slashTxtPath = '/' + txtPath; - checkEntry(txtConnectEntry.get(), b.getEntry(slashTxtPath), id); - checkEntry(txtConnectEntry.get(), b.getResource(slashTxtPath), id); - found = b.findEntries('/' + txtPathDir, "*.txt", false); - checkEntry(txtConnectEntry.get(), found.nextElement(), id); - assertFalse("More entries found.", found.hasMoreElements()); - } - } catch (Throwable t) { - sneakyThrow(t); - } - }); - } - - public void testOpenCloseUpdateConnectContent() { - final String NAME1 = "testUpdate.1"; - final String NAME2 = "testUpdate.2"; - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - TestConnectModule m = createSimpleHeadersModule(NAME1); - connector.setModule(NAME1, m); - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - Bundle b = f.getBundleContext().installBundle(NAME1); - assertEquals("Wrong name.", NAME1, b.getSymbolicName()); - // make sure to open the bundle file - assertNull(b.getEntry("doesNotExist.txt")); - TestConnectContent original = m.getContent(); - assertTrue("Original content is not open.", original.isOpen()); - - // set the new content but don't update - m.setContent(createSimpleHeadersContent(NAME2)); - - FrameworkWiring fwkWiring = f.adapt(FrameworkWiring.class); - CountDownLatch refreshDone = new CountDownLatch(1); - fwkWiring.refreshBundles(Collections.singletonList(b), (e) -> refreshDone.countDown()); - refreshDone.await(); - - // should still be NAME1 - assertEquals("Wrong name.", NAME1, b.getSymbolicName()); - assertTrue("Original content is not open.", original.isOpen()); - - // now update should stage in the new content - b.update(); - assertEquals("Wrong name.", NAME2, b.getSymbolicName()); - // make sure to open the bundle file - assertNull(b.getEntry("doesNotExist.txt")); - TestConnectContent newContent = m.getContent(); - assertTrue("New content is not open.", newContent.isOpen()); - assertFalse("Original content is open.", original.isOpen()); - - // now update with no new content - b.update(); - assertNull(b.getEntry("doesNotExist.txt")); - assertTrue("New content is not open.", newContent.isOpen()); - assertFalse("Original content is open.", original.isOpen()); - } catch (Throwable t) { - sneakyThrow(t); - } - }); - } - - public void testConnectBundleHeaders() throws IOException { - doTestConnectBundleHeaders(false, false); - doTestConnectBundleHeaders(true, false); - doTestConnectBundleHeaders(false, true); - doTestConnectBundleHeaders(true, true); - } - - void doTestConnectBundleHeaders(boolean withSignedHook, boolean withManifest) throws IOException { - final String NAME1 = "bundle1"; - final String NAME2 = "bundle2"; - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - TestConnectModule m = withManifest ? createSimpleManifestModule(NAME1) : createSimpleHeadersModule(NAME1); - connector.setModule(NAME1, m); - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - Bundle b = f.getBundleContext().installBundle(NAME1); - Dictionary<String, String> headers1 = b.getHeaders(); - assertEquals("Wrong name.", NAME1, b.getSymbolicName()); - if (withManifest) { - assertEquals("Wrong symbolic name header.", NAME1, headers1.get(Constants.BUNDLE_SYMBOLICNAME)); - } else { - checkHeaders(m.getContent().getHeaders().get(), headers1); - } - // set the new content - m.setContent(withManifest ? createSimpleManifestContent(NAME2) : createSimpleHeadersContent(NAME2)); - b.update(); - Dictionary<String, String> headers2 = b.getHeaders(); - assertNotEquals("Headers not updated", headers1, headers2); - assertEquals("Wrong name.", NAME2, b.getSymbolicName()); - if (withManifest) { - assertEquals("Wrong symbolic name header.", NAME2, headers2.get(Constants.BUNDLE_SYMBOLICNAME)); - } else { - checkHeaders(m.getContent().getHeaders().get(), headers2); - } - b.uninstall(); - } catch (Throwable t) { - sneakyThrow(t); - } - }, withSignedHook); - } - - public void testGetConnectHeaders() throws Exception { - final String NAME = "bundle"; - final AtomicReference<Dictionary<String, String>> headers1 = new AtomicReference<>(); - final AtomicReference<Dictionary<String, String>> headers2 = new AtomicReference<>(); - - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - TestConnectModule m = createSimpleHeadersModule(NAME); - connector.setModule(NAME, m); - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - Bundle b = f.getBundleContext().installBundle(NAME); - assertEquals("Wrong name.", NAME, b.getSymbolicName()); - headers1.set(b.getHeaders()); - f.stop(); - f.waitForStop(5000); - } catch (Throwable t) { - sneakyThrow(t); - } - }); - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - Bundle b = f.getBundleContext().getBundle(NAME); - assertFalse("Content is not closed", m.getContent().isOpen()); - // Bundle.getHeaders() will eventually call - // ConnectBundleFile.getConnectHeaders() which opens the connect content - headers2.set(b.getHeaders()); - assertTrue("Content is not open", m.getContent().isOpen()); - f.stop(); - f.waitForStop(5000); - } catch (Throwable t) { - sneakyThrow(t); - } - }); - Dictionary<String, String> h1 = headers1.get(); - Dictionary<String, String> h2 = headers2.get(); - - assertEquals("Headers size not equal", h1.size(), h2.size()); - - for (Enumeration<String> keys = h1.keys(); keys.hasMoreElements();) { - String key = keys.nextElement(); - assertEquals(key + " header value not equal", h1.get(key), h2.get(key)); - } - } - - public void testInstallUpdateWithInputStream() throws Exception { - dotestInstallUpdate(false, false); - dotestInstallUpdate(false, true); - dotestInstallUpdate(true, false); - dotestInstallUpdate(true, true); - } - - void dotestInstallUpdate(boolean installWithInputStream, boolean updateWithInputStream) throws Exception { - final InputStream in1 = installWithInputStream ? new URL(installer.getBundleLocation("test")).openStream() - : null; - final InputStream in2 = updateWithInputStream ? new URL(installer.getBundleLocation("test2")).openStream() - : null; - final String NAME1 = installWithInputStream ? "test1" : "bundle1"; - final String NAME2 = updateWithInputStream ? "test2" : "bundle2"; - - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - - TestConnectModule m = createSimpleHeadersModule(NAME1); - connector.setModule(NAME1, m); - - doTestConnect(connector, new HashMap<>(), (f) -> { - try { - f.start(); - Bundle test = f.getBundleContext().installBundle(NAME1, in1); - assertEquals("Wrong name.", NAME1, test.getSymbolicName()); - if (installWithInputStream) { - assertNotNull("Resource not found", test.getResource("stuff/data/resource1")); - } - m.setContent(createSimpleHeadersContent(NAME2)); - test.update(in2); - assertEquals("Wrong name.", NAME2, test.getSymbolicName()); - if (updateWithInputStream) { - assertNotNull("Resource not found", test.getResource("stuff/data/resource2")); - } - f.stop(); - f.waitForStop(5000); - } catch (Throwable t) { - sneakyThrow(t); - } finally { - cleanStorage(); - } - }); - } - - public void testSystemBundleContent() { - TestCountingModuleConnector connector = new TestCountingModuleConnector(); - Bundle systemBundle = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION); - Map<String, String> headers = new HashMap<>(FrameworkUtil.asMap(systemBundle.getHeaders())); - headers.put("test.key", "test.value"); - // remove bundle manifest version to allow java export - headers.remove(Constants.BUNDLE_MANIFESTVERSION); - - TestConnectModule systemModule = new TestConnectModule( - new TestConnectContent(headers, systemBundle.adapt(BundleWiring.class).getClassLoader())); - connector.setModule(Constants.SYSTEM_BUNDLE_LOCATION, systemModule); - Consumer<Framework> test = f -> { - try { - f.init(); - Dictionary<String, String> h = f.getHeaders(); - assertEquals("Wrong system BSN", systemBundle.getSymbolicName(), f.getSymbolicName()); - assertEquals("Wrong test value", "test.value", h.get("test.key")); - } catch (Throwable t) { - sneakyThrow(t); - } - }; - - // run twice to test clean and persistent start - doTestConnect(connector, new HashMap<>(), test); - doTestConnect(connector, new HashMap<>(), test); - } - - private void checkHeaders(Map<String, String> expected, Dictionary<String, String> actual) { - assertEquals("Headers size not equals", expected.size(), actual.size()); - for (Entry<String, String> entry : expected.entrySet()) { - String key = entry.getKey(); - assertEquals(key + " header value not equal", entry.getValue(), actual.get(key)); - } - } - - void checkEntry(ConnectEntry expected, URL actual, Integer id) throws IOException { - assertNotNull("No entry found.", actual); - assertEquals("Wrong path.", expected.getName(), actual.getPath().substring(1)); - URLConnection connection = actual.openConnection(); - assertEquals("Wrong last modified.", expected.getLastModified(), connection.getLastModified()); - assertEquals("Wrong content length.", expected.getContentLength(), connection.getContentLengthLong()); - byte[] expectedBytes = getBytes(expected.getInputStream()); - byte[] actualBytes = getBytes(connection.getInputStream()); - assertEquals("Wrong input steam size.", expectedBytes.length, actualBytes.length); - for (int i = 0; i < expectedBytes.length; i++) { - assertEquals("Wrong byte at: " + i, expectedBytes[i], actualBytes[i]); - } - String actualString = new String(actualBytes); - assertEquals("Wrong entry string.", id.toString(), actualString); - } - - TestConnectModule createSimpleHeadersModule(String name) { - return new TestConnectModule(createSimpleHeadersContent(name)); - } - - TestConnectContent createSimpleHeadersContent(String name) { - Map<String, String> headers = new HashMap<>(); - headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); - headers.put(Constants.BUNDLE_SYMBOLICNAME, name); - headers.put(Constants.IMPORT_PACKAGE, "org.osgi.framework"); - return new TestConnectContent(headers, null); - } - - TestConnectModule createSimpleManifestModule(String name) throws IOException { - return new TestConnectModule(createSimpleManifestContent(name)); - } - - TestConnectContent createSimpleManifestContent(String name) throws IOException { - Manifest manifest = new Manifest(); - Attributes headers = manifest.getMainAttributes(); - headers.putValue("Manifest-Version", "1"); - headers.putValue(Constants.BUNDLE_MANIFESTVERSION, "2"); - headers.putValue(Constants.BUNDLE_SYMBOLICNAME, name); - headers.putValue(Constants.IMPORT_PACKAGE, "org.osgi.framework"); - ByteArrayOutputStream manifestBytes = new ByteArrayOutputStream(); - manifest.write(manifestBytes); - TestConnectContent c = new TestConnectContent(null, null); - addEntry("META-INF/MANIFEST.MF", manifestBytes.toByteArray(), c); - return c; - } - - TestConnectModule createAdvancedModule(Integer id, boolean provideLoader) { - Map<String, String> headers = new HashMap<>(); - headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); - headers.put(Constants.BUNDLE_SYMBOLICNAME, id.toString()); - headers.put(Constants.IMPORT_PACKAGE, "org.osgi.framework"); - headers.put(Constants.BUNDLE_ACTIVATOR, Activator.class.getName() + id); - TestConnectContent c = new TestConnectContent(headers, provideLoader ? getClass().getClassLoader() : null); - addEntry("org/", c); - addEntry("org/eclipse/", c); - addEntry("org/eclipse/osgi/", c); - addEntry("org/eclipse/osgi/tests/", c); - addEntry("org/eclipse/osgi/tests/bundles/", c); - addEntry("org/eclipse/osgi/tests/bundles/classes/", c); - addEntry("org/eclipse/osgi/tests/bundles/classes/Activator.class", c); - addEntry("org/eclipse/osgi/tests/bundles/classes/Activator" + id + ".class", c); - addEntry("org/eclipse/osgi/tests/bundles/resources/", c); - addEntry("org/eclipse/osgi/tests/bundles/resources/" + id + ".txt", c); - return new TestConnectModule(c); - } - - void addEntry(String name, TestConnectContent content) { - content.addEntry(name, new TestConnectEntryURL(name, getClass().getResource("/" + name))); - } - - void addEntry(String name, byte[] bytes, TestConnectContent content) { - content.addEntry(name, new TestConnectEntryBytes(name, bytes)); - } - - static byte[] getBytes(InputStream in) throws IOException { - byte[] classbytes; - int bytesread = 0; - int readcount; - try { - int length = 1024; - classbytes = new byte[length]; - readloop: while (true) { - for (; bytesread < length; bytesread += readcount) { - readcount = in.read(classbytes, bytesread, length - bytesread); - if (readcount <= 0) /* if we didn't read anything */ - break readloop; /* leave the loop */ - } - byte[] oldbytes = classbytes; - length += 1024; - classbytes = new byte[length]; - System.arraycopy(oldbytes, 0, classbytes, 0, bytesread); - } - - if (classbytes.length > bytesread) { - byte[] oldbytes = classbytes; - classbytes = new byte[bytesread]; - System.arraycopy(oldbytes, 0, classbytes, 0, bytesread); - } - } finally { - try { - in.close(); - } catch (IOException ee) { - // nothing to do here - } - } - return classbytes; - } - - public static <E extends Throwable> void sneakyThrow(Throwable e) throws E { - throw (E) e; - } -} diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java index 6bc0d224b..6821483fc 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java @@ -119,7 +119,7 @@ public class DiscardBundleTests extends AbstractBundleTests { // will sometimes result in failure presumably due to a locked // file. stop(equinox); - delete(bundleFile); + rm(bundleFile); equinox = restart(equinox, configuration); assertDiscarded(location, equinox); } finally { @@ -222,4 +222,21 @@ public class DiscardBundleTests extends AbstractBundleTests { file = new File(file, BUNDLE_MANIFEST); assertTrue("Could not set last modified: " + file, file.setLastModified(file.lastModified() + 1000)); } + + public static boolean rm(File file) { + if (file.exists()) { + if (file.isDirectory()) { + String list[] = file.list(); + if (list != null) { + int len = list.length; + for (int i = 0; i < len; i++) { + rm(new File(file, list[i])); + } + } + } + + return file.delete(); + } + return (true); + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java index fb2953472..b94c08db9 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.osgi.tests.bundles; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import junit.framework.Test; import junit.framework.TestSuite; @@ -30,8 +28,6 @@ public class ExtensionBundleTests extends AbstractBundleTests { return new TestSuite(ExtensionBundleTests.class); } - public static List<String> events = new ArrayList<>(); - public void testFrameworkExtension01() throws Exception { Bundle fwkext = installer.installBundle("ext.framework.a", false); //$NON-NLS-1$ Bundle importer = installer.installBundle("ext.framework.a.importer"); //$NON-NLS-1$ @@ -88,28 +84,4 @@ public class ExtensionBundleTests extends AbstractBundleTests { BundleWire eeWire = wiring.getRequiredWires(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE).get(0); assertEquals("Wrong provider for osgi.ee: " + eeWire.getProvider().getBundle(), 0, eeWire.getProvider().getBundle().getBundleId()); } - - public void testActivatorOrder() throws Exception { - Bundle b = installer.installBundle("ext.framework.a", false); - Bundle bImp = installer.installBundle("ext.framework.a.importer"); - Bundle bReq = installer.installBundle("ext.framework.a.requires"); - installer.resolveBundles(new Bundle[] {b, bImp, bReq}); - - try { - bImp.start(); - bReq.start(); - } finally { - installer.uninstallAllBundles(); - } - List<String> expectedEvents = Arrays.asList(bImp.getSymbolicName() + " STARTED", bReq.getSymbolicName() + " STARTED", bReq.getSymbolicName() + " STOPPED", bImp.getSymbolicName() + " STOPPED"); - assertEquals("Expected number of events not found", expectedEvents.size(), events.size()); - for (int i = 0; i < events.size(); i++) { - assertEquals("Expected event not found", expectedEvents.get(i), events.get(i)); - } - } - - public void tearDown() throws Exception { - super.tearDown(); - events.clear(); - } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java index 6bf21e4f9..36d9c8891 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java @@ -121,6 +121,7 @@ public class ImportJavaSEPackagesTests extends AbstractBundleTests { public void testSystemPackages() throws Exception { Map<Integer, Integer> packagesPerVersion = new HashMap<>(); + packagesPerVersion.put(7, 56); packagesPerVersion.put(8, 63); if (!originalSpecVersion.startsWith("1.")) { packagesPerVersion.put(9, calculateJavaPackageCount()); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java index 93405d710..c1c089deb 100755 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java @@ -1022,25 +1022,25 @@ public class SystemBundleTests extends AbstractBundleTests { } public void testChangeEE() throws IOException, BundleException { + URL javaSE7Profile = OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getEntry("JavaSE-1.7.profile"); URL javaSE8Profile = OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getEntry("JavaSE-1.8.profile"); - URL javaSE9Profile = OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getEntry("JavaSE-9.profile"); - // configure equinox for javaSE 9 + // configure equinox for javaSE 8 File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); - configuration.put("osgi.java.profile", javaSE9Profile.toExternalForm()); //$NON-NLS-1$ + configuration.put("osgi.java.profile", javaSE8Profile.toExternalForm()); //$NON-NLS-1$ Equinox equinox = new Equinox(configuration); equinox.start(); - // install a bundle that requires java 9 + // install a bundle that requires java 8 BundleContext systemContext = equinox.getBundleContext(); assertNotNull("System context is null", systemContext); //$NON-NLS-1$ Map<String, String> testHeaders = new HashMap<>(); testHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); testHeaders.put(Constants.BUNDLE_SYMBOLICNAME, getName()); - testHeaders.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-9"); + testHeaders.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-1.8"); File testBundle = createBundle(config, getName(), testHeaders); Bundle b = systemContext.installBundle("reference:file:///" + testBundle.getAbsolutePath()); //$NON-NLS-1$ long bid = b.getBundleId(); @@ -1056,8 +1056,8 @@ public class SystemBundleTests extends AbstractBundleTests { fail("Unexpected interrupted exception", e); //$NON-NLS-1$ } - // configure equinox for java 8 - configuration.put("osgi.java.profile", javaSE8Profile.toExternalForm()); + // configure equinox for java 7 + configuration.put("osgi.java.profile", javaSE7Profile.toExternalForm()); equinox = new Equinox(configuration); try { equinox.start(); @@ -1076,8 +1076,8 @@ public class SystemBundleTests extends AbstractBundleTests { fail("Unexpected interrupted exception", e); //$NON-NLS-1$ } - // move back to java 9 - configuration.put("osgi.java.profile", javaSE9Profile.toExternalForm()); + // move back to java 8 + configuration.put("osgi.java.profile", javaSE8Profile.toExternalForm()); equinox = new Equinox(configuration); try { equinox.start(); @@ -2692,7 +2692,7 @@ public class SystemBundleTests extends AbstractBundleTests { config.mkdirs(); Map<String, Object> configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); - configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=JavaSE; version:Version=1.8, something.system"); + configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=JavaSE; version:Version=1.7, something.system"); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "something.system"); configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA, "something.extra"); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "something.extra"); @@ -2771,6 +2771,7 @@ public class SystemBundleTests extends AbstractBundleTests { doTestJavaProfile("1.10.1", "JavaSE-1.8", null); doTestJavaProfile("1.9", "JavaSE-1.8", null); doTestJavaProfile("1.8", "JavaSE-1.8", null); + doTestJavaProfile("1.7", "JavaSE-1.7", null); doTestJavaProfile("1.8", "JavaSE/compact3-1.8", "compact3"); doTestJavaProfile("1.8", "JavaSE/compact3-1.8", "\"compact3\""); doTestJavaProfile("1.8", "JavaSE/compact3-1.8", " \"compact3\" "); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator.java deleted file mode 100644 index 129445301..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.bundles.classes; - -import java.util.Collections; -import java.util.Hashtable; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class Activator implements BundleActivator { - @Override - public void start(BundleContext context) throws Exception { - context.registerService(Activator.class, this, new Hashtable<>(Collections.singletonMap("activator", this.getClass().getSimpleName()))); - } - - @Override - public void stop(BundleContext context) throws Exception { - // do nothing - } -} diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator1.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator1.java deleted file mode 100644 index 527a559fd..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator1.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.bundles.classes; - -public class Activator1 extends Activator { - // nothing -} diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator2.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator2.java deleted file mode 100644 index a223183f0..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator2.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.bundles.classes; - -public class Activator2 extends Activator { - // nothing -} diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator3.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator3.java deleted file mode 100644 index 272821d47..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator3.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.tests.bundles.classes; - -public class Activator3 extends Activator { - // nothing -} diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/1.txt b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/1.txt deleted file mode 100644 index 56a6051ca..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/1.txt +++ /dev/null @@ -1 +0,0 @@ -1
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/2.txt b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/2.txt deleted file mode 100644 index d8263ee98..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/2.txt +++ /dev/null @@ -1 +0,0 @@ -2
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/3.txt b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/3.txt deleted file mode 100644 index e440e5c84..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/resources/3.txt +++ /dev/null @@ -1 +0,0 @@ -3
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java index 8985c5ca9..f9fbd4097 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java @@ -483,10 +483,5 @@ public abstract class FilterTests { } return new CaseInsensitiveDictionaryMap(dictionary); } - - @Override - public Object adapt(Class type) { - return null; - } } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java index e77c2f0be..f7726f3ee 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java @@ -29,7 +29,6 @@ import org.eclipse.osgi.tests.OSGiTestsActivator; import org.eclipse.osgi.tests.bundles.BundleInstaller; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkEvent; -import org.osgi.framework.connect.FrameworkUtilHelper; import org.osgi.framework.launch.Framework; import org.osgi.framework.launch.FrameworkFactory; @@ -73,7 +72,7 @@ public abstract class AbstractFrameworkHookTests extends CoreTest { throw new RuntimeException(e); } } - if (name.startsWith("org.eclipse") || name.startsWith("org.osgi.framework.FrameworkUtil") || name.equals(FrameworkUtilHelper.class.getName())) { + if (name.startsWith("org.eclipse") || name.startsWith("org.osgi.framework.FrameworkUtil")) { Class<?> result = findLoadedClass(name); if (result == null) result = findClass(name); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ActivatorOrderTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ActivatorOrderTest.java deleted file mode 100644 index 1261d26bb..000000000 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ActivatorOrderTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.eclipse.osgi.tests.hooks.framework; - -import java.io.File; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import org.eclipse.osgi.internal.hookregistry.HookRegistry; -import org.eclipse.osgi.tests.OSGiTestsActivator; -import org.osgi.framework.Constants; -import org.osgi.framework.launch.Framework; - -public class ActivatorOrderTest extends AbstractFrameworkHookTests { - - private Framework framework; - private static final String HOOK_CONFIGURATOR_BUNDLE = "activator.hooks.a"; - private static final String HOOK_CONFIGURATOR_CLASS1 = "org.eclipse.osgi.tests.hooks.framework.activator.a.TestHookConfigurator1"; - private static final String HOOK_CONFIGURATOR_CLASS2 = "org.eclipse.osgi.tests.hooks.framework.activator.a.TestHookConfigurator2"; - private static final String HOOK_CONFIGURATOR_CLASS3 = "org.eclipse.osgi.tests.hooks.framework.activator.a.TestHookConfigurator3"; - - @Override - protected void setUp() throws Exception { - super.setUp(); - String loc = bundleInstaller.getBundleLocation(HOOK_CONFIGURATOR_BUNDLE); - loc = loc.substring(loc.indexOf("file:")); - classLoader.addURL(new URL(loc)); - File file = OSGiTestsActivator.getContext().getDataFile(getName()); - HashMap<String, String> configuration = new HashMap<>(); - configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); - configuration.put(HookRegistry.PROP_HOOK_CONFIGURATORS, HOOK_CONFIGURATOR_CLASS1 + "," + HOOK_CONFIGURATOR_CLASS2 + "," + HOOK_CONFIGURATOR_CLASS3); - - framework = createFramework(configuration); - } - - public void testActivatorOrder() throws Exception { - List<String> actualEvents = new ArrayList<>(); - Class<?> clazz1 = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS1); - clazz1.getField("events").set(null, actualEvents); - Class<?> clazz2 = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS2); - clazz2.getField("events").set(null, actualEvents); - Class<?> clazz3 = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS3); - clazz3.getField("events").set(null, actualEvents); - - List<String> expectedEvents = Arrays.asList("HOOK1 STARTED", "HOOK2 STARTED", "HOOK3 STARTED", "HOOK3 STOPPED", "HOOK2 STOPPED", "HOOK1 STOPPED"); - - initAndStart(framework); - stop(framework); - assertEquals("Activator order not as expected", expectedEvents, actualEvents); - - } - -} diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java index 3e35b9314..dc6c57004 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java @@ -25,7 +25,6 @@ public class AllFrameworkHookTests { suite.addTest(new TestSuite(ContextFinderTests.class)); suite.addTest(new TestSuite(DevClassPathWithExtensionTests.class)); suite.addTest(new TestSuite(EmbeddedEquinoxWithURLInClassLoadTests.class)); - suite.addTest(new TestSuite(ActivatorOrderTest.class)); return suite; } } diff --git a/bundles/org.eclipse.osgi/.classpath b/bundles/org.eclipse.osgi/.classpath index d1e9a6c35..150b59d0d 100644 --- a/bundles/org.eclipse.osgi/.classpath +++ b/bundles/org.eclipse.osgi/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="osgi/src"> <attributes> diff --git a/bundles/org.eclipse.osgi/.settings/.api_filters b/bundles/org.eclipse.osgi/.settings/.api_filters deleted file mode 100644 index e76dc4211..000000000 --- a/bundles/org.eclipse.osgi/.settings/.api_filters +++ /dev/null @@ -1,119 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<component id="org.eclipse.osgi" version="2"> - <resource path="osgi/src/org/osgi/framework/FrameworkUtil.java" type="org.osgi.framework.FrameworkUtil"> - <filter comment="Not for OSGi API" id="1141899266"> - <message_arguments> - <message_argument value="1.10"/> - <message_argument value="3.16"/> - <message_argument value="asDictionary(Map<? extends K,? extends V>)"/> - </message_arguments> - </filter> - <filter comment="Not for OSGi API" id="1141899266"> - <message_arguments> - <message_argument value="1.10"/> - <message_argument value="3.16"/> - <message_argument value="asMap(Dictionary<? extends K,? extends V>)"/> - </message_arguments> - </filter> - <filter comment="Not for OSGi API" id="1141899266"> - <message_arguments> - <message_argument value="1.10"/> - <message_argument value="3.16"/> - <message_argument value="getBundle(ClassLoader)"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/ServiceReference.java" type="org.osgi.framework.ServiceReference"> - <filter comment="Not for OSGi API" id="403804204"> - <message_arguments> - <message_argument value="org.osgi.framework.ServiceReference"/> - <message_argument value="adapt(Class<A>)"/> - </message_arguments> - </filter> - <filter id="403984517"> - <message_arguments> - <message_argument value="org.osgi.framework.ServiceReference"/> - <message_argument value="org.osgi.framework.BundleReference"/> - <message_argument value="getBundle()"/> - </message_arguments> - </filter> - <filter comment="Not for OSGi API" id="1209008130"> - <message_arguments> - <message_argument value="1.10"/> - <message_argument value="3.16"/> - <message_argument value="adapt(Class<A>)"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/connect/ConnectContent.java" type="org.osgi.framework.connect.ConnectContent"> - <filter comment="Not for OSGi API" id="1110441988"> - <message_arguments> - <message_argument value="org.osgi.framework.connect.ConnectContent"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/connect/ConnectFramework.java" type="org.osgi.framework.connect.ConnectFramework"> - <filter comment="Not for OSGi API" id="1110441988"> - <message_arguments> - <message_argument value="org.osgi.framework.connect.ConnectFramework"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/connect/ConnectFrameworkFactory.java" type="org.osgi.framework.connect.ConnectFrameworkFactory"> - <filter comment="Not for OSGi API" id="1110441988"> - <message_arguments> - <message_argument value="org.osgi.framework.connect.ConnectFrameworkFactory"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/connect/ConnectModule.java" type="org.osgi.framework.connect.ConnectModule"> - <filter comment="Not for OSGi API" id="1110441988"> - <message_arguments> - <message_argument value="org.osgi.framework.connect.ConnectModule"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/connect/FrameworkUtilHelper.java" type="org.osgi.framework.connect.FrameworkUtilHelper"> - <filter comment="Not for OSGi API" id="1110441988"> - <message_arguments> - <message_argument value="org.osgi.framework.connect.FrameworkUtilHelper"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/connect/ModuleConnector.java" type="org.osgi.framework.connect.ModuleConnector"> - <filter comment="Not for OSGi API" id="1110441988"> - <message_arguments> - <message_argument value="org.osgi.framework.connect.ModuleConnector"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/launch/FrameworkFactory.java" type="org.osgi.framework.launch.FrameworkFactory"> - <filter comment="Not for OSGi packages" id="403804204"> - <message_arguments> - <message_argument value="org.osgi.framework.launch.FrameworkFactory"/> - <message_argument value="newFramework(Map<String,String>, ConnectFactory)"/> - </message_arguments> - </filter> - <filter comment="Not for OSGi packages" id="1209008130"> - <message_arguments> - <message_argument value="1.3"/> - <message_argument value="3.16"/> - <message_argument value="newFramework(Map<String,String>, ConnectFactory)"/> - </message_arguments> - </filter> - <filter comment="Not for OSGi packages" id="1211105284"> - <message_arguments> - <message_argument value="newFramework(Map<String,String>, ConnectFactory)"/> - </message_arguments> - </filter> - </resource> - <resource path="osgi/src/org/osgi/framework/namespace/IdentityNamespace.java" type="org.osgi.framework.namespace.IdentityNamespace"> - <filter comment="Not for OSGi API" id="1141899266"> - <message_arguments> - <message_argument value="1.2"/> - <message_argument value="3.16"/> - <message_argument value="CAPABILITY_TAGS_ATTRIBUTE"/> - </message_arguments> - </filter> - </resource> -</component> diff --git a/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs index 11ab09e9d..d14e29624 100644 --- a/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.osgi/.settings/org.eclipse.jdt.core.prefs @@ -13,10 +13,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -32,7 +31,6 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -71,7 +69,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning @@ -89,7 +87,6 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -122,8 +119,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false diff --git a/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs index 8dd4a28d9..5b3c8e014 100644 --- a/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs +++ b/bundles/org.eclipse.osgi/.settings/org.eclipse.pde.api.tools.prefs @@ -1,17 +1,11 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error +#Thu Oct 08 09:47:30 CDT 2009 ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_FIELD=Error CLASS_ELEMENT_TYPE_ADDED_METHOD=Error CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error @@ -51,7 +45,6 @@ ILLEGAL_IMPLEMENT=Warning ILLEGAL_INSTANTIATE=Warning ILLEGAL_OVERRIDE=Warning ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Error INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error @@ -63,7 +56,6 @@ INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_ANNOTATION=Ignore INVALID_JAVADOC_TAG=Ignore INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error LEAK_EXTEND=Warning @@ -81,7 +73,6 @@ METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Warning TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error @@ -89,14 +80,10 @@ TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error UNUSED_PROBLEM_FILTERS=Warning -automatically_removed_unused_problem_filters=false -changed_execution_env=Error eclipse.preferences.version=1 incompatible_api_component_version=Error incompatible_api_component_version_include_major_without_breaking_change=Disabled incompatible_api_component_version_include_minor_without_api_change=Disabled -incompatible_api_component_version_report_major_without_breaking_change=Warning -incompatible_api_component_version_report_minor_without_api_change=Warning invalid_since_tag_version=Error malformed_since_tag=Error missing_since_tag=Error diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF index 30f45f660..bed5f7f3a 100644 --- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF @@ -6,7 +6,6 @@ Export-Package: org.eclipse.core.runtime.adaptor;x-friends:="org.eclipse.core.ru org.eclipse.osgi.container;version="1.5"; uses:="org.eclipse.osgi.report.resolution, org.osgi.framework.wiring, - org.eclipse.osgi.framework.eventmgr, org.osgi.framework.startlevel, org.osgi.framework, org.osgi.framework.hooks.resolver, @@ -35,7 +34,7 @@ Export-Package: org.eclipse.core.runtime.adaptor;x-friends:="org.eclipse.core.ru org.eclipse.osgi.internal.serviceregistry;x-internal:=true, org.eclipse.osgi.internal.signedcontent;x-internal:=true, org.eclipse.osgi.internal.url;x-internal:=true, - org.eclipse.osgi.launch;version="1.1";uses:="org.osgi.framework,org.osgi.framework.launch,org.osgi.framework.connect", + org.eclipse.osgi.launch;version="1.0";uses:="org.osgi.framework,org.osgi.framework.launch", org.eclipse.osgi.report.resolution;version="1.0";uses:="org.osgi.service.resolver,org.osgi.resource", org.eclipse.osgi.service.datalocation;version="1.3", org.eclipse.osgi.service.debug;version="1.2", @@ -53,15 +52,14 @@ Export-Package: org.eclipse.core.runtime.adaptor;x-friends:="org.eclipse.core.ru org.eclipse.osgi.storagemanager;version="1.0", org.eclipse.osgi.util;version="1.1", org.osgi.dto;version="1.1", - org.osgi.framework;version="1.10", - org.osgi.framework.connect;version="1.0";uses:="org.osgi.framework.launch", + org.osgi.framework;version="1.9", org.osgi.framework.dto;version="1.8";uses:="org.osgi.dto", org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.framework", org.osgi.framework.hooks.resolver;version="1.0";uses:="org.osgi.framework.wiring", org.osgi.framework.hooks.service;version="1.1";uses:="org.osgi.framework", org.osgi.framework.hooks.weaving;version="1.1";uses:="org.osgi.framework.wiring", org.osgi.framework.launch;version="1.2";uses:="org.osgi.framework", - org.osgi.framework.namespace;version="1.2";uses:="org.osgi.resource", + org.osgi.framework.namespace;version="1.1";uses:="org.osgi.resource", org.osgi.framework.startlevel;version="1.0";uses:="org.osgi.framework", org.osgi.framework.startlevel.dto;version="1.0";uses:="org.osgi.dto", org.osgi.framework.wiring;version="1.2";uses:="org.osgi.framework,org.osgi.resource", @@ -103,12 +101,12 @@ Bundle-Activator: org.eclipse.osgi.internal.framework.SystemBundleActivator Bundle-Description: %systemBundle Bundle-Copyright: %copyright Bundle-Vendor: %eclipse.org -Bundle-Version: 3.16.0.qualifier +Bundle-Version: 3.15.300.qualifier Bundle-Localization: systembundle Bundle-DocUrl: http://www.eclipse.org Eclipse-ExtensibleAPI: true Eclipse-SystemBundle: true Main-Class: org.eclipse.core.runtime.adaptor.EclipseStarter -Require-Capability: osgi.ee; filter:="(| (&(osgi.ee=JavaSE)(version=1.8)) (&(osgi.ee=JavaSE/compact1)(version=1.8)) )" +Require-Capability: osgi.ee; filter:="(| (&(osgi.ee=JavaSE)(version=1.7)) (&(osgi.ee=JavaSE/compact1)(version=1.8)) )" Eclipse-BundleShape: jar Automatic-Module-Name: org.eclipse.osgi diff --git a/bundles/org.eclipse.osgi/META-INF/native-image/native-image.properties b/bundles/org.eclipse.osgi/META-INF/native-image/native-image.properties deleted file mode 100644 index 301a26681..000000000 --- a/bundles/org.eclipse.osgi/META-INF/native-image/native-image.properties +++ /dev/null @@ -1,30 +0,0 @@ -Args = --initialize-at-build-time=\ -org.apache.felix.resolver,\ -org.eclipse.equinox.log,\ -org.eclipse.osgi,\ -org.osgi.dto,\ -org.osgi.framework,\ -org.osgi.framework.connect,\ -org.osgi.framework.dto,\ -org.osgi.framework.hooks.bundle,\ -org.osgi.framework.hooks.resolver,\ -org.osgi.framework.hooks.service,\ -org.osgi.framework.hooks.weaving,\ -org.osgi.framework.launch,\ -org.osgi.framework.namespace,\ -org.osgi.framework.startlevel,\ -org.osgi.framework.startlevel.dto,\ -org.osgi.framework.wiring,\ -org.osgi.framework.wiring.dto,\ -org.osgi.resource,\ -org.osgi.resource.dto,\ -org.osgi.service.condpermadmin,\ -org.osgi.service.cm,\ -org.osgi.service.log,\ -org.osgi.service.log.admin,\ -org.osgi.service.packageadmin,\ -org.osgi.service.permissionadmin,\ -org.osgi.service.resolver,\ -org.osgi.service.startlevel,\ -org.osgi.service.url,\ -org.osgi.util.tracker diff --git a/bundles/org.eclipse.osgi/META-INF/native-image/proxy-config.json b/bundles/org.eclipse.osgi/META-INF/native-image/proxy-config.json deleted file mode 100644 index 50a895ac8..000000000 --- a/bundles/org.eclipse.osgi/META-INF/native-image/proxy-config.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - ["org.osgi.service.cm.SynchronousConfigurationListener"] -] diff --git a/bundles/org.eclipse.osgi/META-INF/native-image/reflect-config.json b/bundles/org.eclipse.osgi/META-INF/native-image/reflect-config.json deleted file mode 100644 index 12dfa3ea9..000000000 --- a/bundles/org.eclipse.osgi/META-INF/native-image/reflect-config.json +++ /dev/null @@ -1,109 +0,0 @@ -[ -{ - "name":"org.osgi.service.cm.SynchronousConfigurationListener", - "allDeclaredMethods":true, - "allPublicConstructors":true -}, -{ - "name":"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", - "allPublicConstructors":true -}, -{ - "name":"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", - "allPublicConstructors":true -}, -{ - "name":"com.sun.xml.internal.stream.XMLInputFactoryImpl", - "allPublicConstructors":true -}, -{ - "name":"java.lang.Boolean", - "methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }] -}, -{ - "name":"java.lang.Object", - "allDeclaredMethods":true -}, -{ - "name":"java.lang.System", - "allPublicMethods":true -}, -{ - "name":"java.net.URL", - "allDeclaredFields":true -}, -{ - "name":"java.net.URLClassLoader", - "methods":[{"name":"addURL","parameterTypes":["java.net.URL"] }] -}, -{ - "name":"java.net.URLConnection", - "allDeclaredFields":true -}, -{ - "name":"java.util.HashSet", - "methods":[{"name":"clone","parameterTypes":[] }] -}, -{ - "name":"javax.xml.parsers.SAXParserFactory" -}, -{ - "name":"org.eclipse.osgi.container.ModuleWiring", - "fields":[{"name":"dynamicMissRef"}] -}, -{ - "name":"org.eclipse.osgi.internal.cds.CDSHookConfigurator", - "methods":[{"name":"<init>","parameterTypes":[] }] -}, -{ - "name":"org.eclipse.osgi.internal.connect.ConnectHookConfigurator", - "methods":[{"name":"<init>","parameterTypes":[] }] -}, -{ - "name":"org.eclipse.osgi.internal.framework.BundleContextImpl", - "allPublicMethods":true -}, -{ - "name":"org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle", - "allPublicMethods":true -}, -{ - "name":"org.eclipse.osgi.internal.framework.SystemBundleActivator", - "methods":[{"name":"<init>","parameterTypes":[] }] -}, -{ - "name":"org.eclipse.osgi.internal.signedcontent.SignedBundleHook", - "methods":[{"name":"<init>","parameterTypes":[] }] -}, -{ - "name":"org.eclipse.osgi.launch.EquinoxFactory", - "methods":[{"name":"<init>","parameterTypes":[] }] -}, -{ - "name":"org.eclipse.osgi.service.resolver.BundleDescription" -}, -{ - "name":"org.osgi.service.cm.Configuration", - "methods":[ - {"name":"getFactoryPid","parameterTypes":[] }, - {"name":"getPid","parameterTypes":[] }, - {"name":"getProperties","parameterTypes":[] } - ] -}, -{ - "name":"org.osgi.service.cm.ConfigurationAdmin", - "methods":[ - {"name":"getConfiguration","parameterTypes":["java.lang.String","java.lang.String"] }, - {"name":"listConfigurations","parameterTypes":["java.lang.String"] } - ] -}, -{ - "name":"org.osgi.service.cm.ConfigurationEvent", - "methods":[ - {"name":"getFactoryPid","parameterTypes":[] }, - {"name":"getPid","parameterTypes":[] }, - {"name":"getReference","parameterTypes":[] }, - {"name":"getType","parameterTypes":[] } - ] -} -] diff --git a/bundles/org.eclipse.osgi/META-INF/native-image/resource-config.json b/bundles/org.eclipse.osgi/META-INF/native-image/resource-config.json deleted file mode 100644 index dc878eead..000000000 --- a/bundles/org.eclipse.osgi/META-INF/native-image/resource-config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "resources":[ - {"pattern":"META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory"}, - {"pattern":"META-INF/services/org.osgi.framework.connect.FrameworkUtilHelper"}, - {"pattern":"META-INF/services/org.osgi.framework.launch.FrameworkFactory"}, - {"pattern":"hookconfigurators.properties"}, - {"pattern":"org/eclipse/osgi/internal/framework/osname.aliases"}, - {"pattern":"org/eclipse/osgi/internal/framework/processor.aliases"}, - {"pattern":"org/eclipse/osgi/internal/messages/ExternalMessages.properties"}, - {"pattern":"org/eclipse/osgi/internal/permadmin/implied.permissions"}, - {"pattern":"org/eclipse/osgi/internal/signedcontent/SignedContentMessages.properties"}, - {"pattern":"org/eclipse/osgi/internal/url/SetAccessible.bytes"} - ] -} diff --git a/bundles/org.eclipse.osgi/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory b/bundles/org.eclipse.osgi/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory deleted file mode 100644 index 6cd04c1be..000000000 --- a/bundles/org.eclipse.osgi/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.osgi.launch.EquinoxFactory diff --git a/bundles/org.eclipse.osgi/build.properties b/bundles/org.eclipse.osgi/build.properties index e6ec93eb5..70f107def 100644 --- a/bundles/org.eclipse.osgi/build.properties +++ b/bundles/org.eclipse.osgi/build.properties @@ -38,4 +38,4 @@ javacWarnings..=-raw,unchecked,hiding,unused,warningToken jars.extra.classpath = osgi/osgi.annotation.jar,\ osgi/function.interface.jar,\ osgi/j9stubs.jar -jre.compilation.profile = JavaSE-1.8 +jre.compilation.profile = JavaSE-1.7 diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSHookImpls.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSHookImpls.java index dfdc81998..5eddeaffc 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSHookImpls.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSHookImpls.java @@ -37,7 +37,6 @@ import org.eclipse.osgi.internal.loader.classpath.ClasspathEntry; import org.eclipse.osgi.internal.loader.classpath.ClasspathManager; import org.eclipse.osgi.internal.loader.classpath.FragmentClasspath; import org.eclipse.osgi.storage.BundleInfo.Generation; -import org.eclipse.osgi.storage.ContentProvider.Type; import org.eclipse.osgi.storage.bundlefile.BundleEntry; import org.eclipse.osgi.storage.bundlefile.BundleFile; import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper; @@ -193,9 +192,6 @@ public class CDSHookImpls extends ClassLoaderHook implements BundleFileWrapperFa //////////////// BundleFileWrapperFactoryHook ////////////// @Override public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) { - if (generation.getContentType() == Type.CONNECT) { - return null; - } // wrap the real bundle file for purposes of loading shared classes. CDSBundleFile newBundleFile; if (!base && generation.getBundleInfo().getBundleId() != 0) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectBundleFile.java deleted file mode 100644 index 25703120d..000000000 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectBundleFile.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.internal.connect; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.Map; -import java.util.Optional; -import org.eclipse.osgi.internal.debug.Debug; -import org.eclipse.osgi.storage.BundleInfo; -import org.eclipse.osgi.storage.bundlefile.BundleEntry; -import org.eclipse.osgi.storage.bundlefile.CloseableBundleFile; -import org.eclipse.osgi.storage.bundlefile.MRUBundleFileList; -import org.osgi.framework.connect.ConnectContent; -import org.osgi.framework.connect.ConnectContent.ConnectEntry; -import org.osgi.framework.connect.ConnectModule; - -public class ConnectBundleFile extends CloseableBundleFile<ConnectEntry> { - public class ConnectBundleEntry extends BundleEntry { - private final ConnectEntry connectEntry; - - public ConnectBundleEntry(ConnectEntry entry) { - this.connectEntry = entry; - } - - @Override - public InputStream getInputStream() throws IOException { - return ConnectBundleFile.this.getInputStream(connectEntry); - } - - @Override - public byte[] getBytes() throws IOException { - return connectEntry.getBytes(); - } - - @Override - public long getSize() { - return connectEntry.getContentLength(); - } - - @Override - public String getName() { - return connectEntry.getName(); - } - - @Override - public long getTime() { - return connectEntry.getLastModified(); - } - - @Override - public URL getFileURL() { - File file = ConnectBundleFile.this.getFile(getName(), false); - if (file != null) { - try { - return file.toURI().toURL(); - } catch (MalformedURLException e) { - // should never happen - } - } - return null; - } - - @Override - public URL getLocalURL() { - // TODO Not sure what to do here - throw new UnsupportedOperationException(); - } - } - - private final ConnectContent content; - - public ConnectBundleFile(ConnectModule module, File basefile, BundleInfo.Generation generation, MRUBundleFileList mruList, Debug debug) throws IOException { - super(basefile, generation, mruList, debug); - this.content = module.getContent(); - } - - @Override - protected void doOpen() throws IOException { - content.open(); - } - - @Override - protected Iterable<String> getPaths() { - try { - return content.getEntries(); - } catch (IOException e) { - return Collections.emptyList(); - } - } - - @Override - protected BundleEntry findEntry(String path) { - if (path.length() > 0 && path.charAt(0) == '/') { - path = path.substring(1); - } - return content.getEntry(path).map(ConnectBundleEntry::new).orElse(null); - } - - @Override - protected void doClose() throws IOException { - content.close(); - } - - @Override - protected void postClose() { - // do nothing - } - - @Override - protected InputStream doGetInputStream(ConnectEntry entry) throws IOException { - return entry.getInputStream(); - } - - public Map<String, String> getConnectHeaders() { - if (!lockOpen()) { - return null; - } - try { - return content.getHeaders().orElse(null); - } finally { - releaseOpen(); - } - } - - Optional<ClassLoader> getClassLoader() { - return content.getClassLoader(); - } -} diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectHookConfigurator.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectHookConfigurator.java deleted file mode 100644 index bc457ed67..000000000 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectHookConfigurator.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.internal.connect; - -import static org.eclipse.osgi.internal.framework.EquinoxContainer.sneakyThrow; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import org.eclipse.osgi.container.Module; -import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent; -import org.eclipse.osgi.container.ModuleRevisionBuilder; -import org.eclipse.osgi.internal.framework.EquinoxConfiguration; -import org.eclipse.osgi.internal.framework.EquinoxContainer.ConnectModules; -import org.eclipse.osgi.internal.hookregistry.ActivatorHookFactory; -import org.eclipse.osgi.internal.hookregistry.ClassLoaderHook; -import org.eclipse.osgi.internal.hookregistry.HookConfigurator; -import org.eclipse.osgi.internal.hookregistry.HookRegistry; -import org.eclipse.osgi.internal.hookregistry.StorageHookFactory; -import org.eclipse.osgi.internal.hookregistry.StorageHookFactory.StorageHook; -import org.eclipse.osgi.internal.loader.BundleLoader; -import org.eclipse.osgi.internal.loader.ModuleClassLoader; -import org.eclipse.osgi.storage.BundleInfo.Generation; -import org.eclipse.osgi.storage.bundlefile.BundleFile; -import org.eclipse.osgi.storage.bundlefile.BundleFileWrapperChain; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.connect.ConnectContent; -import org.osgi.framework.connect.ConnectModule; -import org.osgi.framework.connect.ModuleConnector; -import org.osgi.framework.namespace.BundleNamespace; -import org.osgi.framework.namespace.HostNamespace; -import org.osgi.framework.namespace.IdentityNamespace; - -public class ConnectHookConfigurator implements HookConfigurator { - static final Collection<String> CONNECT_TAG_NAMESPACES = new ArrayList<>(Arrays.asList( - BundleNamespace.BUNDLE_NAMESPACE, HostNamespace.HOST_NAMESPACE, IdentityNamespace.IDENTITY_NAMESPACE)); - - @Override - public void addHooks(final HookRegistry hookRegistry) { - final ConnectModules connectModules = hookRegistry.getContainer().getConnectModules(); - ModuleConnector moduleConnector = connectModules.getModuleConnector(); - - hookRegistry.addStorageHookFactory(new StorageHookFactory<Object, Object, StorageHook<Object, Object>>() { - @Override - protected StorageHook<Object, Object> createStorageHook(Generation generation) { - final ConnectModule m = connectModules.getConnectModule(generation.getBundleInfo().getLocation()); - - return new StorageHook<Object, Object>(generation, this.getClass()) { - boolean hasModule = false; - - @Override - public void save(Object saveContext, DataOutputStream os) throws IOException { - os.writeBoolean(m != null); - } - - @Override - public void load(Object loadContext, DataInputStream is) throws IOException { - hasModule = is.readBoolean(); - } - - @Override - public void validate() throws IllegalStateException { - // make sure we have the module still from the factory - if (hasModule && m == null) { - throw new IllegalStateException("Connect Factory no longer has the module at locataion: " + generation.getBundleInfo().getLocation()); //$NON-NLS-1$ - } - } - - @Override - public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder) { - if (m != null) { - builder.getCapabilities() - .stream() // - .filter(c -> CONNECT_TAG_NAMESPACES.contains(c.getNamespace())) // - .forEach((c) -> { - c.getAttributes().compute(IdentityNamespace.CAPABILITY_TAGS_ATTRIBUTE, (k, v) -> { - if (v == null) { - return Collections.singletonList(ConnectContent.TAG_OSGI_CONNECT); - } - if (v instanceof List) { - @SuppressWarnings({"unchecked", "rawtypes"}) - List<String> l = new ArrayList<>((List) v); - l.add(ConnectContent.TAG_OSGI_CONNECT); - return Collections.unmodifiableList(l); - } - // should not get here, but just recover - return Arrays.asList(v, ConnectContent.TAG_OSGI_CONNECT); - }); - }); - return builder; - } - return null; - } - }; - } - - @Override - public URLConnection handleContentConnection(Module module, String location, InputStream in) { - if (in != null) { - // Do not call ModuleConnector method connect when input stream is non null. - return null; - } - if (location == null) { - location = module.getLocation(); - } - try { - ConnectModule m = connectModules.connect(location); - if (m != null) { - return ConnectInputStream.URL_CONNECTION_INSTANCE; - } - } catch (IllegalStateException e) { - if (e.getCause() instanceof BundleException) { - sneakyThrow(e.getCause()); - } - } - return null; - } - }); - - if (moduleConnector == null) { - return; - } - - hookRegistry.addClassLoaderHook(new ClassLoaderHook() { - @Override - public ModuleClassLoader createClassLoader(ClassLoader parent, EquinoxConfiguration configuration, BundleLoader delegate, Generation generation) { - ConnectModule m = connectModules.getConnectModule(generation.getBundleInfo().getLocation()); - if (m != null) { - BundleFile bundlefile = generation.getBundleFile(); - if (bundlefile instanceof BundleFileWrapperChain) { - BundleFileWrapperChain chain = (BundleFileWrapperChain) bundlefile; - while (chain.getNext() != null) { - chain = chain.getNext(); - } - bundlefile = chain.getBundleFile(); - } - if (bundlefile instanceof ConnectBundleFile) { - return ((ConnectBundleFile) bundlefile).getClassLoader().map((l) // - -> new DelegatingConnectClassLoader(parent, configuration, delegate, generation, l)).orElse(null); - } - } - return null; - } - }); - - hookRegistry.addActivatorHookFactory(new ActivatorHookFactory() { - - @Override - public BundleActivator createActivator() { - final List<BundleActivator> activators = new ArrayList<>(); - moduleConnector.createBundleActivator().ifPresent((a) -> activators.add(a)); - return new BundleActivator() { - @Override - public void start(BundleContext context) throws Exception { - for (BundleActivator activator : activators) { - activator.start(context); - } - } - - @Override - public void stop(BundleContext context) throws Exception { - for (BundleActivator activator : activators) { - activator.stop(context); - } - } - }; - } - }); - } -} diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectInputStream.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectInputStream.java deleted file mode 100644 index 1d5ed6992..000000000 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/ConnectInputStream.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.internal.connect; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLConnection; -import org.eclipse.osgi.storage.ContentProvider; - -public class ConnectInputStream extends InputStream implements ContentProvider { - static final ConnectInputStream INSTANCE = new ConnectInputStream(); - static final URLConnection URL_CONNECTION_INSTANCE = new URLConnection(null) { - @Override - public void connect() throws IOException { - connected = true; - } - - @Override - public InputStream getInputStream() throws IOException { - return INSTANCE; - } - }; - - private ConnectInputStream() { - } - - /* This method should not be called. - */ - @Override - public int read() throws IOException { - throw new IOException(); - } - - public File getContent() { - return null; - } - - @Override - public Type getType() { - return Type.CONNECT; - } - -} diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/DelegatingConnectClassLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/DelegatingConnectClassLoader.java deleted file mode 100644 index d9e1cf522..000000000 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/DelegatingConnectClassLoader.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.internal.connect; - -import java.io.IOException; -import java.net.URL; -import java.util.Collections; -import java.util.Enumeration; -import org.eclipse.osgi.internal.framework.EquinoxConfiguration; -import org.eclipse.osgi.internal.loader.BundleLoader; -import org.eclipse.osgi.internal.loader.EquinoxClassLoader; -import org.eclipse.osgi.storage.BundleInfo.Generation; - -public class DelegatingConnectClassLoader extends EquinoxClassLoader { - static { - try { - ClassLoader.registerAsParallelCapable(); - } catch (Throwable t) { - // ignore any error - } - } - private final ClassLoader connectClassLoader; - - public DelegatingConnectClassLoader(ClassLoader parent, EquinoxConfiguration configuration, BundleLoader delegate, Generation generation, ClassLoader connectClassLoader) { - super(parent, configuration, delegate, generation); - this.connectClassLoader = connectClassLoader; - } - - @Override - public Class<?> findLocalClass(String classname) throws ClassNotFoundException { - if (connectClassLoader == null) { - throw new ClassNotFoundException(); - } - return connectClassLoader.loadClass(classname); - } - - @Override - public URL findLocalResource(String resource) { - if (connectClassLoader == null) { - return null; - } - return connectClassLoader.getResource(resource); - } - - @Override - public Enumeration<URL> findLocalResources(String resource) { - if (connectClassLoader == null) { - return Collections.enumeration(Collections.<URL> emptyList()); - } - try { - return connectClassLoader.getResources(resource); - } catch (IOException e) { - return Collections.enumeration(Collections.<URL> emptyList()); - } - } -} diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java index 2a7eb1932..29b20c0bd 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java @@ -15,8 +15,10 @@ package org.eclipse.osgi.internal.framework; import java.io.File; +import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; +import java.net.URLConnection; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; @@ -180,9 +182,14 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object, @Override public Bundle installBundle(String location, InputStream in) throws BundleException { checkValid(); + try { + URLConnection content = container.getStorage().getContentConnection(null, location, in); + Generation generation = container.getStorage().install(bundle.getModule(), location, content); + return generation.getRevision().getBundle(); + } catch (IOException e) { + throw new BundleException("Error reading bundle content.", e); //$NON-NLS-1$ + } - Generation generation = container.getStorage().install(bundle.getModule(), location, in); - return generation.getRevision().getBundle(); } /** diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java index 86ee2d0b1..96074297f 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java @@ -15,44 +15,17 @@ package org.eclipse.osgi.internal.framework; import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; +import java.util.*; import org.osgi.dto.DTO; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.Version; -import org.osgi.framework.dto.BundleDTO; -import org.osgi.framework.dto.FrameworkDTO; -import org.osgi.framework.dto.ServiceReferenceDTO; +import org.osgi.framework.*; +import org.osgi.framework.dto.*; import org.osgi.framework.startlevel.BundleStartLevel; import org.osgi.framework.startlevel.FrameworkStartLevel; import org.osgi.framework.startlevel.dto.BundleStartLevelDTO; import org.osgi.framework.startlevel.dto.FrameworkStartLevelDTO; -import org.osgi.framework.wiring.BundleCapability; -import org.osgi.framework.wiring.BundleRequirement; -import org.osgi.framework.wiring.BundleRevision; -import org.osgi.framework.wiring.BundleRevisions; -import org.osgi.framework.wiring.BundleWire; -import org.osgi.framework.wiring.BundleWiring; -import org.osgi.framework.wiring.dto.BundleRevisionDTO; -import org.osgi.framework.wiring.dto.BundleWireDTO; -import org.osgi.framework.wiring.dto.BundleWiringDTO; -import org.osgi.framework.wiring.dto.FrameworkWiringDTO; -import org.osgi.resource.dto.CapabilityDTO; -import org.osgi.resource.dto.CapabilityRefDTO; -import org.osgi.resource.dto.RequirementDTO; -import org.osgi.resource.dto.RequirementRefDTO; -import org.osgi.resource.dto.WireDTO; +import org.osgi.framework.wiring.*; +import org.osgi.framework.wiring.dto.*; +import org.osgi.resource.dto.*; public class DTOBuilder { private final Map<BundleRevision, BundleRevisionDTO> resources; @@ -345,7 +318,7 @@ public class DTOBuilder { size = references == null ? 0 : references.length; List<ServiceReferenceDTO> refDTOs = newList(size); for (int i = 0; i < size; i++) { - ServiceReferenceDTO serviceRefDTO = newServiceReferenceDTO(references[i]); + ServiceReferenceDTO serviceRefDTO = getServiceReferenceDTO(references[i]); if (serviceRefDTO != null) { refDTOs.add(serviceRefDTO); } @@ -362,12 +335,17 @@ public class DTOBuilder { return (Map<String, Object>) m; } - public static ServiceReferenceDTO newServiceReferenceDTO(ServiceReference<?> ref) { + private static ServiceReferenceDTO getServiceReferenceDTO(ServiceReference<?> ref) { if (ref == null) { return null; } - + Bundle b = ref.getBundle(); + if (b == null) { + // service has been unregistered + return null; + } ServiceReferenceDTO dto = new ServiceReferenceDTO(); + dto.bundle = b.getBundleId(); String[] keys = ref.getPropertyKeys(); Map<String, Object> properties = newMap(keys.length); for (String k : keys) { @@ -375,9 +353,6 @@ public class DTOBuilder { if (Constants.SERVICE_ID.equals(k)) { dto.id = ((Long) v).longValue(); } - if (Constants.SERVICE_BUNDLEID.equals(k)) { - dto.bundle = ((Long) v).longValue(); - } properties.put(k, mapValue(v)); } dto.properties = properties; @@ -408,7 +383,7 @@ public class DTOBuilder { final int length = references.length; List<ServiceReferenceDTO> refDTOs = new ArrayList<>(length); for (int i = 0; i < length; i++) { - ServiceReferenceDTO dto = newServiceReferenceDTO(references[i]); + ServiceReferenceDTO dto = getServiceReferenceDTO(references[i]); if (dto != null) { refDTOs.add(dto); } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java index 6076f6049..684d80509 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java @@ -480,9 +480,13 @@ public class EquinoxBundle implements Bundle, BundleReference { @Override public void update(InputStream input) throws BundleException { - Storage storage = equinoxContainer.getStorage(); - storage.update(module, input); - signerInfos = null; + try { + Storage storage = equinoxContainer.getStorage(); + storage.update(module, storage.getContentConnection(module, null, input)); + signerInfos = null; + } catch (IOException e) { + throw new BundleException("Error reading bundle content.", e); //$NON-NLS-1$ + } } @Override @@ -967,7 +971,7 @@ public class EquinoxBundle implements Bundle, BundleReference { } /** - * Check for permission to adapt. + * Check for permission to get a service. */ private <A> void checkAdaptPermission(Class<A> adapterType) { SecurityManager sm = System.getSecurityManager(); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java index 04f680981..af1b7d0d6 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java @@ -13,29 +13,20 @@ *******************************************************************************/ package org.eclipse.osgi.internal.framework; -import java.io.File; import java.io.IOException; -import java.lang.ref.WeakReference; import java.lang.reflect.Method; -import java.net.URL; import java.security.AccessController; import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import org.eclipse.osgi.framework.eventmgr.ListenerQueue; import org.eclipse.osgi.framework.log.FrameworkLogEntry; import org.eclipse.osgi.framework.util.SecureAction; -import org.eclipse.osgi.internal.connect.ConnectBundleFile; -import org.eclipse.osgi.internal.debug.Debug; import org.eclipse.osgi.internal.framework.legacy.PackageAdminImpl; import org.eclipse.osgi.internal.framework.legacy.StartLevelImpl; import org.eclipse.osgi.internal.hookregistry.ClassLoaderHook; @@ -45,9 +36,7 @@ import org.eclipse.osgi.internal.log.EquinoxLogServices; import org.eclipse.osgi.internal.messages.Msg; import org.eclipse.osgi.internal.serviceregistry.ServiceRegistry; import org.eclipse.osgi.signedcontent.SignedContentFactory; -import org.eclipse.osgi.storage.BundleInfo; import org.eclipse.osgi.storage.Storage; -import org.eclipse.osgi.storage.bundlefile.MRUBundleFileList; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.osgi.util.NLS; import org.osgi.framework.AdminPermission; @@ -55,9 +44,6 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; -import org.osgi.framework.connect.ConnectContent; -import org.osgi.framework.connect.ConnectModule; -import org.osgi.framework.connect.ModuleConnector; import org.osgi.service.packageadmin.PackageAdmin; import org.osgi.service.startlevel.StartLevel; import org.osgi.util.tracker.ServiceTracker; @@ -67,7 +53,6 @@ public class EquinoxContainer implements ThreadFactory, Runnable { public static final String NAME = "org.eclipse.osgi"; //$NON-NLS-1$ static final SecureAction secureAction = AccessController.doPrivileged(SecureAction.createSecureAction()); - private final ConnectModules connectModules; private final EquinoxConfiguration equinoxConfig; private final EquinoxLogServices logServices; private final Storage storage; @@ -90,7 +75,7 @@ public class EquinoxContainer implements ThreadFactory, Runnable { private ScheduledExecutorService executor; private StorageSaver storageSaver; - public EquinoxContainer(Map<String, ?> configuration, ModuleConnector moduleConnector) { + public EquinoxContainer(Map<String, ?> configuration) { ClassLoader platformClassLoader = null; try { Method getPlatformClassLoader = ClassLoader.class.getMethod("getPlatformClassLoader"); //$NON-NLS-1$ @@ -104,10 +89,6 @@ public class EquinoxContainer implements ThreadFactory, Runnable { this.equinoxConfig = new EquinoxConfiguration(configuration, new HookRegistry(this)); this.logServices = new EquinoxLogServices(this.equinoxConfig); this.equinoxConfig.logMessages(this.logServices); - this.connectModules = new ConnectModules(moduleConnector); - - initConnectFramework(moduleConnector, this.equinoxConfig); - this.equinoxConfig.getHookRegistry().initialize(); try { this.storage = Storage.createStorage(this); @@ -152,17 +133,6 @@ public class EquinoxContainer implements ThreadFactory, Runnable { isProcessClassRecursionSupportedByAll = supportRecursion; } - private static void initConnectFramework(ModuleConnector moduleConnector, EquinoxConfiguration equinoxConfig) { - if (moduleConnector == null) { - return; - } - URL configUrl = equinoxConfig.getEquinoxLocations().getConfigurationLocation().getURL(); - final File fwkStore = new File(configUrl.getPath()); - @SuppressWarnings({"rawtypes", "unchecked"}) - Map<String, String> config = (Map) equinoxConfig.getInitialConfig(); - moduleConnector.initialize(fwkStore, Collections.unmodifiableMap(config)); - } - public Storage getStorage() { return storage; } @@ -361,62 +331,4 @@ public class EquinoxContainer implements ThreadFactory, Runnable { public ClassLoader getBootLoader() { return bootLoader; } - - public ConnectModules getConnectModules() { - return connectModules; - } - - public static class ConnectModules { - final ModuleConnector moduleConnector; - private final ConcurrentMap<String, ConnectModule> connectModules = new ConcurrentHashMap<>(); - private final WeakHashMap<ConnectContent, WeakReference<ConnectBundleFile>> contents = new WeakHashMap<>(); - - public ConnectModules(ModuleConnector moduleConnector) { - this.moduleConnector = moduleConnector; - } - - public ConnectModule connect(String location) { - if (moduleConnector == null) { - return null; - } - ConnectModule result = connectModules.compute(location, (k, v) -> { - try { - return moduleConnector.connect(location).orElse(null); - } catch (BundleException e) { - throw new IllegalStateException(e); - } - }); - return result; - } - - public ConnectBundleFile getConnectBundleFile(ConnectModule module, File basefile, - BundleInfo.Generation generation, MRUBundleFileList mruList, Debug debug) throws IOException { - ConnectContent content = module.getContent(); - synchronized (contents) { - WeakReference<ConnectBundleFile> ref = contents.get(content); - if (ref != null) { - ConnectBundleFile bundleFile = ref.get(); - if (bundleFile != null) { - return bundleFile; - } - } - ConnectBundleFile bundleFile = new ConnectBundleFile(module, basefile, generation, mruList, debug); - contents.put(content, new WeakReference<>(bundleFile)); - return bundleFile; - } - } - - public ModuleConnector getModuleConnector() { - return moduleConnector; - } - - public ConnectModule getConnectModule(String location) { - return connectModules.get(location); - } - } - - @SuppressWarnings("unchecked") - public static <E extends Throwable> void sneakyThrow(Throwable e) throws E { - throw (E) e; - } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/FrameworkUtilHelper.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/FrameworkUtilHelper.java new file mode 100644 index 000000000..5bfb4e3c2 --- /dev/null +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/FrameworkUtilHelper.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.osgi.internal.hookregistry; + +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; + +/** + * The helper provides alternative implementations for methods in the + * {@link FrameworkUtil} class. While this is not a hook, it is possible + * for framework fragments to provide a META-INF/services configuration + * to allow their own implementation to be loaded by the {@link FrameworkUtil} + * class. + */ +public class FrameworkUtilHelper { + /** + * See {@link FrameworkUtil#getBundle(Class)} + * @param classFromBundle a class defined by a bundle class loader. + * @return A Bundle for the specified bundle class or null if the + * specified class was not defined by a bundle class loader. + */ + public Bundle getBundle(Class<?> classFromBundle) { + return null; + } +} diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java index 5990f4ced..552438ada 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java @@ -24,7 +24,6 @@ import java.util.List; import java.util.Properties; import org.eclipse.osgi.framework.log.FrameworkLogEntry; import org.eclipse.osgi.internal.cds.CDSHookConfigurator; -import org.eclipse.osgi.internal.connect.ConnectHookConfigurator; import org.eclipse.osgi.internal.framework.EquinoxConfiguration; import org.eclipse.osgi.internal.framework.EquinoxContainer; import org.eclipse.osgi.internal.hooks.DevClassLoadingHook; @@ -107,8 +106,6 @@ public final class HookRegistry { List<FrameworkLogEntry> errors = new ArrayList<>(0); // optimistic that no errors will occur mergeFileHookConfigurators(configurators, errors); mergePropertyHookConfigurators(configurators); - // make sure to add connect configurator first always - configurators.add(0, ConnectHookConfigurator.class.getName()); synchronized (this) { addClassLoaderHook(new DevClassLoadingHook(container.getConfiguration())); addClassLoaderHook(new EclipseLazyStarter(container)); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevClassLoadingHook.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevClassLoadingHook.java index 8d26f1fb8..8a4eb82a9 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevClassLoadingHook.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/DevClassLoadingHook.java @@ -19,11 +19,8 @@ import java.util.ArrayList; import org.eclipse.osgi.framework.util.KeyedElement; import org.eclipse.osgi.internal.framework.EquinoxConfiguration; import org.eclipse.osgi.internal.hookregistry.ClassLoaderHook; -import org.eclipse.osgi.internal.loader.classpath.ClasspathEntry; -import org.eclipse.osgi.internal.loader.classpath.ClasspathManager; -import org.eclipse.osgi.internal.loader.classpath.FragmentClasspath; +import org.eclipse.osgi.internal.loader.classpath.*; import org.eclipse.osgi.storage.BundleInfo.Generation; -import org.eclipse.osgi.storage.ContentProvider.Type; import org.eclipse.osgi.storage.bundlefile.BundleFile; public class DevClassLoadingHook extends ClassLoaderHook implements KeyedElement { @@ -39,10 +36,6 @@ public class DevClassLoadingHook extends ClassLoaderHook implements KeyedElement @Override public boolean addClassPathEntry(ArrayList<ClasspathEntry> cpEntries, String cp, ClasspathManager hostmanager, Generation sourceGeneration) { - // if this is a connect bundle just ignore - if (sourceGeneration.getContentType() == Type.CONNECT) { - return false; - } // first check that we are in devmode for this sourcedata String[] devClassPaths = !configuration.inDevelopmentMode() ? null : configuration.getDevClassPath(sourceGeneration.getRevision().getSymbolicName()); if (devClassPaths == null || devClassPaths.length == 0) diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java index 9beea76de..3cafc1623 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java @@ -15,14 +15,7 @@ package org.eclipse.osgi.internal.serviceregistry; import java.util.Dictionary; -import org.eclipse.osgi.internal.framework.DTOBuilder; -import org.osgi.framework.AdaptPermission; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; -import org.osgi.framework.dto.ServiceReferenceDTO; +import org.osgi.framework.*; /** * A reference to a service. @@ -325,22 +318,4 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> { public Dictionary<String, Object> getProperties() { return registration.getPropertiesCopy(); } - - @SuppressWarnings("unchecked") - @Override - public <A> A adapt(Class<A> type) { - checkAdaptPermission(type); - if (ServiceReferenceDTO.class.equals(type)) { - return (A) DTOBuilder.newServiceReferenceDTO(this); - } - return null; - } - - private <A> void checkAdaptPermission(Class<A> adapterType) { - SecurityManager sm = System.getSecurityManager(); - if (sm == null) { - return; - } - sm.checkPermission(new AdaptPermission(adapterType.getName(), registration.getRegisteringBundle(), AdaptPermission.ADAPT)); - } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java index bef43d0db..defe49a31 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java @@ -105,7 +105,7 @@ public class SignatureBlockProcessor implements SignedContentConstants { // Step 1, verify the .SF file is signed by the private key that corresponds to the public key // in the .RSA/.DSA file - String baseFile = String.valueOf(bf.getBaseFile()); + String baseFile = bf.getBaseFile() != null ? bf.getBaseFile().toString() : null; PKCS7Processor processor = new PKCS7Processor(pkcs7Bytes, 0, pkcs7Bytes.length, signer, baseFile); // call the Step 1 in the Jar File Verification algorithm processor.verifySFSignature(sfBytes, 0, sfBytes.length); @@ -169,7 +169,7 @@ public class SignatureBlockProcessor implements SignedContentConstants { // check if the the computed digest value of manifest file equals to the digest value in the .sf file if (!digestValue.equals(manifestDigest)) { - SignatureException se = new SignatureException(NLS.bind(SignedContentMessages.Security_File_Is_Tampered, new String[] {String.valueOf(signedBundle.getBaseFile())})); + SignatureException se = new SignatureException(NLS.bind(SignedContentMessages.Security_File_Is_Tampered, new String[] {signedBundle.getBaseFile().toString()})); signedBundleHook.log(se.getMessage(), FrameworkLogEntry.ERROR, se); throw se; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleFile.java index 5f3cf84c7..7e9d88cea 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleFile.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleFile.java @@ -17,20 +17,11 @@ package org.eclipse.osgi.internal.signedcontent; import java.io.IOException; import java.io.InputStream; import java.net.URL; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.SignatureException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateExpiredException; -import java.security.cert.CertificateNotYetValidException; +import java.security.*; +import java.security.cert.*; import java.util.Date; -import org.eclipse.osgi.signedcontent.SignedContent; -import org.eclipse.osgi.signedcontent.SignedContentEntry; -import org.eclipse.osgi.signedcontent.SignerInfo; -import org.eclipse.osgi.storage.bundlefile.BundleEntry; -import org.eclipse.osgi.storage.bundlefile.BundleFile; -import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper; +import org.eclipse.osgi.signedcontent.*; +import org.eclipse.osgi.storage.bundlefile.*; import org.eclipse.osgi.util.NLS; /** @@ -82,7 +73,7 @@ public class SignedBundleFile extends BundleFileWrapper implements SignedContent // double check that no signer thinks it should exist SignedContentEntry signedEntry = signedContent.getSignedEntry(path); if (signedEntry != null) - throw new SecurityException(NLS.bind(SignedContentMessages.file_is_removed_from_jar, path, String.valueOf(getBaseFile()))); + throw new SecurityException(NLS.bind(SignedContentMessages.file_is_removed_from_jar, path, getBaseFile().toString())); return null; } return new SignedBundleEntry(be); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java index f8acc8de8..5b741d06d 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java @@ -196,7 +196,7 @@ public class SignedContentImpl implements SignedContent { exception = e; } if (entry == null) - throw new InvalidContentException(NLS.bind(SignedContentMessages.file_is_removed_from_jar, entryName, String.valueOf(currentContent.getBaseFile())), exception); + throw new InvalidContentException(NLS.bind(SignedContentMessages.file_is_removed_from_jar, entryName, currentContent.getBaseFile().toString()), exception); if (entry.getSize() > VERIFY_LIMIT) { try (InputStream in = entry.getInputStream()) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/Equinox.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/Equinox.java index 901df375a..049334f98 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/Equinox.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/Equinox.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2020 IBM Corporation and others. + * Copyright (c) 2008, 2013 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,24 +13,12 @@ *******************************************************************************/ package org.eclipse.osgi.launch; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.net.URL; import java.security.cert.X509Certificate; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; +import java.util.*; import org.eclipse.osgi.internal.framework.EquinoxContainer; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.FrameworkEvent; -import org.osgi.framework.FrameworkListener; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.Version; -import org.osgi.framework.connect.ModuleConnector; +import org.osgi.framework.*; import org.osgi.framework.launch.Framework; /** @@ -43,14 +31,7 @@ public class Equinox implements Framework { private final Framework systemBundle; public Equinox(Map<String, ?> configuration) { - this(configuration, null); - } - - /** - * @since 3.16 - */ - public Equinox(Map<String, ?> configuration, ModuleConnector moduleConnector) { - EquinoxContainer container = new EquinoxContainer(configuration, moduleConnector); + EquinoxContainer container = new EquinoxContainer(configuration); systemBundle = (Framework) container.getStorage().getModuleContainer().getModule(0).getBundle(); } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/EquinoxFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/EquinoxFactory.java index fd1ad8a5d..17d9c041f 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/EquinoxFactory.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/launch/EquinoxFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2020 IBM Corporation and others. + * Copyright (c) 2009, 2012 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,8 +14,6 @@ package org.eclipse.osgi.launch; import java.util.Map; -import org.osgi.framework.connect.ConnectFrameworkFactory; -import org.osgi.framework.connect.ModuleConnector; import org.osgi.framework.launch.Framework; import org.osgi.framework.launch.FrameworkFactory; @@ -23,15 +21,11 @@ import org.osgi.framework.launch.FrameworkFactory; * The framework factory implementation for the Equinox framework. * @since 3.5 */ -public class EquinoxFactory implements FrameworkFactory, ConnectFrameworkFactory { +public class EquinoxFactory implements FrameworkFactory { @Override public Framework newFramework(Map<String, String> configuration) { - return newFramework(configuration, null); + return new Equinox(configuration); } - @Override - public Framework newFramework(Map<String, String> configuration, ModuleConnector moduleConnector) { - return new Equinox(configuration, moduleConnector); - } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java index ce2b51ce6..3a3014837 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java @@ -38,7 +38,6 @@ import org.eclipse.osgi.container.ModuleRevisionBuilder; import org.eclipse.osgi.framework.log.FrameworkLogEntry; import org.eclipse.osgi.framework.util.CaseInsensitiveDictionaryMap; import org.eclipse.osgi.framework.util.ThreadInfoReport; -import org.eclipse.osgi.internal.connect.ConnectBundleFile; import org.eclipse.osgi.internal.container.LockSet; import org.eclipse.osgi.internal.debug.Debug; import org.eclipse.osgi.internal.framework.EquinoxConfiguration; @@ -46,18 +45,15 @@ import org.eclipse.osgi.internal.framework.EquinoxContainer; import org.eclipse.osgi.internal.hookregistry.StorageHookFactory; import org.eclipse.osgi.internal.hookregistry.StorageHookFactory.StorageHook; import org.eclipse.osgi.internal.messages.Msg; -import org.eclipse.osgi.storage.ContentProvider.Type; import org.eclipse.osgi.storage.Storage.StorageException; import org.eclipse.osgi.storage.bundlefile.BundleEntry; import org.eclipse.osgi.storage.bundlefile.BundleFile; -import org.eclipse.osgi.storage.bundlefile.BundleFileWrapperChain; import org.eclipse.osgi.storage.url.BundleResourceHandler; import org.eclipse.osgi.storage.url.bundleentry.Handler; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.osgi.util.NLS; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; -import org.osgi.framework.connect.ConnectModule; public final class BundleInfo { public static final String OSGI_BUNDLE_MANIFEST = "META-INF/MANIFEST.MF"; //$NON-NLS-1$ @@ -71,6 +67,7 @@ public final class BundleInfo { private final Dictionary<String, String> cachedHeaders; private File content; private boolean isDirectory; + private boolean isReference; private boolean hasPackageInfo; private BundleFile bundleFile; private Map<String, String> rawHeaders; @@ -81,18 +78,17 @@ public final class BundleInfo { private List<StorageHook<?, ?>> storageHooks; private long lastModified; private boolean isMRJar; - private Type contentType; Generation(long generationId) { this.generationId = generationId; this.cachedHeaders = new CachedManifest(this, Collections.<String, String> emptyMap()); } - Generation(long generationId, File content, boolean isDirectory, Type contentType, boolean hasPackageInfo, Map<String, String> cached, long lastModified, boolean isMRJar) { + Generation(long generationId, File content, boolean isDirectory, boolean isReference, boolean hasPackageInfo, Map<String, String> cached, long lastModified, boolean isMRJar) { this.generationId = generationId; this.content = content; this.isDirectory = isDirectory; - this.contentType = contentType; + this.isReference = isReference; this.hasPackageInfo = hasPackageInfo; this.cachedHeaders = new CachedManifest(this, cached); this.lastModified = lastModified; @@ -102,7 +98,7 @@ public final class BundleInfo { public BundleFile getBundleFile() { synchronized (genMonitor) { if (bundleFile == null) { - if (getBundleId() == 0 && content == null && contentType != Type.CONNECT) { + if (getBundleId() == 0 && content == null) { bundleFile = new SystemBundleFile(); } else { bundleFile = getStorage().createBundleFile(content, this, isDirectory, true); @@ -131,20 +127,7 @@ public final class BundleInfo { Map<String, String> getRawHeaders() { synchronized (genMonitor) { if (rawHeaders == null) { - BundleFile bFile = getBundleFile(); - - if (this.contentType == Type.CONNECT) { - ConnectBundleFile connectContent = bFile instanceof BundleFileWrapperChain ? // - ((BundleFileWrapperChain) bFile).getWrappedType(ConnectBundleFile.class) : // - (ConnectBundleFile) bFile; - - Map<String, String> connectHeaders = connectContent.getConnectHeaders(); - if (connectHeaders != null) { - return rawHeaders = connectHeaders; - } - } - - BundleEntry manifest = bFile.getEntry(OSGI_BUNDLE_MANIFEST); + BundleEntry manifest = getBundleFile().getEntry(OSGI_BUNDLE_MANIFEST); if (manifest == null) { rawHeaders = Collections.emptyMap(); } else { @@ -228,6 +211,12 @@ public final class BundleInfo { } } + public boolean isReference() { + synchronized (this.genMonitor) { + return this.isReference; + } + } + public boolean hasPackageInfo() { synchronized (this.genMonitor) { return this.hasPackageInfo; @@ -246,25 +235,11 @@ public final class BundleInfo { } } - public Type getContentType() { - synchronized (this.genMonitor) { - return this.contentType; - } - } - - void setContent(File content, Type contentType) { - if (getBundleId() == 0) { - // check connect for content first - ConnectModule connected = getStorage().getEquinoxContainer().getConnectModules().connect(getLocation()); - if (connected != null) { - content = null; - contentType = Type.CONNECT; - } - } + void setContent(File content, boolean isReference) { synchronized (this.genMonitor) { this.content = content; this.isDirectory = content == null ? false : Storage.secureAction.isDirectory(content); - this.contentType = contentType; + this.isReference = isReference; setLastModified(content); } } @@ -513,9 +488,9 @@ public final class BundleInfo { } } - Generation restoreGeneration(long generationId, File content, boolean isDirectory, Type contentType, boolean hasPackageInfo, Map<String, String> cached, long lastModified, boolean isMRJar) { + Generation restoreGeneration(long generationId, File content, boolean isDirectory, boolean isReference, boolean hasPackageInfo, Map<String, String> cached, long lastModified, boolean isMRJar) { synchronized (this.infoMonitor) { - Generation restoredGeneration = new Generation(generationId, content, isDirectory, contentType, hasPackageInfo, cached, lastModified, isMRJar); + Generation restoredGeneration = new Generation(generationId, content, isDirectory, isReference, hasPackageInfo, cached, lastModified, isMRJar); return restoredGeneration; } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ContentProvider.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ContentProvider.java deleted file mode 100644 index 50f3f34b3..000000000 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ContentProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.osgi.storage; - -import java.io.File; -import org.osgi.framework.BundleException; - -/** - * A content provider is a marker interface that is used - * but the framework internally to handle different kinds of - * bundles. For example, reference installed bundles or - * connect bundles. The type of the provider indicates - * how the framework will handle the install or update - * of the bundle content. - */ -public interface ContentProvider { - - /** - * The type of the provided content - */ - public enum Type { - REFERENCE, CONNECT, DEFAULT; - } - - /** - * A file of the content, may be {@code null} - * @return the file, may be {@code null} - * @throws BundleException - */ - File getContent() throws BundleException; - - /** - * The type of content - * @return the type of content - */ - Type getType(); -} diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java index ec4bf9b2a..bcc1da392 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java @@ -39,7 +39,6 @@ import org.eclipse.osgi.internal.hookregistry.HookRegistry; import org.eclipse.osgi.internal.messages.Msg; import org.eclipse.osgi.internal.url.MultiplexingFactory; import org.eclipse.osgi.storage.BundleInfo.Generation; -import org.eclipse.osgi.storage.ContentProvider.Type; import org.eclipse.osgi.util.NLS; import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; @@ -182,11 +181,6 @@ public class FrameworkExtensionInstaller { * @return a list of classpath files for an extension bundle */ private File[] getExtensionFiles(ModuleRevision revision) { - Generation generation = (Generation) revision.getRevisionInfo(); - if (generation.getContentType() == Type.CONNECT) { - // Don't do anything for connect bundles - return new File[0]; - } List<ModuleCapability> metaDatas = revision.getModuleCapabilities(EquinoxModuleDataNamespace.MODULE_DATA_NAMESPACE); @SuppressWarnings("unchecked") List<String> paths = metaDatas.isEmpty() ? null : (List<String>) metaDatas.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_CLASSPATH); @@ -244,9 +238,7 @@ public class FrameworkExtensionInstaller { current = new ArrayMap<>(hookActivators.getKeys(), hookActivators.getValues()); hookActivators.clear(); } - // indexing into the current collection the hard way to reverse de-activation - for (int i = current.getKeys().size() - 1; i >= 0; i--) { - BundleActivator activator = current.getKey(i); + for (BundleActivator activator : current) { try { activator.stop(context); } catch (Exception e) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java index 0671a94c9..f64df7d72 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java @@ -83,7 +83,6 @@ import org.eclipse.osgi.internal.permadmin.SecurityAdmin; import org.eclipse.osgi.internal.url.URLStreamHandlerFactoryImpl; import org.eclipse.osgi.service.datalocation.Location; import org.eclipse.osgi.storage.BundleInfo.Generation; -import org.eclipse.osgi.storage.ContentProvider.Type; import org.eclipse.osgi.storage.bundlefile.BundleEntry; import org.eclipse.osgi.storage.bundlefile.BundleFile; import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper; @@ -93,6 +92,7 @@ import org.eclipse.osgi.storage.bundlefile.MRUBundleFileList; import org.eclipse.osgi.storage.bundlefile.NestedDirBundleFile; import org.eclipse.osgi.storage.bundlefile.ZipBundleFile; import org.eclipse.osgi.storage.url.reference.Handler; +import org.eclipse.osgi.storage.url.reference.ReferenceInputStream; import org.eclipse.osgi.storagemanager.ManagedOutputStream; import org.eclipse.osgi.storagemanager.StorageManager; import org.eclipse.osgi.util.ManifestElement; @@ -104,7 +104,6 @@ import org.osgi.framework.Constants; import org.osgi.framework.Filter; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.Version; -import org.osgi.framework.connect.ConnectModule; import org.osgi.framework.namespace.HostNamespace; import org.osgi.framework.namespace.NativeNamespace; import org.osgi.framework.namespace.PackageNamespace; @@ -136,10 +135,9 @@ public class Storage { } - public static final int VERSION = 6; - private static final int CONTENT_TYPE_VERSION = 6; - private static final int CACHED_SYSTEM_CAPS_VERION = 5; + public static final int VERSION = 5; private static final int MR_JAR_VERSION = 4; + private static final int CACHED_SYSTEM_CAPS_VERION = 5; private static final int LOWEST_VERSION_SUPPORTED = 3; public static final String BUNDLE_DATA_DIR = "data"; //$NON-NLS-1$ public static final String BUNDLE_FILE_NAME = "bundleFile"; //$NON-NLS-1$ @@ -366,9 +364,6 @@ public class Storage { } } File content = generation.getContent(); - if (content == null) { - return false; - } if (getConfiguration().inCheckConfigurationMode()) { if (generation.isDirectory()) { content = new File(content, "META-INF/MANIFEST.MF"); //$NON-NLS-1$ @@ -391,7 +386,7 @@ public class Storage { newGeneration = info.createGeneration(); File contentFile = getSystemContent(); - newGeneration.setContent(contentFile, Type.DEFAULT); + newGeneration.setContent(contentFile, false); // First we must make sure the VM profile has been loaded loadVMProfile(newGeneration); @@ -417,7 +412,7 @@ public class Storage { File contentFile = currentGeneration.getContent(); if (systemNeedsUpdate(contentFile, currentRevision, currentGeneration, extraCapabilities, extraExports, cachedInfo)) { newGeneration = currentGeneration.getBundleInfo().createGeneration(); - newGeneration.setContent(contentFile, Type.DEFAULT); + newGeneration.setContent(contentFile, false); ModuleRevisionBuilder newBuilder = getBuilder(newGeneration, extraCapabilities, extraExports); moduleContainer.update(systemModule, newBuilder, newGeneration); moduleContainer.refresh(Collections.singleton(systemModule)); @@ -570,47 +565,41 @@ public class Storage { return osgiLocation.isReadOnly(); } - public URLConnection getContentConnection(Module module, String bundleLocation, final InputStream in) - throws BundleException { - try { - List<StorageHookFactory<?, ?, ?>> storageHooks = getConfiguration().getHookRegistry() - .getStorageHookFactories(); - for (StorageHookFactory<?, ?, ?> storageHook : storageHooks) { - URLConnection hookContent = storageHook.handleContentConnection(module, bundleLocation, in); - if (hookContent != null) { - return hookContent; - } + public URLConnection getContentConnection(Module module, String bundleLocation, final InputStream in) throws IOException { + List<StorageHookFactory<?, ?, ?>> storageHooks = getConfiguration().getHookRegistry().getStorageHookFactories(); + for (StorageHookFactory<?, ?, ?> storageHook : storageHooks) { + URLConnection hookContent = storageHook.handleContentConnection(module, bundleLocation, in); + if (hookContent != null) { + return hookContent; } + } - if (in != null) { - return new URLConnection(null) { - /** - * @throws IOException - */ - @Override - public void connect() throws IOException { - connected = true; - } + if (in != null) { + return new URLConnection(null) { + /** + * @throws IOException + */ + @Override + public void connect() throws IOException { + connected = true; + } - /** - * @throws IOException - */ - @Override - public InputStream getInputStream() throws IOException { - return (in); - } - }; - } - if (module == null) { - if (bundleLocation == null) { - throw new IllegalArgumentException("Module and location cannot be null"); //$NON-NLS-1$ + /** + * @throws IOException + */ + @Override + public InputStream getInputStream() throws IOException { + return (in); } - return getContentConnection(bundleLocation); + }; + } + if (module == null) { + if (bundleLocation == null) { + throw new IllegalArgumentException("Module and location cannot be null"); //$NON-NLS-1$ } - return getContentConnection(getUpdateLocation(module)); - } catch (IOException e) { - throw new BundleException("Error reading bundle content.", e); //$NON-NLS-1$ + return getContentConnection(bundleLocation); } + return getContentConnection(getUpdateLocation(module)); } private String getUpdateLocation(final Module module) { @@ -662,8 +651,7 @@ public class Storage { return new URL(spec); } - public Generation install(Module origin, String bundleLocation, InputStream toInstall) throws BundleException { - URLConnection content = getContentConnection(null, bundleLocation, toInstall); + public Generation install(Module origin, String bundleLocation, URLConnection content) throws BundleException { if (osgiLocation.isReadOnly()) { throw new BundleException("The framework storage area is read only.", BundleException.INVALID_OPERATION); //$NON-NLS-1$ } @@ -701,18 +689,16 @@ public class Storage { return (Generation) existingLocation.getCurrentRevision().getRevisionInfo(); } - ContentProvider contentProvider = getContentProvider(in, sourceURL); - Type contentType = contentProvider.getType(); - File staged = contentProvider.getContent(); - + boolean isReference = in instanceof ReferenceInputStream; + File staged = stageContent(in, sourceURL); Generation generation = null; try { Long nextID = moduleDatabase.getAndIncrementNextId(); BundleInfo info = new BundleInfo(this, nextID, bundleLocation, 0); generation = info.createGeneration(); - File contentFile = getContentFile(staged, contentType, nextID, generation.getGenerationId()); - generation.setContent(contentFile, contentType); + File contentFile = getContentFile(staged, isReference, nextID, generation.getGenerationId()); + generation.setContent(contentFile, isReference); // Check that we can open the bundle file generation.getBundleFile().open(); setStorageHooks(generation); @@ -728,7 +714,7 @@ public class Storage { } return generation; } catch (Throwable t) { - if (contentType == Type.DEFAULT) { + if (!isReference) { try { delete(staged); } catch (IOException e) { @@ -758,24 +744,6 @@ public class Storage { } } - ContentProvider getContentProvider(final InputStream in, final URL sourceURL) { - if (in instanceof ContentProvider) { - return (ContentProvider) in; - } - return new ContentProvider() { - - @Override - public Type getType() { - return Type.DEFAULT; - } - - @Override - public File getContent() throws BundleException { - return stageContent(in, sourceURL); - } - }; - } - private void setStorageHooks(Generation generation) throws BundleException { if (generation.getBundleInfo().getBundleId() == 0) { return; // ignore system bundle @@ -913,11 +881,7 @@ public class Storage { ModuleRevision current = module.getCurrentRevision(); Generation currentGen = (Generation) current.getRevisionInfo(); File content = currentGen.getContent(); - if (content == null) { - // TODO Handle connect bundle - return; - } - String spec = (currentGen.getContentType() == Type.REFERENCE ? "reference:" : "") + content.toURI().toString(); //$NON-NLS-1$ //$NON-NLS-2$ + String spec = (currentGen.isReference() ? "reference:" : "") + content.toURI().toString(); //$NON-NLS-1$ //$NON-NLS-2$ URLConnection contentConn; try { contentConn = getContentConnection(spec); @@ -927,12 +891,7 @@ public class Storage { update(module, contentConn); } - public Generation update(Module module, InputStream updateIn) throws BundleException { - return update(module, getContentConnection(module, null, updateIn)); - } - - private Generation update(Module module, URLConnection content) throws BundleException { - + public Generation update(Module module, URLConnection content) throws BundleException { if (osgiLocation.isReadOnly()) { throw new BundleException("The framework storage area is read only.", BundleException.INVALID_OPERATION); //$NON-NLS-1$ } @@ -943,11 +902,8 @@ public class Storage { } catch (Throwable e) { throw new BundleException("Error reading bundle content.", e); //$NON-NLS-1$ } - - ContentProvider contentProvider = getContentProvider(in, sourceURL); - Type contentType = contentProvider.getType(); - File staged = contentProvider.getContent(); - + boolean isReference = in instanceof ReferenceInputStream; + File staged = stageContent(in, sourceURL); ModuleRevision current = module.getCurrentRevision(); Generation currentGen = (Generation) current.getRevisionInfo(); @@ -955,8 +911,8 @@ public class Storage { Generation newGen = bundleInfo.createGeneration(); try { - File contentFile = getContentFile(staged, contentType, bundleInfo.getBundleId(), newGen.getGenerationId()); - newGen.setContent(contentFile, contentType); + File contentFile = getContentFile(staged, isReference, bundleInfo.getBundleId(), newGen.getGenerationId()); + newGen.setContent(contentFile, isReference); // Check that we can open the bundle file newGen.getBundleFile().open(); setStorageHooks(newGen); @@ -964,7 +920,7 @@ public class Storage { ModuleRevisionBuilder builder = getBuilder(newGen); moduleContainer.update(module, builder, newGen); } catch (Throwable t) { - if (contentType == Type.DEFAULT) { + if (!isReference) { try { delete(staged); } catch (IOException e) { @@ -990,14 +946,14 @@ public class Storage { return newGen; } - private File getContentFile(final File staged, Type contentType, final long bundleID, final long generationID) throws BundleException { + private File getContentFile(final File staged, final boolean isReference, final long bundleID, final long generationID) throws BundleException { if (System.getSecurityManager() == null) - return getContentFile0(staged, contentType, bundleID, generationID); + return getContentFile0(staged, isReference, bundleID, generationID); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<File>() { @Override public File run() throws BundleException { - return getContentFile0(staged, contentType, bundleID, generationID); + return getContentFile0(staged, isReference, bundleID, generationID); } }); } catch (PrivilegedActionException e) { @@ -1007,10 +963,9 @@ public class Storage { } } - File getContentFile0(File staged, Type contentType, long bundleID, long generationID) throws BundleException { - File contentFile = staged; - - if (contentType == Type.DEFAULT) { + File getContentFile0(File staged, boolean isReference, long bundleID, long generationID) throws BundleException { + File contentFile; + if (!isReference) { File generationRoot = new File(childRoot, bundleID + "/" + generationID); //$NON-NLS-1$ generationRoot.mkdirs(); if (!generationRoot.isDirectory()) { @@ -1020,6 +975,8 @@ public class Storage { if (!StorageUtil.move(staged, contentFile, getConfiguration().getDebug().DEBUG_STORAGE)) { throw new BundleException("Error while renaming bundle file to final location: " + contentFile); //$NON-NLS-1$ } + } else { + contentFile = staged; } return contentFile; } @@ -1098,7 +1055,7 @@ public class Storage { return result; } - File stageContent(final InputStream in, final URL sourceURL) throws BundleException { + private File stageContent(final InputStream in, final URL sourceURL) throws BundleException { if (System.getSecurityManager() == null) return stageContent0(in, sourceURL); try { @@ -1118,6 +1075,10 @@ public class Storage { File stageContent0(InputStream in, URL sourceURL) throws BundleException { File outFile = null; try { + if (in instanceof ReferenceInputStream) { + return ((ReferenceInputStream) in).getReference(); + } + outFile = File.createTempFile(BUNDLE_FILE_NAME, ".tmp", childRoot); //$NON-NLS-1$ String protocol = sourceURL == null ? null : sourceURL.getProtocol(); @@ -1174,16 +1135,9 @@ public class Storage { } public BundleFile createBundleFile(File content, Generation generation, boolean isDirectory, boolean isBase) { - BundleFile result = null; - ConnectModule connectModule = null; - if (generation.getContentType() == Type.CONNECT) { - connectModule = equinoxContainer.getConnectModules().getConnectModule(generation.getBundleInfo().getLocation()); - } + BundleFile result; try { - if (connectModule != null && isBase) { - result = equinoxContainer.getConnectModules().getConnectBundleFile(connectModule, content, generation, - mruList, getConfiguration().getDebug()); - } else if (isDirectory) { + if (isDirectory) { boolean strictPath = Boolean.parseBoolean(equinoxContainer.getConfiguration().getConfiguration(EquinoxConfiguration.PROPERTY_STRICT_BUNDLE_ENTRY_PATH, Boolean.FALSE.toString())); result = new DirBundleFile(content, strictPath); } else { @@ -1387,14 +1341,13 @@ public class Storage { out.writeLong(bundleInfo.getNextGenerationId()); out.writeLong(generation.getGenerationId()); out.writeBoolean(generation.isDirectory()); - Type contentType = generation.getContentType(); - out.writeInt(contentType.ordinal()); + out.writeBoolean(generation.isReference()); out.writeBoolean(generation.hasPackageInfo()); - if (bundleInfo.getBundleId() == 0 || contentType == Type.CONNECT) { - // just write empty string for system bundle content and connect content in this case + if (bundleInfo.getBundleId() == 0) { + // just write empty string for system bundle content in this case out.writeUTF(""); //$NON-NLS-1$ } else { - if (contentType == Type.REFERENCE) { + if (generation.isReference()) { // make reference installs relative to the install path out.writeUTF(new FilePath(installPath).makeRelative(new FilePath(generation.getContent().getAbsolutePath()))); } else { @@ -1494,23 +1447,13 @@ public class Storage { int numInfos = in.readInt(); Map<Long, Generation> result = new HashMap<>(numInfos); List<Generation> generations = new ArrayList<>(numInfos); - Type[] contentTypes = Type.values(); for (int i = 0; i < numInfos; i++) { long infoId = in.readLong(); String infoLocation = ObjectPool.intern(in.readUTF()); long nextGenId = in.readLong(); long generationId = in.readLong(); boolean isDirectory = in.readBoolean(); - - Type contentType = Type.DEFAULT; - if (version >= CONTENT_TYPE_VERSION) { - contentType = contentTypes[in.readInt()]; - } else { - if (in.readBoolean()) { - contentType = Type.REFERENCE; - } - } - + boolean isReference = in.readBoolean(); boolean hasPackageInfo = in.readBoolean(); String contentPath = in.readUTF(); long lastModified = in.readLong(); @@ -1527,58 +1470,37 @@ public class Storage { } boolean isMRJar = (version >= MR_JAR_VERSION) ? in.readBoolean() : false; - File content = null; - if (contentType != Type.CONNECT) { - if (infoId == 0) { - content = getSystemContent(); - isDirectory = content != null ? content.isDirectory() : false; - // Note that we do not do any checking for absolute paths with - // the system bundle. We always take the content as discovered - // by getSystemContent() - } else { - content = new File(contentPath); - if (!content.isAbsolute()) { - // make sure it has the absolute location instead - switch (contentType) { - case REFERENCE: - // reference installs are relative to the installPath - content = new File(installPath, contentPath); - break; - case DEFAULT: - // normal installs are relative to the storage area - content = getFile(contentPath, true); - break; - default: - throw new IllegalArgumentException("Unknown type: " + contentType); //$NON-NLS-1$ - } + File content; + if (infoId == 0) { + content = getSystemContent(); + isDirectory = content != null ? content.isDirectory() : false; + // Note that we do not do any checking for absolute paths with + // the system bundle. We always take the content as discovered + // by getSystemContent() + } else { + content = new File(contentPath); + if (!content.isAbsolute()) { + // make sure it has the absolute location instead + if (isReference) { + // reference installs are relative to the installPath + content = new File(installPath, contentPath); + } else { + // normal installs are relative to the storage area + content = getFile(contentPath, true); } } } + BundleInfo info = new BundleInfo(this, infoId, infoLocation, nextGenId); - Generation generation = info.restoreGeneration(generationId, content, isDirectory, contentType, hasPackageInfo, cachedHeaders, lastModified, isMRJar); + Generation generation = info.restoreGeneration(generationId, content, isDirectory, isReference, hasPackageInfo, cachedHeaders, lastModified, isMRJar); result.put(infoId, generation); generations.add(generation); } - connectPersistentBundles(generations); loadStorageHookData(generations, in); return result; } - private void connectPersistentBundles(List<Generation> generations) { - generations.forEach(g -> { - try { - if (g.getContentType() == Type.CONNECT) { - equinoxContainer.getConnectModules().connect(g.getBundleInfo().getLocation()); - } - } catch (IllegalStateException e) { - if (!(e.getCause() instanceof BundleException)) { - throw e; - } - } - }); - } - private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<>(getConfiguration().getHookRegistry().getStorageHookFactories()); Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<>(); @@ -2292,8 +2214,4 @@ public class Storage { } return storageStream; } - - EquinoxContainer getEquinoxContainer() { - return equinoxContainer; - } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/CloseableBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/CloseableBundleFile.java index aeb4cc5ac..73720b9eb 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/CloseableBundleFile.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/CloseableBundleFile.java @@ -72,7 +72,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { * Checks if the bundle file is open * @return true if the bundle file is open and locked */ - protected boolean lockOpen() { + private boolean lockOpen() { try { open(true); return true; @@ -98,13 +98,6 @@ public abstract class CloseableBundleFile<E> extends BundleFile { } /** - * Unlocks the open lock - */ - protected void releaseOpen() { - openLock.unlock(); - } - - /** * Opens this bundle file. * @param keepLock true if the open lock should be retained * @throws IOException @@ -169,7 +162,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { } return getExtractFile(dirName); } finally { - releaseOpen(); + openLock.unlock(); } } @@ -226,7 +219,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { generation.getBundleInfo().getStorage().getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, "Unable to extract content: " + generation.getRevision() + ": " + entry, e); //$NON-NLS-1$ //$NON-NLS-2$ } } finally { - releaseOpen(); + openLock.unlock(); } return null; } @@ -258,7 +251,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { } } } finally { - releaseOpen(); + openLock.unlock(); } return false; } @@ -271,7 +264,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { try { return findEntry(path); } finally { - releaseOpen(); + openLock.unlock(); } } @@ -314,7 +307,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { } return result.size() == 0 ? null : Collections.enumeration(result); } finally { - releaseOpen(); + openLock.unlock(); } } @@ -456,7 +449,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { } return in; } finally { - releaseOpen(); + openLock.unlock(); } } @@ -549,9 +542,7 @@ public abstract class CloseableBundleFile<E> extends BundleFile { } private IOException enrichExceptionWithBaseFile(IOException e) { - File baseFile = getBaseFile(); - String extraInfo = baseFile == null ? generation.getBundleInfo().getLocation() : baseFile.toString(); - return new IOException(extraInfo, e); + return new IOException(getBaseFile().toString(), e); } } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java index 1ce4ba33c..b9ff45f04 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java @@ -17,13 +17,12 @@ package org.eclipse.osgi.storage.url.reference; import java.io.File; import java.io.IOException; import java.io.InputStream; -import org.eclipse.osgi.storage.ContentProvider; /** * InputStream subclass which provides a reference (via File) to the data * rather than allowing the input stream to be directly read. */ -public class ReferenceInputStream extends InputStream implements ContentProvider { +public class ReferenceInputStream extends InputStream { private final File reference; public ReferenceInputStream(File reference) { @@ -38,16 +37,6 @@ public class ReferenceInputStream extends InputStream implements ContentProvider } public File getReference() { - return getContent(); - } - - @Override - public File getContent() { return reference; } - - @Override - public Type getType() { - return Type.REFERENCE; - } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java index 7a45b1cb5..7b0816059 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -543,7 +543,7 @@ final class BundlePermissionCollection extends PermissionCollection { // work our way up the tree... int last; int offset = requestedName.length() - 1; - while ((last = requestedName.lastIndexOf('.', offset)) != -1) { + while ((last = requestedName.lastIndexOf(".", offset)) != -1) { requestedName = requestedName.substring(0, last + 1) + "*"; bp = pc.get(requestedName); if (bp != null) { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java index c7bae50ca..8a38df04e 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -714,7 +714,7 @@ final class CapabilityPermissionCollection extends PermissionCollection { /* work our way up the tree... */ int last; int offset = requestedName.length() - 1; - while ((last = requestedName.lastIndexOf('.', offset)) != -1) { + while ((last = requestedName.lastIndexOf(".", offset)) != -1) { requestedName = requestedName.substring(0, last + 1) + "*"; cp = pc.get(requestedName); if (cp != null) { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java index 3d961b80d..41e648afb 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java @@ -1574,7 +1574,7 @@ public interface Constants { String SERVICE_IMPORTED_CONFIGS = "service.imported.configs"; /** - * Service property identifying the intents that this service implements. + * Service property identifying the intents that this service implement. * This property has a dual purpose: * <ul> * <li>A bundle can use this service property to notify the distribution diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java index 236ad75d7..8003880aa 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,27 +16,16 @@ package org.osgi.framework; -import static java.util.Objects.requireNonNull; - import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.AbstractMap; -import java.util.AbstractSet; import java.util.ArrayList; import java.util.Collections; -import java.util.Dictionary; -import java.util.Enumeration; import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; import java.util.ServiceLoader; -import java.util.Set; - import javax.security.auth.x500.X500Principal; import org.eclipse.osgi.internal.framework.FilterImpl; -import org.osgi.framework.connect.FrameworkUtilHelper; +import org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper; /** * Framework Utility class. @@ -196,69 +185,57 @@ public class FrameworkUtil { return DNChainMatching.match(matchPattern, dnChain); } - /** - * Return a {@code Bundle} for the specified bundle class loader. - * - * @param bundleClassLoader A bundle class loader. - * @return An Optional containing {@code Bundle} for the specified bundle - * class loader or an empty Optional if the specified class loader - * is not associated with a specific bundle. - * @since 1.10 - */ - public static Optional<Bundle> getBundle(ClassLoader bundleClassLoader) { - requireNonNull(bundleClassLoader); - return Optional - .ofNullable((bundleClassLoader instanceof BundleReference) - ? ((BundleReference) bundleClassLoader).getBundle() - : null); + private final static List<FrameworkUtilHelper> helpers; + static { + List<FrameworkUtilHelper> l = new ArrayList<>(); + try { + ServiceLoader<FrameworkUtilHelper> helperLoader = AccessController.doPrivileged(new PrivilegedAction<ServiceLoader<FrameworkUtilHelper>>() { + @Override + public ServiceLoader<FrameworkUtilHelper> run() { + return ServiceLoader.load(FrameworkUtilHelper.class, FrameworkUtilHelper.class.getClassLoader()); + } + }); + for (Iterator<FrameworkUtilHelper> iHelpers = helperLoader.iterator(); iHelpers.hasNext();) { + l.add(iHelpers.next()); + } + } catch (Throwable t) { + // should not fail out of static initializers + t.printStackTrace(); + } + helpers = Collections.unmodifiableList(l); } /** - * Return a {@code Bundle} for the specified bundle class. + * Return a {@code Bundle} for the specified bundle class. The returned + * {@code Bundle} is the bundle associated with the bundle class loader + * which defined the specified class. * - * @param classFromBundle A class defined by a bundle. + * @param classFromBundle A class defined by a bundle class loader. * @return A {@code Bundle} for the specified bundle class or {@code null} - * if the specified class was not defined by a bundle. + * if the specified class was not defined by a bundle class loader. * @since 1.5 */ - public static Bundle getBundle(Class< ? > classFromBundle) { + public static Bundle getBundle(final Class<?> classFromBundle) { // We use doPriv since the caller may not have permission // to call getClassLoader. - Optional<ClassLoader> cl = Optional - .ofNullable(AccessController.doPrivileged( - (PrivilegedAction<ClassLoader>) () -> classFromBundle - .getClassLoader())); + Object cl = AccessController.doPrivileged(new PrivilegedAction<Object>() { + @Override + public Object run() { + return classFromBundle.getClassLoader(); + } + }); - return cl.flatMap(FrameworkUtil::getBundle) - .orElseGet(() -> helpers.stream() - .map(helper -> helper.getBundle(classFromBundle)) - .filter(Optional::isPresent) - .map(Optional::get) - .findFirst() - .orElse(null)); - } + if (cl instanceof BundleReference) { + return ((BundleReference) cl).getBundle(); + } - private final static List<FrameworkUtilHelper> helpers; - static { - List<FrameworkUtilHelper> l = new ArrayList<>(); - try { - ServiceLoader<FrameworkUtilHelper> helperLoader = AccessController - .doPrivileged( - (PrivilegedAction<ServiceLoader<FrameworkUtilHelper>>) () -> ServiceLoader - .load(FrameworkUtilHelper.class, - FrameworkUtilHelper.class - .getClassLoader())); - helperLoader.forEach(l::add); - } catch (Throwable error) { - // try hard not to fail static <clinit> - try { - Thread t = Thread.currentThread(); - t.getUncaughtExceptionHandler().uncaughtException(t, error); - } catch (Throwable ignored) { - // we ignore this + for (FrameworkUtilHelper helper : helpers) { + Bundle b = helper.getBundle(classFromBundle); + if (b != null) { + return b; } } - helpers = Collections.unmodifiableList(l); + return null; } /** @@ -703,345 +680,4 @@ public class FrameworkUtil { return sb.toString(); } } - - /** - * Return a Map wrapper around a Dictionary. - * - * @param <K> The type of the key. - * @param <V> The type of the value. - * @param dictionary The dictionary to wrap. - * @return A Map object which wraps the specified dictionary. If the - * specified dictionary can be cast to a Map, then the specified - * dictionary is returned. - * @since 1.10 - */ - public static <K, V> Map<K,V> asMap( - Dictionary< ? extends K, ? extends V> dictionary) { - if (dictionary instanceof Map) { - @SuppressWarnings("unchecked") - Map<K,V> coerced = (Map<K,V>) dictionary; - return coerced; - } - return new DictionaryAsMap<>(dictionary); - } - - private static class DictionaryAsMap<K, V> extends AbstractMap<K,V> { - private final Dictionary<K,V> dict; - - @SuppressWarnings("unchecked") - DictionaryAsMap(Dictionary< ? extends K, ? extends V> dict) { - this.dict = (Dictionary<K,V>) requireNonNull(dict); - } - - Iterator<K> keys() { - List<K> keys = new ArrayList<>(dict.size()); - for (Enumeration<K> e = dict.keys(); e.hasMoreElements();) { - keys.add(e.nextElement()); - } - return keys.iterator(); - } - - @Override - public int size() { - return dict.size(); - } - - @Override - public boolean isEmpty() { - return dict.isEmpty(); - } - - @Override - public boolean containsKey(Object key) { - if (key == null) { - return false; - } - return dict.get(key) != null; - } - - @Override - public V get(Object key) { - if (key == null) { - return null; - } - return dict.get(key); - } - - @Override - public V put(K key, V value) { - return dict.put( - requireNonNull(key, - "a Dictionary cannot contain a null key"), - requireNonNull(value, - "a Dictionary cannot contain a null value")); - } - - @Override - public V remove(Object key) { - if (key == null) { - return null; - } - return dict.remove(key); - } - - @Override - public void clear() { - for (Iterator<K> iter = keys(); iter.hasNext();) { - dict.remove(iter.next()); - } - } - - @Override - public Set<K> keySet() { - return new KeySet(); - } - - @Override - public Set<Map.Entry<K,V>> entrySet() { - return new EntrySet(); - } - - @Override - public String toString() { - return dict.toString(); - } - - final class KeySet extends AbstractSet<K> { - @Override - public Iterator<K> iterator() { - return new KeyIterator(); - } - - @Override - public int size() { - return DictionaryAsMap.this.size(); - } - - @Override - public boolean isEmpty() { - return DictionaryAsMap.this.isEmpty(); - } - - @Override - public boolean contains(Object key) { - return DictionaryAsMap.this.containsKey(key); - } - - @Override - public boolean remove(Object key) { - return DictionaryAsMap.this.remove(key) != null; - } - - @Override - public void clear() { - DictionaryAsMap.this.clear(); - } - } - - final class KeyIterator implements Iterator<K> { - private final Iterator<K> keys = DictionaryAsMap.this.keys(); - private K key = null; - - @Override - public boolean hasNext() { - return keys.hasNext(); - } - - @Override - public K next() { - return key = keys.next(); - } - - @Override - public void remove() { - if (key == null) { - throw new IllegalStateException(); - } - DictionaryAsMap.this.remove(key); - key = null; - } - } - - final class EntrySet extends AbstractSet<Map.Entry<K,V>> { - @Override - public Iterator<Map.Entry<K,V>> iterator() { - return new EntryIterator(); - } - - @Override - public int size() { - return DictionaryAsMap.this.size(); - } - - @Override - public boolean isEmpty() { - return DictionaryAsMap.this.isEmpty(); - } - - @Override - public boolean contains(Object o) { - if (o instanceof Map.Entry) { - Map.Entry< ? , ? > e = (Map.Entry< ? , ? >) o; - return containsEntry(e); - } - return false; - } - - private boolean containsEntry(Map.Entry< ? , ? > e) { - Object key = e.getKey(); - if (key == null) { - return false; - } - Object value = e.getValue(); - if (value == null) { - return false; - } - return Objects.equals(DictionaryAsMap.this.get(key), value); - } - - @Override - public boolean remove(Object o) { - if (o instanceof Map.Entry) { - Map.Entry< ? , ? > e = (Map.Entry< ? , ? >) o; - if (containsEntry(e)) { - DictionaryAsMap.this.remove(e.getKey()); - return true; - } - } - return false; - } - - @Override - public void clear() { - DictionaryAsMap.this.clear(); - } - } - - final class EntryIterator implements Iterator<Map.Entry<K,V>> { - private final Iterator<K> keys = DictionaryAsMap.this.keys(); - private K key = null; - - @Override - public boolean hasNext() { - return keys.hasNext(); - } - - @Override - public Map.Entry<K,V> next() { - return new Entry(key = keys.next()); - } - - @Override - public void remove() { - if (key == null) { - throw new IllegalStateException(); - } - DictionaryAsMap.this.remove(key); - key = null; - } - } - - final class Entry extends SimpleEntry<K,V> { - private static final long serialVersionUID = 1L; - - Entry(K key) { - super(key, DictionaryAsMap.this.get(key)); - } - - @Override - public V setValue(V value) { - DictionaryAsMap.this.put(getKey(), value); - return super.setValue(value); - } - } - } - - /** - * Return a Dictionary wrapper around a Map. - * - * @param <K> The type of the key. - * @param <V> The type of the value. - * @param map The map to wrap. - * @return A Dictionary object which wraps the specified map. If the - * specified map can be cast to a Dictionary, then the specified map - * is returned. - * @since 1.10 - */ - public static <K, V> Dictionary<K,V> asDictionary( - Map< ? extends K, ? extends V> map) { - if (map instanceof Dictionary) { - @SuppressWarnings("unchecked") - Dictionary<K,V> coerced = (Dictionary<K,V>) map; - return coerced; - } - return new MapAsDictionary<>(map); - } - - private static class MapAsDictionary<K, V> extends Dictionary<K,V> { - private final Map<K,V> map; - - @SuppressWarnings("unchecked") - MapAsDictionary(Map< ? extends K, ? extends V> map) { - this.map = (Map<K,V>) requireNonNull(map); - if (map.containsKey(null)) { - throw new NullPointerException( - "a Dictionary cannot contain a null key"); - } - if (map.containsValue(null)) { - throw new NullPointerException( - "a Dictionary cannot contain a null value"); - } - } - - @Override - public int size() { - return map.size(); - } - - @Override - public boolean isEmpty() { - return map.isEmpty(); - } - - @Override - public Enumeration<K> keys() { - return Collections.enumeration(map.keySet()); - } - - @Override - public Enumeration<V> elements() { - return Collections.enumeration(map.values()); - } - - @Override - public V get(Object key) { - if (key == null) { - return null; - } - return map.get(key); - } - - @Override - public V put(K key, V value) { - return map.put( - requireNonNull(key, - "a Dictionary cannot contain a null key"), - requireNonNull(value, - "a Dictionary cannot contain a null value")); - } - - @Override - public V remove(Object key) { - if (key == null) { - return null; - } - return map.remove(key); - } - - @Override - public String toString() { - return map.toString(); - } - } - } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java index cc8cd627f..264ccd683 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -713,7 +713,7 @@ final class PackagePermissionCollection extends PermissionCollection { /* work our way up the tree... */ int last; int offset = requestedName.length() - 1; - while ((last = requestedName.lastIndexOf('.', offset)) != -1) { + while ((last = requestedName.lastIndexOf(".", offset)) != -1) { requestedName = requestedName.substring(0, last + 1) + "*"; pp = pc.get(requestedName); if (pp != null) { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java index a6b52521c..8db61d0b1 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -866,7 +866,7 @@ final class ServicePermissionCollection extends PermissionCollection { // work our way up the tree... int last; int offset = requestedName.length() - 1; - while ((last = requestedName.lastIndexOf('.', offset)) != -1) { + while ((last = requestedName.lastIndexOf(".", offset)) != -1) { requestedName = requestedName.substring(0, last + 1) + "*"; sp = pc.get(requestedName); if (sp != null) { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java index 6f0cc8811..1454244c3 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,8 +53,7 @@ import org.osgi.annotation.versioning.ProviderType; * @author $Id$ */ @ProviderType -public interface ServiceReference<S> - extends Comparable<Object>, BundleReference { +public interface ServiceReference<S> extends Comparable<Object> { /** * Returns the property value to which the specified property key is mapped * in the properties {@code Dictionary} object of the service referenced by @@ -110,7 +109,6 @@ public interface ServiceReference<S> * already been unregistered. * @see BundleContext#registerService(String[],Object,Dictionary) */ - @Override public Bundle getBundle(); /** @@ -214,27 +212,4 @@ public interface ServiceReference<S> * @since 1.9 */ public Dictionary<String,Object> getProperties(); - - /** - * Adapt this {@code ServiceReference} object to the specified type. - * <p> - * Adapting this {@code ServiceReference} object to the specified type may - * require certain checks, including security checks, to succeed. If a check - * does not succeed, then this {@code ServiceReference} object cannot be - * adapted and {@code null} is returned. - * - * @param <A> The type to which this {@code ServiceReference} object is to - * be adapted. - * @param type Class object for the type to which this - * {@code ServiceReference} object is to be adapted. - * @return The object, of the specified type, to which this - * {@code ServiceReference} object has been adapted or {@code null} - * if this {@code ServiceReference} object cannot be adapted to the - * specified type. - * @throws SecurityException If the caller does not have the appropriate - * {@code AdaptPermission[type,this,ADAPT]}, and the Java - * Runtime Environment supports permissions. - * @since 1.10 - */ - <A> A adapt(Class<A> type); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectContent.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectContent.java deleted file mode 100644 index 44ec66031..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectContent.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2019). All Rights Reserved. - * - * 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. - */ -package org.osgi.framework.connect; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import java.util.Optional; - -import org.osgi.framework.Bundle; -import org.osgi.framework.launch.Framework; -import org.osgi.framework.namespace.IdentityNamespace; -import org.osgi.framework.wiring.BundleRevisions; - -/** - * A connect content provides a {@link Framework framework} access to the - * content of a connect {@link ConnectModule module}. A framework may - * {@link #open() open} and {@link #close() close} the content for a connect - * module multiple times while the connect content is in use by the framework - * instance. The framework must close the connect content once the connect - * content is no longer used as the content of a current bundle revision or an - * in use bundle revision. - * <p> - * An entry in a connect content is identified by a path name that is a - * '{@code /}'-separated path. A connect content may treat directories as - * entries. A directory entry path name will end with a slash ('/'). A directory - * entry may be located using a path name that drops the trailing slash. - * - * @see BundleRevisions - * @ThreadSafe - * @author $Id$ - */ -public interface ConnectContent { - /** - * The {@code osgi.identity} - * {@link IdentityNamespace#CAPABILITY_TAGS_ATTRIBUTE tags} attribute value - * used by the framework to tag connect bundle revisions. - */ - public static final String TAG_OSGI_CONNECT = "osgi.connect"; - - /** - * Returns this connect content Manifest headers and values. The - * {@link Optional#empty() empty} value is returned if the framework should - * handle parsing the Manifest of the content itself. - * - * @return This connect content Manifest headers and values. - * @throws IllegalStateException if the connect content has been closed - */ - Optional<Map<String,String>> getHeaders(); - - /** - * Returns an iterable with all the entry names available in this - * ConnectContent - * - * @return the entry names - * @throws IOException if an error occurs reading the ConnectContent - * @throws IllegalStateException if the connect content has been closed - */ - Iterable<String> getEntries() throws IOException; - - /** - * Returns the connect entry for the specified path name in this content. - * The {@link Optional#empty() empty} value is returned if an entry with the - * specified path name does not exist. The path must not start with a - * "/" and is relative to the root of this content. A connect - * entry for a directory will have a path name that ends with a slash ('/'). - * - * @param path the path name of the entry - * @return the connect entry, or {@link Optional#empty() empty} if not - * found. - * @throws IllegalStateException if the connect content has been closed - */ - Optional<ConnectEntry> getEntry(String path); - - /** - * Returns a class loader for this connect content. The - * {@link Optional#empty() empty} value is returned if the framework should - * handle creating a class loader for the bundle revision associated with - * this connect content. - * <p> - * This method is called by the framework for {@link Bundle#RESOLVED - * resolved} bundles only and will be called at most once while a bundle is - * resolved. If a bundle associated with a connect module is refreshed and - * resolved again the framework will ask the content for the class loader - * again. This allows for a connect content to reuse or create a new class - * loader each time the bundle revision is resolved. - * - * @return a class loader for the module. - */ - Optional<ClassLoader> getClassLoader(); - - /** - * Opens this connect content. The framework will open the content when it - * needs to access the content for a bundle revision associated with the - * connect content. The framework may lazily postpone to open the content - * until right before requests to access the bundle revision content are - * made. - * - * @throws IOException if an error occurred opening the content - */ - void open() throws IOException; - - /** - * Closes this connect content. - * - * @throws IOException if an error occurred closing the connect content - */ - void close() throws IOException; - - /** - * Represents the entry of a connect module - */ - public interface ConnectEntry { - /** - * Returns the path name of the entry - * - * @return the path name of the entry - */ - String getName(); - - /** - * Returns the size of the entry. The value {@code -1} is returned if - * the content length is not known. - * - * @return the size of the entry, or {@code -1} if the content length is - * not known. - */ - public long getContentLength(); - - /** - * Returns the last modification time of the entry - * - * @return the last modification time of the entry - */ - public long getLastModified(); - - /** - * Returns the content of the entry as a byte array. - * - * @return the content bytes - * @throws IOException if an error occurs reading the content - */ - default byte[] getBytes() throws IOException { - long longLength = getContentLength(); - if (longLength > Integer.MAX_VALUE - 8) { - throw new IOException( - "Entry is to big to fit into a byte[]: " + getName()); - } - - try (InputStream in = getInputStream()) { - int length = (int) longLength; - if (length > 0) { - int bytesread = 0; - byte[] result = new byte[length]; - int readcount = 0; - while (bytesread < length) { - readcount = in.read(result, bytesread, - length - bytesread); - bytesread += readcount; - if (readcount <= 0) { - break; - } - } - return result; - } else { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int nRead; - byte[] data = new byte[1024]; - while ((nRead = in.read(data, 0, data.length)) > 0) { - buffer.write(data, 0, nRead); - } - buffer.flush(); - return buffer.toByteArray(); - } - } - } - - /** - * Returns the content of the entry as an input stream. - * - * @return the content input stream - * @throws IOException if an error occurs reading the content - */ - InputStream getInputStream() throws IOException; - } -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectFrameworkFactory.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectFrameworkFactory.java deleted file mode 100644 index c1193dbc9..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectFrameworkFactory.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2019). All Rights Reserved. - * - * 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. - */ -package org.osgi.framework.connect; - -import java.util.Map; - -import org.osgi.annotation.versioning.ProviderType; -import org.osgi.framework.Bundle; -import org.osgi.framework.launch.Framework; - -/** - * A factory for creating {@link Framework} instances. - * <p> - * If a framework supports {@link ModuleConnector} then the implementation jar - * must contain the following resource: - * - * <pre> - * /META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory - * </pre> - * - * This UTF-8 encoded resource must contain the name of the framework - * implementation's ConnectFrameworkFactory implementation class. Space and tab - * characters, including blank lines, in the resource must be ignored. The - * number sign ({@code '#'} \u0023) and all characters following it on each - * line are a comment and must be ignored. - * <p> - * Launchers can find the name of the ConnectFrameworkFactory implementation - * class in the resource and then load and construct a ConnectFrameworkFactory - * object for the framework implementation. The ConnectFrameworkFactory - * implementation class must have a public, no-argument constructor. Java™ - * SE 6 introduced the {@code ServiceLoader} class which can create a - * ConnectFrameworkFactory instance from the resource. - * - * @ThreadSafe - * @author $Id$ - */ -@ProviderType -public interface ConnectFrameworkFactory { - /** - * Create a new {@link Framework} instance using the specified - * {@link ModuleConnector module connector}. - * - * @param configuration The framework properties to configure the new - * framework instance. If framework properties are not provided - * by the configuration argument, the created framework instance - * must use some reasonable default configuration appropriate for - * the current VM. For example, the system packages for the - * current execution environment should be properly exported. The - * specified configuration argument may be {@code null}. The - * created framework instance must copy any information needed - * from the specified configuration argument since the - * configuration argument can be changed after the framework - * instance has been created. - * @param moduleConnector The module connector that the new framework - * instance will use. The specified module connector argument may - * be {@code null}. - * @return A new, configured {@link Framework} instance. The framework - * instance must be in the {@link Bundle#INSTALLED} state. - * @throws SecurityException If the caller does not have - * {@code AllPermission}, and the Java Runtime Environment - * supports permissions. - * @see ModuleConnector - * @since 1.3 - */ - Framework newFramework(Map<String,String> configuration, - ModuleConnector moduleConnector); -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectModule.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectModule.java deleted file mode 100644 index 421e5c476..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ConnectModule.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2019). All Rights Reserved. - * - * 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. - */ -package org.osgi.framework.connect; - -import java.io.IOException; - -import org.osgi.framework.launch.Framework; -import org.osgi.framework.wiring.BundleRevision; - -/** - * A connect module instance is used by a {@link Framework framework} when a - * bundle location is connected to connect module. The connected bundle must use - * the connect module to load content for the bundle revisions installed in the - * framework for the connected bundle. - * - * @ThreadSafe - * @author $Id$ - */ -public interface ConnectModule { - /** - * Returns the current content of this connect module. The framework will - * call this method when it needs to access the content for the current - * {@link BundleRevision bundle revision} that is connected to this connect - * module. The framework may lazily postpone to open the content until right - * before requests to access the bundle revision content are made. - * - * @return the current content of this connect module - * @throws IOException if an error occurred getting the content - * @see ModuleConnector#connect(String) - */ - ConnectContent getContent() throws IOException; -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/FrameworkUtilHelper.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/FrameworkUtilHelper.java deleted file mode 100644 index d418a6bcc..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/FrameworkUtilHelper.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2019). All Rights Reserved. - * - * 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. - */ - -package org.osgi.framework.connect; - -import java.util.Optional; - -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; - -/** - * A helper for the {@link FrameworkUtil} class. This helper provides - * alternative implementations for methods on {@link FrameworkUtil}. - */ -public interface FrameworkUtilHelper { - /** - * Return a {@code Bundle} associated with the specified class. - * <p> - * This helper method is called by {@link FrameworkUtil#getBundle(Class)} if - * the standard implementation of {@code FrameworkUtil} cannot find the - * bundle. - * - * @param classFromBundle A class associated with a bundle - * @return An Optional containing a {@code Bundle} for the specified class - * or an empty Optional if the specified class is not from a bundle. - */ - default Optional<Bundle> getBundle(Class< ? > classFromBundle) { - return Optional.empty(); - } -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ModuleConnector.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ModuleConnector.java deleted file mode 100644 index 3f9a112c5..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/ModuleConnector.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2019). All Rights Reserved. - * - * 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. - */ -package org.osgi.framework.connect; - -import java.io.File; -import java.util.Map; -import java.util.Optional; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleException; -import org.osgi.framework.Constants; -import org.osgi.framework.launch.Framework; - -/** - * A <code>ModuleConnector</code> provides connections to instances of - * {@link ConnectModule} that are used by a {@link Framework} instance to - * connect installed bundles locations with content provided by the - * <code>ModuleConnector</code>. This allows a <code>ModuleConnector</code> to - * provide content and classes for a connected bundle installed in the - * <code>Framework</code>. A <code>ModuleConnector</code> is provided when - * {@link ConnectFrameworkFactory#newFramework(java.util.Map, ModuleConnector) - * creating} a framework instance. Because a <code>ModuleConnector</code> - * instance can participate in the initialization of the <code>Framework</code> - * and the life cycle of a <code>Framework</code> instance the - * <code>ModuleConnector</code> instance should only be used with a single - * <code>Framework</code> instance at a time. - * - * @ThreadSafe - * @author $Id$ - */ -public interface ModuleConnector { - - /** - * Initializes this module connector with the - * {@link Constants#FRAMEWORK_STORAGE framework persistent storage} file and - * framework properties configured for a {@link Framework} instance. This - * method is called once by a {@link Framework} instance and is called - * before any other methods on this module connector are called. - * - * @param configuration The framework properties used configure the new - * framework instance. An unmodifiable map of framework - * configuration properties that were used to create a new - * framework instance. - * @param storage the persistent storage area used by the {@link Framework} - * or {@code null} if the platform does not have file system - * support. - */ - void initialize(File storage, Map<String,String> configuration); - - /** - * Connects a bundle location with a {@link ConnectModule}. If an - * {@link Optional#empty() empty} optional is returned the the framework - * must handle reading the content of the bundle itself. If a value is - * {@link Optional#isPresent() present} in the returned optional then the - * <code>ConnectModule</code> {@link Optional#get() value} from the optional - * must be used to connect the bundle to the returned {@link ConnectModule}. - * The returned connect module is used by the framework to access the - * content of the bundle. - * - * @param location the bundle location used to install a bundle - * @return the connect module for the specified bundle location - * @throws BundleException if the location cannot be handled - */ - Optional<ConnectModule> connect(String location) throws BundleException; - - /** - * Creates a new activator for this module connector. A new activator is - * created by the framework each time the framework is - * {@link Framework#init() initialized}. An activator allows the module - * connector to participate in the framework life cycle. When the framework - * is {@link Framework#init() initialized} the activator - * {@link BundleActivator#start(org.osgi.framework.BundleContext) start} - * method is called. When the framework is {@link Framework#stop() stopped} - * the activator - * {@link BundleActivator#stop(org.osgi.framework.BundleContext) stop} - * method is called - * - * @return a new activator for this module connector or - * {@link Optional#empty() empty} if no activator is available - */ - Optional<BundleActivator> createBundleActivator(); -} diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/package-info.java deleted file mode 100644 index a196dc76c..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/connect/package-info.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) OSGi Alliance (2010, 2019). All Rights Reserved. - * - * 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. - */ - -/** - * Framework Connect Package Version 1.0. - * <p> - * Bundles wishing to use this package must list the package in the - * Import-Package header of the bundle's manifest. - * <p> - * Example import for consumers using the API in this package: - * <p> - * {@code Import-Package: org.osgi.framework.connect; version="[1.0,2.0)"} - * - * @author $Id$ - */ - -@Version("1.0") -package org.osgi.framework.connect; - -import org.osgi.annotation.versioning.Version; - diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/dto/ServiceReferenceDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/dto/ServiceReferenceDTO.java index 8ac26a24b..87265ded2 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/dto/ServiceReferenceDTO.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/dto/ServiceReferenceDTO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2012, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,17 +17,16 @@ package org.osgi.framework.dto; import java.util.Map; - import org.osgi.dto.DTO; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; /** * Data Transfer Object for a ServiceReference. + * * <p> * {@code ServiceReferenceDTO}s for all registered services can be obtained from - * a {@link FrameworkDTO}. A {@link ServiceReference} can be adapted to a - * {@code ServiceReferenceDTO}. A started Bundle can be adapted to provide a + * a {@link FrameworkDTO}. A started Bundle can be adapted to provide a * {@code ServiceReferenceDTO[]} of the services registered by the Bundle. A * {@code ServiceReferenceDTO} obtained from a framework must convert service * property values which are not valid value types for DTOs to type diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java index ecb53ee09..c1647bcb8 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/FrameworkFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2009, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.osgi.framework.launch; import java.util.Map; - import org.osgi.annotation.versioning.ProviderType; import org.osgi.framework.Bundle; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/package-info.java index 70417d372..db5e926ca 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/package-info.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2014). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java index 05e5d1482..9f789ca25 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2012, 2018). All Rights Reserved. + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,13 +54,13 @@ import org.osgi.resource.Namespace; * </ul> * * <p> - * A non-fragment resource with the {@link IdentityNamespace#TYPE_BUNDLE - * osgi.bundle} type {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE - * identity} provides zero or one<sup>†</sup> host capabilities. A - * fragment resource with the {@link IdentityNamespace#TYPE_FRAGMENT - * osgi.fragment} type {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE - * identity} must not declare a host capability and must declare exactly one - * host requirement. + * A non-fragment resource with the with the + * {@link IdentityNamespace#TYPE_BUNDLE osgi.bundle} type + * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} provides zero or + * one<sup>†</sup> host capabilities. A fragment resource with the + * {@link IdentityNamespace#TYPE_FRAGMENT osgi.fragment} type + * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} must not declare + * a host capability and must declare exactly one host requirement. * <p> * † A resource with no bundle symbolic name must not provide a host * capability. diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java index 27ae5d1c5..7bc7a11c4 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2012, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,16 +105,6 @@ public final class IdentityNamespace extends Namespace { public static final String TYPE_UNKNOWN = "unknown"; /** - * The attribute value that contains tags for the resource. A tag is used to - * identify an aspect of the resource that is not otherwise expressed by the - * capabilities of the resource. The value of this attribute must be of type - * {@code List<String>}. - * - * @since 1.2 - */ - public static final String CAPABILITY_TAGS_ATTRIBUTE = "tags"; - - /** * The capability attribute that contains a human readable copyright notice * for the resource. See the {@code Bundle-Copyright} manifest header. */ diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/package-info.java index 43f3804d3..e89f34a4f 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/package-info.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2012, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /** - * Namespace Package Version 1.2. + * Namespace Package Version 1.1. * * <p> * Bundles should not need to import this package at runtime since all @@ -25,7 +25,7 @@ * @author $Id$ */ -@Version("1.2") +@Version("1.1") package org.osgi.framework.namespace; import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/package-info.java index 5b7956509..818d4aed9 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/package-info.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,19 +15,19 @@ */ /** - * Framework Package Version 1.10. + * Framework Package Version 1.9. * <p> * Bundles wishing to use this package must list the package in the * Import-Package header of the bundle's manifest. * <p> * Example import for consumers using the API in this package: * <p> - * {@code Import-Package: org.osgi.framework; version="[1.10,2.0)"} + * {@code Import-Package: org.osgi.framework; version="[1.9,2.0)"} * * @author $Id$ */ -@Version("1.10") +@Version("1.9") package org.osgi.framework; import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java index e4011e12a..86bff0073 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2006, 2019). All Rights Reserved. + * Copyright (c) OSGi Alliance (2006, 2017). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,10 @@ * limitations under the License. */ +// This document is an experimental draft to enable interoperability +// between bundle repositories. There is currently no commitment to +// turn this draft into an official specification. + package org.osgi.service.resolver; import java.util.List; diff --git a/bundles/org.eclipse.osgi/pom.xml b/bundles/org.eclipse.osgi/pom.xml index b75f512e2..10e6bef21 100644 --- a/bundles/org.eclipse.osgi/pom.xml +++ b/bundles/org.eclipse.osgi/pom.xml @@ -19,7 +19,7 @@ </parent> <groupId>org.eclipse.osgi</groupId> <artifactId>org.eclipse.osgi</artifactId> - <version>3.16.0-SNAPSHOT</version> + <version>3.15.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <build> diff --git a/bundles/org.eclipse.osgi/supplement/.classpath b/bundles/org.eclipse.osgi/supplement/.classpath index eca7bdba8..098194ca4 100644 --- a/bundles/org.eclipse.osgi/supplement/.classpath +++ b/bundles/org.eclipse.osgi/supplement/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/bundles/org.eclipse.osgi/supplement/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi/supplement/.settings/org.eclipse.jdt.core.prefs index ccae001e2..e88e78ebc 100644 --- a/bundles/org.eclipse.osgi/supplement/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.osgi/supplement/.settings/org.eclipse.jdt.core.prefs @@ -7,9 +7,9 @@ org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -70,27 +70,23 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -160,12 +156,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -195,8 +190,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -220,16 +213,12 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -275,8 +264,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -312,11 +299,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -339,10 +323,6 @@ org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true -org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true -org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true -org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true -org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF index de14a4b88..caa323ede 100644 --- a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.supplement -Bundle-Version: 1.10.0.qualifier +Bundle-Version: 1.9.300.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.log;version="1.1", @@ -18,7 +18,7 @@ Export-Package: org.eclipse.equinox.log;version="1.1", org.eclipse.osgi.service.urlconversion;version="1.0", org.eclipse.osgi.storagemanager;version="1.0", org.eclipse.osgi.util;version="1.1" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Import-Package: org.osgi.framework, org.osgi.framework.hooks.resolver, org.osgi.resource, diff --git a/bundles/org.eclipse.osgi/supplement/pom.xml b/bundles/org.eclipse.osgi/supplement/pom.xml index b6588fe49..c31cac54b 100644 --- a/bundles/org.eclipse.osgi/supplement/pom.xml +++ b/bundles/org.eclipse.osgi/supplement/pom.xml @@ -21,7 +21,7 @@ <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.supplement</artifactId> - <version>1.10.0-SNAPSHOT</version> + <version>1.9.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> |