diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.natives')
31 files changed, 0 insertions, 3017 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath deleted file mode 100644 index 64c5e31b7..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.project b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.project deleted file mode 100644 index 854172c94..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.equinox.p2.touchpoint.natives</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> - <buildCommand> - <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c98f1d59f..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,329 +0,0 @@ -#Tue Dec 22 23:15:07 CET 2009 -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=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=jsr14 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -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=error -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=error -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.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.5 -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_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.touchpoint.natives/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 6eacd08fa..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,57 +0,0 @@ -#Sun Sep 23 11:59:07 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.touchpoint.natives/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index 7913d20db..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ - -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF deleted file mode 100644 index 03fbcd48d..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF +++ /dev/null @@ -1,25 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.equinox.p2.touchpoint.natives;singleton:=true -Bundle-Version: 1.0.200.qualifier -Bundle-Activator: org.eclipse.equinox.internal.p2.touchpoint.natives.Activator -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: org.eclipse.equinox.internal.p2.touchpoint.natives;x-internal:=true, - org.eclipse.equinox.internal.p2.touchpoint.natives.actions;x-internal:=true -Require-Bundle: org.eclipse.equinox.common -Bundle-RequiredExecutionEnvironment: J2SE-1.5, - J2SE-1.4, - CDC-1.1/Foundation-1.1 -Bundle-ActivationPolicy: lazy -Import-Package: org.eclipse.equinox.internal.p2.core.helpers, - org.eclipse.equinox.internal.p2.engine, - org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", - org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)", - org.eclipse.equinox.p2.engine.spi;version="[2.0.0,3.0.0)", - org.eclipse.equinox.p2.metadata;version="[2.0.0,3.0.0)", - org.eclipse.equinox.p2.repository;version="[2.0.0,3.0.0)", - org.eclipse.equinox.p2.repository.artifact;version="[2.0.0,3.0.0)", - org.eclipse.osgi.util;version="1.0.0", - org.osgi.framework;version="1.3.0" diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/about.html b/bundles/org.eclipse.equinox.p2.touchpoint.natives/about.html deleted file mode 100644 index 460233046..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!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.touchpoint.natives/build.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties deleted file mode 100644 index 0328daa18..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# 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/,\ - .,\ - plugin.xml,\ - about.html,\ - plugin.properties -src.includes = about.html -javacTarget=jsr14 -javacSource=1.5 diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.properties deleted file mode 100644 index 31cfe1f41..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2007, 2009 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 -############################################################################### -pluginName = Equinox Provisioning Native Touchpoint -providerName = Eclipse.org - Equinox diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.xml b/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.xml deleted file mode 100644 index 2565253a1..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.xml +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.5"?> -<plugin> - <extension point="org.eclipse.equinox.p2.engine.touchpoints" id="native" name="Native Touchpoint"> - <touchpoint - type="org.eclipse.equinox.p2.native" - class="org.eclipse.equinox.internal.p2.touchpoint.natives.NativeTouchpoint" - version="1.0.0"/> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.ChmodAction" - name="chmod" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.CleanupzipAction" - name="cleanupzip" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.CollectAction" - name="collect" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.LinkAction" - name="ln" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.MkdirAction" - name="mkdir" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.RmdirAction" - name="rmdir" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.UnzipAction" - name="unzip" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.CopyAction" - description="copy(source,target[,overwrite])" - name="copy" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.CleanupcopyAction" - description="cleanupcopy(source,target)" - name="cleanupcopy" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> - <extension - point="org.eclipse.equinox.p2.engine.actions"> - <action - class="org.eclipse.equinox.internal.p2.touchpoint.natives.actions.RemoveAction" - description="remove(path)" - name="remove" - touchpointType="org.eclipse.equinox.p2.native" - touchpointVersion="1.0.0" - version="1.0.0"> - </action> - </extension> -</plugin> diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml b/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml deleted file mode 100644 index 1d86bdb60..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>org.eclipse.equinox.p2-parent</artifactId> - <groupId>org.eclipse</groupId> - <version>0.0.1-SNAPSHOT</version><relativePath>../org.eclipse.equinox.p2-parent</relativePath> - </parent> - <groupId>org.eclipse</groupId> - <artifactId>org.eclipse.equinox.p2.touchpoint.natives</artifactId> - <version>1.0.200.qualifier</version> - <packaging>eclipse-plugin</packaging> -</project> diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Activator.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Activator.java deleted file mode 100644 index e3c7010d5..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Activator.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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.p2.touchpoint.natives; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class Activator implements BundleActivator { - public static final String ID = "org.eclipse.equinox.p2.touchpoint.natives"; //$NON-NLS-1$ - private static BundleContext context = null; - - public static BundleContext getContext() { - return context; - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext aContext) throws Exception { - Activator.context = aContext; - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext aContext) throws Exception { - context = null; - } - -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java deleted file mode 100644 index 82a3503cf..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java +++ /dev/null @@ -1,722 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. 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: - * Cloudsmith Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.equinox.internal.p2.touchpoint.natives; - -import java.io.*; -import java.net.*; -import java.util.*; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; -import org.eclipse.osgi.util.NLS; - -/** - * Stores files by copying them to a uniquely named temporary directory. - * The BackupStore remembers filenames and can recreate them in their original location. - * - * <h3>Usage</h3> - * The user of this class should instantiate the BackupStore with some prefix that is - * meaningful to a human. Uniqueness is obtained without the prefix - the prefix is used to - * be able to differentiate between different backup directories by a human (in case of crashes etc). - * - * If instantiated with a directory this directory will be used to store the backup root directory. If - * this directory is null, the users home directory is used by default. - * - * Once instantiated, use the {@link #backup(File)} and {@link #backupDirectory(File)} methods - * to move files to backup instead of deleting them. A file that - * is backed up should not be deleted - it is simply moved out of the way. - * Use {@link #backupCopy(File)} to - * move the file out of harms way, but keep a copy of it in the original location. - * The methods {@link #backupAll(File)} and {@link #backupCopyAll(File)} backs up an entire structure. - * - * When backup is finished - the user should either call {@link #restore()} to put all - * of the files back, or call {@link #discard()} to remove all of the backed up "copies". - * - * If {@link #restore()} or {@link #discard()} is not called the backup files will never be deleted. - * - * The backup store does not synchronize directories - actions that write new files are - * responsible for removing them. Overwriting existing files should be done by first backing - * up the file, and then creating a new file. Modifying a file, should be done by - * using {@link #backupCopy(File)} or - * first making a copy, then backing up the original, and then renaming the copy. - * - * <h3>Read Only and Permissions</h3> - * Directories that are read only (to current user) can not be backed up. - * Backup is performed using {@link File#renameTo(File)} and handling of permissions - * is operating system dependent. It is expected that a Un*x type system retains the - * permissions as a file is moved to the backup store and later gets restored. - * Backup directories are created as they are needed and will (at least on Un*x) inherit the - * permissions from its parent directory. - * - * If a rename can not be performed, the backup store will make a copy and delete the original - * file. This makes it possible to backup and restore across volume boundaries. - * - * When restoring directories they - * will be created with permissions in a platform specific way (on UN*IX they will inherit the permissions - * of the parent directory). - * - * <h3>Checkpointing</h3> - * Checkpointing (i.e. to be able to rollback to a particular point) can be implemented by using - * multiple instances of BackupStore. The client code will need to remember the individual order - * among the backup stores. - * - * <h3>Restartability</h3> - * Not implemented - it is possible to obtain the name of the backup directories, - * so manual restore is possible after a crash. An idea is to add persistence to a file, and - * be able to read it back in again. - * - * <h3>A note about exceptions</h3> - * In general {@link IllegalArgumentException} is thrown when attempting an operation - * that is considered "wrong use", and an {@link IllegalStateException} or subclass thereof is thrown on an overall - * wrong use of BackupStore (i.e. attempt to backup when store has been restored). Some cases of - * "wrong use" can not be differentiated from I/O errors (like a "file not found" as this could - * be caused by an entire disk disappearing - in these case an {@link IOException} is thrown. - * - * <h3>Implementation Note</h3> - * The backup root directory will contain folders that reflects file system roots. These are encoded using - * "_" for the UNI*X root directory, "__" for a Windows network mounted directory, and single "drive letter" folders - * corresponding to Windows drive letters. Typically, on UN*X there will only be a "_" directory in the backup root, - * and on windows there will typically be a single directory called "C". - * - * - */ -public class BackupStore implements IBackupStore { - - /** - * The name to use for a directory that represents leading separator (i.e. "/" or "\"). - */ - private static final String ROOTCHAR = "_"; //$NON-NLS-1$ - - /** - * Map of directory File to backup root (File) - the backup root has - * a directory named {@link #backupName} where the backup is found. - */ - //private Map backups = new HashMap(); - private final File backupRoot; - - /** - * The name of the backup directory (no path - relative to the backup root). - */ - private String backupName; - - /** - * The name of a dummy file used to backup empty directories - */ - private String dummyName; - - /** - * A server socket that is used to obtain a port (a shared resource on this machine) - * and thus create a unique number. Used as part of the unique id of backup directories - * and probe files. - */ - private ServerSocket socket = null; - - /** - * Counter of how many files where backed up. Used as a simple check mechanism if - * everything was restored (a guard against manual/external tampering with the backup directories). - */ - private long backupCounter; - - /** - * Counter of how many files where restored. See {@link #backupCounter}. - */ - private long restoreCounter; - - /** - * Flag indicating if this BackupStore has been restored or canceled. - */ - private boolean closed; - - /** - * Generates a BackupStore with a default prefix of ".p2bu" for backup directory and - * probe file. - * The full id of the store is on the format "prefix_hextime_hexIPport" - * - see {@link #genUnique()} for more info. - */ - public BackupStore() { - this(null, ".p2bu"); //$NON-NLS-1$ - } - - /** - * Generates a BackupStore with a specified prefix for backup directories and - * probe file. - * The full id of the store is on the format "prefix_hextime_hexipport" - * - see {@link #genUnique()} for more info. - * - * @param buParentDirectory - name of directory where the backup directory should be created - if null, java.io.tmpdir is used - * @param prefix - prefix used for human identification of backup directories - */ - public BackupStore(File buParentDirectory, String prefix) { - if (buParentDirectory == null) - buParentDirectory = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ - backupRoot = buParentDirectory; - - // generate a name for the backup store and the dummy file used for empty directories - String unique = genUnique(); - dummyName = prefix + "d_" + unique; //$NON-NLS-1$ - backupName = prefix + "_" + unique; //$NON-NLS-1$ - backupCounter = 0; - restoreCounter = 0; - closed = false; - } - - /** - * Since a socket port is used to create a unique number, the socket - * must be closed if this instance is garbage collected and the user - * of the instance has not either restored or discarded. - */ - protected void finalize() throws Throwable { - try { - if (socket != null && !socket.isClosed()) - socket.close(); - } finally { - super.finalize(); - } - } - - /** - * Returns the unique backup name (this is the name of generated backup directories). - * @return the backup name. - */ - public String getBackupName() { - return backupName; - } - - public File getBackupRoot() { - return backupRoot; - } - - /** - * Backup the file by moving it to the backup store (for later (optional) restore). - * Calling this method with a file that represents a directory is equivalent to calling - * {@link #backupDirectory(File)}. - * - * A file (path) can only be backed up once per BackupStore instance. - * When the file is backed up, it is moved to a directory under this BackupStore instance's directory - * with a relative path corresponding to the original relative path from the backup root e.g. - * the file /A/B/C/foo.txt could be moved to /A/.p2bu_ffffff_ffffff/B/C/foo.txt when /A is the - * backup root. - * - * If a directory is first backed up, and later replaced by a regular file, and this file - * is backed up (or vice versa) - an {@link IllegalArgumentException} is thrown - * - * A backup can not be performed on a closed BackupStore. - * - * @param file - the file (or directory) to backup - * @return true if the file was backed up, false if this file (path) has already been backed up (the file is not moved to the store). - * @throws IOException - if the backup operation fails, or the file does not exist - * @throws ClosedBackupStoreException - if the BackupStore has been closed - * @throws IllegalArgumentException - on type mismatch (file vs. directory) of earlier backup, or if file does not exist - */ - public boolean backup(File file) throws IOException { - if (closed) - throw new ClosedBackupStoreException("Can not perform backup()"); //$NON-NLS-1$ - if (!file.exists()) - throw new IOException(NLS.bind(Messages.BackupStore_file_not_found, file.getAbsolutePath())); - if (file.isDirectory()) - return backupDirectory(file); - file = makeParentCanonical(file); - File buRoot = backupRoot; - // File buRoot = findBackupRoot(file); - File buDir = new File(buRoot, backupName); - // move the file - // create the relative path from root and use that in buDir - File buFile = new File(buDir, makeRelativeFromRoot(file).getPath()); - // already backed up, but was a directory = wrong usage - if (buFile.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_directory_file_mismatch, buFile.getAbsolutePath())); - // has already been backed up - can only be done once with one BackupStore - if (buFile.exists()) - return false; - - // make sure all of the directories exist / gets created - buFile.getParentFile().mkdirs(); - if (buFile.getParentFile().exists() && !buFile.getParentFile().isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_file_directory_mismatch, buFile.getParentFile().getAbsolutePath())); - if (file.renameTo(buFile)) { - backupCounter++; - return true; - } - // could not move - this can happen because source and target are on different volumes, or - // that source is locked "in use" on a windows machine. The copy will work across volumes, - // but the locked file will fail on the subsequent delete. - // - Util.copyStream(new FileInputStream(file), true, new FileOutputStream(buFile), true); - backupCounter++; - - // need to remove the backed up file - if (!file.delete()) - throw new IOException(NLS.bind(Messages.BackupStore_can_not_delete_after_copy_0, file)); - - return true; - } - - /** - * Backs up a file, or everything under a directory. - * - * @param file - file to backup or directory - * @throws IOException if backup operation failed - */ - public void backupAll(File file) throws IOException { - if (!file.exists()) - return; - file = makeParentCanonical(file); - if (file.isDirectory()) { - File[] files = file.listFiles(); - if (files != null) - for (int i = 0; i < files.length; i++) - backupAll(files[i]); - } - backup(file); - } - - /** - * Backs up a file, or everything under a directory. - * A copy of the backup is left in the original place. - * @param file - * @throws IOException - */ - public void backupCopyAll(File file) throws IOException { - if (!file.exists()) - return; - file = makeParentCanonical(file); - if (file.isDirectory()) { - File[] files = file.listFiles(); - if (files != null) - for (int i = 0; i < files.length; i++) - backupCopyAll(files[i]); - // if directory was empty, it needs to be backed up and then recreated - // - if (files == null || files.length == 0) { - backupDirectory(file); - file.mkdir(); - } - } else - backupCopy(file); - } - - /** - * Backup the file by moving it to the backup store (for later (optional) restore) but leaving - * a copy of the contents in the original location. - * Calling this method with a file that represents a directory throws an {@link IllegalArgumentException}. - * - * A file (path) can only be backed up once per BackupStore instance. - * When the file is backed up, it is moved to a directory under this BackupStore instance's directory - * with a relative path corresponding to the original relative path from the backup root e.g. - * the file /A/B/C/foo.txt could be moved to /A/.p2bu_ffffff_ffffff/B/C/foo.txt when /A is the - * backup root. - * - * If a directory is first backed up, and later replaced by a regular file, and this file - * is backed up (or vice versa) - an {@link IllegalArgumentException} is thrown - * - * A backup can not be performed on a closed BackupStore. - * - * @param file - the file (or directory) to backup - * @return true if the file was backed up, false if this file (path) has already been backed up (the file is not moved to the store). - * @throws IOException - if the backup operation fails, or the file does not exist - * @throws ClosedBackupStoreException - if the BackupStore has been closed - * @throws IllegalArgumentException - on type mismatch (file vs. directory) of earlier backup, or if file is a Directory - */ - public boolean backupCopy(File file) throws IOException { - if (closed) - throw new ClosedBackupStoreException(Messages.BackupStore_backupCopy_closed_store); - if (!file.exists()) - throw new IOException(NLS.bind(Messages.BackupStore_file_not_found, file.getAbsolutePath())); - if (file.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_can_not_copy_directory, file.getAbsolutePath())); - file = makeParentCanonical(file); - //File buRoot = backupRoot; - // File buRoot = findBackupRoot(file); - File buDir = new File(backupRoot, backupName); - // move the file - // create the relative path from root and use that in buDir - File buFile = new File(buDir, makeRelativeFromRoot(file).getPath()); - // already backed up, but was a directory = wrong usage - if (buFile.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_directory_file_mismatch, buFile.getAbsolutePath())); - // has already been backed up - can only be done once with one BackupStore - if (buFile.exists()) - return false; - - // make sure all of the directories exist / gets created - buFile.getParentFile().getCanonicalFile().mkdirs(); - if (buFile.getParentFile().exists() && !buFile.getParentFile().isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_file_directory_mismatch, buFile.getParentFile().getAbsolutePath())); - - // just make a copy - one has to be made in one direction anyway - // A renameTo followed by a copy is preferred as it preserves file permissions on the moved file - // but it is easier to just copy and keep original. - Util.copyStream(new FileInputStream(file), true, new FileOutputStream(buFile), true); - backupCounter++; - return true; - } - - /** - * Performs backup of an empty directory. The directory must be empty before it can be backed up (i.e. - * similar to a delete of a directory). Backup the files of the directory first. - * A call to backup a directory is really only needed for empty directories as a restore - * of a file will also restore all of its parent directories. - * @param file - the (empty) directory to back up - * @return true if the directory was moved to backup. false if the directory was already backed up and remains. - * @throws IllegalArgumentException if file is not a directory, or is not empty. - * @throws IOException if directory can not be moved to the backup store, or if the directory is not writeable - */ - public boolean backupDirectory(File file) throws IOException { - if (!file.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_not_a_directory, file.getAbsolutePath())); - file = makeParentCanonical(file); - if (file.list().length != 0) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_directory_not_empty, file.getAbsolutePath())); - // the easiest is to create a dummy file and back that up (the dummy is simply ignored when restoring). - File dummy = new File(file, dummyName); - if (!dummy.createNewFile()) - throw new IOException(NLS.bind(Messages.BackupStore_can_not_create_dummy, dummy.getAbsolutePath())); - boolean result = backup(dummy); - // if already backed up - do not delete the directory - if (result && !file.delete()) - throw new IOException(NLS.bind(Messages.BackupStore_can_not_remove, dummy.getAbsolutePath())); - return result; - } - - /** - * Restores all backup files from backup store. - * Note that restore of a (non directory) file deletes an existing file or directory found - * in the restore location. - * When the backup has been restored this BackupStore instance is closed and can not be - * used for further backup or restore. - * - * If there are unrestorable items (non writable directories, or general IO exceptions) these items - * are written to the log, and the backup copies remain in the file system and can be manually restored - * (using a simple zip of the backup directory, and an unzip to the buRoot once the problem has been corrected). - * - * @throws IOException if the backup was not fully restored - unrestored items have been logged. - * @throws ClosedBackupStoreException if the backup is already closed. - */ - public void restore() throws IOException { - if (closed) - throw new ClosedBackupStoreException(Messages.BackupStore_restore_closed_store); - // put back all files - // collect things that could not be restored (so final status can be reported) - Set<File> unrestorable = new HashSet<File>(); - boolean restored = true; - if (!backupRoot.exists()) { - logError(NLS.bind(Messages.BackupStore_missing_backup_directory, backupRoot.getAbsolutePath())); - restored = false; - } else - restoreRoots(new File(backupRoot, backupName), unrestorable); - - logUnrestorables(unrestorable); - if (unrestorable.size() > 0) - restored = false; - close(restored); - closed = true; - } - - private void logUnrestorables(Set<File> unrestorable) { - // if there are unrestorable units log them - // - if (unrestorable != null && unrestorable.size() > 0) { - for (File file : unrestorable) - logError(NLS.bind(Messages.BackupStore_manual_restore_needed, file.getAbsolutePath())); - } - } - - /** - * Discards and closes this BackupStore. Does nothing if this store is already - * restored or discarded. - */ - public void discard() { - if (closed) - return; - closeSocket(); - removeBackups(); - closed = true; - } - - private void close(boolean fullyRestored) throws IOException { - closeSocket(); - // check external tampering with backup store - if (backupCounter != restoreCounter) { - if (!fullyRestored) - logError(NLS.bind(Messages.BackupStore_0_of_1_items_restored, new Long(restoreCounter), new Long(backupCounter))); - else { - logError(NLS.bind(Messages.BackupStore_externally_modified_0_of_1_restored, new Long(restoreCounter), new Long(backupCounter))); - fullyRestored = false; - } - } - if (!fullyRestored) - throw new IOException(Messages.BackupStore_errors_while_restoring_see_log); - // everything has been restored - the backup can now be removed - removeBackups(); - } - - private void closeSocket() { - if (socket != null && !socket.isClosed()) - try { - socket.close(); - } catch (IOException e) { /* ignored */ - logWarning(NLS.bind(Messages.BackupStore_can_not_close_tcp_port, new Integer(socket.getLocalPort()))); - } - } - - private void removeBackups() { - File buRoot = new File(backupRoot, backupName); - if (!fullyDelete(buRoot)) - logWarning(NLS.bind(Messages.BackupStore_can_not_remove_bu_directory, buRoot.getAbsolutePath())); - } - - private static void logWarning(String message) { - LogHelper.log(createWarning(message)); - } - - private static IStatus createWarning(String message) { - return new Status(IStatus.WARNING, Activator.ID, message); - } - - private static void logError(String message) { - LogHelper.log(createError(message)); - } - - private static IStatus createError(String message) { - return new Status(IStatus.ERROR, Activator.ID, message); - } - - /** - * Deletes a file, or a directory with all of it's children. - * @param file the file or directory to fully delete - * @return true if, and only if the file is deleted without errors - */ - private boolean fullyDelete(File file) { - if (!file.exists()) - return true; - if (file.isDirectory()) { - File[] children = file.listFiles(); - if (children == null) - return false; - for (int i = 0; i < children.length; i++) - if (!fullyDelete(new File(file, children[i].getName()))) - return false; - } - return file.delete(); - } - - private void restore(File root, File buRoot, Set<File> unrestorable) { - File[] children = buRoot.listFiles(); - if (children == null) { // error - can't read the backup directory - unrestorable.add(buRoot); - return; - } - for (int i = 0; i < children.length; i++) { - File bu = new File(buRoot, children[i].getName()); - File target = new File(root, bu.getName()); - if (bu.isDirectory()) { - if (!target.exists() && !target.mkdir()) { - unrestorable.add(bu); - continue; // give up on this branch - } else if (target.exists() && !target.isDirectory()) { - // ouch, there is a file where we need a directory - // that must be deleted. - target.delete(); - if (!target.mkdir()) { - unrestorable.add(bu); - continue; // give up on branch - } - } - restore(target, bu, unrestorable); - } else { - // do not restore the dummies (as they are used to trigger creation of - // empty directories and are not wanted in the restored location. - if (bu.getName().equals(dummyName)) { - restoreCounter++; // count of the restored directory in this case. - continue; - } - // if the original was overwritten by something and this file was not - // removed, it needs to be deleted now. If it can't be deleted, the - // renameTo will fail, and the bu is reported as not restorable. - // fullyDelete will remove a directory completely - we are restoring a file so it can - // not be kept. - if (target.exists()) - fullyDelete(target); - - // rename if possible, but must copy if not possible to just rename - if (!bu.renameTo(target)) { - // did not work to rename, probably because of volume boundaries. Try to copy instead, - try { - Util.copyStream(new FileInputStream(bu), true, new FileOutputStream(target), true); - restoreCounter++; // consider it restored - } catch (FileNotFoundException e) { - unrestorable.add(bu); - continue; - } catch (IOException e) { - unrestorable.add(bu); - continue; - } - if (!bu.delete()) { // cleanup - // could not remove the backup after copy - log, safe to remove manually - logWarning(NLS.bind(Messages.BackupStore_can_not_delete_tmp_file, bu.getAbsolutePath())); - } - } else - restoreCounter++; - } - } - } - - /** - * Restores everything backed up in the buRoot. Responsible for decoding the specially named root - * target directories (i.e. _/, __/, C/, etc.) into the real system names. - * @param buRoot - * @param unrestorable - */ - private void restoreRoots(File buRoot, Set<File> unrestorable) { - File[] children = buRoot.listFiles(); - if (children == null) { // error - can't read the backup directory - unrestorable.add(buRoot); - return; - } - for (int i = 0; i < children.length; i++) { - // Names are root-chars, or drive letters in the root bu directory - String name = children[i].getName(); - String rName = name; - String prefix = ""; //$NON-NLS-1$ - while (rName.startsWith(ROOTCHAR)) { - prefix += File.separator; - rName = rName.substring(1); - } - if (prefix.length() < 1) { - // The name is a drive name - rName = rName + ":" + File.separator; //$NON-NLS-1$ - } else - rName = prefix + rName; - // File root = new File(rName); - File bu = new File(buRoot, name); - File target = new File(rName); - if (!bu.isDirectory()) { - // the roots should all be directories - so this can only happen if someone manually - // stored files in the backup root - mark them as unrestorable and continue. - unrestorable.add(bu); - continue; - } - // the backup roots are system roots, and can not be created - but check root is directory and exists. - // (Network drives could have gone away etc). - // - if (!(target.exists() && target.isDirectory())) { - unrestorable.add(bu); - continue; // give up on this branch - } - // then perform a recursive restore - restore(target, bu, unrestorable); - } - } - - private static long msCounter = 0; - - /** - * Generates a unique hex string by taking currentTimeMillis + sequence - * number at the end allowing for 32 numbers to be generated per ms. - * This is sufficient uniqueness in the same VM. (And is still just a fallback solution - * if there is no access to a TCP port) - * - * To make number unique over multiple VMs - the PID of the process would be enough, but - * it is complicated to get hold of - a separate program must be launched and its PPID - * investigated. There is no standard API in Java to get the PID. Instead, a socket port is bound - * to ensure local uniqueness. - * - * To make number unique across multiple hosts (we may be provisioning over NFS), the - * 48 LS bits of the IP address is used (this is more than enough for an IPv4 address). - * (If there is no IP address, the machine is not on a - * network) - unfortunately the MAC address can not be used as this requires Java 6 (where - * there also is a UUID that should be used instead of this method). - * - * This method needs to be modified when IPv6 addressing is the norm - at that time, the - * restriction on Java 1.4 has hopefully been lifted, and it is possible to use the MAC address, - * or the UUID provided since java 1.6 - * - * @return a unique string - */ - private String genUnique() { - // use 5 LSB bits for counter within ms - i.e. 32 instances can be created - // per millisecond. - long timePart = (System.currentTimeMillis() << 5) | (msCounter++ & 31); - // can't use the MAC address - but take IP address if provisioning across NFS - long ipPart = 0; - try { - // the returned address can be 32 bits IPv4, or 128 bits IPv6 (?) - // In any case use the LSB bits (as many as will fit - byte[] address = InetAddress.getLocalHost().getAddress(); - for (int i = 0; i < address.length; i++) - ipPart = ((ipPart << 8) | (address[i] & 0xff)); - } catch (UnknownHostException e) { - // there is no IP address, and there and hence no concurrency from other machines. - // use the default ip part 0 - } - int port = 0; - try { - socket = new ServerSocket(0); - port = socket.getLocalPort(); - } catch (IOException e) { - try { - if (socket != null) - socket.close(); - } catch (IOException e1) { // ignore failure to close - - } - // use a random number as port in this case - port = new Random().nextInt() & 0xffff; - } - // port is never > 0xffff - long aPart = (ipPart << 16) | (port & 0xffff); - return Long.toHexString(timePart) + "_" + Long.toHexString(aPart); //$NON-NLS-1$ - - } - - /** - * Turns a file into a "relativized" absolute file. - * A leading "root" is transformed to the ROOTCHAR character. On Windows, network mapped drives starts - * with two separators - and are encoded as two ROOTCHAR. - * e.g. - * \\Host\C$\File becomes __\Host\C$\File - * /users/test/file becomes _/users/test/file - * C:/somewhere/file becomes C/somewhere/file - * - * @param file - * @return a relativized absolute abstract file - */ - private File makeRelativeFromRoot(File file) { - File absolute = file.getAbsoluteFile(); - String path = absolute.getPath(); - String prefix = ""; //$NON-NLS-1$ - while (path.startsWith(File.separator)) { - prefix += ROOTCHAR; - path = path.substring(1); - } - if (prefix.length() > 0) { - path = prefix + File.separator + path; - return new File(path); - } - // it is a windows drive letter first. - // Transform C:/foo to C/foo - // - int idx = path.indexOf(":"); //$NON-NLS-1$ - if (idx < 1) - throw new InternalError("File is neither absolute nor has a drive name: " + path); //$NON-NLS-1$ - path = path.substring(0, idx) + path.substring(idx + 1); - - return new File(path); - } - - /** - * The parent path may include ".." as a directory name - this must be made canonical. But if the file itself is - * a symbolic link, it should not be resolved. - */ - private File makeParentCanonical(File file) throws IOException { - return new File(file.getParentFile().getCanonicalFile(), file.getName()); - } -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/ClosedBackupStoreException.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/ClosedBackupStoreException.java deleted file mode 100644 index 7a19da549..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/ClosedBackupStoreException.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. 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: - * Cloudsmith Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.touchpoint.natives; - -public class ClosedBackupStoreException extends IllegalStateException { - private static final long serialVersionUID = -5030940685029643678L; - - public ClosedBackupStoreException() { - super(); - } - - public ClosedBackupStoreException(String message) { - super(message); - } - -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/IBackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/IBackupStore.java deleted file mode 100644 index 4b08dca09..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/IBackupStore.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. 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: - * Cloudsmith Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.equinox.internal.p2.touchpoint.natives; - -import java.io.File; -import java.io.IOException; - -public interface IBackupStore { - - /** - * Backup the file. - * Calling this method with a file that represents a directory is equivalent to calling - * {@link #backupDirectory(File)}. - * - * A file (path) can only be backed up once per IBackupStore instance. - * - * If a directory is first backed up, and later replaced by a regular file, and this file - * is also backed up (or vice versa) - an {@link IllegalArgumentException} is thrown - * - * A backup can not be performed on a closed IBackupStore. - * - * @param file - the file (or directory) to backup - * @return true if the file was backed up, false if this file (path) has already been backed up (the file is not moved to the store). - * @throws IOException - if the backup operation fails, or the file does not exist - * @throws IllegalStateException - if the IBackupStore has been closed - * @throws IllegalArgumentException - on type mismatch (file vs. directory) of earlier backup, or if file does not exist - */ - public boolean backup(File file) throws IOException; - - /** - * Same as {@link #backup(File)} except that a copy is kept in the original location. - * Can not be used to copy directories. - * @param file to backup and copy - * @return true if the file was backed up, false if this file (path) has already been backed up (the file is not moved to the store). - * @throws IOException - if the backup operation fails, if the file does not exist, or if the copy can not be created. - * @throws IllegalStateException - if the IBackupStore has been closed - * @throws IllegalArgumentException - on type mismatch (file vs. directory) of earlier backup, or if file is a directory. - */ - public boolean backupCopy(File file) throws IOException; - - /** - * Performs backup of an empty directory. The directory must be empty before it can be backed up (i.e. - * similar to a delete of a directory). Backup the files of the directory first. - * A call to backup a directory is really only needed for empty directories as a restore - * of a file will also restore all of its parent directories. - * @param file - the (empty) directory to back up - * @return true if the directory was moved to backup. false if the directory was already backed up and remains. - * @throws IllegalArgumentException if file is not a directory, or is not empty. - * @throws IOException if directory can not be moved to the backup store, or if the directory is not writeable - */ - public boolean backupDirectory(File file) throws IOException; - - /** - * Discards and closes this BackupStore. Does nothing if this store is already - * restored or discarded. - */ - public void discard(); - - /** - * Restores all backup files from backup store. - * Note that restore of a (non directory) file deletes an existing file or directory found - * in the restore location. - * When the backup has been restored it can not be - * used for further backup or restore. - * - * If there are unrestorable items (non writeable directories, or general IO exceptions) these items - * should be written to the log, and the backup copies should be retained - * for manual restore. - * - * @throws IOException if the backup was not fully restored - unrestored items should have been logged. - * @throws IllegalStateException if the backup is already closed. - */ - public void restore() throws IOException; - - /** - * Returns the unique backup name (this is the name of generated backup directories). - * @return the backup name. - */ - public String getBackupName(); - - /** - * Backs up a file, or everything under a directory. - * - * @param file - file to backup or directory - * @throws IOException if backup operation failed - */ - public void backupAll(File file) throws IOException; - - /** - * Backs up a file, or everything under a directory. - * A copy of the backup is left in the original place. - * @param file - * @throws IOException - */ - public void backupCopyAll(File file) throws IOException; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/LazyBackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/LazyBackupStore.java deleted file mode 100644 index e3dbc4c6f..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/LazyBackupStore.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. 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: - * Cloudsmith Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.touchpoint.natives; - -import java.io.File; -import java.io.IOException; - -/** - * LazyBackupStore is a BackupStore that only instantiates a real backup store - * when needed. - * - * - */ -public class LazyBackupStore implements IBackupStore { - private BackupStore delegate; - private final String prefix; - - /** - * Creates a new lazy backup store - * @param prefix The prefix to use in constructing the backup store directory - */ - public LazyBackupStore(String prefix) { - this.prefix = prefix; - } - - public boolean backup(File file) throws IOException { - loadDelegate(); - return delegate.backup(file); - } - - public boolean backupDirectory(File file) throws IOException { - loadDelegate(); - return delegate.backupDirectory(file); - } - - public void discard() { - if (delegate == null) - return; - delegate.discard(); - } - - public void restore() throws IOException { - if (delegate == null) - return; - delegate.restore(); - } - - private void loadDelegate() { - if (delegate != null) - return; - delegate = new BackupStore(null, prefix); - } - - public String getBackupName() { - loadDelegate(); - return delegate.getBackupName(); - } - - public boolean backupCopy(File file) throws IOException { - loadDelegate(); - return delegate.backupCopy(file); - } - - public void backupCopyAll(File file) throws IOException { - loadDelegate(); - delegate.backupCopyAll(file); - } - - public void backupAll(File file) throws IOException { - loadDelegate(); - delegate.backupAll(file); - } -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java deleted file mode 100644 index 0d73c2a72..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.p2.touchpoint.natives; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.touchpoint.natives.messages"; //$NON-NLS-1$ - - static { - // load message values from bundle file and assign to fields below - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - public static String BackupStore_0_of_1_items_restored; - public static String BackupStore_backupCopy_closed_store; - public static String BackupStore_can_not_close_tcp_port; - public static String BackupStore_can_not_copy_directory; - public static String BackupStore_can_not_create_dummy; - public static String BackupStore_can_not_delete_after_copy_0; - public static String BackupStore_can_not_delete_tmp_file; - public static String BackupStore_can_not_remove; - public static String BackupStore_can_not_remove_bu_directory; - public static String BackupStore_directory_file_mismatch; - public static String BackupStore_directory_not_empty; - public static String BackupStore_errors_while_restoring_see_log; - public static String BackupStore_externally_modified_0_of_1_restored; - public static String BackupStore_file_directory_mismatch; - public static String BackupStore_file_not_found; - public static String BackupStore_manual_restore_needed; - public static String BackupStore_missing_backup_directory; - public static String BackupStore_not_a_directory; - public static String BackupStore_restore_closed_store; - - public static String action_0_failed_file_1_doesNotExist; - public static String artifact_not_available; - public static String artifact_repo_not_found; - public static String could_not_obtain_download_cache; - public static String download_cache_not_writeable; - public static String unzipping; - public static String param_not_set; - public static String copy_failed; - public static String failed_backup_restore; - public static String backup_file_failed; - public static String Error_list_children_0; - public static String link_failed; - public static String mkdir_failed; - public static String rmdir_failed; - public static String Util_Invalid_Zip_File_Format; - public static String Util_Error_Unzipping; - -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java deleted file mode 100644 index cd8eef4a4..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.p2.touchpoint.natives; - -import org.eclipse.equinox.p2.core.ProvisionException; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import java.util.WeakHashMap; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.touchpoint.natives.actions.ActionConstants; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.engine.IProfile; -import org.eclipse.equinox.p2.engine.spi.Touchpoint; -import org.eclipse.equinox.p2.metadata.IArtifactKey; -import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository; -import org.eclipse.osgi.util.NLS; - -public class NativeTouchpoint extends Touchpoint { - - public static final String PARM_BACKUP = "backup"; //$NON-NLS-1$ - - public static final String PARM_ARTIFACT = "artifact"; //$NON-NLS-1$ - - public static final String PARM_ARTIFACT_LOCATION = "artifact.location"; //$NON-NLS-1$ - - private static Map<IProfile, IBackupStore> backups = new WeakHashMap<IProfile, IBackupStore>(); - - public IStatus initializeOperand(IProfile profile, Map<String, Object> parameters) { - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT); - IArtifactKey artifactKey = (IArtifactKey) parameters.get(PARM_ARTIFACT); - if (!parameters.containsKey(PARM_ARTIFACT_LOCATION) && artifactKey != null) { - try { - IFileArtifactRepository downloadCache = Util.getDownloadCacheRepo(agent); - File fileLocation = downloadCache.getArtifactFile(artifactKey); - if (fileLocation != null && fileLocation.exists()) - parameters.put(PARM_ARTIFACT_LOCATION, fileLocation.getAbsolutePath()); - } catch (ProvisionException e) { - return e.getStatus(); - } - } - return Status.OK_STATUS; - } - - public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map<String, Object> touchpointParameters) { - touchpointParameters.put(PARM_BACKUP, getBackupStore(profile)); - return null; - } - - public String qualifyAction(String actionId) { - return Activator.ID + "." + actionId; //$NON-NLS-1$ - } - - public IStatus prepare(IProfile profile) { - // does not have to do anything - everything is already in the correct place - // the commit means that the backup is discarded - if that fails it is not a - // terrible problem. - return super.prepare(profile); - } - - public IStatus commit(IProfile profile) { - IBackupStore store = getBackupStore(profile); - store.discard(); - return Status.OK_STATUS; - } - - /** - * Converts a profile id into a string that can be used as a file name in any file system. - */ - public static String escape(String toEscape) { - StringBuffer buffer = new StringBuffer(); - int length = toEscape.length(); - for (int i = 0; i < length; ++i) { - char ch = toEscape.charAt(i); - switch (ch) { - case '\\' : - case '/' : - case ':' : - case '*' : - case '?' : - case '"' : - case '<' : - case '>' : - case '|' : - case '%' : - buffer.append("%" + (int) ch + ";"); //$NON-NLS-1$ //$NON-NLS-2$ - break; - default : - buffer.append(ch); - } - } - return buffer.toString(); - } - - public IStatus rollback(IProfile profile) { - IStatus returnStatus = Status.OK_STATUS; - IBackupStore store = getBackupStore(profile); - try { - store.restore(); - } catch (IOException e) { - returnStatus = new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.failed_backup_restore, store.getBackupName()), e); - } catch (ClosedBackupStoreException e) { - returnStatus = new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.failed_backup_restore, store.getBackupName()), e); - } - clearProfileState(profile); - return returnStatus; - } - - /** - * Cleans up the transactional state associated with a profile. - */ - private static synchronized void clearProfileState(IProfile profile) { - backups.remove(profile); - } - - /** - * Gets the transactional state associated with a profile. A transactional state is - * created if it did not exist. - * @param profile - * @return a lazily initialized backup store - */ - private static synchronized IBackupStore getBackupStore(IProfile profile) { - IBackupStore store = backups.get(profile); - if (store == null) { - store = new LazyBackupStore(escape(profile.getProfileId())); - backups.put(profile, store); - } - return store; - } -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java deleted file mode 100644 index 60c1c0a86..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.p2.touchpoint.natives; - -import java.io.*; -import java.net.URI; -import java.util.*; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; -import org.eclipse.equinox.p2.core.*; -import org.eclipse.equinox.p2.engine.IProfile; -import org.eclipse.equinox.p2.repository.IRepository; -import org.eclipse.equinox.p2.repository.artifact.*; -import org.eclipse.osgi.util.NLS; - -public class Util { - - public static void log(String message) { - LogHelper.log(createError(message)); - } - - public static IStatus createError(String message) { - return new Status(IStatus.ERROR, Activator.ID, message); - } - - public static String getInstallFolder(IProfile profile) { - return profile.getProperty(IProfile.PROP_INSTALL_FOLDER); - } - - private static IAgentLocation getAgentLocation(IProvisioningAgent agent) { - return (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME); - } - - public static IArtifactRepositoryManager getArtifactRepositoryManager(IProvisioningAgent agent) { - return (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); - } - - public static IFileArtifactRepository getDownloadCacheRepo(IProvisioningAgent agent) throws ProvisionException { - URI location = getDownloadCacheLocation(agent); - if (location == null) - throw new IllegalStateException(Messages.could_not_obtain_download_cache); - IArtifactRepositoryManager manager = getArtifactRepositoryManager(agent); - if (manager == null) - throw new IllegalStateException(Messages.artifact_repo_not_found); - IArtifactRepository repository; - try { - repository = manager.loadRepository(location, null); - } catch (ProvisionException e) { - // the download cache doesn't exist or couldn't be read. Create new cache. - String repositoryName = location + " - Agent download cache"; //$NON-NLS-1$ - Map<String, String> properties = new HashMap<String, String>(1); - properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString()); - repository = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); - } - - IFileArtifactRepository downloadCache = (IFileArtifactRepository) repository.getAdapter(IFileArtifactRepository.class); - if (downloadCache == null) - throw new ProvisionException(NLS.bind(Messages.download_cache_not_writeable, location)); - return downloadCache; - } - - static private URI getDownloadCacheLocation(IProvisioningAgent agent) { - IAgentLocation location = getAgentLocation(agent); - if (location == null) - return null; - return URIUtil.append(location.getDataArea("org.eclipse.equinox.p2.core"), "cache/"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Unzip from a File to an output directory, with progress indication and backup. - * monitor and backup store may be null. - */ - public static File[] unzipFile(File zipFile, File outputDir, IBackupStore store, String taskName, IProgressMonitor monitor) throws IOException { - InputStream in = new FileInputStream(zipFile); - try { - return unzipStream(in, zipFile.length(), outputDir, store, taskName, monitor); - } catch (IOException e) { - // add the file name to the message - throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage())); - } finally { - in.close(); - } - } - - /** - * Unzip from an InputStream to an output directory using backup of overwritten files - * if backup store is not null. - */ - public static File[] unzipStream(InputStream stream, long size, File outputDir, IBackupStore store, String taskName, IProgressMonitor monitor) throws IOException { - InputStream is = monitor == null ? stream : stream; // new ProgressMonitorInputStream(stream, size, size, taskName, monitor); TODO Commented code - ZipInputStream in = new ZipInputStream(new BufferedInputStream(is)); - ZipEntry ze = in.getNextEntry(); - if (ze == null) { - // There must be at least one entry in a zip file. - // When there isn't getNextEntry returns null. - in.close(); - throw new IOException(Messages.Util_Invalid_Zip_File_Format); - } - ArrayList<File> unzippedFiles = new ArrayList<File>(); - do { - File outFile = new File(outputDir, ze.getName()); - unzippedFiles.add(outFile); - if (ze.isDirectory()) { - outFile.mkdirs(); - } else { - if (outFile.exists()) { - if (store != null) - store.backup(outFile); - else - outFile.delete(); - } else { - outFile.getParentFile().mkdirs(); - } - try { - copyStream(in, false, new FileOutputStream(outFile), true); - } catch (FileNotFoundException e) { - // TEMP: ignore this for now in case we're trying to replace - // a running eclipse.exe - } - outFile.setLastModified(ze.getTime()); - } - in.closeEntry(); - } while ((ze = in.getNextEntry()) != null); - in.close(); - - return unzippedFiles.toArray(new File[unzippedFiles.size()]); - } - - /** - * Copy an input stream to an output stream. - * Optionally close the streams when done. - * Return the number of bytes written. - */ - public static int copyStream(InputStream in, boolean closeIn, OutputStream out, boolean closeOut) throws IOException { - try { - int written = 0; - byte[] buffer = new byte[16 * 1024]; - int len; - while ((len = in.read(buffer)) != -1) { - out.write(buffer, 0, len); - written += len; - } - return written; - } finally { - try { - if (closeIn) { - in.close(); - } - } finally { - if (closeOut) { - out.close(); - } - } - } - } -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ActionConstants.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ActionConstants.java deleted file mode 100644 index a3357eb03..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ActionConstants.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.p2.touchpoint.natives.actions; - -public class ActionConstants { - - public static final String PARM_AGENT = "agent"; //$NON-NLS-1$ - public static final String PARM_PATH = "path"; //$NON-NLS-1$ - public static final String PARM_TARGET_FILE = "targetFile"; //$NON-NLS-1$ - public static final String PARM_PERMISSIONS = "permissions"; //$NON-NLS-1$ - public static final String PARM_TARGET_DIR = "targetDir"; //$NON-NLS-1$ - public static final String PARM_TARGET = "target"; //$NON-NLS-1$ - public static final String PARM_SOURCE = "source"; //$NON-NLS-1$ - public static final String PARM_IU = "iu"; //$NON-NLS-1$ - public static final String PIPE = "|"; //$NON-NLS-1$ - public static final String PARM_AT_ARTIFACT = "@artifact"; //$NON-NLS-1$ - public static final String PARM_ARTIFACT_REQUESTS = "artifactRequests"; //$NON-NLS-1$ - public static final String PARM_PROFILE = "profile"; //$NON-NLS-1$ - public static final String PARM_LINK_NAME = "linkName"; //$NON-NLS-1$ - public static final String PARM_LINK_TARGET = "linkTarget"; //$NON-NLS-1$ - public static final String PARM_LINK_FORCE = "force"; //$NON-NLS-1$ - public static final String PARM_COPY_TARGET = "target"; //$NON-NLS-1$ - public static final String PARM_COPY_SOURCE = "source"; //$NON-NLS-1$ - public static final String PARM_COPY_OVERWRITE = "overwrite"; //$NON-NLS-1$ - public static final String PARM_OPTIONS = "options"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java deleted file mode 100644 index 5de59d276..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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: - * Red Hat Incorporated - initial API and implementation - * IBM Corporation - ongoing development - * Cloudsmith Inc - ongoing development - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.touchpoint.natives.actions; - -import java.io.*; -import java.util.ArrayList; -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.touchpoint.natives.Messages; -import org.eclipse.equinox.internal.p2.touchpoint.natives.Util; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.osgi.util.NLS; - -public class ChmodAction extends ProvisioningAction { - private static final String ACTION_CHMOD = "chmod"; //$NON-NLS-1$ - private static final boolean WINDOWS = java.io.File.separatorChar == '\\'; - - public IStatus execute(Map<String, Object> parameters) { - String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR); - if (targetDir == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET_DIR, ACTION_CHMOD)); - String targetFile = (String) parameters.get(ActionConstants.PARM_TARGET_FILE); - if (targetFile == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET_FILE, ACTION_CHMOD)); - String permissions = (String) parameters.get(ActionConstants.PARM_PERMISSIONS); - if (permissions == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PERMISSIONS, ACTION_CHMOD)); - String optionsString = (String) parameters.get(ActionConstants.PARM_OPTIONS); - - // Check that file exist - File probe = new File(targetDir + IPath.SEPARATOR + targetFile); - if (!probe.exists()) - return Util.createError(NLS.bind(Messages.action_0_failed_file_1_doesNotExist, ACTION_CHMOD, probe.toString())); - - String options[] = null; - if (optionsString != null) { - ArrayList<String> collect = new ArrayList<String>(); - String r = optionsString.trim(); - while (r.length() > 0) { - int spaceIdx = r.indexOf(' '); - if (spaceIdx < 0) { - collect.add(r); - r = ""; //$NON-NLS-1$ - } else { - collect.add(r.substring(0, spaceIdx)); - r = r.substring(spaceIdx + 1); - r = r.trim(); - } - } - if (collect.size() > 0) { - options = new String[collect.size()]; - collect.toArray(options); - } - } - - chmod(targetDir, targetFile, permissions, options); - return Status.OK_STATUS; - } - - public IStatus undo(Map<String, Object> parameters) { - //TODO: implement undo ?? - return Status.OK_STATUS; - } - - public void chmod(String targetDir, String targetFile, String perms, String[] options) { - if (WINDOWS) - return; - Runtime r = Runtime.getRuntime(); - try { - // Note: 3 is from chmod, permissions, and target - String[] args = new String[3 + (options == null ? 0 : options.length)]; - int i = 0; - args[i++] = "chmod"; //$NON-NLS-1$ - if (options != null) { - for (int j = 0; j < options.length; j++) - args[i++] = options[j]; - } - args[i++] = perms; - args[i] = targetDir + IPath.SEPARATOR + targetFile; - Process process = r.exec(args); - readOffStream(process.getErrorStream()); - readOffStream(process.getInputStream()); - try { - process.waitFor(); - } catch (InterruptedException e) { - // mark thread interrupted and continue - Thread.currentThread().interrupt(); - } - } catch (IOException e) { - // ignore - } - } - - private void readOffStream(InputStream inputStream) { - BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); - try { - while (reader.readLine() != null) { - // do nothing - } - } catch (IOException e) { - // ignore - } finally { - try { - reader.close(); - } catch (IOException e) { - // ignore - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java deleted file mode 100644 index b394f0adf..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. 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: - * Cloudsmith Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.touchpoint.natives.actions; - -import java.io.File; -import java.io.IOException; -import java.util.*; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.touchpoint.natives.*; -import org.eclipse.equinox.p2.engine.IProfile; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.osgi.util.NLS; - -public class CleanupcopyAction extends ProvisioningAction { - - public static final String ACTION_CLEANUPCOPY = "cleanupcopy"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - return cleanupcopy(parameters, true); - } - - public IStatus undo(Map<String, Object> parameters) { - return CopyAction.copy(parameters, false); - } - - /** - * Perform a cleanup of a previously made copy action. - * @param parameters action parameters - * @param restoreable flag indicating if the operation should be backed up - * @return status - */ - public static IStatus cleanupcopy(Map<String, Object> parameters, boolean restoreable) { - String source = (String) parameters.get(ActionConstants.PARM_SOURCE); - if (source == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_CLEANUPCOPY)); - String target = (String) parameters.get(ActionConstants.PARM_TARGET); - if (target == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET, ACTION_CLEANUPCOPY)); - IBackupStore backupStore = (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP); - - IInstallableUnit iu = (IInstallableUnit) parameters.get(ActionConstants.PARM_IU); - IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); - - String copied = profile.getInstallableUnitProperty(iu, "copied" + ActionConstants.PIPE + source + ActionConstants.PIPE + target); //$NON-NLS-1$ - - if (copied == null) - return Status.OK_STATUS; - - StringTokenizer tokenizer = new StringTokenizer(copied, ActionConstants.PIPE); - List<File> directories = new ArrayList<File>(); - while (tokenizer.hasMoreTokens()) { - String fileName = tokenizer.nextToken(); - File file = new File(fileName); - if (!file.exists()) - continue; - - //directories need to be deleted from the bottom-up, but directories are listed - //in traversal order during copy, so we need to reverse the directory list - if (file.isDirectory()) - directories.add(0, file); - else { - if (restoreable) - try { - backupStore.backup(file); - } catch (IOException e) { - return Util.createError(NLS.bind(Messages.backup_file_failed, file)); - } - else - file.delete(); - } - } - - for (File directory : directories) { - File[] children = directory.listFiles(); - if (children == null) - return Util.createError(NLS.bind(Messages.Error_list_children_0, directory)); - - if (children.length == 0) { - if (restoreable) - try { - backupStore.backup(directory); - } catch (IOException e) { - return Util.createError(NLS.bind(Messages.backup_file_failed, directory)); - } - else - directory.delete(); - } - } - - return Status.OK_STATUS; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java deleted file mode 100644 index 7ef7d5413..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.p2.touchpoint.natives.actions; - -import java.io.File; -import java.io.IOException; -import java.util.*; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.internal.p2.touchpoint.natives.*; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.osgi.util.NLS; - -public class CleanupzipAction extends ProvisioningAction { - - private static final String UNZIPPED = "unzipped"; //$NON-NLS-1$ - public static final String ACTION_CLEANUPZIP = "cleanupzip"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - return cleanupzip(parameters, true); - } - - public IStatus undo(Map<String, Object> parameters) { - return UnzipAction.unzip(parameters, false); - } - - public static IStatus cleanupzip(Map<String, Object> parameters, boolean restoreable) { - String source = (String) parameters.get(ActionConstants.PARM_SOURCE); - if (source == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_CLEANUPZIP)); - String target = (String) parameters.get(ActionConstants.PARM_TARGET); - if (target == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET, ACTION_CLEANUPZIP)); - - IInstallableUnit iu = (IInstallableUnit) parameters.get(ActionConstants.PARM_IU); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); - - String iuPropertyKey = UNZIPPED + ActionConstants.PIPE + source + ActionConstants.PIPE + target; - - String unzipped = profile.getInstallableUnitProperty(iu, iuPropertyKey); - if (unzipped == null) { - // best effort - // we try to substitute the current target with what was written. - Map<String, String> iuProperties = profile.getInstallableUnitProperties(iu); - String sourcePrefix = UNZIPPED + ActionConstants.PIPE + source + ActionConstants.PIPE; - for (String key : iuProperties.keySet()) { - if (key.startsWith(sourcePrefix)) { - if (unzipped == null) { - iuPropertyKey = key; - String storedTarget = key.substring(sourcePrefix.length()); - unzipped = substituteTarget(storedTarget, target, iuProperties.get(key)); - } else - return Status.OK_STATUS; // possible two unzips of this source - give up on best effort - } - } - // no match - if (unzipped == null) - return Status.OK_STATUS; - } - - IBackupStore store = restoreable ? (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP) : null; - StringTokenizer tokenizer = new StringTokenizer(unzipped, ActionConstants.PIPE); - List<File> directories = new ArrayList<File>(); - while (tokenizer.hasMoreTokens()) { - String fileName = tokenizer.nextToken(); - File file = new File(fileName); - if (!file.exists()) - continue; - - if (file.isDirectory()) - directories.add(file); - else { - if (store != null) - try { - store.backup(file); - } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.backup_file_failed, file.getPath()), e); - } - else - file.delete(); - } - } - // sort directories by path length longest path is in top - // this will make sure that a sub folder will be removed before its parent - Collections.sort(directories, new Comparator<File>() { - - public int compare(File f1, File f2) { - if (f1 == f2) - return 0; - if (f1 != null && f2 == null) - return -1; - if (f1 == null) - return 1; - try { - return Integer.valueOf(f2.getCanonicalPath().length()).compareTo(f1.getCanonicalPath().length()); - } catch (IOException e) { - // did our best. try an absolute path compare - return Integer.valueOf(f2.getAbsolutePath().length()).compareTo(f1.getAbsolutePath().length()); - } - } - - }); - for (File directory : directories) { - if (store != null) { - File[] children = directory.listFiles(); - // Since backup will deny backup of non empty directory a check must be made - if (children == null || children.length == 0) - try { - store.backupDirectory(directory); - } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.backup_file_failed, directory.getPath()), e); - } - } else - directory.delete(); - } - - profile.removeInstallableUnitProperty(iu, iuPropertyKey); - return Status.OK_STATUS; - } - - private static String substituteTarget(String oldTarget, String newTarget, String value) { - StringBuffer buffer = new StringBuffer(); - StringTokenizer tokenizer = new StringTokenizer(value, ActionConstants.PIPE); - while (tokenizer.hasMoreTokens()) { - String fileName = tokenizer.nextToken().trim(); - if (fileName.length() == 0) - continue; - if (fileName.startsWith(oldTarget)) - fileName = newTarget + fileName.substring(oldTarget.length()); - - buffer.append(fileName).append(ActionConstants.PIPE); - } - return buffer.toString(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java deleted file mode 100644 index 21c3cf159..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.p2.touchpoint.natives.actions; - -import java.util.Collection; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.touchpoint.natives.Util; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.core.ProvisionException; -import org.eclipse.equinox.p2.engine.IProfile; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.metadata.IArtifactKey; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; -import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest; - -public class CollectAction extends ProvisioningAction { - - public static final String ACTION_COLLECT = "collect"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT); - IInstallableUnit iu = (IInstallableUnit) parameters.get(ActionConstants.PARM_IU); - try { - IArtifactRequest[] requests = collect(agent, iu, profile); - @SuppressWarnings("unchecked") - Collection<IArtifactRequest[]> artifactRequests = (Collection<IArtifactRequest[]>) parameters.get(ActionConstants.PARM_ARTIFACT_REQUESTS); - artifactRequests.add(requests); - } catch (ProvisionException e) { - return e.getStatus(); - } - return Status.OK_STATUS; - } - - public IStatus undo(Map<String, Object> parameters) { - // nothing to do for now - return Status.OK_STATUS; - } - - IArtifactRequest[] collect(IProvisioningAgent agent, IInstallableUnit installableUnit, IProfile profile) throws ProvisionException { - Collection<IArtifactKey> toDownload = installableUnit.getArtifacts(); - if (toDownload == null) - return new IArtifactRequest[0]; - IArtifactRepository destination = Util.getDownloadCacheRepo(agent); - IArtifactRequest[] requests = new IArtifactRequest[toDownload.size()]; - int count = 0; - for (IArtifactKey key : toDownload) { - //TODO Here there are cases where the download is not necessary again because what needs to be done is just a configuration step - requests[count++] = Util.getArtifactRepositoryManager(agent).createMirrorRequest(key, destination, null, null); - } - - if (requests.length == count) - return requests; - IArtifactRequest[] result = new IArtifactRequest[count]; - System.arraycopy(requests, 0, result, 0, count); - return result; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java deleted file mode 100644 index d9dab3c98..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. 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: - * Cloudsmith Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.touchpoint.natives.actions; - -import java.io.File; - -import java.io.*; -import java.util.ArrayList; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.internal.p2.touchpoint.natives.*; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.metadata.IArtifactKey; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.osgi.util.NLS; - -/** - * Copies from PARM_COPY_SOURCE to PARAM_COPY_TARGET - * The optional parameter PARAM_COPY_OVERWRITE overwrites and existing file if set to true, else - * and existing file with the same name is an error. The default is false. - * If the source is a directory, a merge copy to the target is performed. - * Copy will copy files and directories (recursively). - * - */ -public class CopyAction extends ProvisioningAction { - public static final String ID = "cp"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - return copy(parameters, true); - } - - /** Perform the copy. - * - * @param parameters action parameters - * @param restoreable flag indicating if the operation should be backed up - * @return status - */ - public static IStatus copy(Map<String, Object> parameters, boolean restoreable) { - String target = (String) parameters.get(ActionConstants.PARM_COPY_TARGET); - IBackupStore backupStore = restoreable ? (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP) : null; - - if (target == null) - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_COPY_TARGET, ID), null); - - String source = (String) parameters.get(ActionConstants.PARM_COPY_SOURCE); - if (source == null) - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_COPY_SOURCE, ID), null); - - String overwrite = (String) parameters.get(ActionConstants.PARM_COPY_OVERWRITE); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); - IInstallableUnit iu = (IInstallableUnit) parameters.get(ActionConstants.PARM_IU); - - String originalSource = source; - if (source.equals(ActionConstants.PARM_AT_ARTIFACT)) { - String artifactLocation = (String) parameters.get(NativeTouchpoint.PARM_ARTIFACT_LOCATION); - if (artifactLocation == null) { - IArtifactKey artifactKey = (IArtifactKey) parameters.get(NativeTouchpoint.PARM_ARTIFACT); - return Util.createError(NLS.bind(Messages.artifact_not_available, artifactKey)); - } - source = artifactLocation; - } - - File sourceFile = new File(source); - File targetFile = new File(target); - File[] copiedFiles = null; - try { - copiedFiles = mergeCopy(sourceFile, targetFile, Boolean.valueOf(overwrite).booleanValue(), backupStore); - } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.copy_failed, sourceFile.getPath()), e); - } - // keep copied file in the profile as memento for CleanupCopy - StringBuffer copiedFileNameBuffer = new StringBuffer(); - for (int i = 0; i < copiedFiles.length; i++) - copiedFileNameBuffer.append(copiedFiles[i].getAbsolutePath()).append(ActionConstants.PIPE); - - profile.setInstallableUnitProperty(iu, "copied" + ActionConstants.PIPE + originalSource + ActionConstants.PIPE + target, copiedFileNameBuffer.toString()); //$NON-NLS-1$ - - return Status.OK_STATUS; - } - - public IStatus undo(Map<String, Object> parameters) { - return CleanupcopyAction.cleanupcopy(parameters, false); - } - - /** - * Merge-copy file or directory. - * @param source - * @param target - * @param overwrite - * @throws IOException - */ - private static File[] mergeCopy(File source, File target, boolean overwrite, IBackupStore backupStore) throws IOException { - ArrayList<File> copiedFiles = new ArrayList<File>(); - xcopy(copiedFiles, source, target, overwrite, backupStore); - return copiedFiles.toArray(new File[copiedFiles.size()]); - } - - /** - * Merge-copy file or directory. - * @param copiedFiles - ArrayList where copied files are collected - * @param source - * @param target - * @param overwrite - * @throws IOException - */ - private static void xcopy(ArrayList<File> copiedFiles, File source, File target, boolean overwrite, IBackupStore backupStore) throws IOException { - if (!source.exists()) - throw new IOException("Source: " + source + "does not exists"); //$NON-NLS-1$//$NON-NLS-2$ - - if (source.isDirectory()) { - if (target.exists() && target.isFile()) { - if (!overwrite) - throw new IOException("Target: " + target + " already exists"); //$NON-NLS-1$//$NON-NLS-2$ - if (backupStore != null) - backupStore.backup(target); - else - target.delete(); - } - if (!target.exists()) - target.mkdirs(); - copiedFiles.add(target); - File[] children = source.listFiles(); - if (children == null) - throw new IOException("Error while retrieving children of directory: " + source); //$NON-NLS-1$ - for (int i = 0; i < children.length; i++) - xcopy(copiedFiles, children[i], new File(target, children[i].getName()), overwrite, backupStore); - return; - } - if (target.exists() && !overwrite) - throw new IOException("Target: " + target + " already exists"); //$NON-NLS-1$//$NON-NLS-2$ - - if (!target.getParentFile().exists() && !target.getParentFile().mkdirs()) - throw new IOException("Target: Path " + target.getParent() + " could not be created"); //$NON-NLS-1$//$NON-NLS-2$ - - try { - Util.copyStream(new FileInputStream(source), true, new FileOutputStream(target), true); - } catch (IOException e) { - // get the original IOException to the log - e.printStackTrace(); - throw new IOException("Error while copying:" + source.getAbsolutePath()); //$NON-NLS-1$ - } - copiedFiles.add(target); - } -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java deleted file mode 100644 index a27777cec..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.p2.touchpoint.natives.actions; - -import java.io.*; -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.touchpoint.natives.*; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.osgi.util.NLS; - -public class LinkAction extends ProvisioningAction { - public static final String ID = "ln"; //$NON-NLS-1$ - private static final boolean WINDOWS = java.io.File.separatorChar == '\\'; - - public IStatus execute(Map<String, Object> parameters) { - String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR); - if (targetDir == null) - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET_DIR, ID), null); - - String linkTarget = (String) parameters.get(ActionConstants.PARM_LINK_TARGET); - if (linkTarget == null) - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_LINK_TARGET, ID), null); - - String linkName = (String) parameters.get(ActionConstants.PARM_LINK_NAME); - if (linkName == null) - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_LINK_NAME, ID), null); - - String force = (String) parameters.get(ActionConstants.PARM_LINK_FORCE); - - IBackupStore store = (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP); - - try { - ln(targetDir, linkTarget, linkName, Boolean.valueOf(force).booleanValue(), store); - } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.link_failed, linkName, ID), e); - } - return Status.OK_STATUS; - } - - public IStatus undo(Map<String, Object> parameters) { - if (WINDOWS) - return Status.OK_STATUS; - String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR); - String linkName = (String) parameters.get(ActionConstants.PARM_LINK_NAME); - - if (targetDir != null && linkName != null) { - File linkFile = new File(targetDir, linkName); - linkFile.delete(); // ok since if something was overwritten - it is restored from backup - } - return Status.OK_STATUS; - } - - /** - * Creates a link to the source file linkTarget - the created link is targetDir/linkName. - * TODO: Only runs on systems with a "ln -s" command supported. - * TODO: Does not report errors if the "ln -s" fails - * @param targetDir the directory where the link is created - * @param linkTarget the source - * @param linkName the name of the created link - * @param force if overwrite of existing file should be performed. - * @param store an (optional - set to null) backup store to use - * @throws IOException if backup of existing file fails - */ - private void ln(String targetDir, String linkTarget, String linkName, boolean force, IBackupStore store) throws IOException { - if (WINDOWS) - return; - // backup a file that would be overwritten using "force == true" - if (force && store != null) { - File xFile = new File(targetDir, linkName); - if (xFile.exists()) - store.backup(xFile); - } - Runtime r = Runtime.getRuntime(); - try { - Process process = r.exec(new String[] {"ln", "-s" + (force ? "f" : ""), linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - readOffStream(process.getErrorStream()); - readOffStream(process.getInputStream()); - try { - process.waitFor(); - } catch (InterruptedException e) { - // mark thread interrupted and continue - Thread.currentThread().interrupt(); - } - } catch (IOException e) { - // ignore - } - } - - private void readOffStream(InputStream inputStream) { - BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); - try { - while (reader.readLine() != null) { - // do nothing - } - } catch (IOException e) { - // ignore - } finally { - try { - reader.close(); - } catch (IOException e) { - // ignore - } - } - } -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java deleted file mode 100644 index bea5668c0..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.p2.touchpoint.natives.actions; - -import java.io.File; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.touchpoint.natives.Messages; -import org.eclipse.equinox.internal.p2.touchpoint.natives.Util; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.osgi.util.NLS; - -public class MkdirAction extends ProvisioningAction { - public static final String ID = "mkdir"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - String path = (String) parameters.get(ActionConstants.PARM_PATH); - if (path == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID)); - File dir = new File(path); - // A created or existing directory is ok - dir.mkdir(); - if (dir.isDirectory()) - return Status.OK_STATUS; - // mkdir could have failed because of permissions, or because of an existing file - return Util.createError(NLS.bind(Messages.mkdir_failed, path, ID)); - } - - public IStatus undo(Map<String, Object> parameters) { - String path = (String) parameters.get(ActionConstants.PARM_PATH); - if (path == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID)); - File dir = new File(path); - // although not perfect, it at least prevents a faulty mkdir to delete a file on undo - // worst case is that an empty directory could be deleted - if (dir.isDirectory()) - dir.delete(); - return Status.OK_STATUS; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java deleted file mode 100644 index c820a9bbd..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. 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: - * Cloudsmith Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.touchpoint.natives.actions; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.touchpoint.natives.*; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.osgi.util.NLS; - -public class RemoveAction extends ProvisioningAction { - public static final String ID = "remove"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - String path = (String) parameters.get(ActionConstants.PARM_PATH); - if (path == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID)); - File file = new File(path); - // ignore if the file is already removed - if (!file.exists()) - return Status.OK_STATUS; - IBackupStore store = (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP); - if (store == null) - return Util.createError(NLS.bind(Messages.param_not_set, NativeTouchpoint.PARM_BACKUP, ID)); - try { - store.backupAll(file); - } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.backup_file_failed, file.getPath()), e); - } - return Status.OK_STATUS; - } - - public IStatus undo(Map<String, Object> parameters) { - // Does not have to do anything as the backup will restore what was deleted - return Status.OK_STATUS; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java deleted file mode 100644 index 8473a2ae8..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.p2.touchpoint.natives.actions; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.touchpoint.natives.*; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.osgi.util.NLS; - -public class RmdirAction extends ProvisioningAction { - public static final String ID = "rmdir"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - String path = (String) parameters.get(ActionConstants.PARM_PATH); - if (path == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID)); - - IBackupStore store = (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP); - - File dir = new File(path); - if (!dir.isDirectory()) - return Util.createError(NLS.bind(Messages.rmdir_failed, path, ID)); - if (store != null) - try { - store.backupDirectory(dir); - } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.rmdir_failed, path, ID), e); - } catch (IllegalArgumentException e) { - // Ignore the delete/backup if the directory was not empty as this preserves the - // the original semantics. - // See Bug 272312 for more detail. - // return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.rmdir_failed, ActionConstants.PARM_PATH, ID), e); - // - } - else - dir.delete(); - return Status.OK_STATUS; - } - - public IStatus undo(Map<String, Object> parameters) { - String path = (String) parameters.get(ActionConstants.PARM_PATH); - IBackupStore store = (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP); - if (path == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID)); - // only need to create a dir if backup was not used - if (store == null) - new File(path).mkdir(); - return Status.OK_STATUS; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java deleted file mode 100644 index 108161650..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.p2.touchpoint.natives.actions; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.internal.p2.touchpoint.natives.*; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.metadata.IArtifactKey; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.osgi.util.NLS; - -public class UnzipAction extends ProvisioningAction { - - public static final String ACTION_UNZIP = "unzip"; //$NON-NLS-1$ - - public IStatus execute(Map<String, Object> parameters) { - return unzip(parameters, true); - } - - public IStatus undo(Map<String, Object> parameters) { - return CleanupzipAction.cleanupzip(parameters, false); - } - - /** - * Unzip as directed by parameters. - * Record what was zipped in the profile. - * @param parameters - * @param restoreable - if the unzip should be backed up - * @return status - */ - public static IStatus unzip(Map<String, Object> parameters, boolean restoreable) { - String source = (String) parameters.get(ActionConstants.PARM_SOURCE); - if (source == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_UNZIP)); - - String originalSource = source; - String target = (String) parameters.get(ActionConstants.PARM_TARGET); - if (target == null) - return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET, ACTION_UNZIP)); - - IInstallableUnit iu = (IInstallableUnit) parameters.get(ActionConstants.PARM_IU); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); - - if (source.equals(ActionConstants.PARM_AT_ARTIFACT)) { - String artifactLocation = (String) parameters.get(NativeTouchpoint.PARM_ARTIFACT_LOCATION); - if (artifactLocation == null) { - IArtifactKey artifactKey = (IArtifactKey) parameters.get(NativeTouchpoint.PARM_ARTIFACT); - return Util.createError(NLS.bind(Messages.artifact_not_available, artifactKey)); - } - source = artifactLocation; - } - IBackupStore store = restoreable ? (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP) : null; - File[] unzippedFiles = unzip(source, target, store); - StringBuffer unzippedFileNameBuffer = new StringBuffer(); - for (int i = 0; i < unzippedFiles.length; i++) - unzippedFileNameBuffer.append(unzippedFiles[i].getAbsolutePath()).append(ActionConstants.PIPE); - - profile.setInstallableUnitProperty(iu, "unzipped" + ActionConstants.PIPE + originalSource + ActionConstants.PIPE + target, unzippedFileNameBuffer.toString()); //$NON-NLS-1$ - - return Status.OK_STATUS; - } - - /** - * Unzips a source zip into the given destination. Any existing contents in the destination - * are backed up in the provided backup store. - */ - private static File[] unzip(String source, String destination, IBackupStore store) { - File zipFile = new File(source); - if (zipFile == null || !zipFile.exists()) { - Util.log(UnzipAction.class.getName() + " the files to be unzipped is not here"); //$NON-NLS-1$ - } - try { - String taskName = NLS.bind(Messages.unzipping, source); - return Util.unzipFile(zipFile, new File(destination), store, taskName, new NullProgressMonitor()); - } catch (IOException e) { - Util.log(UnzipAction.class.getName() + " error unzipping zipfile: " + zipFile.getAbsolutePath() + "destination: " + destination); //$NON-NLS-1$ //$NON-NLS-2$ - } - return new File[0]; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties deleted file mode 100644 index 1dbe1a176..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################### -# Copyright (c) 2007, 2009 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 -############################################################################### - -BackupStore_backupCopy_closed_store=Can not perform backup on closed backup store. -BackupStore_0_of_1_items_restored={0} items out of {1} items restored. -BackupStore_can_not_close_tcp_port=Could not close tcp socket for port: {0} -BackupStore_can_not_copy_directory=Can not copy a directory: {0} -BackupStore_can_not_create_dummy=Can not create dummy file: {0} -BackupStore_can_not_delete_after_copy_0=File that was copied to backup could not be deleted: {0} -BackupStore_can_not_delete_tmp_file=Can not delete temporary file - it is safe to delete it manually: {0} -BackupStore_can_not_remove=Can not remove : {0} -BackupStore_can_not_remove_bu_directory=Could not remove temporary backup directory (it is safe to manually delete it and its contents): {0} -BackupStore_directory_file_mismatch=File already backed up as a directory: {0} -BackupStore_directory_not_empty=Directory is not empty: {0} -BackupStore_errors_while_restoring_see_log=Errors while restoring - see earlier logged errors -BackupStore_externally_modified_0_of_1_restored=Backup store modified externally\! {0} items out of {1} items restored. Remaining items can not be found. -BackupStore_file_directory_mismatch=File already backed up as a file - and is now required as a directory: {0} -BackupStore_file_not_found=File does not exist: {0}. -BackupStore_manual_restore_needed=Manual restore of backup needed for: {0} -BackupStore_missing_backup_directory=Missing backup directory - can not restore: {0} -BackupStore_not_a_directory=File is not a directory: {0} -BackupStore_restore_closed_store=Can not perform restore on closed backup store - -action_0_failed_file_1_doesNotExist=The action {0} failed - file {1} does not exist -artifact_not_available=The artifact for {0} is not available. -unzipping=Extracting {0} -param_not_set=The \"{0}\" parameter was not set in the \"{1}\" action. -artifact_repo_not_found=The artifact repository manager could not be found. -could_not_obtain_download_cache=Could not obtain the download cache location. -download_cache_not_writeable=Agent download cache not writeable: {0}. -copy_failed=I/O Error while copying {0} - see details. -failed_backup_restore=Restore of backup failed - see log for details. Backup directory name: {0}. -backup_file_failed=Backup of file {0} failed. -Error_list_children_0=Error while retrieving children of directory: {0} -link_failed=Could not create link {0}. -mkdir_failed=Could not create directory {0}. -rmdir_failed=Could not remove directory {0}. -Util_Invalid_Zip_File_Format=Invalid zip file format -Util_Error_Unzipping=Error unzipping {0}: {1} |