diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.metadata.generator')
37 files changed, 3878 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.classpath b/bundles/org.eclipse.equinox.p2.metadata.generator/.classpath new file mode 100644 index 000000000..ce7393340 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.cvsignore b/bundles/org.eclipse.equinox.p2.metadata.generator/.cvsignore new file mode 100644 index 000000000..f2fc20d10 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.cvsignore @@ -0,0 +1,2 @@ +org.eclipse.equinox.simpleconfigurator.jar +org.eclipse.update.configurator.jar diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.project b/bundles/org.eclipse.equinox.p2.metadata.generator/.project new file mode 100644 index 000000000..6fc39c431 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.equinox.prov.metadata.generator</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..78523cd05 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,331 @@ +#Thu Aug 16 11:00:59 EDT 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +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=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +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.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +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.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +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.3 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +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_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_multiple_fields=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_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 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=false +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +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_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_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 +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +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_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 +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +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_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not 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_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 +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +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_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 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +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_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_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 +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=800 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +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_binary_operator=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..7c9816508 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,57 @@ +#Sun Sep 23 11:58:19 EDT 2007 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_core +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=; +org.eclipse.jdt.ui.ondemandthreshold=3 +org.eclipse.jdt.ui.staticondemandthreshold=3 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..7913d20db --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ + +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.0_Foundation-1.0.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.0_Foundation-1.0.profile new file mode 100644 index 000000000..1157a29bd --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.0_Foundation-1.0.profile @@ -0,0 +1,19 @@ +############################################################################### +# Copyright (c) 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.microedition.io +org.osgi.framework.bootdelegation = \ + javax.microedition.io +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0,\ + OSGi/Minimum-1.1,\ + CDC-1.0/Foundation-1.0 +osgi.java.profile.name = CDC-1.0/Foundation-1.0 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.1_Foundation-1.1.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.1_Foundation-1.1.profile new file mode 100644 index 000000000..374300afc --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.1_Foundation-1.1.profile @@ -0,0 +1,24 @@ +############################################################################### +# Copyright (c) 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.microedition.io,\ + javax.microedition.pki,\ + javax.security.auth.x500 +org.osgi.framework.bootdelegation = \ + javax.microedition.io,\ + javax.microedition.pki,\ + javax.security.auth.x500 +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0,\ + OSGi/Minimum-1.1,\ + CDC-1.0/Foundation-1.0,\ + CDC-1.1/Foundation-1.1 +osgi.java.profile.name = CDC-1.1/Foundation-1.1 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.2.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.2.profile new file mode 100644 index 000000000..28f973ad5 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.2.profile @@ -0,0 +1,42 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + org.omg.CORBA,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextPackage +org.osgi.framework.bootdelegation = \ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + JRE-1.1,\ + J2SE-1.2 +osgi.java.profile.name = J2SE-1.2 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.3.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.3.profile new file mode 100644 index 000000000..b7dbdfabb --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.3.profile @@ -0,0 +1,63 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.transaction,\ + org.omg.CORBA,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi +org.osgi.framework.bootdelegation = \ + javax.*,\ + org.omg.*,\ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0,\ + OSGi/Minimum-1.1,\ + JRE-1.1,\ + J2SE-1.2,\ + J2SE-1.3 +osgi.java.profile.name = J2SE-1.3 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.4.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.4.profile new file mode 100644 index 000000000..b307c978e --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.4.profile @@ -0,0 +1,118 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.crypto,\ + javax.crypto.interfaces,\ + javax.crypto.spec,\ + javax.imageio,\ + javax.imageio.event,\ + javax.imageio.metadata,\ + javax.imageio.plugins.jpeg,\ + javax.imageio.spi,\ + javax.imageio.stream,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.net,\ + javax.net.ssl,\ + javax.print,\ + javax.print.attribute,\ + javax.print.attribute.standard,\ + javax.print.event,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.security.auth,\ + javax.security.auth.callback,\ + javax.security.auth.kerberos,\ + javax.security.auth.login,\ + javax.security.auth.spi,\ + javax.security.auth.x500,\ + javax.security.cert,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.sql,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.transaction,\ + javax.transaction.xa,\ + javax.xml.parsers,\ + javax.xml.transform,\ + javax.xml.transform.dom,\ + javax.xml.transform.sax,\ + javax.xml.transform.stream,\ + org.ietf.jgss,\ + org.omg.CORBA,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextExtPackage,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.Dynamic,\ + org.omg.DynamicAny,\ + org.omg.DynamicAny.DynAnyFactoryPackage,\ + org.omg.DynamicAny.DynAnyPackage,\ + org.omg.IOP,\ + org.omg.IOP.CodecFactoryPackage,\ + org.omg.IOP.CodecPackage,\ + org.omg.Messaging,\ + org.omg.PortableInterceptor,\ + org.omg.PortableInterceptor.ORBInitInfoPackage,\ + org.omg.PortableServer,\ + org.omg.PortableServer.CurrentPackage,\ + org.omg.PortableServer.POAManagerPackage,\ + org.omg.PortableServer.POAPackage,\ + org.omg.PortableServer.portable,\ + org.omg.PortableServer.ServantLocatorPackage,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi,\ + org.w3c.dom,\ + org.xml.sax,\ + org.xml.sax.ext,\ + org.xml.sax.helpers +org.osgi.framework.bootdelegation = \ + javax.*,\ + org.ietf.jgss,\ + org.omg.*,\ + org.w3c.*,\ + org.xml.*,\ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0,\ + OSGi/Minimum-1.1,\ + JRE-1.1,\ + J2SE-1.2,\ + J2SE-1.3,\ + J2SE-1.4 +osgi.java.profile.name = J2SE-1.4 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.5.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.5.profile new file mode 100644 index 000000000..d23d6ca5e --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.5.profile @@ -0,0 +1,146 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.activity,\ + javax.crypto,\ + javax.crypto.interfaces,\ + javax.crypto.spec,\ + javax.imageio,\ + javax.imageio.event,\ + javax.imageio.metadata,\ + javax.imageio.plugins.bmp,\ + javax.imageio.plugins.jpeg,\ + javax.imageio.spi,\ + javax.imageio.stream,\ + javax.management,\ + javax.management.loading,\ + javax.management.modelmbean,\ + javax.management.monitor,\ + javax.management.openmbean,\ + javax.management.relation,\ + javax.management.remote,\ + javax.management.remote.rmi,\ + javax.management.timer,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.net,\ + javax.net.ssl,\ + javax.print,\ + javax.print.attribute,\ + javax.print.attribute.standard,\ + javax.print.event,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.rmi.ssl,\ + javax.security.auth,\ + javax.security.auth.callback,\ + javax.security.auth.kerberos,\ + javax.security.auth.login,\ + javax.security.auth.spi,\ + javax.security.auth.x500,\ + javax.security.cert,\ + javax.security.sasl,\ + javax.servlet,\ + javax.servlet.http,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.sql,\ + javax.sql.rowset,\ + javax.sql.rowset.serial,\ + javax.sql.rowset.spi,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.plaf.synth,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.transaction,\ + javax.transaction.xa,\ + javax.xml,\ + javax.xml.datatype,\ + javax.xml.namespace,\ + javax.xml.parsers,\ + javax.xml.transform,\ + javax.xml.transform.dom,\ + javax.xml.transform.sax,\ + javax.xml.transform.stream,\ + javax.xml.validation,\ + javax.xml.xpath,\ + org.ietf.jgss,\ + org.omg.CORBA,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextExtPackage,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.Dynamic,\ + org.omg.DynamicAny,\ + org.omg.DynamicAny.DynAnyFactoryPackage,\ + org.omg.DynamicAny.DynAnyPackage,\ + org.omg.IOP,\ + org.omg.IOP.CodecFactoryPackage,\ + org.omg.IOP.CodecPackage,\ + org.omg.Messaging,\ + org.omg.PortableInterceptor,\ + org.omg.PortableInterceptor.ORBInitInfoPackage,\ + org.omg.PortableServer,\ + org.omg.PortableServer.CurrentPackage,\ + org.omg.PortableServer.POAManagerPackage,\ + org.omg.PortableServer.POAPackage,\ + org.omg.PortableServer.portable,\ + org.omg.PortableServer.ServantLocatorPackage,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi,\ + org.w3c.dom,\ + org.w3c.dom.bootstrap,\ + org.w3c.dom.events,\ + org.w3c.dom.ls,\ + org.xml.sax,\ + org.xml.sax.ext,\ + org.xml.sax.helpers +org.osgi.framework.bootdelegation = \ + javax.*,\ + org.ietf.jgss,\ + org.omg.*,\ + org.w3c.*,\ + org.xml.*,\ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0,\ + OSGi/Minimum-1.1,\ + JRE-1.1,\ + J2SE-1.2,\ + J2SE-1.3,\ + J2SE-1.4,\ + J2SE-1.5 +osgi.java.profile.name = J2SE-1.5 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/JRE-1.1.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/JRE-1.1.profile new file mode 100644 index 000000000..9a8d8fd51 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/JRE-1.1.profile @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = +org.osgi.framework.bootdelegation = \ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + JRE-1.1 +osgi.java.profile.name = JRE-1.1 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/JavaSE-1.6.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/JavaSE-1.6.profile new file mode 100644 index 000000000..1c7abcba6 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/JavaSE-1.6.profile @@ -0,0 +1,145 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.activity,\ + javax.crypto,\ + javax.crypto.interfaces,\ + javax.crypto.spec,\ + javax.imageio,\ + javax.imageio.event,\ + javax.imageio.metadata,\ + javax.imageio.plugins.bmp,\ + javax.imageio.plugins.jpeg,\ + javax.imageio.spi,\ + javax.imageio.stream,\ + javax.management,\ + javax.management.loading,\ + javax.management.modelmbean,\ + javax.management.monitor,\ + javax.management.openmbean,\ + javax.management.relation,\ + javax.management.remote,\ + javax.management.remote.rmi,\ + javax.management.timer,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.net,\ + javax.net.ssl,\ + javax.print,\ + javax.print.attribute,\ + javax.print.attribute.standard,\ + javax.print.event,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.rmi.ssl,\ + javax.security.auth,\ + javax.security.auth.callback,\ + javax.security.auth.kerberos,\ + javax.security.auth.login,\ + javax.security.auth.spi,\ + javax.security.auth.x500,\ + javax.security.cert,\ + javax.security.sasl,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.sql,\ + javax.sql.rowset,\ + javax.sql.rowset.serial,\ + javax.sql.rowset.spi,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.plaf.synth,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.transaction,\ + javax.transaction.xa,\ + javax.xml,\ + javax.xml.datatype,\ + javax.xml.namespace,\ + javax.xml.parsers,\ + javax.xml.transform,\ + javax.xml.transform.dom,\ + javax.xml.transform.sax,\ + javax.xml.transform.stream,\ + javax.xml.validation,\ + javax.xml.xpath,\ + org.ietf.jgss,\ + org.omg.CORBA,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextExtPackage,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.Dynamic,\ + org.omg.DynamicAny,\ + org.omg.DynamicAny.DynAnyFactoryPackage,\ + org.omg.DynamicAny.DynAnyPackage,\ + org.omg.IOP,\ + org.omg.IOP.CodecFactoryPackage,\ + org.omg.IOP.CodecPackage,\ + org.omg.Messaging,\ + org.omg.PortableInterceptor,\ + org.omg.PortableInterceptor.ORBInitInfoPackage,\ + org.omg.PortableServer,\ + org.omg.PortableServer.CurrentPackage,\ + org.omg.PortableServer.POAManagerPackage,\ + org.omg.PortableServer.POAPackage,\ + org.omg.PortableServer.portable,\ + org.omg.PortableServer.ServantLocatorPackage,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi,\ + org.w3c.dom,\ + org.w3c.dom.bootstrap,\ + org.w3c.dom.events,\ + org.w3c.dom.ls,\ + org.xml.sax,\ + org.xml.sax.ext,\ + org.xml.sax.helpers +org.osgi.framework.bootdelegation = \ + javax.*,\ + org.ietf.jgss,\ + org.omg.*,\ + org.w3c.*,\ + org.xml.*,\ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0,\ + OSGi/Minimum-1.1,\ + JRE-1.1,\ + J2SE-1.2,\ + J2SE-1.3,\ + J2SE-1.4,\ + J2SE-1.5,\ + JavaSE-1.6 +osgi.java.profile.name = JavaSE-1.6 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF new file mode 100644 index 000000000..448c7c16f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF @@ -0,0 +1,26 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Generator Plug-in (Incubation) +Bundle-SymbolicName: org.eclipse.equinox.prov.metadata.generator;singleton:=true +Bundle-Version: 0.1.0.qualifier +Require-Bundle: org.eclipse.equinox.prov.core, + org.eclipse.osgi, + org.eclipse.equinox.common +Import-Package: com.thoughtworks.xstream, + javax.xml.parsers, + org.eclipse.equinox.app;version="1.0.0", + org.eclipse.equinox.frameworkadmin, + org.eclipse.equinox.internal.prov.artifact.repository, + org.eclipse.equinox.internal.prov.metadata, + org.eclipse.equinox.internal.prov.metadata.repository, + org.eclipse.equinox.prov.artifact.repository, + org.eclipse.equinox.prov.metadata, + org.eclipse.equinox.prov.metadata.repository, + org.xml.sax +Bundle-Activator: org.eclipse.equinox.internal.prov.metadata.generator.Activator +Export-Package: org.eclipse.equinox.internal.prov.metadata.generator, + org.eclipse.equinox.internal.prov.metadata.generator.features;x-internal:=true, + org.eclipse.equinox.prov.metadata.generator +Eclipse-LazyStart: true +Bundle-RequiredExecutionEnvironment: J2SE-1.4, + CDC-1.1/Foundation-1.1 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator CDT.launch b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator CDT.launch new file mode 100644 index 000000000..c44aa41ce --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator CDT.launch @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher"> +<booleanAttribute key="automaticAdd" value="false"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="[NONE]"/> +<booleanAttribute key="clearConfig" value="true"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Metadata Generator CDT"/> +<booleanAttribute key="default_auto_start" value="false"/> +<intAttribute key="default_start_level" value="4"/> +<booleanAttribute key="includeOptional" value="true"/> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog -application org.eclipse.equinox.prov.metadata.generator.EclipseGenerator -metadataRepository file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ -artifactRepository file:c:/temp/equinox.prov/servers/CDTartifactRepository/ -source c:/eclipse/CDT4.0 -root cdt -flavor tooling -publishArtifacts"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=c:/temp/equinox.prov/agent/ -Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ -Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/ -Declipse.ignoreApp=false -Declipse.application.registerDescriptors=true -Declipse.application=org.eclipse.equinox.prov.metadata.generator.EclipseGenerator -Declipse.prov.metadataGenerator.eclipseBase=c:/eclipse/CDT4.0/ -Declipse.prov.rootIUId=cdt -Declipse.prov.configurationFlavor=tooling -Declipse.prov.appendToRepo=true -Declipse.prov.generateArtifacts=true"/> +<stringAttribute key="target_bundles" value="org.eclipse.core.jobs@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default"/> +<booleanAttribute key="tracing" value="false"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<stringAttribute key="vminstall" value="jdk"/> +<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.generator@default:default,org.eclipse.equinox.prov.metadata.repository@default:default"/> +</launchConfiguration> diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator SDK.launch b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator SDK.launch new file mode 100644 index 000000000..23d6ab8c9 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator SDK.launch @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher"> +<booleanAttribute key="append.args" value="true"/> +<booleanAttribute key="automaticAdd" value="false"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="[NONE]"/> +<booleanAttribute key="clearConfig" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Metadata Generator SDK"/> +<booleanAttribute key="default_auto_start" value="false"/> +<intAttribute key="default_start_level" value="4"/> +<booleanAttribute key="includeOptional" value="false"/> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog -application org.eclipse.equinox.prov.metadata.generator.EclipseGenerator -metadataRepository file:d:/tmp/equinox.prov/servers/metadataRepository/ -artifactRepository file:d:/tmp/equinox.prov/servers/artifactRepository/ -source d:/3.3/eclipse -root sdk -rootVersion 3.3.0 -flavor tooling -publishArtifacts -append"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="target_bundles" value="org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:default,org.eclipse.core.runtime.compatibility.registry@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default,org.eclipse.update.configurator@default:default"/> +<booleanAttribute key="tracing" value="false"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<stringAttribute key="vminstall" value="jre1.6.0"/> +<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.generator@default:default,org.eclipse.equinox.prov.metadata.repository@default:default"/> +</launchConfiguration> diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.0.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.0.profile new file mode 100644 index 000000000..d8c2d3fdf --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.0.profile @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = +org.osgi.framework.bootdelegation = \ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0 +osgi.java.profile.name = OSGi/Minimum-1.0 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.1.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.1.profile new file mode 100644 index 000000000..2d8b661a6 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.1.profile @@ -0,0 +1,18 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = +org.osgi.framework.bootdelegation = \ + sun.*,\ + com.sun.* +org.osgi.framework.executionenvironment = \ + OSGi/Minimum-1.0,\ + OSGi/Minimum-1.1 +osgi.java.profile.name = OSGi/Minimum-1.1 diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/about.html b/bundles/org.eclipse.equinox.p2.metadata.generator/about.html new file mode 100644 index 000000000..460233046 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 2, 2006</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/build.properties b/bundles/org.eclipse.equinox.p2.metadata.generator/build.properties new file mode 100644 index 000000000..5ec9256f4 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/build.properties @@ -0,0 +1,26 @@ +############################################################################### +# Copyright (c) 2007 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html,\ + OSGi_Minimum-1.1.profile,\ + OSGi_Minimum-1.0.profile,\ + JavaSE-1.6.profile,\ + JRE-1.1.profile,\ + J2SE-1.5.profile,\ + J2SE-1.4.profile,\ + J2SE-1.3.profile,\ + J2SE-1.2.profile,\ + CDC-1.1_Foundation-1.1.profile,\ + CDC-1.0_Foundation-1.0.profile,\ + plugin.xml diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/config.ini b/bundles/org.eclipse.equinox.p2.metadata.generator/config.ini new file mode 100644 index 000000000..ec1329813 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/config.ini @@ -0,0 +1,57 @@ +# Eclipse runtime configuration file +# This file contains a number of key/value pairs that are merged into the +# System properties on system startup. The values control the way the +# runtime is structured and runs. + +# Note: Only platform:/base/ and file: URLs are supported. In general the +# URLs given may include a version number (e.g., .../location_1.2.3). +# If a version is not specified, the system binds +# to the location which matches exactly or to the versioned location with the +# latest version number. If a version number is given then only exact matches +# are considered. + +# The URL for the runtime entry point. The default value is +# platform:/base/plugins/org.eclipse.osgi +#osgi.framework=platform:/base/plugins/org.eclipse.osgi + +# The classpath for the framework found at the osgi.framework location. This +# comma-separated list contains either URLs or simple element names. Simple +# names are assumed to be relative to the framework's install directory. +# Typically this value need not be set as it is initialized by the framework itself. +# Version match searching is not done for URLs listed here. +#osgi.frameworkClassPath = + +# The comma-separated list of locations to search for the splash screen file (splash.bmp). +# For each list element a subdirectory structure based on the pattern nl/<locale> is searched. +# The system binds to the first matching file. There is no default value. +#osgi.splashPath= + +# The location of the splash screen file. If this value is set at system startup it is used +# in favour of the osgi.splashPath searching outlined above. If the value is not set +# the searching is done and this key is bound to the result of the search. +#osgi.splashLocation = + +# The comma-separated list of bundles which are automatically installed and optionally started +# once the system is up and running. Each entry if of the form +# <URL | simple bundle location>[@ [<startlevel>] [":start"]] +# If the startlevel is omitted then the framework will use the default start level for the bundle. +# If the "start" tag is added then the bundle will be marked as started after being installed. +# Simple bundle locations are interepreted as relative to the framework's parent directory. +# The startlevel indicates the OSGi start level at which the bundle should run. +osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@3:start, org.eclipse.core.runtime@start,org.eclipse.equinox.frameworkadmin.equinox@start + +# The product to run. A given Eclipse configuration may contain many products. +# The product identified will supply the branding (window icons, title bar text) etc +# as well as define the default application to run. +#eclipse.product= + +# The application to run. The value specified here is the id of the application extension +# the runtime will find, instantiate and execute once the system is up. Note that typically +# the identified eclipse.product defines the default application to run. +#eclipse.application= + +# The build identifier +eclipse.buildId=@build@ + +# End of file marker - must be here +eof=eof
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/generator.product b/bundles/org.eclipse.equinox.p2.metadata.generator/generator.product new file mode 100644 index 000000000..714a2b139 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/generator.product @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?pde version="3.1"?> + +<product name="Equinox Provisioning Metadata Generator" id="org.eclipse.equinox.prov.metadata.generator.product" application="org.eclipse.equinox.prov.metadata.generator.EclipseGenerator" useFeatures="true"> + + <configIni use="custom" path="/org.eclipse.equinox.prov.metadata.generator/config.ini"/> + + <launcherArgs> + <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> + </launcherArgs> + + <launcher name="eclipse"> + <solaris/> + <win useIco="false"> + <bmp/> + </win> + </launcher> + + <vm> + </vm> + + <plugins> + </plugins> + + <features> + <feature id="org.eclipse.equinox.prov.generator.feature" version="0.0.0"/> + <feature id="org.eclipse.rcp" version="0.0.0"/> + </features> + +</product> diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/plugin.xml b/bundles/org.eclipse.equinox.p2.metadata.generator/plugin.xml new file mode 100644 index 000000000..f8ff83d03 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/plugin.xml @@ -0,0 +1,22 @@ +<plugin> + <extension + id="EclipseGenerator" + point="org.eclipse.core.runtime.applications"> + <application + cardinality="1" + thread="main" + visible="true"> + <run + class="org.eclipse.equinox.internal.prov.metadata.generator.EclipseGeneratorApplication"> + </run> + </application> + </extension> + <extension + id="product" + point="org.eclipse.core.runtime.products"> + <product + application="org.eclipse.equinox.prov.metadata.generator.EclipseGenerator" + name="Equinox Provisioning Metadata Generator"> + </product> + </extension> +</plugin> diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/Activator.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/Activator.java new file mode 100644 index 000000000..d6799e045 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/Activator.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.internal.prov.metadata.generator; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + public static BundleContext context = null; + public static String ID = "org.eclipse.equinox.prov.metadata.generator"; + + public static BundleContext getContext() { + return context; + } + + public void start(BundleContext context) throws Exception { + Activator.context = context; + } + + public void stop(BundleContext context) throws Exception { + Activator.context = null; + } + +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/EclipseGeneratorApplication.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/EclipseGeneratorApplication.java new file mode 100644 index 000000000..0f43eda25 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/EclipseGeneratorApplication.java @@ -0,0 +1,295 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.internal.prov.metadata.generator; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.equinox.internal.prov.artifact.repository.ArtifactRepositoryManager; +import org.eclipse.equinox.internal.prov.metadata.repository.MetadataRepositoryManager; +import org.eclipse.equinox.prov.artifact.repository.*; +import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus; +import org.eclipse.equinox.prov.core.helpers.ServiceHelper; +import org.eclipse.equinox.prov.metadata.generator.EclipseInstallGeneratorInfoProvider; +import org.eclipse.equinox.prov.metadata.generator.Generator; +import org.eclipse.equinox.prov.metadata.repository.*; +import org.osgi.framework.ServiceRegistration; + +public class EclipseGeneratorApplication implements IApplication { + + // The mapping rules for in-place generation need to construct paths into the structure + // of an eclipse installation; in the future the default artifact mapping declared in + // SimpleArtifactRepository may change, for example, to not have a 'bundles' directory + // instead of a 'plugins' directory, so a separate constant is defined and used here. + static final private String[][] INPLACE_MAPPING_RULES = { {"(& (namespace=eclipse) (classifier=feature))", "${repoUrl}/features/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$ + {"(& (namespace=eclipse) (classifier=plugin))", "${repoUrl}/plugins/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$ + {"(& (namespace=eclipse) (classifier=native))", "${repoUrl}/native/${id}_${version}"}}; //$NON-NLS-1$//$NON-NLS-2$ + + private ArtifactRepositoryManager defaultArtifactManager; + private ServiceRegistration registrationDefaultArtifactManager; + private MetadataRepositoryManager defaultMetadataManager; + private ServiceRegistration registrationDefaultMetadataManager; + private ProvisioningEventBus bus; + private ServiceRegistration registrationBus; + private String metadataLocation; + private String artifactLocation; + private String operation; + private String argument; + private String features; + private String bundles; + private String base; + + private void registerDefaultMetadataRepoManager() { + if (ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName()) == null) { + defaultMetadataManager = new MetadataRepositoryManager(); + registrationDefaultMetadataManager = Activator.getContext().registerService(IMetadataRepositoryManager.class.getName(), defaultMetadataManager, null); + } + } + + private void registerDefaultArtifactRepoManager() { + if (ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()) == null) { + defaultArtifactManager = new ArtifactRepositoryManager(); + registrationDefaultArtifactManager = Activator.getContext().registerService(IArtifactRepositoryManager.class.getName(), defaultArtifactManager, null); + } + } + + private void registerEventBus() { + if (ServiceHelper.getService(Activator.getContext(), ProvisioningEventBus.class.getName()) == null) { + bus = new ProvisioningEventBus(); + registrationBus = Activator.getContext().registerService(ProvisioningEventBus.class.getName(), bus, null); + } + } + + public Object start(IApplicationContext context) throws Exception { + registerEventBus(); + registerDefaultMetadataRepoManager(); + registerDefaultArtifactRepoManager(); + EclipseInstallGeneratorInfoProvider provider = new EclipseInstallGeneratorInfoProvider(); + Map args = context.getArguments(); + processCommandLineArguments((String[]) args.get("application.args"), provider); + initialize(provider); + + if (provider.getBaseLocation() == null) { + System.out.println("Eclipse base location not specified"); + String[] a = (String[]) args.get("application.args"); + for (int i = 0; i < a.length; i++) + System.out.println(a[i]); + return IApplication.EXIT_OK; + } + System.out.println("Generating metadata for " + provider.getBaseLocation()); + + IStatus result = new Generator(provider).generate(); + + if (result.isOK()) { + System.out.println("Generation completed with success"); + return IApplication.EXIT_OK; + } + System.out.println(result); + return new Integer(1); + } + + private void initialize(EclipseInstallGeneratorInfoProvider provider) { + if ("-source".equalsIgnoreCase(operation)) + provider.initialize(new File(argument)); + else if ("-inplace".equalsIgnoreCase(operation)) { + provider.initialize(new File(argument)); + initializeForInplace(provider); + } else if ("-config".equalsIgnoreCase(operation)) { + provider.initialize(new File(argument), new File(argument, "configuration"), getExecutableName(argument, provider), null, null); + } else if ("-updateSite".equalsIgnoreCase(operation)) { + provider.setAddDefaultIUs(false); + provider.initialize(new File(argument), null, null, new File[] {new File(argument, "plugins")}, new File(argument, "features")); + initializeForInplace(provider); + } else { + if (base != null && bundles != null && features != null) + provider.initialize(new File(base), null, null, new File[] {new File(bundles)}, new File(features)); + } + initializeRepositories(provider); + } + + private File getExecutableName(String base, EclipseInstallGeneratorInfoProvider provider) { + File location = provider.getExecutableLocation(); + if (location == null) + return new File(base, EclipseInstallGeneratorInfoProvider.getDefaultExecutableName()); + if (location.isAbsolute()) + return location; + return new File(base, location.getPath()); + } + + private void initializeRepositories(EclipseInstallGeneratorInfoProvider provider) { + initializeArtifactRepository(provider); + initializeMetadataRepository(provider); + } + + public void initializeForInplace(EclipseInstallGeneratorInfoProvider provider) { + File location = provider.getBaseLocation(); + if (location == null) + location = provider.getBundleLocations()[0]; + try { + metadataLocation = location.toURL().toExternalForm(); + artifactLocation = location.toURL().toExternalForm(); + } catch (MalformedURLException e) { + // ought not happen... + } + provider.setPublishArtifactRepository(true); + provider.setPublishArtifacts(false); + provider.setMappingRules(INPLACE_MAPPING_RULES); + } + + public void processCommandLineArguments(String[] args, EclipseInstallGeneratorInfoProvider provider) throws Exception { + if (args == null) + return; + for (int i = 0; i < args.length; i++) { + // check for args without parameters (i.e., a flag arg) + + if (args[i].equalsIgnoreCase("-publishArtifacts") || args[i].equalsIgnoreCase("-pa")) + provider.setPublishArtifacts(true); + + if (args[i].equalsIgnoreCase("-publishArtifactRepository") || args[i].equalsIgnoreCase("-par")) + provider.setPublishArtifactRepository(true); + + if (args[i].equalsIgnoreCase("-append")) + provider.setAppend(true); + + if (args[i].equalsIgnoreCase("-noDefaultIUs")) + provider.setAddDefaultIUs(false); + + // check for args with parameters. If we are at the last argument or if the next one + // has a '-' as the first character, then we can't have an arg with a parm so continue. + if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$ + continue; + String arg = args[++i]; + + if (args[i - 1].equalsIgnoreCase("-source")) { + operation = args[i - 1]; + argument = arg; + } + + if (args[i - 1].equalsIgnoreCase("-inplace")) { + operation = args[i - 1]; + argument = arg; + } + + if (args[i - 1].equalsIgnoreCase("-config")) { + operation = args[i - 1]; + argument = arg; + } + if (args[i - 1].equalsIgnoreCase("-updateSite")) { + operation = args[i - 1]; + argument = arg; + } + + if (args[i - 1].equalsIgnoreCase("-exe")) + provider.setExecutableLocation(arg); + + if (args[i - 1].equalsIgnoreCase("-metadataRepository") || args[i - 1].equalsIgnoreCase("-mr")) + metadataLocation = arg; + + if (args[i - 1].equalsIgnoreCase("-artifactRepository") | args[i - 1].equalsIgnoreCase("-ar")) + artifactLocation = arg; + + if (args[i - 1].equalsIgnoreCase("-flavor")) + provider.setFlavor(arg); + + if (args[i - 1].equalsIgnoreCase("-features")) + features = arg; + + if (args[i - 1].equalsIgnoreCase("-bundles")) + bundles = arg; + + if (args[i - 1].equalsIgnoreCase("-base")) + base = arg; + + if (args[i - 1].equalsIgnoreCase("-root")) + provider.setRootId(arg); + + if (args[i - 1].equalsIgnoreCase("-rootVersion")) + provider.setRootVersion(arg); + + if (args[i - 1].equalsIgnoreCase("-prov.os")) + provider.setOS(arg); + } + } + + private void initializeArtifactRepository(EclipseInstallGeneratorInfoProvider provider) { + IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.context, IArtifactRepositoryManager.class.getName()); + URL location; + try { + location = new URL(artifactLocation); + } catch (MalformedURLException e) { + throw new IllegalArgumentException("Artifact repository location not a valid URL:" + artifactLocation); //$NON-NLS-1$ + } + IArtifactRepository repository = manager.loadRepository(location, null); + if (repository != null) { + IWritableArtifactRepository result = (IWritableArtifactRepository) repository.getAdapter(IWritableArtifactRepository.class); + if (result == null) + throw new IllegalArgumentException("Artifact repository not writeable: " + location); //$NON-NLS-1$ + provider.setArtifactRepository(result); + if (!provider.append()) + result.removeAll(); + return; + } + + // the given repo location is not an existing repo so we have to create something + // TODO for now create a Simple repo by default. + String repositoryName = artifactLocation + " - artifacts"; //$NON-NLS-1$ + IWritableArtifactRepository result = (IWritableArtifactRepository) manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.artifact.repository.simpleRepository"); //$NON-NLS-1$ + if (result != null) + provider.setArtifactRepository(result); + } + + private void initializeMetadataRepository(EclipseInstallGeneratorInfoProvider provider) { + URL location; + try { + location = new URL(metadataLocation); + } catch (MalformedURLException e) { + throw new IllegalArgumentException("Metadata repository location not a valid URL:" + artifactLocation); //$NON-NLS-1$ + } + IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.context, IMetadataRepositoryManager.class.getName()); + IMetadataRepository repository = manager.loadRepository(location, null); + if (repository != null) { + IWritableMetadataRepository result = (IWritableMetadataRepository) repository.getAdapter(IWritableMetadataRepository.class); + if (result == null) + throw new IllegalArgumentException("Metadata repository not writeable: " + location); //$NON-NLS-1$ + provider.setMetadataRepository(result); + if (!provider.append()) + result.removeAll(); + return; + } + + // the given repo location is not an existing repo so we have to create something + // TODO for now create a random repo by default. + String repositoryName = metadataLocation + " - metadata"; //$NON-NLS-1$ + IWritableMetadataRepository result = (IWritableMetadataRepository) manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.metadata.repository.simpleRepository"); //$NON-NLS-1$ + if (result != null) + provider.setMetadataRepository(result); + } + + public void stop() { + if (registrationDefaultMetadataManager != null) { + registrationDefaultMetadataManager.unregister(); + registrationDefaultMetadataManager = null; + } + if (registrationDefaultArtifactManager != null) { + registrationDefaultArtifactManager.unregister(); + registrationDefaultArtifactManager = null; + } + if (registrationBus != null) { + registrationBus.unregister(); + registrationBus = null; + } + } + +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/features/FeatureParser.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/features/FeatureParser.java new file mode 100644 index 000000000..8ef5249d5 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/features/FeatureParser.java @@ -0,0 +1,238 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.internal.prov.metadata.generator.features; + +import java.io.*; +import java.net.URL; +import javax.xml.parsers.*; +import org.eclipse.equinox.prov.metadata.generator.Feature; +import org.eclipse.equinox.prov.metadata.generator.FeatureEntry; +import org.eclipse.osgi.util.NLS; +import org.xml.sax.*; +import org.xml.sax.helpers.DefaultHandler; + +/** + * Default feature parser. + * Parses the feature manifest file as defined by the platform. + * + * @since 3.0 + */ +public class FeatureParser extends DefaultHandler { + + private SAXParser parser; + private Feature result; + private URL url; + private StringBuffer characters = null; + + private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance(); + + public FeatureParser() { + super(); + try { + parserFactory.setNamespaceAware(true); + this.parser = parserFactory.newSAXParser(); + } catch (ParserConfigurationException e) { + System.out.println(e); + } catch (SAXException e) { + System.out.println(e); + } + } + + /** + * Parses the specified url and constructs a feature + */ + public Feature parse(URL featureURL) { + result = null; + InputStream in = null; + try { + url = featureURL; + in = featureURL.openStream(); + parser.parse(new InputSource(in), this); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (in != null) + try { + in.close(); + } catch (IOException e1) { + // Utils.log(e1.getLocalizedMessage()); + } + } + return result; + } + + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + // Utils.debug("Start Element: uri:" + uri + " local Name:" + localName + " qName:" + qName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if ("plugin".equals(localName)) { //$NON-NLS-1$ + processPlugin(attributes); + } else if ("description".equals(localName)) { //$NON-NLS-1$ + processDescription(attributes); + } else if ("license".equals(localName)) { //$NON-NLS-1$ + processLicense(attributes); + } else if ("copyright".equals(localName)) { //$NON-NLS-1$ + processCopyright(attributes); + } else if ("feature".equals(localName)) { //$NON-NLS-1$ + processFeature(attributes); + } else if ("import".equals(localName)) { //$NON-NLS-1$ + processImport(attributes); + } else if ("includes".equals(localName)) { //$NON-NLS-1$ + processIncludes(attributes); + } else if ("install-handler".equals(localName)) { //$NON-NLS-1$ + processInstallHandler(attributes); + } else if ("update".equals(localName)) { //$NON-NLS-1$ + processUpdateSite(attributes); + } else if ("discovery".equals(localName)) { //$NON-NLS-1$ + processDiscoverySite(attributes); + } + } + + private void processImport(Attributes attributes) { + String id = attributes.getValue("feature"); //$NON-NLS-1$ + FeatureEntry entry = null; + if (id != null) { + entry = FeatureEntry.createRequires(id, attributes.getValue("version"), attributes.getValue("match"), attributes.getValue("filter"), false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } else { + id = attributes.getValue("plugin"); //$NON-NLS-1$ + entry = FeatureEntry.createRequires(id, attributes.getValue("version"), attributes.getValue("match"), attributes.getValue("filter"), true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + result.addEntry(entry); + } + + private void processIncludes(Attributes attributes) { + FeatureEntry entry = new FeatureEntry(attributes.getValue("id"), attributes.getValue("version"), false); //$NON-NLS-1$ //$NON-NLS-2$ + String flag = attributes.getValue("unpack"); //$NON-NLS-1$ + if (flag != null) + entry.setOptional(Boolean.valueOf(flag).booleanValue()); + setEnvironment(attributes, entry); + result.addEntry(entry); + } + + private void processInstallHandler(Attributes attributes) { + result.setInstallHandler(attributes.getValue("handler")); //$NON-NLS-1$ + result.setInstallHandlerLibrary(attributes.getValue("library")); //$NON-NLS-1$ + result.setInstallHandlerURL(attributes.getValue("url")); //$NON-NLS-1$ + } + + private void processUpdateSite(Attributes attributes) { + result.setUpdateSiteLabel(attributes.getValue("label")); //$NON-NLS-1$ + result.setUpdateSiteURL(attributes.getValue("url")); //$NON-NLS-1$ + } + + private void processDiscoverySite(Attributes attributes) { + result.addDiscoverySite(attributes.getValue("url"), attributes.getValue("label")); //$NON-NLS-1$ //$NON-NLS-2$ + } + + private void setEnvironment(Attributes attributes, FeatureEntry entry) { + String os = attributes.getValue("os"); //$NON-NLS-1$ + String ws = attributes.getValue("ws"); //$NON-NLS-1$ + String nl = attributes.getValue("nl"); //$NON-NLS-1$ + String arch = attributes.getValue("arch"); //$NON-NLS-1$ + entry.setEnvironment(os, ws, arch, nl); + } + + protected Feature createFeature(String id, String version) { + return new Feature(id, version); + } + + protected void processFeature(Attributes attributes) { + String id = attributes.getValue("id"); //$NON-NLS-1$ + String ver = attributes.getValue("version"); //$NON-NLS-1$ + + if (id == null || id.trim().equals("") //$NON-NLS-1$ + || ver == null || ver.trim().equals("")) { //$NON-NLS-1$ + // System.out.println(NLS.bind(Messages.FeatureParser_IdOrVersionInvalid, (new String[] { id, ver}))); + } else { + result = createFeature(id, ver); + + String os = attributes.getValue("os"); //$NON-NLS-1$ + String ws = attributes.getValue("ws"); //$NON-NLS-1$ + String nl = attributes.getValue("nl"); //$NON-NLS-1$ + String arch = attributes.getValue("arch"); //$NON-NLS-1$ + result.setEnvironment(os, ws, arch, nl); + + //TODO rootURLs + if ("file".equals(url.getProtocol())) { //$NON-NLS-1$ + File f = new File(url.getFile().replace('/', File.separatorChar)); + result.setURL("features" + "/" + f.getParentFile().getName() + "/");// + f.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } else { + // externalized URLs might be in relative form, ensure they are absolute + // feature.setURL(Utils.makeAbsolute(Utils.getInstallURL(), url).toExternalForm()); + } + + result.setProviderName(attributes.getValue("provider-name")); //$NON-NLS-1$ + result.setLabel(attributes.getValue("label")); //$NON-NLS-1$ + result.setImage(attributes.getValue("image")); //$NON-NLS-1$ + + // Utils.debug("End process DefaultFeature tag: id:" +id + " ver:" +ver + " url:" + feature.getURL()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + + private void processPlugin(Attributes attributes) { + String id = attributes.getValue("id"); //$NON-NLS-1$ + String version = attributes.getValue("version"); //$NON-NLS-1$ + + if (id == null || id.trim().equals("") || version == null || version.trim().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println(NLS.bind("FeatureParser#processPlugin, ID {0} or version {1} invalid", (new String[] {id, version}))); //$NON-NLS-1$ + } else { + FeatureEntry plugin = new FeatureEntry(id, version, true); + setEnvironment(attributes, plugin); + String unpack = attributes.getValue("unpack"); //$NON-NLS-1$ + if (unpack != null) + plugin.setUnpack(Boolean.valueOf(unpack).booleanValue()); + String fragment = attributes.getValue("fragment"); //$NON-NLS-1$ + if (fragment != null) + plugin.setFragment(Boolean.valueOf(fragment).booleanValue()); + String filter = attributes.getValue("filter"); //$NON-NLS-1$ + if (filter != null) + plugin.setFilter(filter); + result.addEntry(plugin); + + // Utils.debug("End process DefaultFeature tag: id:" + id + " ver:" + ver + " url:" + feature.getURL()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + + private void processLicense(Attributes attributes) { + result.setLicenseURL(attributes.getValue("url")); //$NON-NLS-1$ + characters = new StringBuffer(); + } + + private void processCopyright(Attributes attributes) { + result.setCopyrightURL(attributes.getValue("url")); //$NON-NLS-1$ + characters = new StringBuffer(); + } + + private void processDescription(Attributes attributes) { + result.setDescriptionURL(attributes.getValue("url")); //$NON-NLS-1$ + characters = new StringBuffer(); + } + + public void characters(char[] ch, int start, int length) throws SAXException { + if (characters == null) + return; + characters.append(ch, start, length); + } + + public void endElement(String uri, String localName, String qName) throws SAXException { + if (characters != null) + return; + if ("description".equals(localName)) { //$NON-NLS-1$ + result.setDescription(characters.toString().trim()); + } else if ("license".equals(localName)) { //$NON-NLS-1$ + result.setLicense(characters.toString().trim()); + } else if ("copyright".equals(localName)) { //$NON-NLS-1$ + result.setCopyright(characters.toString().trim()); + } + characters = null; + } + +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/BundleDescriptionFactory.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/BundleDescriptionFactory.java new file mode 100644 index 000000000..0f0c07611 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/BundleDescriptionFactory.java @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +import java.io.*; +import java.util.*; +import java.util.jar.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import org.eclipse.core.runtime.Path; +import org.eclipse.osgi.service.resolver.*; +import org.eclipse.osgi.util.ManifestElement; +import org.osgi.framework.BundleException; + +public class BundleDescriptionFactory { + static final String DIR = "dir"; + static final String JAR = "jar"; + static String BUNDLE_FILE_KEY = "eclipse.prov.bundle.format"; + + StateObjectFactory factory; + State state; + + public BundleDescriptionFactory(StateObjectFactory factory, State state) { + this.factory = factory; + this.state = state; + //TODO find a state and a factory when not provided + } + + public BundleDescription getBundleDescription(File bundleLocation) { + Dictionary manifest = loadManifest(bundleLocation); + if (manifest == null) + return null; + return getBundleDescription(manifest, bundleLocation); + } + + public BundleDescription getBundleDescription(InputStream manifestStream, File bundleLocation) { + Hashtable entries = new Hashtable(); + try { + ManifestElement.parseBundleManifest(manifestStream, entries); + return getBundleDescription(entries, bundleLocation); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (BundleException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + public Dictionary loadManifest(File bundleLocation) { + InputStream manifestStream = null; + ZipFile jarFile = null; + try { + if ("jar".equalsIgnoreCase(new Path(bundleLocation.getName()).getFileExtension()) && bundleLocation.isFile()) { //$NON-NLS-1$ + jarFile = new ZipFile(bundleLocation, ZipFile.OPEN_READ); + ZipEntry manifestEntry = jarFile.getEntry(JarFile.MANIFEST_NAME); + if (manifestEntry != null) { + manifestStream = jarFile.getInputStream(manifestEntry); + } + } else { + manifestStream = new BufferedInputStream(new FileInputStream(new File(bundleLocation, JarFile.MANIFEST_NAME))); + } + } catch (IOException e) { + //ignore + } + + if (manifestStream == null) + return null; + try { + Dictionary manifest = manifestToProperties(new Manifest(manifestStream).getMainAttributes()); + // remember the format of the bundle as we found it + manifest.put(BUNDLE_FILE_KEY, bundleLocation.isDirectory() ? DIR : JAR); + return manifest; + } catch (IOException ioe) { + return null; + } finally { + try { + manifestStream.close(); + } catch (IOException e1) { + //Ignore + } + try { + if (jarFile != null) + jarFile.close(); + } catch (IOException e2) { + //Ignore + } + } + } + + private Properties manifestToProperties(Attributes attributes) { + Properties result = new Properties(); + for (Iterator i = attributes.keySet().iterator(); i.hasNext();) { + Attributes.Name key = (Attributes.Name) i.next(); + result.put(key.toString(), attributes.get(key)); + } + return result; + } + + public BundleDescription getBundleDescription(Dictionary enhancedManifest, File bundleLocation) { + try { + BundleDescription descriptor = factory.createBundleDescription(state, enhancedManifest, bundleLocation != null ? bundleLocation.getAbsolutePath() : null, 1); //TODO Do we need to have a real bundle id + descriptor.setUserObject(enhancedManifest); + return descriptor; + } catch (BundleException e) { + // IStatus status = new Status(IStatus.WARNING, IPDEBuildConstants.PI_PDEBUILD, EXCEPTION_STATE_PROBLEM, NLS.bind(Messages.exception_stateAddition, enhancedManifest.get(Constants.BUNDLE_NAME)), e); + // BundleHelper.getDefault().getLog().log(status); + System.err.println("An error has occured while adding the bundle" + bundleLocation != null ? bundleLocation.getAbsoluteFile() : null); + return null; + } + } +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/EclipseInstallGeneratorInfoProvider.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/EclipseInstallGeneratorInfoProvider.java new file mode 100644 index 000000000..4117eeda1 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/EclipseInstallGeneratorInfoProvider.java @@ -0,0 +1,358 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +import java.io.File; +import java.io.IOException; +import java.util.*; +import org.eclipse.equinox.frameworkadmin.*; +import org.eclipse.equinox.internal.prov.metadata.generator.Activator; +import org.eclipse.equinox.prov.artifact.repository.IWritableArtifactRepository; +import org.eclipse.equinox.prov.core.helpers.ServiceHelper; +import org.eclipse.equinox.prov.metadata.IInstallableUnit; +import org.eclipse.equinox.prov.metadata.InstallableUnit; +import org.eclipse.equinox.prov.metadata.repository.IWritableMetadataRepository; +import org.eclipse.osgi.service.environment.EnvironmentInfo; +import org.osgi.framework.*; +import org.osgi.util.tracker.ServiceTracker; + +public class EclipseInstallGeneratorInfoProvider implements IGeneratorInfo { + private static final String ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR = "org.eclipse.equinox.simpleconfigurator"; + + private final static String FILTER_OBJECTCLASS = "(" + Constants.OBJECTCLASS + "=" + FrameworkAdmin.class.getName() + ")"; + private final static String filterFwName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_FW_NAME + "=Equinox)"; + //String filterFwVersion = "(" + FrameworkAdmin.SERVICE_PROP_KEY_FW_VERSION + "=" + props.getProperty("equinox.fw.version") + ")"; + private final static String filterLauncherName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_NAME + "=Eclipse.exe)"; + //String filterLauncherVersion = "(" + FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_VERSION + "=" + props.getProperty("equinox.launcher.version") + ")"; + private final static String frameworkAdminFillter = "(&" + FILTER_OBJECTCLASS + filterFwName + filterLauncherName + ")"; + + private ServiceTracker frameworkAdminTracker; + private Manipulator manipulator; + private ArrayList defaultIUs; + + private File baseLocation; + private File[] bundleLocations; + private File featuresLocation; + private File configLocation; + private File executableLocation; + private String flavor; + private String rootId; + private String rootVersion; + private boolean publishArtifacts = false; + private boolean publishArtifactRepo = false; + private boolean append = false; + private String[][] mappingRules; + private boolean addDefaultIUs = true; + private IWritableMetadataRepository metadataRepository; + private IWritableArtifactRepository artifactRepository; + private static String os; + + public EclipseInstallGeneratorInfoProvider() { + super(); + } + + /** + * Returns a default name for the executable. + */ + public static String getDefaultExecutableName() { + String theOS = os; + if (theOS == null) { + EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName()); + theOS = info.getOS(); + } + if (theOS.equalsIgnoreCase("win32")) //$NON-NLS-1$ + return "eclipse.exe"; //$NON-NLS-1$ + //FIXME Is this a reasonable default for all non-Windows platforms? + return "eclipse"; //$NON-NLS-1$ + } + + public void initialize(File base) { + initialize(base, new File(base, "configuration"), new File(base, getDefaultExecutableName()), new File[] {new File(base, "plugins")}, new File(base, "features")); + } + + public void initialize(File base, File config, File executable, File[] bundleLocations, File features) { + // TODO + if (base == null || !base.exists()) + throw new RuntimeException("Source directory is invalid: " + base.getAbsolutePath()); + this.baseLocation = base; + if (config == null || config.exists()) + this.configLocation = config; + if (executable == null || executable.exists()) + this.executableLocation = executable; + this.bundleLocations = bundleLocations; + this.featuresLocation = features; + + expandBundleLocations(); + + // if the config or exe are not set then we cannot be generating any data related to the config so + // don't bother setting up the manipulator. In fact, the manipulator will likely be invalid without + // these locations. + if (configLocation == null || executableLocation == null) + return; + + createFrameworkManipulator(); + + LauncherData launcherData = manipulator.getLauncherData(); + launcherData.setFwPersistentDataLocation(configLocation, true); + launcherData.setLauncher(executableLocation); + try { + manipulator.load(); + } catch (IllegalStateException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (FrameworkAdminRuntimeException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + } + + private void expandBundleLocations() { + ArrayList result = new ArrayList(); + for (int i = 0; i < bundleLocations.length; i++) { + File location = bundleLocations[i]; + if (location.isDirectory()) { + File[] list = location.listFiles(); + for (int j = 0; j < list.length; j++) + result.add(list[j]); + } else { + result.add(location); + } + } + bundleLocations = (File[]) result.toArray(new File[result.size()]); + } + + public ArrayList getDefaultIUs(Set ius) { + if (defaultIUs != null) + return defaultIUs; + defaultIUs = new ArrayList(5); + if (addDefaultIUs) { + defaultIUs.addAll(createLauncherBundleInfo(ius)); + defaultIUs.add(createLauncher()); + defaultIUs.add(createSimpleConfigurator()); + // defaultIUs.add(createDefaultConfigurationBundleInfo()); + // defaultIUs.add(createDefaultUnconfigurationBundleInfo()); + } + return defaultIUs; + } + + protected GeneratorBundleInfo createDefaultConfigurationBundleInfo() { + GeneratorBundleInfo result = new GeneratorBundleInfo(); + result.setSymbolicName("defaultConfigure"); + result.setVersion("1.0.0"); + result.setStartLevel(4); + result.setSpecialConfigCommands("manipulator.getConfigData().addBundle(bundleToInstall);"); + return result; + } + + protected GeneratorBundleInfo createDefaultUnconfigurationBundleInfo() { + GeneratorBundleInfo result = new GeneratorBundleInfo(); + result.setSymbolicName("defaultUnconfigure"); + result.setVersion("1.0.0"); + result.setSpecialConfigCommands("manipulator.getConfigData().removeBundle(bundleToRemove);"); + return result; + } + + /** + * Obtains the framework manipulator instance. Throws an exception + * if it could not be created. + */ + private void createFrameworkManipulator() { + FrameworkAdmin admin = getFrameworkAdmin(); + if (admin == null) + throw new RuntimeException("Framework admin service not found"); //$NON-NLS-1$ + manipulator = admin.getManipulator(); + if (manipulator == null) + throw new RuntimeException("Framework manipulator not found"); //$NON-NLS-1$ + } + + private FrameworkAdmin getFrameworkAdmin() { + if (frameworkAdminTracker == null) { + try { + Filter filter = Activator.getContext().createFilter(frameworkAdminFillter); + frameworkAdminTracker = new ServiceTracker(Activator.getContext(), filter, null); + frameworkAdminTracker.open(); + } catch (InvalidSyntaxException e) { + // never happens + e.printStackTrace(); + } + } + // try { + // frameworkAdminTracker.waitForService(500); + // } catch (InterruptedException e) { + // // ignore + // } + return (FrameworkAdmin) frameworkAdminTracker.getService(); + } + + public ConfigData getConfigData() { + return manipulator == null ? null : manipulator.getConfigData(); + } + + public LauncherData getLauncherData() { + return manipulator == null ? null : manipulator.getLauncherData(); + } + + private Collection createLauncherBundleInfo(Set ius) { + Collection result = new HashSet(); + Collection launchers = getIUs(ius, "org.eclipse.equinox.launcher."); + for (Iterator iterator = launchers.iterator(); iterator.hasNext();) { + InstallableUnit object = (InstallableUnit) iterator.next(); + GeneratorBundleInfo temp = new GeneratorBundleInfo(); + temp.setSymbolicName(object.getId()); + temp.setVersion(object.getVersion().toString()); + temp.setSpecialConfigCommands("manipulator.getLauncherData().addProgramArg('--launcher.library');manipulator.getLauncherData().addProgramArg(artifact);"); + result.add(temp); + } + return result; + } + + private Collection getIUs(Set ius, String prefix) { + Set result = new HashSet(); + for (Iterator iterator = ius.iterator(); iterator.hasNext();) { + IInstallableUnit tmp = (IInstallableUnit) iterator.next(); + if (tmp.getId().startsWith(prefix)) + result.add(tmp); + } + return result; + } + + private GeneratorBundleInfo createLauncher() { + GeneratorBundleInfo result = new GeneratorBundleInfo(); + result.setSymbolicName("org.eclipse.equinox.launcher"); + result.setVersion("0.0.0"); + //result.setSpecialConfigCommands("manipulator.addProgramArgument('-startup'); manipulator.addProgramArgument(artifact);"); + result.setSpecialConfigCommands("manipulator.getLauncherData().addProgramArg('-startup');manipulator.getLauncherData().addProgramArg(artifact);"); + return result; + } + + private GeneratorBundleInfo createSimpleConfigurator() { + GeneratorBundleInfo result = new GeneratorBundleInfo(); + result.setSymbolicName(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR); + result.setVersion("0.0.0"); + result.setStartLevel(1); + result.setMarkedAsStarted(true); + result.setSpecialConfigCommands("manipulator.getLauncherData().addJvmArg('-Dorg.eclipse.equinox.simpleconfigurator.useReference=true');"); + return result; + } + + public File getBaseLocation() { + return baseLocation; + } + + public File[] getBundleLocations() { + return bundleLocations; + } + + public File getFeaturesLocation() { + return featuresLocation; + } + + public File getConfigurationLocation() { + return configLocation; + } + + public File getExecutableLocation() { + return executableLocation; + } + + public boolean publishArtifacts() { + return publishArtifacts; + } + + public boolean addDefaultIUs() { + return addDefaultIUs; + } + + public boolean publishArtifactRepository() { + return publishArtifactRepo; + } + + public String getRootId() { + return rootId; + } + + public String getRootVersion() { + if (rootVersion == null) + return "0.0.0"; //$NON-NLS-1$ + return rootVersion; + } + + public String getFlavor() { + return flavor; + } + + public void setMetadataRepository(IWritableMetadataRepository value) { + metadataRepository = value; + } + + public void setArtifactRepository(IWritableArtifactRepository value) { + artifactRepository = value; + } + + public void setFlavor(String value) { + flavor = value; + } + + public void setRootId(String value) { + rootId = value; + } + + public void setRootVersion(String value) { + rootVersion = value; + } + + public void setPublishArtifacts(boolean value) { + publishArtifacts = value; + } + + public void setPublishArtifactRepository(boolean value) { + publishArtifactRepo = value; + } + + public boolean append() { + return append; + } + + public String[][] getMappingRules() { + return mappingRules; + } + + public void setMappingRules(String[][] value) { + mappingRules = value; + } + + public void setExecutableLocation(String value) { + executableLocation = new File(value); + } + + public void setAppend(boolean value) { + append = value; + } + + public void setAddDefaultIUs(boolean value) { + addDefaultIUs = value; + } + + public IWritableArtifactRepository getArtifactRepository() { + return artifactRepository; + } + + public IWritableMetadataRepository getMetadataRepository() { + return metadataRepository; + } + + public void setOS(String os) { + this.os = os; + } +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Feature.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Feature.java new file mode 100644 index 000000000..289e1243c --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Feature.java @@ -0,0 +1,271 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +import java.util.ArrayList; + +/** + * + * Feature information + */ +public class Feature implements IPlatformEntry { + + private String id; + private String version; + private String label; + private String image; + + private URLEntry description; + private URLEntry license; + private URLEntry copyright; + + private String installHandler; + private String installHandlerURL; + private String installHandlerLibrary; + + private URLEntry updateSite; + private ArrayList discoverySites; + + private ArrayList entries; + private String name; + private String providerName; + private String os; + private String ws; + private String arch; + private String nl; + + public Feature(String id, String version) { + if (id == null) + throw new IllegalArgumentException(); + this.id = id; + this.version = version; + } + + public void addEntry(FeatureEntry plugin) { + if (entries == null) + entries = new ArrayList(); + entries.add(plugin); + } + + public FeatureEntry[] getEntries() { + return (FeatureEntry[]) entries.toArray(new FeatureEntry[entries.size()]); + } + + public void setLabel(String label) { + this.label = label; + } + + public String getLabel() { + return label; + } + + public void setImage(String image) { + this.image = image; + } + + public String getImage() { + return image; + } + + public void setDescription(String description) { + if (this.description == null) + this.description = new URLEntry(); + this.description.setAnnotation(description); + } + + public String getDescription() { + if (description != null) + return description.getAnnotation(); + return null; + } + + public String getDescriptionURL() { + if (description != null) + return description.getURL(); + return null; + } + + public void setDescriptionURL(String descriptionURL) { + if (this.description == null) + this.description = new URLEntry(); + this.description.setURL(descriptionURL); + } + + public String getName() { + return name; + } + + public String getProviderName() { + return providerName; + } + + public void setProviderName(String value) { + providerName = value; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getId() { + return id; + } + + public void setLicenseURL(String licenseURL) { + if (this.license == null) + this.license = new URLEntry(); + this.license.setURL(licenseURL); + } + + public String getLicenseURL() { + if (license != null) + return license.getURL(); + return null; + } + + public void setLicense(String license) { + if (this.license == null) + this.license = new URLEntry(); + this.license.setAnnotation(license); + } + + public String getLicense() { + if (license != null) + return license.getAnnotation(); + return null; + } + + public void setCopyright(String copyright) { + if (this.copyright == null) + this.copyright = new URLEntry(); + this.copyright.setAnnotation(copyright); + } + + public void setCopyrightURL(String copyrightURL) { + if (this.copyright == null) + this.copyright = new URLEntry(); + this.copyright.setURL(copyrightURL); + } + + public String getCopyright() { + if (copyright != null) + return copyright.getAnnotation(); + return null; + } + + public String getCopyrightURL() { + if (copyright != null) + return copyright.getURL(); + return null; + } + + public void setInstallHandler(String installHandler) { + this.installHandler = installHandler; + } + + public void setInstallHandlerLibrary(String installHandlerLibrary) { + this.installHandlerLibrary = installHandlerLibrary; + } + + public void setInstallHandlerURL(String installHandlerURL) { + this.installHandlerURL = installHandlerURL; + } + + public String getInstallHandler() { + return installHandler; + } + + public String getInstallHandlerLibrary() { + return installHandlerLibrary; + } + + public String getInstallHandlerURL() { + return installHandlerURL; + } + + public void setUpdateSiteLabel(String updateSiteLabel) { + if (this.updateSite == null) + this.updateSite = new URLEntry(); + this.updateSite.setAnnotation(updateSiteLabel); + } + + public void setUpdateSiteURL(String updateSiteURL) { + if (this.updateSite == null) + this.updateSite = new URLEntry(); + this.updateSite.setURL(updateSiteURL); + } + + public String getUpdateSiteLabel() { + if (updateSite != null) + return updateSite.getAnnotation(); + return null; + } + + public String getUpdateSiteURL() { + if (updateSite != null) + return updateSite.getURL(); + return null; + } + + public void addDiscoverySite(String label, String url) { + if (label == null && url == null) + return; + + if (this.discoverySites == null) + this.discoverySites = new ArrayList(); + + URLEntry entry = new URLEntry(url, label); + this.discoverySites.add(entry); + } + + public URLEntry[] getDiscoverySites() { + if (discoverySites == null) + return new URLEntry[0]; + return (URLEntry[]) discoverySites.toArray(new URLEntry[discoverySites.size()]); + } + + public void setEnvironment(String os, String ws, String arch, String nl) { + this.os = os; + this.ws = ws; + this.arch = arch; + this.nl = nl; + } + + public String getOS() { + return os; + } + + public String getWS() { + return ws; + } + + public String getArch() { + return arch; + } + + public String getNL() { + return nl; + } + + public void setURL(String value) { + } + + /** + * For debugging purposes only. + */ + public String toString() { + return "Feature " + id + " version: " + version; //$NON-NLS-1$ //$NON-NLS-2$ + } +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/FeatureEntry.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/FeatureEntry.java new file mode 100644 index 000000000..b7bdfd373 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/FeatureEntry.java @@ -0,0 +1,175 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + ******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +/** + */ +public class FeatureEntry implements IPlatformEntry { + private String id; + private String version; + private String url; + private String os; + private String ws; + private String arch; + private String nl; + private String match; + private boolean isPlugin; + private boolean isFragment = false; + private boolean isRequires = false; + private boolean unpack = true; + private boolean optional = false; + + /** + * Temporary field to add provisioning filters to features + */ + private String filter; + + public static FeatureEntry createRequires(String id, String version, String match, String filter, boolean isPlugin) { + FeatureEntry result = new FeatureEntry(id, version, isPlugin); + result.match = match; + result.isRequires = true; + if (filter != null) + result.setFilter(filter); + return result; + } + + public FeatureEntry(String id, String version, boolean isPlugin) { + this.id = id; + this.version = version; + this.isPlugin = isPlugin; + } + + public String getURL() { + return url; + } + + public void setURL(String value) { + url = value; + } + + public String getId() { + return id; + } + + public String getVersion() { + return version; + } + + public boolean isPlugin() { + return isPlugin; + } + + public boolean isRequires() { + return isRequires; + } + + public boolean isFragment() { + return isFragment; + } + + public String toString() { + StringBuffer result = new StringBuffer(); + + result.append(isPlugin ? "Plugin: " : "Feature: "); //$NON-NLS-1$ + result.append(id != null ? id.toString() : ""); //$NON-NLS-1$ + result.append(version != null ? " " + version.toString() : ""); //$NON-NLS-1$ //$NON-NLS-2$ + return result.toString(); + } + + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((version == null) ? 0 : version.hashCode()); + return result; + } + + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final FeatureEntry other = (FeatureEntry) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (version == null) { + if (other.version != null) + return false; + } else if (!version.equals(other.version)) + return false; + return true; + } + + public void setEnvironment(String os, String ws, String arch, String nl) { + this.os = os; + this.ws = ws; + this.arch = arch; + this.nl = nl; + } + + public void setFragment(boolean value) { + isFragment = value; + } + + public void setUnpack(boolean value) { + unpack = value; + } + + public boolean isUnpack() { + return unpack; + } + + public void setOptional(boolean value) { + optional = value; + } + + /** + * Temporary method to add provisioning filters to features + */ + public void setFilter(String filter) { + this.filter = filter; + + } + + /** + * Temporary method to add provisioning filters to features + */ + public String getFilter() { + return filter; + } + + public String getMatch() { + return match; + } + + public boolean isOptional() { + return optional; + } + + public String getOS() { + return os; + } + + public String getWS() { + return ws; + } + + public String getArch() { + return arch; + } + + public String getNL() { + return nl; + } +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java new file mode 100644 index 000000000..b2f85fe99 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java @@ -0,0 +1,338 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + ******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +import java.io.*; +import java.net.MalformedURLException; +import java.util.*; +import java.util.Map.Entry; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.frameworkadmin.*; +import org.eclipse.equinox.internal.prov.metadata.generator.Activator; +import org.eclipse.equinox.internal.prov.metadata.generator.features.FeatureParser; +import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor; +import org.eclipse.equinox.prov.artifact.repository.IWritableArtifactRepository; +import org.eclipse.equinox.prov.core.helpers.FileUtils; +import org.eclipse.equinox.prov.core.helpers.ServiceHelper; +import org.eclipse.equinox.prov.metadata.*; +import org.eclipse.osgi.service.resolver.*; +import org.osgi.framework.Version; + +public class Generator { + + private static final Version ECLIPSE_TOUCHPOINT_VERSION = new Version(1, 0, 0); + private static final String ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR = "org.eclipse.equinox.simpleconfigurator"; + private static final String ORG_ECLIPSE_UPDATE_CONFIGURATOR = "org.eclipse.update.configurator"; + // private static String[][] defaultMappingRules = new String[][] { {"(& (namespace=eclipse) (classifier=feature))", "${repoUrl}/feature/${id}_${version}"}, {"(& (namespace=eclipse) (classifier=plugin))", "${repoUrl}/plugin/${id}_${version}"}, {"(& (namespace=eclipse) (classifier=native))", "${repoUrl}/native/${id}_${version}"}}; + + private StateObjectFactory stateObjectFactory; + private IGeneratorInfo info; + + public Generator(IGeneratorInfo infoProvider) { + this.info = infoProvider; + // TODO need to figure a better way of configuring the generator... + PlatformAdmin platformAdmin = (PlatformAdmin) ServiceHelper.getService(Activator.getContext(), PlatformAdmin.class.getName()); + if (platformAdmin != null) { + stateObjectFactory = platformAdmin.getFactory(); + } + } + + public IStatus generate() { + Set ius = new HashSet(); + + Feature[] features = getFeatures(info.getFeaturesLocation()); + generateFeatureIUs(features, ius); + + BundleDescription[] bundles = getBundleDescriptions(info.getBundleLocations()); + generateBundleIUs(bundles, ius, info.getArtifactRepository()); + + generateNativeIUs(info.getExecutableLocation(), ius, info.getArtifactRepository()); + + generateConfigIUs(info.getConfigData() == null ? null : info.getConfigData().getBundles(), ius); + + if (info.addDefaultIUs()) + generateDefaultConfigIU(ius, info); + + generateRootIU(ius, info.getRootId(), info.getRootVersion()); + + // persistence.setMappingRules(info.getMappingRules() == null ? defaultMappingRules : info.getMappingRules()); + // if (info.publishArtifacts() || info.publishArtifactRepository()) { + // persistence.saveArtifactRepository(); + // } + info.getMetadataRepository().addInstallableUnits((InstallableUnit[]) ius.toArray(new InstallableUnit[ius.size()])); + + return Status.OK_STATUS; + } + + private void generateDefaultConfigIU(Set ius, IGeneratorInfo info) { + // TODO this is a bit of a hack. We need to have the default IU fragment generated with code that configures + // and unconfigures. the Generator should be decoupled from any particular provider but it is not clear + // that we should add the create* methods to IGeneratorInfo... + // MockBundleDescription bd1 = new MockBundleDescription("defaultConfigure"); + // MockBundleDescription bd2 = new MockBundleDescription("defaultUnconfigure"); + EclipseInstallGeneratorInfoProvider provider = (EclipseInstallGeneratorInfoProvider) info; + ius.add(MetadataGeneratorHelper.createEclipseDefaultConfigurationUnit(provider.createDefaultConfigurationBundleInfo(), provider.createDefaultUnconfigurationBundleInfo(), info.getFlavor())); + } + + private Feature[] getFeatures(File folder) { + if (folder == null || !folder.exists()) + return new Feature[0]; + File[] locations = folder.listFiles(); + ArrayList result = new ArrayList(locations.length); + for (int i = 0; i < locations.length; i++) { + FeatureParser parser = new FeatureParser(); + try { + result.add(parser.parse(new File(locations[i], "feature.xml").toURL())); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } + return (Feature[]) result.toArray(new Feature[result.size()]); + } + + protected void generateFeatureIUs(Feature[] features, Set resultantIUs) { + for (int i = 0; i < features.length; i++) { + Feature feature = features[i]; + resultantIUs.add(MetadataGeneratorHelper.createGroupIU(feature)); + } + } + + protected BundleDescription[] getBundleDescriptions(File[] bundleLocations) { + boolean addSimpleConfigurator = false; + for (int i = 0; i < bundleLocations.length; i++) { + addSimpleConfigurator = bundleLocations[i].toString().indexOf(ORG_ECLIPSE_UPDATE_CONFIGURATOR) > 0; + if (addSimpleConfigurator) + break; + } + BundleDescription[] result = new BundleDescription[bundleLocations.length + (addSimpleConfigurator ? 1 : 0)]; + BundleDescriptionFactory factory = getBundleFactory(); + for (int i = 0; i < bundleLocations.length; i++) + result[i] = factory.getBundleDescription(bundleLocations[i]); + if (addSimpleConfigurator) { + //Add simple configurator to the list of bundles + try { + File location = new File(FileLocator.toFileURL(Activator.getContext().getBundle().getEntry(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR + ".jar")).getFile()); + result[result.length - 1] = factory.getBundleDescription(location); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + protected BundleDescriptionFactory getBundleFactory() { + BundleDescriptionFactory factory = new BundleDescriptionFactory(stateObjectFactory, null); + return factory; + } + + protected void generateRootIU(Set resultantIUs, String rootIUId, String rootIUVersion) { + if (rootIUId == null) + return; + resultantIUs.add(createTopLevelIU(resultantIUs, rootIUId, rootIUVersion)); + } + + protected void generateNativeIUs(File executableLocation, Set resultantIUs, IWritableArtifactRepository destination) { + if (executableLocation == null) + return; + HashSet newArtifacts = new HashSet(); + + //generate data for JRE + File jreLocation = new File(executableLocation.getParentFile(), "jre"); + MetadataGeneratorHelper.createJREData(jreLocation, resultantIUs, newArtifacts); + publishArtifact(jreLocation, newArtifacts); + newArtifacts.clear(); + + //generate data for executable launcher + MetadataGeneratorHelper.createLauncherData(executableLocation, info.getFlavor(), resultantIUs, newArtifacts); + publishArtifact(executableLocation, newArtifacts); + } + + private void publishArtifact(File location, Set artifacts) { + if (!info.publishArtifacts() || artifacts.isEmpty()) + return; + for (Iterator i = artifacts.iterator(); i.hasNext();) { + IArtifactDescriptor descriptor = (IArtifactDescriptor) i.next(); + publishArtifact(descriptor, location, info.getArtifactRepository(), false, true); + } + } + + protected void generateConfigIUs(BundleInfo[] infos, Set resultantIUs) { + if (infos == null) + return; + for (int i = 0; i < infos.length; i++) { + GeneratorBundleInfo bundle = new GeneratorBundleInfo(infos[i]); + if (bundle.getSymbolicName().equals(ORG_ECLIPSE_UPDATE_CONFIGURATOR)) { + bundle.setStartLevel(BundleInfo.NO_LEVEL); + bundle.setMarkedAsStarted(false); + bundle.setSpecialConfigCommands("manipulator.getLauncherData().addJvmArg('-Dorg.eclipse.update.reconcile=false');"); + } + if (bundle.getSymbolicName().equals(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR)) { + bundle.setSpecialConfigCommands("manipulator.getLauncherData().addJvmArg('-Dorg.eclipse.equinox.simpleconfigurator.useReference=true');"); + } + IInstallableUnit cu = MetadataGeneratorHelper.createEclipseConfigurationUnit(bundle.getSymbolicName(), new Version(bundle.getVersion()), false, bundle, info.getFlavor()); + if (cu != null) + resultantIUs.add(cu); + } + + if (info.addDefaultIUs()) { + for (Iterator iterator = info.getDefaultIUs(resultantIUs).iterator(); iterator.hasNext();) { + GeneratorBundleInfo bundle = (GeneratorBundleInfo) iterator.next(); + InstallableUnit configuredIU = getIU(resultantIUs, bundle.getSymbolicName()); + if (configuredIU != null) + bundle.setVersion(configuredIU.getVersion().toString()); + IInstallableUnit cu = MetadataGeneratorHelper.createEclipseConfigurationUnit(bundle.getSymbolicName(), new Version(bundle.getVersion()), false, bundle, info.getFlavor()); + if (cu != null) + resultantIUs.add(cu); + } + } + } + + private InstallableUnit getIU(Set ius, String id) { + for (Iterator iterator = ius.iterator(); iterator.hasNext();) { + InstallableUnit tmp = (InstallableUnit) iterator.next(); + if (tmp.getId().equals(id)) + return tmp; + } + return null; + } + + protected void generateBundleIUs(BundleDescription[] bundles, Set resultantIUs, IWritableArtifactRepository destination) { + for (int i = 0; i < bundles.length; i++) { + BundleDescription bd = bundles[i]; + // A bundle may be null if the associated plug-in does not have a manifest file - + // for example, org.eclipse.jdt.launching.j9 + if (bd != null) { + String format = (String) ((Dictionary) bd.getUserObject()).get(BundleDescriptionFactory.BUNDLE_FILE_KEY); + boolean isDir = format.equals(BundleDescriptionFactory.DIR) ? true : false; + IArtifactKey key = MetadataGeneratorHelper.createEclipseArtifactKey(bd.getSymbolicName(), bd.getVersion().toString()); + IArtifactDescriptor ad = MetadataGeneratorHelper.createArtifactDescriptor(key, new File(bd.getLocation()), true, false); + if (info.publishArtifacts()) + // publishArtifact(info.getArtifactRepoLocation().getParentFile(), new File(bd.getLocation()), key.getClassifier(), key.getId() + "_" + key.getVersion().toString(), !isDir, true); + publishArtifact(ad, new File(bd.getLocation()), destination, !isDir, true); + else + destination.addDescriptor(ad); + + IInstallableUnit iu = MetadataGeneratorHelper.createEclipseIU(bd, (Map) bd.getUserObject(), isDir, key); + resultantIUs.add(iu); + } + } + } + + protected InstallableUnit createTopLevelIU(Set resultantIUs, String configurationIdentification, String configurationVersion) { + InstallableUnit iu = new InstallableUnit(); + iu.setSingleton(true); + iu.setId(configurationIdentification); + iu.setVersion(new Version(configurationVersion)); + + ArrayList reqsConfigurationUnits = new ArrayList(resultantIUs.size()); + for (Iterator iterator = resultantIUs.iterator(); iterator.hasNext();) { + InstallableUnit tmp = (InstallableUnit) iterator.next(); + reqsConfigurationUnits.add(RequiredCapability.createRequiredCapabilityForName(tmp.getId(), new VersionRange(tmp.getVersion(), true, tmp.getVersion(), true), false)); + } + iu.setRequiredCapabilities((RequiredCapability[]) reqsConfigurationUnits.toArray(new RequiredCapability[reqsConfigurationUnits.size()])); + iu.setApplicabilityFilter(""); + iu.setArtifacts(new IArtifactKey[0]); + + iu.setProperty("lineUp", "true"); + iu.setProperty(IInstallableUnitConstants.UPDATE_FROM, configurationIdentification); + iu.setProperty(IInstallableUnitConstants.UPDATE_RANGE, VersionRange.emptyRange.toString()); + ProvidedCapability groupCapability = new ProvidedCapability(IInstallableUnit.IU_KIND_NAMESPACE, "group", new Version("1.0.0")); + iu.setCapabilities(new ProvidedCapability[] {groupCapability}); + iu.setTouchpointType(new TouchpointType("eclipse", ECLIPSE_TOUCHPOINT_VERSION)); + Map touchpointData = new HashMap(); + + String configurationData = ""; + + ConfigData configData = info.getConfigData(); + if (configData != null) { + for (Iterator iterator = configData.getFwDependentProps().entrySet().iterator(); iterator.hasNext();) { + Entry aProperty = (Entry) iterator.next(); + String key = ((String) aProperty.getKey()); + if (key.equals("osgi.frameworkClassPath") || key.equals("osgi.framework") || key.equals("osgi.bundles") || key.equals("eof")) + continue; + configurationData += "manipulator.getConfigData().setFwDependentProp('" + key + "', '" + ((String) aProperty.getValue()) + "');"; + } + for (Iterator iterator = configData.getFwIndependentProps().entrySet().iterator(); iterator.hasNext();) { + Entry aProperty = (Entry) iterator.next(); + String key = ((String) aProperty.getKey()); + if (key.equals("osgi.frameworkClassPath") || key.equals("osgi.framework") || key.equals("osgi.bundles") || key.equals("eof")) + continue; + configurationData += "manipulator.getConfigData().setFwIndependentProp('" + key + "', '" + ((String) aProperty.getValue()) + "');"; + } + } + + LauncherData launcherData = info.getLauncherData(); + if (launcherData != null) { + final String[] jvmArgs = launcherData.getJvmArgs(); + for (int i = 0; i < jvmArgs.length; i++) + configurationData += "manipulator.getLauncherData().addJvmArg('" + jvmArgs[i] + "');"; + + final String[] programArgs = launcherData.getProgramArgs(); + for (int i = 0; i < programArgs.length; i++) { + String programArg = programArgs[i]; + if (programArg.equals("--launcher.library") || programArg.equals("-startup") || programArg.equals("-configuration")) + i++; + configurationData += "manipulator.getLauncherData().addProgramArg('" + programArg + "');"; + } + } + touchpointData.put("configurationData", configurationData); + iu.setImmutableTouchpointData(new TouchpointData(touchpointData)); + return iu; + } + + // Put the artifact on the server + protected void publishArtifact(IArtifactDescriptor descriptor, File bundlePath, IWritableArtifactRepository destination, boolean asIs, boolean recurse) { + // key.getClassifier(), key.getId() + '_' + key.getVersion().toString() + if (asIs) { + try { + if (!destination.contains(descriptor)) { + OutputStream output = destination.getOutputStream(descriptor); + if (output == null) + throw new IOException("unable to open output stream for " + descriptor); + FileUtils.copyStream(new BufferedInputStream(new FileInputStream(bundlePath)), true, new BufferedOutputStream(output), true); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + File tempFile = null; + try { + tempFile = File.createTempFile("work", ""); + if (recurse) + FileUtils.zip(new File[] {bundlePath}, tempFile); + else + FileUtils.zip(bundlePath.listFiles(new FileFilter() { + public boolean accept(File pathname) { + if (pathname.isFile()) + return true; + return false; + } + }), tempFile); + if (!destination.contains(descriptor)) { + OutputStream output = destination.getOutputStream(descriptor); + if (output == null) + throw new IOException("unable to open output stream for " + descriptor); + FileUtils.copyStream(new BufferedInputStream(new FileInputStream(tempFile)), true, new BufferedOutputStream(output), true); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + if (tempFile != null) + tempFile.delete(); + } + } + } + + protected IGeneratorInfo getGeneratorInfo() { + return info; + } +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/GeneratorBundleInfo.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/GeneratorBundleInfo.java new file mode 100644 index 000000000..11009c567 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/GeneratorBundleInfo.java @@ -0,0 +1,150 @@ +/******************************************************************************* + * Copyright (c) 2006, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +import java.io.ByteArrayInputStream; +import org.eclipse.equinox.frameworkadmin.BundleInfo; +import org.eclipse.equinox.prov.core.helpers.Headers; +import org.eclipse.osgi.util.ManifestElement; +import org.osgi.framework.BundleException; +import org.osgi.framework.Constants; + +public class GeneratorBundleInfo extends BundleInfo { + // public static final int NO_LEVEL = -1; + + // private String symbolicName; + // private String version; + // private String location; + // private int expectedState; + // private int startLevel = NO_LEVEL; + // private String manifest; + + private String specialConfigCommands; + + public GeneratorBundleInfo(BundleInfo bInfo) { + super.setBundleId(bInfo.getBundleId()); + super.setLocation(bInfo.getLocation()); + super.setManifest(bInfo.getManifest()); + super.setMarkedAsStarted(bInfo.isMarkedAsStarted()); + super.setResolved(bInfo.isResolved()); + super.setStartLevel(bInfo.getStartLevel()); + super.setSymbolicName(bInfo.getSymbolicName()); + super.setVersion(bInfo.getVersion()); + } + + public GeneratorBundleInfo() { + // TODO Auto-generated constructor stub + } + + // /* (non-Javadoc) + // * @see java.lang.Object#hashCode() + // */ + // public int hashCode() { + // int result = symbolicName == null ? 0 : symbolicName.hashCode(); + // result = result + (version == null ? 0 : version.hashCode()); + // result = result + (location == null ? 0 : location.hashCode()); + // return result; + // } + // + // public String getSymbolicName() { + // return symbolicName; + // } + // + // public String getVersion() { + // return version; + // } + // + // public int expectedState() { + // return expectedState; + // } + // + // public int getStartLevel() { + // return startLevel; + // } + // + // public String getLocation() { + // return location; + // } + // + // public void setSymbolicName(String id) { + // symbolicName = id; + // } + // + // public void setVersion(String version) { + // this.version = version; + // } + // + // public void setExpectedState(int state) { + // expectedState = state; + // } + // + // public void setStartLevel(int level) { + // this.startLevel = level; + // } + // + // public void setLocation(String location) { + // this.location = location; + // } + // + // public void setManifest(String manifest) { + // this.manifest = manifest; + // } + // + // public String getManifest() { + // return manifest; + // } + // + public String getSpecialConfigCommands() { + return specialConfigCommands; + } + + public void setSpecialConfigCommands(String specialConfigCommands) { + this.specialConfigCommands = specialConfigCommands; + } + + // /* (non-Javadoc) + // * @see java.lang.Object#equals(java.lang.Object) + // */ + // public boolean equals(Object toCompare) { + // if (toCompare instanceof GeneratorBundleInfo) { + // GeneratorBundleInfo info = (GeneratorBundleInfo) toCompare; + // if (info.symbolicName.equals(symbolicName) && info.version.equals(version) && (info.location == null || location == null ? true : info.location.equals(location))) + // return true; + // } + // return false; + // } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); + String superSt = super.toString(); + buffer.append(superSt.substring(superSt.length() - 1)); + buffer.append(", this.specialConfigCommands="); //$NON-NLS-1$ + buffer.append(this.specialConfigCommands); + buffer.append(')'); + return buffer.toString(); + } + + public void initFromManifest(String manifest) { + try { + super.setManifest(manifest); + Headers headers = Headers.parseManifest(new ByteArrayInputStream(manifest.getBytes())); + ManifestElement[] element = ManifestElement.parseHeader("bsn", (String) headers.get(Constants.BUNDLE_SYMBOLICNAME)); + super.setSymbolicName(element[0].getValue()); + super.setVersion((String) headers.get(Constants.BUNDLE_VERSION)); + } catch (BundleException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IGeneratorInfo.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IGeneratorInfo.java new file mode 100644 index 000000000..72af1ead7 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IGeneratorInfo.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +import java.io.File; +import java.util.ArrayList; +import java.util.Set; +import org.eclipse.equinox.frameworkadmin.ConfigData; +import org.eclipse.equinox.frameworkadmin.LauncherData; +import org.eclipse.equinox.prov.artifact.repository.IWritableArtifactRepository; +import org.eclipse.equinox.prov.metadata.repository.IWritableMetadataRepository; + +public interface IGeneratorInfo { + public boolean addDefaultIUs(); + + public boolean append(); + + public IWritableArtifactRepository getArtifactRepository(); + + public File[] getBundleLocations(); + + public ConfigData getConfigData(); + + public File getConfigurationLocation(); + + public ArrayList getDefaultIUs(Set ius); + + public File getExecutableLocation(); + + public File getFeaturesLocation(); + + public String getFlavor(); + + public LauncherData getLauncherData(); + + public String[][] getMappingRules(); + + public IWritableMetadataRepository getMetadataRepository(); + + public String getRootId(); + + public String getRootVersion(); + + public boolean publishArtifactRepository(); + + public boolean publishArtifacts(); + + public void setArtifactRepository(IWritableArtifactRepository value); + + public void setFlavor(String value); + + public void setMetadataRepository(IWritableMetadataRepository value); + + public void setPublishArtifacts(boolean value); + + public void setRootId(String value); +}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IPlatformEntry.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IPlatformEntry.java new file mode 100644 index 000000000..132eecca3 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IPlatformEntry.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.equinox.prov.metadata.generator; + +public interface IPlatformEntry { + public String getOS(); + + public String getWS(); + + public String getArch(); + + public String getNL(); +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/MetadataGeneratorHelper.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/MetadataGeneratorHelper.java new file mode 100644 index 000000000..e315d5ba5 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/MetadataGeneratorHelper.java @@ -0,0 +1,504 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.generator; + +import java.io.*; +import java.util.*; +import org.eclipse.equinox.frameworkadmin.BundleInfo; +import org.eclipse.equinox.internal.prov.metadata.ArtifactKey; +import org.eclipse.equinox.internal.prov.metadata.generator.Activator; +import org.eclipse.equinox.prov.artifact.repository.ArtifactDescriptor; +import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor; +import org.eclipse.equinox.prov.core.helpers.ServiceHelper; +import org.eclipse.equinox.prov.metadata.*; +import org.eclipse.osgi.service.environment.EnvironmentInfo; +import org.eclipse.osgi.service.resolver.*; +import org.eclipse.osgi.util.ManifestElement; +import org.osgi.framework.*; + +public class MetadataGeneratorHelper { + private static final String ECLIPSE_EXTENSIBLE_API = "Eclipse-ExtensibleAPI"; //$NON-NLS-1$ + + private static final String CAPABILITY_TYPE_OSGI_PACKAGES = "osgi.packages"; //$NON-NLS-1$ + + private static final Version versionMax = new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); + + private static final String ECLIPSE_TOUCHPOINT = "eclipse"; //$NON-NLS-1$ + private static final Version ECLIPSE_TOUCHPOINT_VERSION = new Version(1, 0, 0); + + private static final String NATIVE_TOUCHPOINT = "native"; //$NON-NLS-1$ + private static final Version NATIVE_TOUCHPOINT_VERSION = new Version(1, 0, 0); + + private static final String ECLIPSE_ARTIFACT_NAMESPACE = "eclipse"; //$NON-NLS-1$ + private static final String ECLIPSE_ARTIFACT_CLASSIFIER = "plugin"; //$NON-NLS-1$ + + private static final String ORG_ECLIPSE_EXECUTABLE = "org.eclipse.executable"; //$NON-NLS-1$ + private static final Version ORG_ECLIPSE_EXECUTABLE_VERSION = new Version(1, 0, 0); + private static final String IU_NAMESPACE = IInstallableUnit.IU_NAMESPACE; + + private static final String[] BUNDLE_IU_PROPERTY_MAP = {Constants.BUNDLE_NAME, IInstallableUnitConstants.NAME, Constants.BUNDLE_DESCRIPTION, IInstallableUnitConstants.DESCRIPTION, Constants.BUNDLE_VENDOR, IInstallableUnitConstants.PROVIDER, Constants.BUNDLE_CONTACTADDRESS, IInstallableUnitConstants.CONTACT, Constants.BUNDLE_COPYRIGHT, IInstallableUnitConstants.COPYRIGHT, Constants.BUNDLE_DOCURL, IInstallableUnitConstants.DOC_URL, Constants.BUNDLE_UPDATELOCATION, IInstallableUnitConstants.UPDATE_SITE}; + + private static final Version DEFAULT_JRE_VERSION = new Version("1.5"); //$NON-NLS-1$ + + /** + * Creates IUs and artifact descriptors for the JRE, and adds them to the given sets. + * if the jreLocation is <code>null</code>, default information is generated. + */ + public static void createJREData(File jreLocation, Set resultantIUs, Set resultantArtifactDescriptors) { + InstallableUnit iu = new InstallableUnit(); + iu.setSingleton(false); + iu.setId("a.jre"); //$NON-NLS-1$ + iu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, NATIVE_TOUCHPOINT_VERSION)); + if (jreLocation == null || !jreLocation.exists()) { + //set some reasonable defaults + iu.setVersion(DEFAULT_JRE_VERSION); + iu.setCapabilities(generateJRECapability(null)); + resultantIUs.add(iu); + return; + } + generateJREIUData(iu, jreLocation); + + //Generate artifact for JRE + IArtifactKey key = new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, NATIVE_TOUCHPOINT, iu.getId(), iu.getVersion()); + iu.setArtifacts(new IArtifactKey[] {key}); + iu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, new Version(1, 0, 0))); + resultantIUs.add(iu); + + //Create the CU + InstallableUnitFragment cu = new InstallableUnitFragment(); + cu.setId("config." + iu.getId()); //$NON-NLS-1$ + cu.setVersion(iu.getVersion()); + cu.setHost(iu.getId(), new VersionRange(iu.getVersion(), true, versionMax, true)); + + cu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, NATIVE_TOUCHPOINT_VERSION)); + Map touchpointData = new HashMap(); + String configurationData = "Zip.unzip(artifact, currentDir, null);"; + EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName()); + touchpointData.put("configurationData", configurationData); + cu.setImmutableTouchpointData(new TouchpointData(touchpointData)); + resultantIUs.add(cu); + + //Create the artifact descriptor + IArtifactDescriptor descriptor = createArtifactDescriptor(key, jreLocation, false, true); + resultantArtifactDescriptors.add(descriptor); + } + + private static void generateJREIUData(InstallableUnit iu, File jreLocation) { + //Look for a JRE profile file to set version and capabilities + File[] profiles = jreLocation.listFiles(new FileFilter() { + public boolean accept(File pathname) { + return pathname.getAbsolutePath().endsWith(".profile"); //$NON-NLS-1$ + } + }); + if (profiles.length != 1) { + iu.setVersion(DEFAULT_JRE_VERSION); + iu.setCapabilities(generateJRECapability(null)); + return; + } + String profileName = profiles[0].getAbsolutePath().substring(profiles[0].getAbsolutePath().lastIndexOf('/')); + Version version = DEFAULT_JRE_VERSION; + //TODO Find a better way to determine JRE version + if (profileName.indexOf("1.5") > 0) { //$NON-NLS-1$ + version = new Version("1.5"); //$NON-NLS-1$ + } else if (profileName.indexOf("1.4") > 0) { //$NON-NLS-1$ + version = new Version("1.4"); //$NON-NLS-1$ + } + iu.setVersion(version); + try { + iu.setCapabilities(generateJRECapability(new FileInputStream(profiles[0]))); + } catch (FileNotFoundException e) { + //Shouldn't happen, but ignore and fall through to use default + } + } + + /** + * Creates IUs and artifacts for the Eclipse executable, and adds them to the given + * sets. + */ + public static void createLauncherData(File launcher, String configurationFlavor, Set resultantIUs, Set resultantArtifactDescriptors) { + if (launcher == null || !launcher.exists()) + return; + + //Create the IU + InstallableUnit iu = new InstallableUnit(); + iu.setSingleton(true); + iu.setId(ORG_ECLIPSE_EXECUTABLE); + iu.setVersion(ORG_ECLIPSE_EXECUTABLE_VERSION); + + IArtifactKey key = new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, NATIVE_TOUCHPOINT, ORG_ECLIPSE_EXECUTABLE, ORG_ECLIPSE_EXECUTABLE_VERSION); + iu.setArtifacts(new IArtifactKey[] {key}); + iu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, new Version(1, 0, 0))); + resultantIUs.add(iu); + + //Create the CU + InstallableUnitFragment cu = new InstallableUnitFragment(); + cu.setId(configurationFlavor + iu.getId()); + cu.setVersion(iu.getVersion()); + cu.setHost(iu.getId(), new VersionRange(iu.getVersion(), true, versionMax, true)); + + cu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, NATIVE_TOUCHPOINT_VERSION)); + Map touchpointData = new HashMap(); + String configurationData = "Zip.unzip(artifact, currentDir, null);"; + EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName()); + if (!info.getOS().equals(org.eclipse.osgi.service.environment.Constants.OS_WIN32)) + // FIXME: is this correct? do all non-Windows platforms need execute permissions on the launcher? + configurationData += " Permissions.chmod(currentDir, \"" + launcher.getName() + "\", 755);"; + touchpointData.put("configurationData", configurationData); + cu.setImmutableTouchpointData(new TouchpointData(touchpointData)); + resultantIUs.add(cu); + + //Create the artifact descriptor + IArtifactDescriptor descriptor = createArtifactDescriptor(new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, NATIVE_TOUCHPOINT, ORG_ECLIPSE_EXECUTABLE, ORG_ECLIPSE_EXECUTABLE_VERSION), launcher, false, true); + resultantArtifactDescriptors.add(descriptor); + } + + private static ProvidedCapability[] generateJRECapability(InputStream profileStream) { + if (profileStream == null) { + //use the 1.5 profile stored in the generator bundle + try { + profileStream = Activator.getContext().getBundle().getEntry("J2SE-1.5.profile").openStream(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + Properties p = new Properties(); + try { + p.load(profileStream); + ManifestElement[] jrePackages = ManifestElement.parseHeader("org.osgi.framework.system.packages", (String) p.get("org.osgi.framework.system.packages")); + ProvidedCapability[] exportedPackageAsCapabilities = new ProvidedCapability[jrePackages.length]; + for (int i = 0; i < jrePackages.length; i++) { + exportedPackageAsCapabilities[i] = new ProvidedCapability("osgi.packages", jrePackages[i].getValue(), null); + } + return exportedPackageAsCapabilities; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (BundleException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + if (profileStream != null) { + try { + profileStream.close(); + } catch (IOException e) { + //ignore secondary failure + } + } + } + return new ProvidedCapability[0]; + } + + public static IInstallableUnit createEclipseConfigurationUnit(String iuId, Version iuVersion, boolean isBundleFragment, GeneratorBundleInfo configInfo, String configurationFlavor) { + if (configInfo == null) + return null; + + InstallableUnitFragment cu = new InstallableUnitFragment(); + cu.setId(configurationFlavor + iuId); + cu.setVersion(iuVersion); + + //Indicate the IU to which this CU apply + cu.setHost(iuId, new VersionRange(iuVersion, true, versionMax, true)); + + //Add a capability describing the flavor supported + cu.setCapabilities(new ProvidedCapability[] {new ProvidedCapability(IInstallableUnit.FLAVOR_NAMESPACE, configurationFlavor, Version.emptyVersion)}); + + cu.setTouchpointType(new TouchpointType(ECLIPSE_TOUCHPOINT, ECLIPSE_TOUCHPOINT_VERSION)); //TODO Is this necessary? I think we get that from the IU + + Map touchpointData = new HashMap(); + touchpointData.put("configurationData", createConfigScript(configInfo, isBundleFragment)); + touchpointData.put("unconfigurationData", createUnconfigScript(configInfo, isBundleFragment)); + cu.setImmutableTouchpointData(new TouchpointData(touchpointData)); + + return cu; + } + + public static IInstallableUnit createEclipseDefaultConfigurationUnit(GeneratorBundleInfo configInfo, GeneratorBundleInfo unconfigInfo, String configurationFlavor) { + InstallableUnitFragment cu = new InstallableUnitFragment(); + cu.setId(configurationFlavor + "default"); + cu.setVersion(new Version(1, 0, 0)); + + //Add a capability describing the flavor supported + cu.setCapabilities(new ProvidedCapability[] {new ProvidedCapability(IInstallableUnit.FLAVOR_NAMESPACE, configurationFlavor, Version.emptyVersion)}); + + //Create a capability on bundles + RequiredCapability[] reqs = new RequiredCapability[] {new RequiredCapability(IInstallableUnit.CAPABILITY_ECLIPSE_TYPES, IInstallableUnit.CAPABILITY_ECLIPSE_BUNDLE, VersionRange.emptyRange, null, false, true)}; + cu.setRequiredCapabilities(reqs); + cu.setTouchpointType(new TouchpointType(ECLIPSE_TOUCHPOINT, ECLIPSE_TOUCHPOINT_VERSION)); //TODO Is this necessary? I think we get that from the IU + Map touchpointData = new HashMap(); + + touchpointData.put("configurationData", createDefaultConfigScript(configInfo)); + touchpointData.put("unconfigurationData", createDefaultUnconfigScript(unconfigInfo)); + + cu.setImmutableTouchpointData(new TouchpointData(touchpointData)); + return cu; + } + + private static String createDefaultConfigScript(GeneratorBundleInfo configInfo) { + String configScript = "";//$NON-NLS-1$ + if (configInfo != null) { + if (configInfo.getStartLevel() != BundleInfo.NO_LEVEL) { + configScript += "bundleToInstall.setStartLevel(" + configInfo.getStartLevel() + ");"; + } + if (configInfo.isMarkedAsStarted()) { + configScript += "bundleToInstall.setMarkedAsStarted(true);"; + } + if (configInfo.getSpecialConfigCommands() != null) { + configScript += configInfo.getSpecialConfigCommands(); + } + } + return configScript; + } + + private static String createDefaultUnconfigScript(GeneratorBundleInfo unconfigInfo) { + String unconfigScript = ""; //$NON-NLS-1$ + if (unconfigInfo != null) { + if (unconfigInfo.getSpecialConfigCommands() != null) { + unconfigScript += unconfigInfo.getSpecialConfigCommands(); + } + } + return unconfigScript; + } + + private static String createConfigScript(GeneratorBundleInfo configInfo, boolean isBundleFragment) { + String configScript = "manipulator.getConfigData().addBundle(bundleToInstall);"; + if (configInfo != null) { + if (!isBundleFragment && configInfo.getStartLevel() != BundleInfo.NO_LEVEL) { + configScript += "bundleToInstall.setStartLevel(" + configInfo.getStartLevel() + ");"; + } + if (!isBundleFragment && configInfo.isMarkedAsStarted()) { + configScript += "bundleToInstall.setMarkedAsStarted(true);"; + } + if (configInfo.getSpecialConfigCommands() != null) { + configScript += configInfo.getSpecialConfigCommands(); + } + } + return configScript; + } + + private static String createUnconfigScript(GeneratorBundleInfo configInfo, boolean isBundleFragment) { + String unconfigScript = ""; + if (configInfo != null) { + if (!isBundleFragment && configInfo.getStartLevel() != BundleInfo.NO_LEVEL) { + unconfigScript += "bundleToRemove.setStartLevel(" + BundleInfo.NO_LEVEL + ");"; + } + if (!isBundleFragment && configInfo.isMarkedAsStarted()) { + unconfigScript += "bundleToRemove.setMarkedAsStarted(false);"; + } + if (configInfo.getSpecialConfigCommands() != null) { + // TODO: how should special config commands be removed + // unconfigScript += "foobar.remove(" + configInfo.getSpecialConfigCommands() + ");"; + } + } + unconfigScript += "manipulator.getConfigData().removeBundle(bundleToRemove);"; + return unconfigScript; + } + + private static boolean requireAFragment(BundleDescription bd, Map manifest) { + if (manifest == null) + return false; + if (manifest.get(ECLIPSE_EXTENSIBLE_API) == null) + return false; + if (bd.getSymbolicName().equals("org.eclipse.osgi")) //Special case for OSGi + return false; + String classpath = (String) ((Map) bd.getUserObject()).get(Constants.BUNDLE_CLASSPATH); + if (classpath == null) + return true; + ManifestElement[] classpathEntries; + try { + classpathEntries = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, classpath); + if (classpathEntries.length != 0 && classpathEntries[0].getValue().equals(".")) + return true; + } catch (BundleException e) { + //If we are here, it is that we have already parsed the bundle manifest and it contains no error + } + return false; + } + + public static IInstallableUnit createEclipseIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key) { + InstallableUnit iu = new InstallableUnit(); + iu.setSingleton(bd.isSingleton()); + iu.setId(bd.getSymbolicName()); + iu.setVersion(bd.getVersion()); + iu.setFilter(bd.getPlatformFilter()); + iu.setProperty(IInstallableUnitConstants.UPDATE_FROM, bd.getSymbolicName()); + iu.setProperty(IInstallableUnitConstants.UPDATE_RANGE, VersionRange.emptyRange.toString()); + + boolean isFragment = bd.getHost() != null; + boolean requiresAFragment = isFragment ? false : requireAFragment(bd, manifest); + + //Process the required bundles + BundleSpecification requiredBundles[] = bd.getRequiredBundles(); + ArrayList reqsDeps = new ArrayList(); + if (requiresAFragment) + reqsDeps.add(new RequiredCapability("fragment", iu.getId(), VersionRange.emptyRange, null, false, false)); + if (isFragment) + reqsDeps.add(RequiredCapability.createRequiredCapabilityForName(bd.getHost().getName(), bd.getHost().getVersionRange(), false)); + for (int j = 0; j < requiredBundles.length; j++) + reqsDeps.add(RequiredCapability.createRequiredCapabilityForName(requiredBundles[j].getName(), requiredBundles[j].getVersionRange() == VersionRange.emptyRange ? null : requiredBundles[j].getVersionRange(), requiredBundles[j].isOptional())); + + //Process the import package + ImportPackageSpecification osgiImports[] = bd.getImportPackages(); + for (int i = 0; i < osgiImports.length; i++) { + // TODO we need to sort out how we want to handle wild-carded dynamic imports - for now we ignore them + ImportPackageSpecification importSpec = osgiImports[i]; + String importPackageName = importSpec.getName(); + if (importPackageName.indexOf('*') != -1) + continue; + + VersionRange versionRange = importSpec.getVersionRange() == VersionRange.emptyRange ? null : importSpec.getVersionRange(); + + //TODO this needs to be refined to take into account all the attribute handled by imports + reqsDeps.add(new RequiredCapability(CAPABILITY_TYPE_OSGI_PACKAGES, importPackageName, versionRange, null, isOptional(importSpec), false)); + } + iu.setRequiredCapabilities((RequiredCapability[]) reqsDeps.toArray(new RequiredCapability[reqsDeps.size()])); + + //Process the export package + ExportPackageDescription exports[] = bd.getExportPackages(); + ProvidedCapability[] exportedPackageAsCapabilities = new ProvidedCapability[exports.length + 1 + (isFragment ? 1 : 0)]; + exportedPackageAsCapabilities[exports.length] = new ProvidedCapability(IInstallableUnit.CAPABILITY_ECLIPSE_TYPES, IInstallableUnit.CAPABILITY_ECLIPSE_BUNDLE, new Version(1, 0, 0)); //Here we add a bundle capability to identify bundles + for (int i = 0; i < exports.length; i++) { + exportedPackageAsCapabilities[i] = new ProvidedCapability(CAPABILITY_TYPE_OSGI_PACKAGES, exports[i].getName(), exports[i].getVersion() == Version.emptyVersion ? null : exports[i].getVersion()); //TODO make sure that we support all the refinement on the exports + } + if (isFragment) + exportedPackageAsCapabilities[exportedPackageAsCapabilities.length - 1] = new ProvidedCapability("fragment", bd.getHost().getName(), bd.getVersion()); + iu.setCapabilities(exportedPackageAsCapabilities); + iu.setApplicabilityFilter(""); + + iu.setArtifacts(new IArtifactKey[] {key}); + + iu.setTouchpointType(new TouchpointType(ECLIPSE_TOUCHPOINT, ECLIPSE_TOUCHPOINT_VERSION)); + + // Set IU properties from the manifest header attributes + // TODO The values of the attributes may be localized. Metadata generation + // should construct property files for the IU based on the bundle/plug-in + // property files in whatever locales are provided. + if (manifest != null) { + int i = 0; + while (i < BUNDLE_IU_PROPERTY_MAP.length) { + if (manifest.containsKey(BUNDLE_IU_PROPERTY_MAP[i])) { + String value = (String) manifest.get(BUNDLE_IU_PROPERTY_MAP[i]); + if (value != null) { + iu.setProperty(BUNDLE_IU_PROPERTY_MAP[i + 1], value); + } + } + i += 2; + } + } + + //Define the immutable metadata for this IU. In this case immutable means that this is something that will not impact the configuration + Map touchpointData = new HashMap(); + if (isFolderPlugin) + touchpointData.put("zipped", "true"); + touchpointData.put("manifest", toManifestString(manifest)); + iu.setImmutableTouchpointData(new TouchpointData(touchpointData)); + return iu; + } + + public static VersionRange getVersionRange(FeatureEntry entry) { + String versionSpec = entry.getVersion(); + if (versionSpec == null) + // TODO should really be returning VersionRange.emptyRange here... + return null; + Version version = new Version(versionSpec); + if (!entry.isRequires()) + return new VersionRange(version, true, version, true); + String match = entry.getMatch(); + if (match == null) + // TODO should really be returning VersionRange.emptyRange here... + return null; + if (match.equals("perfect")) + return new VersionRange(version, true, version, true); + if (match.equals("equivalent")) { + Version upper = new Version(version.getMajor(), version.getMinor() + 1, 0); + return new VersionRange(version, true, upper, false); + } + if (match.equals("compatible")) { + Version upper = new Version(version.getMajor() + 1, 0, 0); + return new VersionRange(version, true, upper, false); + } + if (match.equals("greaterOrEqual")) + return new VersionRange(version, true, new VersionRange(null).getMaximum(), true); + return null; + } + + private static String getTransformedId(String original, boolean isPlugin) { + return isPlugin ? original : original + ".featureIU"; + } + + public static IInstallableUnit createGroupIU(Feature feature) { + InstallableUnit iu = new InstallableUnit(); + iu.setId(getTransformedId(feature.getId(), false)); + iu.setVersion(new Version(feature.getVersion())); + iu.setProperty(IInstallableUnitConstants.UPDATE_FROM, iu.getId()); + iu.setProperty(IInstallableUnitConstants.UPDATE_RANGE, VersionRange.emptyRange.toString()); + + FeatureEntry entries[] = feature.getEntries(); + RequiredCapability[] required = new RequiredCapability[entries.length]; + for (int i = 0; i < entries.length; i++) { + VersionRange range = getVersionRange(entries[i]); + required[i] = new RequiredCapability(IU_NAMESPACE, getTransformedId(entries[i].getId(), entries[i].isPlugin()), range, getFilter(entries[i]), entries[i].isOptional(), false); + } + iu.setRequiredCapabilities(required); + iu.setTouchpointType(TouchpointType.NONE); + ProvidedCapability groupCapability = new ProvidedCapability(IInstallableUnit.IU_KIND_NAMESPACE, "group", new Version("1.0.0")); + iu.setCapabilities(new ProvidedCapability[] {groupCapability}); + return iu; + } + + public static String getFilter(FeatureEntry entry) { + StringBuffer result = new StringBuffer(); + result.append("(&"); //$NON-NLS-1$ + if (entry.getFilter() != null) + result.append(entry.getFilter()); + if (entry.getOS() != null) + result.append("(osgi.os=" + entry.getOS() + ')');//$NON-NLS-1$ + if (entry.getWS() != null) + result.append("(osgi.ws=" + entry.getWS() + ')');//$NON-NLS-1$ + if (entry.getArch() != null) + result.append("(osgi.arch=" + entry.getArch() + ')');//$NON-NLS-1$ + if (entry.getNL() != null) + result.append("(osgi.nl=" + entry.getNL() + ')');//$NON-NLS-1$ + if (result.length() == 2) + return null; + result.append(')'); + return result.toString(); + } + + private static boolean isOptional(ImportPackageSpecification importedPackage) { + if (importedPackage.getDirective(Constants.RESOLUTION_DIRECTIVE).equals(ImportPackageSpecification.RESOLUTION_DYNAMIC) || importedPackage.getDirective(Constants.RESOLUTION_DIRECTIVE).equals(ImportPackageSpecification.RESOLUTION_OPTIONAL)) + return true; + return false; + } + + private static String toManifestString(Map p) { + if (p == null) + return null; + Collection properties = p.entrySet(); + StringBuffer result = new StringBuffer(); + for (Iterator iterator = properties.iterator(); iterator.hasNext();) { + Map.Entry aProperty = (Map.Entry) iterator.next(); + result.append(aProperty.getKey()).append(": ").append(aProperty.getValue()).append('\n'); + } + return result.toString(); + } + + public static IArtifactKey createEclipseArtifactKey(String bsn, String version) { + return new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, ECLIPSE_ARTIFACT_CLASSIFIER, bsn, new Version(version)); + } + + public static IArtifactDescriptor createArtifactDescriptor(IArtifactKey key, File pathOnDisk, boolean asIs, boolean recurse) { + //TODO this size calculation is bogus + ArtifactDescriptor result = new ArtifactDescriptor(key); + if (pathOnDisk != null) + result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length())); + return result; + } +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/URLEntry.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/URLEntry.java new file mode 100644 index 000000000..fb628f82d --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/URLEntry.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.equinox.prov.metadata.generator; + +public class URLEntry { + private String annotation; + private String url; + + public URLEntry() { + } + + public URLEntry(String url, String annotation) { + this.url = url; + this.annotation = annotation; + } + + public void setAnnotation(String annotation) { + this.annotation = annotation; + } + + public String getAnnotation() { + return annotation; + } + + public void setURL(String url) { + this.url = url; + } + + public String getURL() { + return url; + } +} |