diff options
1250 files changed, 0 insertions, 147321 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/.classpath b/org.eclipse.mylyn.bugzilla.core/.classpath deleted file mode 100644 index 6fe19812c..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.classpath +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> - <accessrules> - <accessrule kind="nonaccessible" pattern="**/System"/> - </accessrules> - </classpathentry> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> - <accessrules> - <accessrule kind="nonaccessible" pattern="com/sun/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/org.eclipse.mylyn.bugzilla.core/.cvsignore b/org.eclipse.mylyn.bugzilla.core/.cvsignore deleted file mode 100644 index bc8b2d4cb..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -bugzilla.jar -doc.zip diff --git a/org.eclipse.mylyn.bugzilla.core/.project b/org.eclipse.mylyn.bugzilla.core/.project deleted file mode 100644 index ffdfd20f4..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.mylyn.bugzilla.core</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/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index fa10b7532..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,340 +0,0 @@ -#Mon Dec 15 14:23:06 PST 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -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.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=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -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=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -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.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX -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=80 -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=1 -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=false -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_comments=true -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=true -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=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -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=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=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=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=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=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not 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=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true -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=true -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 diff --git a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 766f9cb69..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,63 +0,0 @@ -#Thu Sep 11 16:27:18 PDT 2008 -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Mylyn based on Eclipse -formatter_settings_version=11 -internal.default.compliance=default -org.eclipse.jdt.ui.exception.name=e -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2004, 2008 Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></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_methods=false -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=true -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -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=true -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=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -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=true -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=true -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/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.ltk.core.refactoring.prefs b/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index 7ab03bdac..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Jun 02 15:30:09 PDT 2006 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=true diff --git a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.mylyn.tasklist.prefs b/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.mylyn.tasklist.prefs deleted file mode 100644 index 0a2cc0b30..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.mylyn.tasklist.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Mon Jun 18 17:14:59 PDT 2007 -eclipse.preferences.version=1 -project.repository.kind=bugzilla -project.repository.url=https\://bugs.eclipse.org/bugs diff --git a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.mylyn.tasks.ui.prefs b/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.mylyn.tasks.ui.prefs deleted file mode 100644 index d8c6d26af..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.mylyn.tasks.ui.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Mon Jun 25 03:02:37 GMT 2007 -eclipse.preferences.version=1 -project.repository.kind=bugzilla -project.repository.url=https\://bugs.eclipse.org/bugs diff --git a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.pde.prefs b/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.pde.prefs deleted file mode 100644 index e8f2d5620..000000000 --- a/org.eclipse.mylyn.bugzilla.core/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,18 +0,0 @@ -#Tue Apr 15 11:07:59 PDT 2008 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=2 -compilers.p.missing-bundle-classpath-entries=1 -compilers.p.missing-packages=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=0 -compilers.p.unknown-class=0 -compilers.p.unknown-element=0 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=0 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF deleted file mode 100644 index 601cdc84e..000000000 --- a/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,18 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-SymbolicName: org.eclipse.mylyn.bugzilla.core;singleton:=true -Bundle-Version: 3.1.1.qualifier -Bundle-Activator: org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.mylyn.tasks.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.mylyn.commons.net;bundle-version="[3.0.0,4.0.0)", - org.eclipse.mylyn.commons.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.core.net -Bundle-ActivationPolicy: lazy -Bundle-Vendor: %Bundle-Vendor -Bundle-ClassPath: . -Export-Package: org.eclipse.mylyn.internal.bugzilla.core;x-friends:="org.eclipse.mylyn.bugzilla.ide,org.eclipse.mylyn.bugzilla.ui", - org.eclipse.mylyn.internal.bugzilla.core.history;x-friends:="org.eclipse.mylyn.bugzilla.ide,org.eclipse.mylyn.bugzilla.ui" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Bundle-Localization: plugin diff --git a/org.eclipse.mylyn.bugzilla.core/about.html b/org.eclipse.mylyn.bugzilla.core/about.html deleted file mode 100644 index d774b07c7..000000000 --- a/org.eclipse.mylyn.bugzilla.core/about.html +++ /dev/null @@ -1,27 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 25, 2008</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</a>.</p> - -</body> -</html>
\ No newline at end of file diff --git a/org.eclipse.mylyn.bugzilla.core/build-user.xml b/org.eclipse.mylyn.bugzilla.core/build-user.xml deleted file mode 100644 index 6097713f2..000000000 --- a/org.eclipse.mylyn.bugzilla.core/build-user.xml +++ /dev/null @@ -1,3 +0,0 @@ -<target name="help"> - <echo message="Please run: $ ant -v -projecthelp"/> -</target>
\ No newline at end of file diff --git a/org.eclipse.mylyn.bugzilla.core/build.properties b/org.eclipse.mylyn.bugzilla.core/build.properties deleted file mode 100644 index 0130a60da..000000000 --- a/org.eclipse.mylyn.bugzilla.core/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2004, 2008 Tasktop Technologies 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 -############################################################################### - -bin.includes = META-INF/,\ - about.html,\ - .,\ - plugin.xml,\ - plugin.properties -src.includes = about.html -jre.compilation.profile = J2SE-1.5 -source.. = src/ diff --git a/org.eclipse.mylyn.bugzilla.core/plugin.properties b/org.eclipse.mylyn.bugzilla.core/plugin.properties deleted file mode 100644 index 25c80dfb6..000000000 --- a/org.eclipse.mylyn.bugzilla.core/plugin.properties +++ /dev/null @@ -1,3 +0,0 @@ -#Properties file for org.eclipse.mylyn.bugzilla.core -Bundle-Vendor = Eclipse.org -Bundle-Name = Mylyn Bugzilla Connector Core diff --git a/org.eclipse.mylyn.bugzilla.core/plugin.xml b/org.eclipse.mylyn.bugzilla.core/plugin.xml deleted file mode 100644 index 5b1879cd9..000000000 --- a/org.eclipse.mylyn.bugzilla.core/plugin.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<plugin> - <extension-point id="languages" name="languages" schema="schema/languages.exsd"/> -<!--<extension - point="org.eclipse.mylyn.tasks.ui.duplicateDetectors"> - <detector - class="org.eclipse.mylyn.internal.bugzilla.core.BugzillaStackTraceDuplicateDetector" - kind="bugzilla" - name="Stack Trace"> - </detector> - </extension>--> -</plugin> diff --git a/org.eclipse.mylyn.bugzilla.core/schema/languages.exsd b/org.eclipse.mylyn.bugzilla.core/schema/languages.exsd deleted file mode 100644 index d175012e6..000000000 --- a/org.eclipse.mylyn.bugzilla.core/schema/languages.exsd +++ /dev/null @@ -1,116 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.mylyn.bugzilla.core"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.mylyn.bugzilla.core" id="languages" name="languages"/> - </appInfo> - <documentation> - [Enter description of this extension point.] - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="language" minOccurs="1" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute translatable="true"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="language"> - <complexType> - <sequence> - <element ref="languageAttribute" minOccurs="1" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <element name="languageAttribute"> - <complexType> - <attribute name="command" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="response" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - -</schema> diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java deleted file mode 100644 index 617c162ba..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.security.GeneralSecurityException; - -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.helpers.XMLReaderFactory; - -/** - * @author Rob Elves - */ -public class AbstractReportFactory { - - public static final int RETURN_ALL_HITS = -1; - - private final InputStream inStream; - - private final String characterEncoding; - - public AbstractReportFactory(InputStream inStream, String encoding) { - this.inStream = inStream; - this.characterEncoding = encoding; - } - - /** - * expects rdf returned from repository (ctype=rdf in url) - * - * @throws GeneralSecurityException - */ - protected void collectResults(DefaultHandler contentHandler, boolean clean) throws IOException { - File tempFile = null; - - if (inStream == null) { - return; - } - - final BufferedInputStream is = new BufferedInputStream(inStream, 1024); - - InputStream iis = new InputStream() { - @SuppressWarnings( { "deprecation", "restriction" }) - @Override - public int read() throws IOException { - int c; - while ((c = is.read()) != -1) { - if (org.eclipse.mylyn.internal.commons.core.XmlStringConverter.isValid((char) c)) { - return c; - } - } - return -1; - } - }; - - Reader in; - if (characterEncoding != null) { - in = new InputStreamReader(iis, characterEncoding); - } else { - in = new InputStreamReader(iis); - } - - if (clean) { - tempFile = File.createTempFile("XmlCleaner-", "tmp"); //$NON-NLS-1$//$NON-NLS-2$ - tempFile.deleteOnExit(); - in = XmlCleaner.clean(in, tempFile); - } - - try { - final XMLReader reader = XMLReaderFactory.createXMLReader(); - reader.setFeature("http://xml.org/sax/features/validation", false); //$NON-NLS-1$ - reader.setContentHandler(contentHandler); - - EntityResolver resolver = new EntityResolver() { - - public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { - // The default resolver will try to resolve the dtd via - // URLConnection. Since we - // don't have need of entity resolving - // currently, we just supply a dummy (empty) resource for - // each request... - InputSource source = new InputSource(); - source.setCharacterStream(new StringReader("")); //$NON-NLS-1$ - return source; - } - }; - - reader.setEntityResolver(resolver); - reader.setErrorHandler(new ErrorHandler() { - - public void error(SAXParseException exception) throws SAXException { - throw exception; - } - - public void fatalError(SAXParseException exception) throws SAXException { - throw exception; - } - - public void warning(SAXParseException exception) throws SAXException { - throw exception; - } - }); - reader.parse(new InputSource(in)); - } catch (SAXException e) { - throw new IOException(e.getMessage()); - } - - finally { - if (tempFile != null) { - tempFile.delete(); - } - } - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java deleted file mode 100644 index 62275a877..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; - -/** - * @author Rob Elves - */ -public enum BugzillaAttribute { - - STATUS_WHITEBOARD(Messages.BugzillaAttribute_Status_Whiteboard, - "status_whiteboard", TaskAttribute.TYPE_LONG_RICH_TEXT, false, false), //$NON-NLS-1$ - - ACTUAL_TIME(Messages.BugzillaAttribute_Worked, "actual_time", TaskAttribute.TYPE_SHORT_TEXT, true, true), //$NON-NLS-1$ - - ADD_COMMENT(Messages.BugzillaAttribute_Additional_Comments, "comment", TaskAttribute.TYPE_LONG_TEXT, true, false), //$NON-NLS-1$ - - ASSIGNED_TO(Messages.BugzillaAttribute_Assigned_to, "assigned_to", TaskAttribute.TYPE_PERSON, true, true), //$NON-NLS-1$ - - ASSIGNED_TO_NAME(Messages.BugzillaAttribute_Assigned_to_NAME, - "assigned_to_name", TaskAttribute.TYPE_PERSON, true, true), //$NON-NLS-1$ - - ATTACHID(Messages.BugzillaAttribute_ATTACH_ID, "attachid", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$ - - ATTACHMENT(Messages.BugzillaAttribute_attachment, "attachment", TaskAttribute.TYPE_ATTACHMENT, false, false), //$NON-NLS-1$ - - BLOCKED(Messages.BugzillaAttribute_Blocks, "blocked", TaskAttribute.TYPE_TASK_DEPENDENCY, false, false), //$NON-NLS-1$ - - BUG(Messages.BugzillaAttribute_bug, "bug", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - BUG_FILE_LOC(Messages.BugzillaAttribute_URL, "bug_file_loc", TaskAttribute.TYPE_URL, false, false), //$NON-NLS-1$ - - BUG_ID(Messages.BugzillaAttribute_Bug_ID, "bug_id", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - BUG_SEVERITY(Messages.BugzillaAttribute_Severity, "bug_severity", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - BUG_STATUS(Messages.BugzillaAttribute_Status, "bug_status", TaskAttribute.TYPE_SHORT_TEXT, true, true), //$NON-NLS-1$ - - BUG_WHEN(Messages.BugzillaAttribute_bug_when, "bug_when", TaskAttribute.TYPE_DATE, true, true), //$NON-NLS-1$ - - BUGZILLA(Messages.BugzillaAttribute_bugzilla, "bugzilla", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - CC(Messages.BugzillaAttribute_CC, "cc", IBugzillaConstants.EDITOR_TYPE_REMOVECC, true, true), //$NON-NLS-1$ - - REMOVECC(Messages.BugzillaAttribute_Remove_CC, "removecc", IBugzillaConstants.EDITOR_TYPE_REMOVECC, true, true), //$NON-NLS-1$ - - CCLIST_ACCESSIBLE(Messages.BugzillaAttribute_CC_List, "cclist_accessible", TaskAttribute.TYPE_BOOLEAN, true, false), //$NON-NLS-1$ - - CLASSIFICATION(Messages.BugzillaAttribute_Classification, - "classification", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - CLASSIFICATION_ID(Messages.BugzillaAttribute_Classification_ID, - "classification_id", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - COMPONENT(Messages.BugzillaAttribute_Component, "component", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - CONFIRM_PRODUCT_CHANGE("confirm_product_change", "confirm_product_change", TaskAttribute.TYPE_BOOLEAN, true, false), //$NON-NLS-1$ //$NON-NLS-2$ - - CREATION_TS(Messages.BugzillaAttribute_Opened, "creation_ts", TaskAttribute.TYPE_DATE, true, false), //$NON-NLS-1$ - - CTYPE(Messages.BugzillaAttribute_Content_Type, "ctype", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$ - - DATA(Messages.BugzillaAttribute_data, "data", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$ - - DATE(Messages.BugzillaAttribute_Date, "date", TaskAttribute.TYPE_DATE, false, false), //$NON-NLS-1$ - - DEADLINE(Messages.BugzillaAttribute_Due, "deadline", TaskAttribute.TYPE_DATE, true, false), //$NON-NLS-1$ - - DELTA_TS(Messages.BugzillaAttribute_Modified, "delta_ts", TaskAttribute.TYPE_DATE, true, false), //$NON-NLS-1$ - - DEPENDSON(Messages.BugzillaAttribute_Depends_on__Subtasks_, - "dependson", TaskAttribute.TYPE_TASK_DEPENDENCY, false, false), //$NON-NLS-1$ - - DESC(Messages.BugzillaAttribute_desc, "desc", TaskAttribute.TYPE_LONG_TEXT, true, true), //$NON-NLS-1$ - - EVERCONFIRMED(Messages.BugzillaAttribute_everconfirmed, "everconfirmed", TaskAttribute.TYPE_BOOLEAN, true, false), //$NON-NLS-1$ - - ESTIMATED_TIME(Messages.BugzillaAttribute_Estimated_Time, - "estimated_time", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - FILENAME(Messages.BugzillaAttribute_filename, "filename", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$ - - FLAG(Messages.BugzillaAttribute_flag, "flag", IBugzillaConstants.EDITOR_TYPE_FLAG, false, false), //$NON-NLS-1$ - - GROUP(Messages.BugzillaAttribute_Group, "group", TaskAttribute.TYPE_BOOLEAN, true, true), //$NON-NLS-1$ - - IS_OBSOLETE(Messages.BugzillaAttribute_Obsolete, "isobsolete", TaskAttribute.TYPE_BOOLEAN, true, false), //$NON-NLS-1$ - - IS_PATCH(Messages.BugzillaAttribute_Patch, "ispatch", TaskAttribute.TYPE_BOOLEAN, true, false), //$NON-NLS-1$ - - KEYWORDS(Messages.BugzillaAttribute_Keywords, "keywords", IBugzillaConstants.EDITOR_TYPE_KEYWORDS, false, false), //$NON-NLS-1$ - - LONG_DESC(Messages.BugzillaAttribute_Description, "long_desc", TaskAttribute.TYPE_LONG_RICH_TEXT, true, true), //$NON-NLS-1$ - - LONGDESCLENGTH(Messages.BugzillaAttribute_Number_of_comments, - "longdesclength", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - NEWCC(Messages.BugzillaAttribute_Add_CC, "newcc", TaskAttribute.TYPE_PERSON, true, false), //$NON-NLS-1$ - - OP_SYS(Messages.BugzillaAttribute_OS, "op_sys", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - PRIORITY(Messages.BugzillaAttribute_Priority, "priority", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - PRODUCT(Messages.BugzillaAttribute_Product, "product", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - REP_PLATFORM(Messages.BugzillaAttribute_Platform, "rep_platform", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - REPORTER(Messages.BugzillaAttribute_Reporter, "reporter", TaskAttribute.TYPE_PERSON, true, true), //$NON-NLS-1$ - - REPORTER_NAME(Messages.BugzillaAttribute_REPORT_NAME, "reporter_name", TaskAttribute.TYPE_PERSON, true, true), //$NON-NLS-1$ - - REPORTER_ACCESSIBLE(Messages.BugzillaAttribute_REPORT_ACCESSIBLE, "reporter_accessible", //$NON-NLS-1$ - TaskAttribute.TYPE_BOOLEAN, true, false), - - RESOLUTION(Messages.BugzillaAttribute_Resolution, "resolution", TaskAttribute.TYPE_SHORT_TEXT, false, true), //$NON-NLS-1$ - - REMAINING_TIME(Messages.BugzillaAttribute_Remaining, "remaining_time", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - SET_DEFAULT_ASSIGNEE(Messages.BugzillaAttribute_Reassign_to_default_assignee, - "set_default_assignee", TaskAttribute.TYPE_BOOLEAN, true, //$NON-NLS-1$ - false), - - SHORT_DESC(Messages.BugzillaAttribute_Summary, "short_desc", TaskAttribute.TYPE_SHORT_RICH_TEXT, true, false), //$NON-NLS-1$ - - SIZE(Messages.BugzillaAttribute_Size, "size", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$ - - TARGET_MILESTONE(Messages.BugzillaAttribute_Target_milestone, - "target_milestone", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - THETEXT(Messages.BugzillaAttribute_thetext, "thetext", TaskAttribute.TYPE_SHORT_TEXT, false, true), //$NON-NLS-1$ - - TYPE(Messages.BugzillaAttribute_type, "type", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$ - - UNKNOWN(Messages.BugzillaAttribute_UNKNOWN, "UNKNOWN", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$ - - VERSION(Messages.BugzillaAttribute_Version, "version", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$ - - INSTALL_VERSION(Messages.BugzillaAttribute_version_of_bugzilla_installed, "install_version", null, true, false), //$NON-NLS-1$ - - VOTES(Messages.BugzillaAttribute_Votes, "votes", IBugzillaConstants.EDITOR_TYPE_VOTES, false, true), //$NON-NLS-1$ - - WORK_TIME(Messages.BugzillaAttribute_Add, "work_time", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$ - - WHO(Messages.BugzillaAttribute_who, "who", TaskAttribute.TYPE_PERSON, false, false), //$NON-NLS-1$ - - WHO_NAME(Messages.BugzillaAttribute_who_name, "who_name", TaskAttribute.TYPE_SHORT_TEXT, true, true), //$NON-NLS-1$ - - QA_CONTACT(Messages.BugzillaAttribute_QA_Contact, "qa_contact", TaskAttribute.TYPE_PERSON, true, false), //$NON-NLS-1$ - - QA_CONTACT_NAME(Messages.BugzillaAttribute_QA_Contact_NAME, - "qa_contact_name", TaskAttribute.TYPE_SHORT_TEXT, true, true), //$NON-NLS-1$ - - ADDSELFCC(Messages.BugzillaAttribute_Add_self_to_CC, "addselfcc", TaskAttribute.TYPE_BOOLEAN, true, false), //$NON-NLS-1$ - - STATUS_OPEN(Messages.BugzillaAttribute_open_status_values, "status_open", null, true, true), //$NON-NLS-1$ - - NEW_COMMENT(Messages.BugzillaAttribute_new_comment, "new_comment", TaskAttribute.TYPE_LONG_RICH_TEXT, true, false), //$NON-NLS-1$ - - TOKEN("token", "token", null, true, true), //$NON-NLS-1$ //$NON-NLS-2$ - - // Used by search engine - LI(Messages.BugzillaAttribute_used_by_search_engine_li, "li", null, true, false), //$NON-NLS-1$ - - ID(Messages.BugzillaAttribute_used_by_search_engine_id, "id", null, true, false), //$NON-NLS-1$ - - SHORT_SHORT_DESC(Messages.BugzillaAttribute_used_by_search_engine_desc, "short_short_desc", null, false, false), //$NON-NLS-1$ - - SEQ(Messages.BugzillaAttribute_used_by_search_engine_seq, "seq", null, false, false), //$NON-NLS-1$ - - RESULT(Messages.BugzillaAttribute_used_by_search_engine_result, "result", null, false, false), //$NON-NLS-1$ - - RDF(Messages.BugzillaAttribute_used_by_search_engine_rdf, "rdf", null, false, false), //$NON-NLS-1$ - - INSTALLATION(Messages.BugzillaAttribute_used_by_search_engine_installation, "installation", null, false, false), //$NON-NLS-1$ - - BUGS(Messages.BugzillaAttribute_used_by_search_engine_bugs, "bugs", null, false, false); //$NON-NLS-1$ - - private final boolean isHidden; - - private final boolean isReadOnly; - - private final String keyString; - - private final String prettyName; - - private final String type; - - public static final BugzillaAttribute[] EXTENDED_ATTRIBUTES = { DELTA_TS, BUG_SEVERITY, PRODUCT }; - - BugzillaAttribute(String prettyName, String idKey, String type, boolean hidden, boolean readonly) { - this.prettyName = prettyName; - this.keyString = idKey; - this.type = type; - this.isHidden = hidden; - this.isReadOnly = readonly; - } - - public String getKey() { - return keyString; - } - - public boolean isHidden() { - return isHidden; - } - - public boolean isReadOnly() { - return isReadOnly; - } - - @Override - public String toString() { - return prettyName; - } - - public String getKind() { - return isHidden() ? null : TaskAttribute.KIND_DEFAULT; - } - - public String getType() { - return type; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java deleted file mode 100644 index 9fab63822..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java +++ /dev/null @@ -1,299 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.mylyn.tasks.core.IRepositoryPerson; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; - -/** - * @author Rob Elves - */ -public class BugzillaAttributeMapper extends TaskAttributeMapper { - - private static final String DATE_FORMAT_1 = "yyyy-MM-dd HH:mm"; //$NON-NLS-1$ - - private static final String DATE_FORMAT_2 = "yyyy-MM-dd HH:mm:ss"; //$NON-NLS-1$ - - private static final String DATE_FORMAT_3 = "yyyy-MM-dd"; //$NON-NLS-1$ - - private static final String delta_ts_format = DATE_FORMAT_2; - - private static final String creation_ts_format = DATE_FORMAT_1; - - private static final String deadline_format = DATE_FORMAT_3; - - private static final String customAttribute_format = DATE_FORMAT_2; - - /** - * public for testing Bugzilla 2.18 uses DATE_FORMAT_1 but later versions use DATE_FORMAT_2 Using lowest common - * denominator DATE_FORMAT_1 - */ - public static final String comment_creation_ts_format = DATE_FORMAT_1; - - private static final String attachment_creation_ts_format = DATE_FORMAT_1; - - public BugzillaAttributeMapper(TaskRepository taskRepository) { - super(taskRepository); - } - - @Override - public Date getDateValue(TaskAttribute attribute) { - if (attribute == null) { - return null; - } - String dateString = attribute.getValue(); - String id = attribute.getId(); - Date parsedDate = getDate(id, dateString); - if (parsedDate == null) { - parsedDate = super.getDateValue(attribute); - } - return parsedDate; - } - - @Override - public boolean getBooleanValue(TaskAttribute attribute) { - if (attribute.getValue().equals("1")) { //$NON-NLS-1$ - return true; - } else { - return false; - } - } - - @Override - public void setBooleanValue(TaskAttribute attribute, Boolean value) { - if (value == null) { - attribute.setValue("0"); //$NON-NLS-1$ - } else if (value) { - attribute.setValue("1"); //$NON-NLS-1$ - } else { - attribute.setValue("0"); //$NON-NLS-1$ - } - } - - private Date getDate(String attributeId, String dateString) { - Date parsedDate = null; - try { - if (attributeId.equals(BugzillaAttribute.DELTA_TS.getKey())) { - parsedDate = new SimpleDateFormat(delta_ts_format).parse(dateString); - } else if (attributeId.equals(BugzillaAttribute.CREATION_TS.getKey())) { - parsedDate = new SimpleDateFormat(creation_ts_format).parse(dateString); - } else if (attributeId.equals(BugzillaAttribute.BUG_WHEN.getKey())) { - parsedDate = new SimpleDateFormat(comment_creation_ts_format).parse(dateString); - } else if (attributeId.equals(BugzillaAttribute.DATE.getKey())) { - parsedDate = new SimpleDateFormat(attachment_creation_ts_format).parse(dateString); - } else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) { - parsedDate = new SimpleDateFormat(deadline_format).parse(dateString); - } else if (attributeId.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { - parsedDate = new SimpleDateFormat(customAttribute_format).parse(dateString); - } - } catch (ParseException e) { - return null; - } catch (NumberFormatException e) { - return null; - } - return parsedDate; - } - - @Override - public void setDateValue(TaskAttribute attribute, Date date) { - if (date != null) { - String dateString = null; - String attributeId = attribute.getId(); - - if (attributeId.equals(BugzillaAttribute.DELTA_TS.getKey())) { - dateString = new SimpleDateFormat(delta_ts_format).format(date); - } else if (attributeId.equals(BugzillaAttribute.CREATION_TS.getKey())) { - dateString = new SimpleDateFormat(creation_ts_format).format(date); - } else if (attributeId.equals(BugzillaAttribute.BUG_WHEN.getKey())) { - dateString = new SimpleDateFormat(comment_creation_ts_format).format(date); - } else if (attributeId.equals(BugzillaAttribute.DATE.getKey())) { - dateString = new SimpleDateFormat(attachment_creation_ts_format).format(date); - } else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) { - dateString = new SimpleDateFormat(deadline_format).format(date); - } else if (attributeId.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { - dateString = new SimpleDateFormat(customAttribute_format).format(date); - } - - if (dateString == null) { - super.setDateValue(attribute, date); - } else { - attribute.setValue(dateString); - } - - } else { - attribute.clearValues(); - } - } - - @Override - public String mapToRepositoryKey(TaskAttribute parent, String key) { - /*if (key.equals(TaskAttribute.NEW_CC)) { - return BugzillaReportElement.NEWCC.getKey(); - } else*/if (key.equals(TaskAttribute.COMMENT_DATE)) { - return BugzillaAttribute.BUG_WHEN.getKey(); - } else if (key.equals(TaskAttribute.COMMENT_AUTHOR)) { - return BugzillaAttribute.WHO.getKey(); - } else if (key.equals(TaskAttribute.COMMENT_AUTHOR_NAME)) { - return BugzillaAttribute.WHO_NAME.getKey(); - } else if (key.equals(TaskAttribute.USER_CC)) { - return BugzillaAttribute.CC.getKey(); - } else if (key.equals(TaskAttribute.COMMENT_TEXT)) { - return BugzillaAttribute.THETEXT.getKey(); - } else if (key.equals(TaskAttribute.DATE_CREATION)) { - return BugzillaAttribute.CREATION_TS.getKey(); - } else if (key.equals(TaskAttribute.DESCRIPTION)) { - return BugzillaAttribute.LONG_DESC.getKey(); - } else if (key.equals(TaskAttribute.ATTACHMENT_ID)) { - return BugzillaAttribute.ATTACHID.getKey(); - } else if (key.equals(TaskAttribute.ATTACHMENT_DESCRIPTION)) { - return BugzillaAttribute.DESC.getKey(); - } else if (key.equals(TaskAttribute.ATTACHMENT_CONTENT_TYPE)) { - return BugzillaAttribute.CTYPE.getKey(); - //return BugzillaReportElement.TYPE.getKey();*/ - } else if (key.equals(TaskAttribute.USER_ASSIGNED)) { - return BugzillaAttribute.ASSIGNED_TO.getKey(); - } else if (key.equals(TaskAttribute.USER_ASSIGNED_NAME)) { - return BugzillaAttribute.ASSIGNED_TO_NAME.getKey(); - } else if (key.equals(TaskAttribute.RESOLUTION)) { - return BugzillaAttribute.RESOLUTION.getKey(); - } else if (key.equals(TaskAttribute.STATUS)) { - return BugzillaAttribute.BUG_STATUS.getKey(); - } else if (key.equals(TaskAttribute.DATE_MODIFICATION)) { - return BugzillaAttribute.DELTA_TS.getKey(); - } else if (key.equals(TaskAttribute.USER_REPORTER)) { - return BugzillaAttribute.REPORTER.getKey(); - } else if (key.equals(TaskAttribute.USER_REPORTER_NAME)) { - return BugzillaAttribute.REPORTER_NAME.getKey(); - } else if (key.equals(TaskAttribute.SUMMARY)) { - return BugzillaAttribute.SHORT_DESC.getKey(); - } else if (key.equals(TaskAttribute.PRODUCT)) { - return BugzillaAttribute.PRODUCT.getKey(); - } else if (key.equals(TaskAttribute.KEYWORDS)) { - return BugzillaAttribute.KEYWORDS.getKey(); - } else if (key.equals(TaskAttribute.ATTACHMENT_DATE)) { - return BugzillaAttribute.DATE.getKey(); - } else if (key.equals(TaskAttribute.ATTACHMENT_SIZE)) { - return BugzillaAttribute.SIZE.getKey(); - } else if (key.equals(TaskAttribute.ADD_SELF_CC)) { - return BugzillaAttribute.ADDSELFCC.getKey(); - } else if (key.equals(TaskAttribute.PRIORITY)) { - return BugzillaAttribute.PRIORITY.getKey(); - } else if (key.equals(TaskAttribute.COMMENT_NEW)) { - return BugzillaAttribute.NEW_COMMENT.getKey(); - } else if (key.equals(TaskAttribute.COMPONENT)) { - return BugzillaAttribute.COMPONENT.getKey(); - } else if (key.equals(TaskAttribute.TASK_KEY)) { - return BugzillaAttribute.BUG_ID.getKey(); - } else if (key.equals(TaskAttribute.DATE_DUE)) { - return BugzillaAttribute.DEADLINE.getKey(); - } - return super.mapToRepositoryKey(parent, key); - } - - @Override - public TaskAttribute getAssoctiatedAttribute(TaskAttribute taskAttribute) { - String id = taskAttribute.getMetaData().getValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID); - if (id != null) { - // operation associated input attributes are stored on the root attribute - if (TaskAttribute.TYPE_OPERATION.equals(taskAttribute.getMetaData().getType())) { - return taskAttribute.getTaskData().getRoot().getMappedAttribute(id); - } - return taskAttribute.getMappedAttribute(id); - } - return null; - } - - @Override - public IRepositoryPerson getRepositoryPerson(TaskAttribute taskAttribute) { - - IRepositoryPerson person = super.getRepositoryPerson(taskAttribute); - if (person.getName() == null) { - if (taskAttribute.getId().equals(BugzillaAttribute.ASSIGNED_TO.getKey())) { - TaskAttribute attrAssigned = taskAttribute.getTaskData().getRoot().getAttribute( - BugzillaAttribute.ASSIGNED_TO_NAME.getKey()); - if (attrAssigned != null) { - person.setName(attrAssigned.getValue()); - } - } else if (taskAttribute.getId().equals(BugzillaAttribute.REPORTER.getKey())) { - TaskAttribute attrReporter = taskAttribute.getTaskData().getRoot().getAttribute( - BugzillaAttribute.REPORTER_NAME.getKey()); - if (attrReporter != null) { - person.setName(attrReporter.getValue()); - } - } else if (taskAttribute.getId().equals(BugzillaAttribute.QA_CONTACT.getKey())) { - TaskAttribute attrReporter = taskAttribute.getTaskData().getRoot().getAttribute( - BugzillaAttribute.QA_CONTACT_NAME.getKey()); - if (attrReporter != null) { - person.setName(attrReporter.getValue()); - } - } - } - return person; - } - - @Override - public Map<String, String> getOptions(TaskAttribute attribute) { - RepositoryConfiguration configuration = BugzillaCorePlugin.getRepositoryConfiguration(getTaskRepository().getRepositoryUrl()); - if (configuration != null) { - TaskAttribute attributeProduct = attribute.getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.PRODUCT.getKey()); - if (attributeProduct != null && attributeProduct.getValue().length() > 0) { - List<String> options = configuration.getAttributeOptions(attributeProduct.getValue(), attribute); - if (options.size() == 0 && attribute.getId().equals(BugzillaOperation.resolve.getInputId())) { - options = configuration.getOptionValues(BugzillaAttribute.RESOLUTION, attributeProduct.getValue()); - // DUPLICATE and MOVED have special meanings so do not show as resolution - // TODO: COPIED FUNCTIONALITY from RepositoryConfiguration.addOperation() refactor. - options.remove("DUPLICATE"); //$NON-NLS-1$ - options.remove("MOVED"); //$NON-NLS-1$ - } - Map<String, String> newOptions = new LinkedHashMap<String, String>(); - for (String option : options) { - newOptions.put(option, option); - } - return newOptions; - } - } - return super.getOptions(attribute); - } - - @Override - public boolean equals(TaskAttribute newAttribute, TaskAttribute oldAttribute) { - if (oldAttribute.getId().startsWith(TaskAttribute.PREFIX_ATTACHMENT)) { - TaskAttachmentMapper oldAttachment; - oldAttachment = TaskAttachmentMapper.createFrom(oldAttribute); - TaskAttachmentMapper newAttachment; - newAttachment = TaskAttachmentMapper.createFrom(newAttribute); - return newAttachment.equals(oldAttachment); - } - return super.equals(newAttribute, oldAttribute); - } - - @Override - public String getLabel(TaskAttribute taskAttribute) { - if (taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { - return super.getLabel(taskAttribute) + ":"; //$NON-NLS-1$ - } else { - return super.getLabel(taskAttribute); - } - } - -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java deleted file mode 100644 index 2fbfb6cc9..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java +++ /dev/null @@ -1,1883 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.Proxy; -import java.net.URL; -import java.net.URLDecoder; -import java.nio.charset.Charset; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import javax.security.auth.login.LoginException; -import javax.swing.text.html.HTML.Tag; - -import org.apache.commons.httpclient.Cookie; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HostConfiguration; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpMethodBase; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.NameValuePair; -import org.apache.commons.httpclient.URI; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.HeadMethod; -import org.apache.commons.httpclient.methods.multipart.FilePart; -import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity; -import org.apache.commons.httpclient.methods.multipart.Part; -import org.apache.commons.httpclient.methods.multipart.PartBase; -import org.apache.commons.httpclient.methods.multipart.StringPart; -import org.apache.commons.httpclient.params.HttpMethodParams; -import org.eclipse.core.net.proxy.IProxyData; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.mylyn.commons.net.AbstractWebLocation; -import org.eclipse.mylyn.commons.net.AuthenticationCredentials; -import org.eclipse.mylyn.commons.net.AuthenticationType; -import org.eclipse.mylyn.commons.net.HtmlStreamTokenizer; -import org.eclipse.mylyn.commons.net.HtmlTag; -import org.eclipse.mylyn.commons.net.Policy; -import org.eclipse.mylyn.commons.net.WebUtil; -import org.eclipse.mylyn.commons.net.HtmlStreamTokenizer.Token; -import org.eclipse.mylyn.internal.bugzilla.core.history.BugzillaTaskHistoryParser; -import org.eclipse.mylyn.internal.bugzilla.core.history.TaskHistory; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.RepositoryResponse; -import org.eclipse.mylyn.tasks.core.RepositoryStatus; -import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind; -import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource; -import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; -import org.eclipse.mylyn.tasks.core.data.TaskAttachmentPartSource; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; -import org.eclipse.mylyn.tasks.core.data.TaskData; -import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; - -/** - * @author Mik Kersten - * @author Rob Elves - * @author Steffen Pingel - */ -public class BugzillaClient { - - private static final String COOKIE_BUGZILLA_LOGIN = "Bugzilla_login"; //$NON-NLS-1$ - - protected static final String USER_AGENT = "BugzillaConnector"; //$NON-NLS-1$ - - private static final int MAX_RETRIEVED_PER_QUERY = 100; - - private static final String QUERY_DELIMITER = "?"; //$NON-NLS-1$ - - private static final String KEY_ID = "id"; //$NON-NLS-1$ - - private static final String VAL_TRUE = "true"; //$NON-NLS-1$ - - private static final String KEY_CC = "cc"; //$NON-NLS-1$ - - private static final String POST_BUG_CGI = "/post_bug.cgi"; //$NON-NLS-1$ - - private static final String PROCESS_BUG_CGI = "/process_bug.cgi"; //$NON-NLS-1$ - - private static final String PROCESS_ATTACHMENT_CGI = "/attachment.cgi"; //$NON-NLS-1$ - - public static final int WRAP_LENGTH = 80; - - private static final String VAL_PROCESS_BUG = "process_bug"; //$NON-NLS-1$ - - private static final String KEY_FORM_NAME = "form_name"; //$NON-NLS-1$ - - private static final String VAL_NONE = "none"; //$NON-NLS-1$ - - private static final String KEY_KNOB = "knob"; //$NON-NLS-1$ - - // TODO change to BugzillaReportElement.ADD_COMMENT - private static final String KEY_COMMENT = "comment"; //$NON-NLS-1$ - - private static final String KEY_SHORT_DESC = "short_desc"; //$NON-NLS-1$ - - private static final String VALUE_CONTENTTYPEMETHOD_MANUAL = "manual"; //$NON-NLS-1$ - - private static final String VALUE_ISPATCH = "1"; //$NON-NLS-1$ - - private static final String VALUE_ACTION_INSERT = "insert"; //$NON-NLS-1$ - - private static final String ATTRIBUTE_CONTENTTYPEENTRY = "contenttypeentry"; //$NON-NLS-1$ - - private static final String ATTRIBUTE_CONTENTTYPEMETHOD = "contenttypemethod"; //$NON-NLS-1$ - - private static final String ATTRIBUTE_ISPATCH = "ispatch"; //$NON-NLS-1$ - - private static final String CONTENT_TYPE_APP_RDF_XML = "application/rdf+xml"; //$NON-NLS-1$ - - private static final String CONTENT_TYPE_APP_XML = "application/xml"; //$NON-NLS-1$ - - private static final String CONTENT_TYPE_TEXT_XML = "text/xml"; //$NON-NLS-1$ - - private static final String[] VALID_CONFIG_CONTENT_TYPES = { CONTENT_TYPE_APP_RDF_XML, CONTENT_TYPE_APP_XML, - CONTENT_TYPE_TEXT_XML }; - - private static final String ATTR_CHARSET = "charset"; //$NON-NLS-1$ - - protected Proxy proxy = Proxy.NO_PROXY; - - protected URL repositoryUrl; - - protected String characterEncoding; - - private boolean loggedIn; - - private final Map<String, String> configParameters; - - private final HttpClient httpClient = new HttpClient(WebUtil.getConnectionManager()); - - private boolean lastModifiedSupported = true; - - private final BugzillaLanguageSettings bugzillaLanguageSettings; - - private RepositoryConfiguration repositoryConfiguration; - - private HostConfiguration hostConfiguration; - - private final AbstractWebLocation location; - - public BugzillaClient(AbstractWebLocation location, String characterEncoding, Map<String, String> configParameters, - BugzillaLanguageSettings languageSettings) throws MalformedURLException { - this.repositoryUrl = new URL(location.getUrl()); - this.location = location; - this.characterEncoding = characterEncoding; - this.configParameters = configParameters; - this.bugzillaLanguageSettings = languageSettings; - this.proxy = location.getProxyForHost(location.getUrl(), IProxyData.HTTP_PROXY_TYPE); - WebUtil.configureHttpClient(httpClient, USER_AGENT); - } - - public void validate(IProgressMonitor monitor) throws IOException, CoreException { - monitor = Policy.monitorFor(monitor); - GzipGetMethod method = null; - try { - logout(monitor); - method = getConnect(repositoryUrl + "/", monitor); //$NON-NLS-1$ - } finally { - if (method != null) { - method.releaseConnection(); - } - } - } - - protected boolean hasAuthenticationCredentials() { - AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); - return (credentials != null && credentials.getUserName() != null && credentials.getUserName().length() > 0); - } - - private GzipGetMethod getConnect(String serverURL, IProgressMonitor monitor) throws IOException, CoreException { - - return connectInternal(serverURL, false, monitor); - - } - - /** - * in order to provide an even better solution for bug 196056 the size of the bugzilla configuration downloaded must - * be reduced. By using a cached version of the config.cgi this can reduce traffic considerably: - * http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.phoenix/infra-scripts/bugzilla/?root=Technology_Project - * - * @param serverURL - * @return a GetMethod with possibly gzip encoded response body, so caller MUST check with - * "gzip".equals(method.getResponseHeader("Content-encoding") or use the utility method - * getResponseBodyAsUnzippedStream(). - * @throws IOException - * @throws CoreException - */ - protected GzipGetMethod getConnectGzip(String serverURL, IProgressMonitor monitor) throws IOException, - CoreException { - - return connectInternal(serverURL, true, monitor); - - } - - private GzipGetMethod connectInternal(String requestURL, boolean gzip, IProgressMonitor monitor) - throws IOException, CoreException { - monitor = Policy.monitorFor(monitor); - hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - - for (int attempt = 0; attempt < 2; attempt++) { - // force authentication - authenticate(monitor); - - GzipGetMethod getMethod = new GzipGetMethod(WebUtil.getRequestPath(requestURL), gzip); - if (requestURL.contains(QUERY_DELIMITER)) { - getMethod.setQueryString(requestURL.substring(requestURL.indexOf(QUERY_DELIMITER))); - } - - getMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=" //$NON-NLS-1$ //$NON-NLS-2$ - + characterEncoding); - - // Resolves bug#195113 - httpClient.getParams().setParameter("http.protocol.single-cookie-header", true); //$NON-NLS-1$ - - // WARNING!! Setting browser compatibility breaks Bugzilla - // authentication - // getMethod.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); - // getMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2109); - - getMethod.setDoAuthentication(true); - - int code; - try { - code = WebUtil.execute(httpClient, hostConfiguration, getMethod, monitor); - } catch (IOException e) { - getMethod.getResponseBodyNoop(); - getMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_IO, repositoryUrl.toString(), e)); - } - - if (code == HttpURLConnection.HTTP_OK) { - return getMethod; - } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) { - getMethod.getResponseBodyNoop(); - // login or reauthenticate due to an expired session - getMethod.releaseConnection(); - loggedIn = false; - authenticate(monitor); - } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) { - loggedIn = false; - getMethod.getResponseBodyNoop(); - getMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), - "Proxy authentication required")); //$NON-NLS-1$ - } else { - getMethod.getResponseBodyNoop(); - getMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_NETWORK, "Http error: " + HttpStatus.getStatusText(code))); //$NON-NLS-1$ - } - } - - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_INTERNAL, "All connection attempts to " + repositoryUrl.toString() //$NON-NLS-1$ - + " failed. Please verify connection and authentication information.")); //$NON-NLS-1$ - } - - public void logout(IProgressMonitor monitor) throws IOException, CoreException { - monitor = Policy.monitorFor(monitor); - String loginUrl = repositoryUrl + "/relogin.cgi"; //$NON-NLS-1$ - GzipGetMethod method = null; - try { - method = getConnect(loginUrl, monitor); - loggedIn = false; - httpClient.getState().clearCookies(); - } finally { - if (method != null) { - method.releaseConnection(); - } - } - } - - protected InputStream getResponseStream(HttpMethodBase method, IProgressMonitor monitor) throws IOException { - InputStream in = WebUtil.getResponseBodyAsStream(method, monitor); - if (isZippedReply(method)) { - in = new java.util.zip.GZIPInputStream(in); - } - return in; - } - - private boolean isZippedReply(HttpMethodBase method) { - // content-encoding:gzip can be set by a dedicated perl script or mod_gzip - boolean zipped = (null != method.getResponseHeader("Content-encoding") && method.getResponseHeader( //$NON-NLS-1$ - "Content-encoding").getValue().equals(IBugzillaConstants.CONTENT_ENCODING_GZIP)) //$NON-NLS-1$ - || - // content-type: application/x-gzip can be set by any apache after 302 redirect, based on .gz suffix - (null != method.getResponseHeader("Content-Type") && method.getResponseHeader("Content-Type") //$NON-NLS-1$ //$NON-NLS-2$ - .getValue() - .equals("application/x-gzip")); //$NON-NLS-1$ - return zipped; - } - - public void authenticate(IProgressMonitor monitor) throws CoreException { - if (loggedIn || !hasAuthenticationCredentials()) { - return; -// throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, -// RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), -// "Authentication credentials missing.")); //$NON-NLS-1$ - } - - monitor = Policy.monitorFor(monitor); - - GzipPostMethod postMethod = null; - - try { - - hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - - NameValuePair[] formData = new NameValuePair[2]; - AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); - if (credentials == null) { - loggedIn = false; - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), - "Authentication credentials from location missing.")); //$NON-NLS-1$ - } - formData[0] = new NameValuePair(IBugzillaConstants.POST_INPUT_BUGZILLA_LOGIN, credentials.getUserName()); - formData[1] = new NameValuePair(IBugzillaConstants.POST_INPUT_BUGZILLA_PASSWORD, credentials.getPassword()); - - postMethod = new GzipPostMethod(WebUtil.getRequestPath(repositoryUrl.toString() - + IBugzillaConstants.URL_POST_LOGIN), true); - - postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=" //$NON-NLS-1$ //$NON-NLS-2$ - + characterEncoding); - - postMethod.setRequestBody(formData); - postMethod.setDoAuthentication(true); - postMethod.setFollowRedirects(false); - httpClient.getState().clearCookies(); - - AuthenticationCredentials httpAuthCredentials = location.getCredentials(AuthenticationType.HTTP); - - if (httpAuthCredentials != null && httpAuthCredentials.getUserName() != null - && httpAuthCredentials.getUserName().length() > 0) { - httpClient.getParams().setAuthenticationPreemptive(true); - } - - int code = WebUtil.execute(httpClient, hostConfiguration, postMethod, monitor); - if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) { - loggedIn = false; - postMethod.getResponseBodyNoop(); - postMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), - "HTTP authentication failed.")); //$NON-NLS-1$ - - } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) { - loggedIn = false; - postMethod.getResponseBodyNoop(); - postMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), - "Proxy authentication required")); //$NON-NLS-1$ - - } else if (code != HttpURLConnection.HTTP_OK) { - loggedIn = false; - postMethod.getResponseBodyNoop(); - postMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_NETWORK, "Http error: " + HttpStatus.getStatusText(code))); //$NON-NLS-1$ - } - - if (hasAuthenticationCredentials()) { - for (Cookie cookie : httpClient.getState().getCookies()) { - if (cookie.getName().equals(COOKIE_BUGZILLA_LOGIN)) { - loggedIn = true; - break; - } - } - - if (!loggedIn) { - InputStream input = getResponseStream(postMethod, monitor); - try { - parseHtmlError(input); - } finally { - input.close(); - } - } - } else { - // anonymous login - loggedIn = true; - } - } catch (IOException e) { - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_IO, repositoryUrl.toString(), e)); - } finally { - if (postMethod != null) { - postMethod.releaseConnection(); - } - httpClient.getParams().setAuthenticationPreemptive(false); - } - } - - public boolean getSearchHits(IRepositoryQuery query, TaskDataCollector collector, TaskAttributeMapper mapper, - IProgressMonitor monitor) throws IOException, CoreException { - GzipPostMethod postMethod = null; - - try { - authenticate(new SubProgressMonitor(monitor, 1)); - String queryUrl = query.getUrl(); - int start = queryUrl.indexOf('?'); - - List<NameValuePair> pairs = new ArrayList<NameValuePair>(); - if (start != -1) { - queryUrl = queryUrl.substring(start + 1); - String[] result = queryUrl.split("&"); //$NON-NLS-1$ - if (result.length > 0) { - for (String string : result) { - String[] nameValue = string.split("="); //$NON-NLS-1$ - if (nameValue.length == 1) { - pairs.add(new NameValuePair(nameValue[0].trim(), "")); //$NON-NLS-1$ - } else if (nameValue.length == 2 && nameValue[0] != null && nameValue[1] != null) { - pairs.add(new NameValuePair(nameValue[0].trim(), URLDecoder.decode(nameValue[1].trim(), - characterEncoding))); - } - } - } - } - - NameValuePair ctypePair = new NameValuePair("ctype", "rdf"); //$NON-NLS-1$ //$NON-NLS-2$ - // Test that we don't specify content type twice. - if (!pairs.contains(ctypePair)) { - pairs.add(ctypePair); - } - - postMethod = postFormData(IBugzillaConstants.URL_BUGLIST, pairs.toArray(new NameValuePair[pairs.size()]), - monitor); - if (postMethod.getResponseHeader("Content-Type") != null) { //$NON-NLS-1$ - Header responseTypeHeader = postMethod.getResponseHeader("Content-Type"); //$NON-NLS-1$ - for (String type : VALID_CONFIG_CONTENT_TYPES) { - if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) { - InputStream stream = getResponseStream(postMethod, monitor); - try { - RepositoryQueryResultsFactory queryFactory = getQueryResultsFactory(stream); - int count = queryFactory.performQuery(repositoryUrl.toString(), collector, mapper, - TaskDataCollector.MAX_HITS); - return count > 0; - } finally { - stream.close(); - } - } - } - } - - parseHtmlError(getResponseStream(postMethod, monitor)); - } finally { - if (postMethod != null) { - postMethod.releaseConnection(); - } - } - return false; - } - - protected RepositoryQueryResultsFactory getQueryResultsFactory(InputStream stream) { - return new RepositoryQueryResultsFactory(stream, characterEncoding); - } - - public static void setupExistingBugAttributes(String serverUrl, TaskData existingReport) { - // ordered list of elements as they appear in UI - // and additional elements that may not appear in the incoming xml - // stream but need to be present for bug submission / not always dirty - // state handling - BugzillaAttribute[] reportElements = { BugzillaAttribute.SHORT_DESC, BugzillaAttribute.BUG_STATUS, - BugzillaAttribute.RESOLUTION, BugzillaAttribute.BUG_ID, BugzillaAttribute.REP_PLATFORM, - BugzillaAttribute.PRODUCT, BugzillaAttribute.OP_SYS, BugzillaAttribute.COMPONENT, - BugzillaAttribute.VERSION, BugzillaAttribute.PRIORITY, BugzillaAttribute.BUG_SEVERITY, - BugzillaAttribute.ASSIGNED_TO, BugzillaAttribute.TARGET_MILESTONE, BugzillaAttribute.REPORTER, - BugzillaAttribute.DEPENDSON, BugzillaAttribute.BLOCKED, BugzillaAttribute.BUG_FILE_LOC, - BugzillaAttribute.NEWCC, BugzillaAttribute.KEYWORDS, BugzillaAttribute.CC, - BugzillaAttribute.NEW_COMMENT, BugzillaAttribute.QA_CONTACT, BugzillaAttribute.STATUS_WHITEBOARD, - BugzillaAttribute.DEADLINE }; - - for (BugzillaAttribute element : reportElements) { - BugzillaTaskDataHandler.createAttribute(existingReport, element); - } - } - - public static String getBugUrlWithoutLogin(String repositoryUrl, String id) { - String url = repositoryUrl + IBugzillaConstants.URL_GET_SHOW_BUG + id; - return url; - } - - public static String getCharsetFromString(String string) { - int charsetStartIndex = string.indexOf(ATTR_CHARSET); - if (charsetStartIndex != -1) { - int charsetEndIndex = string.indexOf("\"", charsetStartIndex); // TODO: //$NON-NLS-1$ - // could - // be - // space - // after? - if (charsetEndIndex == -1) { - charsetEndIndex = string.length(); - } - String charsetString = string.substring(charsetStartIndex + 8, charsetEndIndex); - if (Charset.availableCharsets().containsKey(charsetString)) { - return charsetString; - } - } - return null; - } - - public RepositoryConfiguration getRepositoryConfiguration(IProgressMonitor monitor) throws IOException, - CoreException { - GzipGetMethod method = null; - int attempt = 0; - while (attempt < 2) { - try { - method = getConnectGzip(repositoryUrl + IBugzillaConstants.URL_GET_CONFIG_RDF, monitor); - // provide a solution for bug 196056 by allowing a (cached) gzipped configuration to be sent - // modified to also accept "application/x-gzip" as results from a 302 redirect to a previously gzipped file. - if (method == null) { - throw new IOException("Could not retrieve configuratoin. HttpClient return null method."); //$NON-NLS-1$ - } - - InputStream stream = getResponseStream(method, monitor); - try { - if (method.getResponseHeader("Content-Type") != null) { //$NON-NLS-1$ - Header responseTypeHeader = method.getResponseHeader("Content-Type"); //$NON-NLS-1$ - for (String type : VALID_CONFIG_CONTENT_TYPES) { - if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) { - RepositoryConfigurationFactory configFactory = new RepositoryConfigurationFactory( - stream, characterEncoding); - - repositoryConfiguration = configFactory.getConfiguration(); - - if (repositoryConfiguration != null) { - if (!repositoryConfiguration.getProducts().isEmpty()) { - repositoryConfiguration.setRepositoryUrl(repositoryUrl.toString()); - return repositoryConfiguration; - } else { - if (attempt == 0) { - // empty configuration, retry authenticate - loggedIn = false; - break; - } else { - throw new CoreException( - new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, - "Unable to retrieve repository configuration. Ensure credentials are valid.")); //$NON-NLS-1$ - } - } - } - } - } - - } - if (loggedIn) { - parseHtmlError(stream); - return null; - } - } finally { - stream.close(); - } - } finally { - attempt++; - if (method != null) { - method.releaseConnection(); - } - } - } - return null; - } - - public void getAttachmentData(String attachmentId, OutputStream out, IProgressMonitor monitor) throws IOException, - CoreException { - String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId; - GetMethod method = connectInternal(url, false, monitor);//getConnectGzip(url, monitor); - try { - int status = WebUtil.execute(httpClient, hostConfiguration, method, monitor); - if (status == HttpStatus.SC_OK) { - out.write(method.getResponseBody()); - } else { - parseHtmlError(method.getResponseBodyAsStream()); - } - } catch (IOException e) { - throw e; - } finally { - method.releaseConnection(); - } - } - - public void postAttachment(String bugReportID, String comment, AbstractTaskAttachmentSource source, - TaskAttribute attachmentAttribute, IProgressMonitor monitor) throws HttpException, IOException, - CoreException { - monitor = Policy.monitorFor(monitor); - String description = source.getDescription(); - String contentType = source.getContentType(); - String filename = source.getName(); - boolean isPatch = false; - - if (attachmentAttribute != null) { - TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attachmentAttribute); - - if (mapper.getDescription() != null) { - description = mapper.getDescription(); - } - - if (mapper.getContentType() != null) { - contentType = mapper.getContentType(); - } - - if (mapper.getFileName() != null) { - filename = mapper.getFileName(); - } - - if (mapper.isPatch() != null) { - isPatch = mapper.isPatch(); - } - } - Assert.isNotNull(bugReportID); - Assert.isNotNull(source); - Assert.isNotNull(contentType); - if (description == null) { - throw new CoreException(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, - Messages.BugzillaClient_description_required_when_submitting_attachments)); - } - - hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - authenticate(monitor); - GzipPostMethod postMethod = null; - - try { - postMethod = new GzipPostMethod(WebUtil.getRequestPath(repositoryUrl - + IBugzillaConstants.URL_POST_ATTACHMENT_UPLOAD), true); - // This option causes the client to first - // check - // with the server to see if it will in fact receive the post before - // actually sending the contents. - postMethod.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true); - List<PartBase> parts = new ArrayList<PartBase>(); - parts.add(new StringPart(IBugzillaConstants.POST_INPUT_ACTION, VALUE_ACTION_INSERT, characterEncoding)); - AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); - String username; - String password; - if (credentials != null) { - username = credentials.getUserName(); - password = credentials.getPassword(); - } else { - username = null; - password = null; - - } - if (username != null && password != null) { - parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_LOGIN, username, characterEncoding)); - parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGZILLA_PASSWORD, password, characterEncoding)); - } - parts.add(new StringPart(IBugzillaConstants.POST_INPUT_BUGID, bugReportID, characterEncoding)); - if (description != null) { - parts.add(new StringPart(IBugzillaConstants.POST_INPUT_DESCRIPTION, description, characterEncoding)); - } - if (comment != null) { - parts.add(new StringPart(IBugzillaConstants.POST_INPUT_COMMENT, comment, characterEncoding)); - } - parts.add(new FilePart(IBugzillaConstants.POST_INPUT_DATA, new TaskAttachmentPartSource(source, filename))); - - if (isPatch) { - parts.add(new StringPart(ATTRIBUTE_ISPATCH, VALUE_ISPATCH)); - } else { - parts.add(new StringPart(ATTRIBUTE_CONTENTTYPEMETHOD, VALUE_CONTENTTYPEMETHOD_MANUAL)); - parts.add(new StringPart(ATTRIBUTE_CONTENTTYPEENTRY, contentType)); - } - if (attachmentAttribute != null) { - Collection<TaskAttribute> attributes = attachmentAttribute.getAttributes().values(); - Iterator<TaskAttribute> itr = attributes.iterator(); - while (itr.hasNext()) { - TaskAttribute a = itr.next(); - if (a.getId().startsWith("task.common.kind.flag_type")) { //$NON-NLS-1$ - List<BugzillaFlag> flags = repositoryConfiguration.getFlags(); - TaskAttribute requestee = a.getAttribute("requestee"); //$NON-NLS-1$ - a = a.getAttribute("state"); //$NON-NLS-1$ - String value = a.getValue(); - String id = ""; //$NON-NLS-1$ - if (value.equals(" ")) { //$NON-NLS-1$ - continue; - } - String flagname = a.getMetaData().getLabel(); - BugzillaFlag theFlag = null; - for (BugzillaFlag bugzillaFlag : flags) { - if (flagname.equals(bugzillaFlag.getName())) { - theFlag = bugzillaFlag; - break; - } - } - if (theFlag != null) { - int flagTypeNumber = theFlag.getFlagId(); - id = "flag_type-" + flagTypeNumber; //$NON-NLS-1$ - value = a.getValue(); - if (value.equals("?") && requestee != null) { //$NON-NLS-1$ - parts.add(new StringPart("requestee_type-" + flagTypeNumber, //$NON-NLS-1$ - requestee.getValue() != null ? requestee.getValue() : "")); //$NON-NLS-1$ - } - } - parts.add(new StringPart(id, value != null ? value : "")); //$NON-NLS-1$ - } else if (a.getId().startsWith("task.common.kind.flag")) { //$NON-NLS-1$ - TaskAttribute flagnumber = a.getAttribute("number"); //$NON-NLS-1$ - TaskAttribute requestee = a.getAttribute("requestee"); //$NON-NLS-1$ - a = a.getAttribute("state"); //$NON-NLS-1$ - String id = "flag-" + flagnumber.getValue(); //$NON-NLS-1$ - String value = a.getValue(); - if (value.equals(" ")) { //$NON-NLS-1$ - value = "X"; //$NON-NLS-1$ - } - if (value.equals("?") && requestee != null) { //$NON-NLS-1$ - parts.add(new StringPart("requestee-" + flagnumber.getValue(), //$NON-NLS-1$ - requestee.getValue() != null ? requestee.getValue() : "")); //$NON-NLS-1$ - } - parts.add(new StringPart(id, value != null ? value : "")); //$NON-NLS-1$ - } - } - } - postMethod.setRequestEntity(new MultipartRequestEntity(parts.toArray(new Part[1]), postMethod.getParams())); - postMethod.setDoAuthentication(true); - int status = WebUtil.execute(httpClient, hostConfiguration, postMethod, monitor); - if (status == HttpStatus.SC_OK) { - InputStream input = getResponseStream(postMethod, monitor); - try { - parseHtmlError(input); - } finally { - input.close(); - } - - } else { - postMethod.getResponseBodyNoop(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_NETWORK, repositoryUrl.toString(), "Http error: " //$NON-NLS-1$ - + HttpStatus.getStatusText(status))); - // throw new IOException("Communication error occurred during - // upload. \n\n" - // + HttpStatus.getStatusText(status)); - } - } finally { - if (postMethod != null) { - postMethod.releaseConnection(); - } - } - } - - /** - * calling method must release the connection on the returned PostMethod once finished. - * - * @throws CoreException - */ - private GzipPostMethod postFormData(String formUrl, NameValuePair[] formData, IProgressMonitor monitor) - throws IOException, CoreException { - - GzipPostMethod postMethod = null; - monitor = Policy.monitorFor(monitor); - hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - authenticate(monitor); - - postMethod = new GzipPostMethod(WebUtil.getRequestPath(repositoryUrl.toString() + formUrl), true); - postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=" + characterEncoding); //$NON-NLS-1$ //$NON-NLS-2$ - - httpClient.getHttpConnectionManager().getParams().setSoTimeout(WebUtil.getConnectionTimeout()); - -// postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new BugzillaRetryHandler()); - postMethod.setRequestBody(formData); - postMethod.setDoAuthentication(true); - // httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECT_TIMEOUT); - int status = WebUtil.execute(httpClient, hostConfiguration, postMethod, monitor); - if (status == HttpStatus.SC_OK) { - return postMethod; - } else { - postMethod.getResponseBodyNoop(); - postMethod.releaseConnection(); - //StatusManager.log("Post failed: " + HttpStatus.getStatusText(status), this); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_IO, repositoryUrl.toString(), new IOException( - "Communication error occurred during upload. \n\n" + HttpStatus.getStatusText(status)))); //$NON-NLS-1$ -// throw new IOException("Communication error occurred during upload. \n\n" + HttpStatus.getStatusText(status)); - } - - } - - public void postUpdateAttachment(TaskAttribute taskAttribute, String action, IProgressMonitor monitor) - throws IOException, CoreException { - List<NameValuePair> formData = new ArrayList<NameValuePair>(5); - boolean existingBugPosted = false; - - formData.add(new NameValuePair("action", action)); //$NON-NLS-1$ - formData.add(new NameValuePair("contenttypemethod", "manual")); //$NON-NLS-1$ //$NON-NLS-2$ - - formData.add(new NameValuePair("id", taskAttribute.getValue())); //$NON-NLS-1$ - Collection<TaskAttribute> attributes = taskAttribute.getAttributes().values(); - Iterator<TaskAttribute> itr = attributes.iterator(); - while (itr.hasNext()) { - TaskAttribute a = itr.next(); - String id = a.getId(); - String value = a.getValue(); - if (id.equals(TaskAttribute.ATTACHMENT_AUTHOR) || id.equals("date") || id.equals("size") //$NON-NLS-1$ //$NON-NLS-2$ - || id.equals(TaskAttribute.ATTACHMENT_URL)) { - continue; - } - - if (id.equals("desc")) { //$NON-NLS-1$ - id = "description"; //$NON-NLS-1$ - } - if (id.equals("ctype")) { //$NON-NLS-1$ - id = "contenttypeentry"; //$NON-NLS-1$ - } - - if (id.equals(TaskAttribute.ATTACHMENT_IS_DEPRECATED)) { - id = "isobsolete"; //$NON-NLS-1$ - } - if (id.equals(TaskAttribute.ATTACHMENT_IS_PATCH)) { - id = "ispatch"; //$NON-NLS-1$ - } - formData.add(new NameValuePair(id, value)); - } - GzipPostMethod method = null; - InputStream input = null; - try { - method = postFormData(PROCESS_ATTACHMENT_CGI, formData.toArray(new NameValuePair[formData.size()]), monitor); - - if (method == null) { - throw new IOException(Messages.BugzillaClient_could_not_post_form_null_returned); - } - - input = getResponseStream(method, monitor); - - BufferedReader in = new BufferedReader(new InputStreamReader(input, method.getRequestCharSet())); - if (in.markSupported()) { - in.mark(1028); - } - HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null); - - boolean isTitle = false; - String title = ""; //$NON-NLS-1$ - - for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { - - if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.TITLE - && !((HtmlTag) (token.getValue())).isEndTag()) { - isTitle = true; - continue; - } - - if (isTitle) { - // get all of the data in the title tag - if (token.getType() != Token.TAG) { - title += ((StringBuffer) token.getValue()).toString().toLowerCase(Locale.ENGLISH) + " "; //$NON-NLS-1$ - continue; - } else if (token.getType() == Token.TAG && ((HtmlTag) token.getValue()).getTagType() == Tag.TITLE - && ((HtmlTag) token.getValue()).isEndTag()) { - - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_CHANGES_SUBMITTED).iterator(); iterator.hasNext() - && !existingBugPosted;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - existingBugPosted = existingBugPosted || title.indexOf(value) != -1; - } - break; - } - } - } - - if (existingBugPosted != true) { - try { - if (in.markSupported()) { - in.reset(); - } - } catch (IOException e) { - // ignore - } - parseHtmlError(in); - } - - } catch (ParseException e) { - loggedIn = false; - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_INTERNAL, "Unable to parse response from " + repositoryUrl.toString() + ".")); //$NON-NLS-1$ //$NON-NLS-2$ - } finally { - if (input != null) { - input.close(); - } - if (method != null) { - method.releaseConnection(); - } - } - } - - public RepositoryResponse postTaskData(TaskData taskData, IProgressMonitor monitor) throws IOException, - CoreException { - NameValuePair[] formData = null; - monitor = Policy.monitorFor(monitor); - - authenticate(new SubProgressMonitor(monitor, 1)); - - if (taskData == null) { - return null; - } else if (taskData.isNew()) { - formData = getPairsForNew(taskData); - } else { - formData = getPairsForExisting(taskData, new SubProgressMonitor(monitor, 1)); - } - - String result = null; - GzipPostMethod method = null; - InputStream input = null; - try { - if (taskData.isNew()) { - method = postFormData(POST_BUG_CGI, formData, monitor); - } else { - method = postFormData(PROCESS_BUG_CGI, formData, monitor); - } - - if (method == null) { - throw new IOException("Could not post form, client returned null method."); //$NON-NLS-1$ - } - - input = getResponseStream(method, monitor); - - BufferedReader in = new BufferedReader(new InputStreamReader(input, method.getRequestCharSet())); - if (in.markSupported()) { - in.mark(1028); - } - HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null); - - boolean existingBugPosted = false; - boolean isTitle = false; - String title = ""; //$NON-NLS-1$ - - for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { - if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.TITLE - && !((HtmlTag) (token.getValue())).isEndTag()) { - isTitle = true; - continue; - } - - if (isTitle) { - // get all of the data in the title tag - if (token.getType() != Token.TAG) { - title += ((StringBuffer) token.getValue()).toString().toLowerCase(Locale.ENGLISH) + " "; //$NON-NLS-1$ - continue; - } else if (token.getType() == Token.TAG && ((HtmlTag) token.getValue()).getTagType() == Tag.TITLE - && ((HtmlTag) token.getValue()).isEndTag()) { - - boolean found = false; - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_PROCESSED).iterator(); iterator.hasNext() && !found;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - found = found || title.indexOf(value) != -1; - } - if (!taskData.isNew() && found) { - existingBugPosted = true; - } else if (taskData.isNew()) { - - int startIndex = -1; - - if (result == null) { - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_SUBMITTED).iterator(); iterator.hasNext();) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - int stopIndex = title.indexOf(value); - if (stopIndex > -1) { - for (iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_BUG).iterator(); iterator.hasNext();) { - value = iterator.next().toLowerCase(Locale.ENGLISH); - startIndex = title.indexOf(value); - if (startIndex > -1) { - startIndex = startIndex + value.length(); - result = (title.substring(startIndex, stopIndex)).trim(); - break; - } - } - break; - } - } - } - } - break; - } - } - } - - if ((!taskData.isNew() && existingBugPosted != true) || (taskData.isNew() && result == null)) { - try { - if (in.markSupported()) { - in.reset(); - } - } catch (IOException e) { - // ignore - } - parseHtmlError(in); - } - - if (taskData.isNew()) { - return new RepositoryResponse(ResponseKind.TASK_CREATED, result); - } else { - return new RepositoryResponse(ResponseKind.TASK_UPDATED, taskData.getTaskId()); - } - } catch (ParseException e) { - loggedIn = false; - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_INTERNAL, "Unable to parse response from " + repositoryUrl.toString() + ".")); //$NON-NLS-1$ //$NON-NLS-2$ - } finally { - if (input != null) { - input.close(); - } - if (method != null) { - method.releaseConnection(); - } - } - - } - - private NameValuePair[] getPairsForNew(TaskData taskData) { - Map<String, NameValuePair> fields = new HashMap<String, NameValuePair>(); - - // go through all of the attributes and add them to - // the bug post - Collection<TaskAttribute> attributes = new ArrayList<TaskAttribute>(taskData.getRoot().getAttributes().values()); - Iterator<TaskAttribute> itr = attributes.iterator(); - while (itr.hasNext()) { - TaskAttribute a = itr.next(); - if (a != null && a.getId() != null && a.getId().compareTo("") != 0) { //$NON-NLS-1$ - String value = null; - value = a.getValue(); - if (value == null) { - continue; - } - if (a.getId().equals(BugzillaAttribute.NEWCC.getKey())) { - TaskAttribute b = taskData.getRoot().createAttribute(BugzillaAttribute.CC.getKey()); - b.getMetaData().defaults().setReadOnly(BugzillaAttribute.CC.isReadOnly()).setKind( - BugzillaAttribute.CC.getKind()).setLabel(BugzillaAttribute.CC.toString()).setType( - BugzillaAttribute.CC.getType()); - for (String val : a.getValues()) { - if (val != null) { - b.addValue(val); - } - } - a = b; - cleanIfShortLogin(a); - } else { - cleanQAContact(a); - } - fields.put(a.getId(), new NameValuePair(a.getId(), value)); - } - } - - TaskAttribute descAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION); - if (descAttribute != null && !descAttribute.getValue().equals("")) { //$NON-NLS-1$ - BugzillaVersion bugzillaVersion = null; - if (repositoryConfiguration != null) { - bugzillaVersion = repositoryConfiguration.getInstallVersion(); - } else { - bugzillaVersion = BugzillaVersion.MIN_VERSION; - } - - if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_2_18) == 0) { - fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, formatTextToLineWrap(descAttribute.getValue(), - true))); - } else { - fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, descAttribute.getValue())); - } - } - - return fields.values().toArray(new NameValuePair[fields.size()]); - - } - - private void cleanQAContact(TaskAttribute a) { - if (a.getId().equals(BugzillaAttribute.QA_CONTACT.getKey())) { - cleanIfShortLogin(a); - } - } - - private void cleanIfShortLogin(TaskAttribute a) { - if ("true".equals(configParameters.get(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN))) { //$NON-NLS-1$ - if (a.getValue() != null && a.getValue().length() > 0) { - int atIndex = a.getValue().indexOf("@"); //$NON-NLS-1$ - if (atIndex != -1) { - String newValue = a.getValue().substring(0, atIndex); - a.setValue(newValue); - } - } - } - } - - private NameValuePair[] getPairsForExisting(TaskData model, IProgressMonitor monitor) throws CoreException { - boolean groupSecurityEnabled = false; - Map<String, NameValuePair> fields = new HashMap<String, NameValuePair>(); - fields.put(KEY_FORM_NAME, new NameValuePair(KEY_FORM_NAME, VAL_PROCESS_BUG)); - // go through all of the attributes and add them to the bug post - Collection<TaskAttribute> attributes = model.getRoot().getAttributes().values(); - Iterator<TaskAttribute> itr = attributes.iterator(); - boolean tokenFound = false; - boolean tokenRequired = false; - while (itr.hasNext()) { - TaskAttribute a = itr.next(); - - if (a == null) { - continue; - } else { - String id = a.getId(); - if (id.equalsIgnoreCase(BugzillaAttribute.TOKEN.getKey())) { - tokenFound = true; - } else if (id.equals(BugzillaAttribute.QA_CONTACT.getKey()) - || id.equals(BugzillaAttribute.ASSIGNED_TO.getKey())) { - cleanIfShortLogin(a); - } else if (id.equals(BugzillaAttribute.REPORTER.getKey()) || id.equals(BugzillaAttribute.CC.getKey()) - || id.equals(BugzillaAttribute.REMOVECC.getKey()) - || id.equals(BugzillaAttribute.CREATION_TS.getKey()) - || id.equals(BugzillaAttribute.BUG_STATUS.getKey()) - || id.equals(BugzillaAttribute.VOTES.getKey())) { - continue; - } else if (id.equals(BugzillaAttribute.NEW_COMMENT.getKey())) { - BugzillaVersion bugzillaVersion = null; - if (repositoryConfiguration != null) { - bugzillaVersion = repositoryConfiguration.getInstallVersion(); - } else { - bugzillaVersion = BugzillaVersion.MIN_VERSION; - } - if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_2_18) == 0) { - a.setValue(formatTextToLineWrap(a.getValue(), true)); - } - } else if (id.equals(BugzillaAttribute.GROUP.getKey()) && a.getValue().length() > 0) { - groupSecurityEnabled = true; - } - - if (a.getMetaData().getType() != null - && a.getMetaData().getType().equals(TaskAttribute.TYPE_MULTI_SELECT)) { - List<String> values = a.getValues(); - int i = 0; - for (String string : values) { - fields.put(id + i++, new NameValuePair(id, string != null ? string : "")); //$NON-NLS-1$ - } - } else if (id != null && id.compareTo("") != 0) {//$NON-NLS-1$ - String value = a.getValue(); - if (id.equals(BugzillaAttribute.DELTA_TS.getKey())) { - value = stripTimeZone(value); - } - if (id.startsWith("task.common.kind.flag_type")) { //$NON-NLS-1$ - List<BugzillaFlag> flags = repositoryConfiguration.getFlags(); - TaskAttribute requestee = a.getAttribute("requestee"); //$NON-NLS-1$ - a = a.getAttribute("state"); //$NON-NLS-1$ - value = a.getValue(); - if (value.equals(" ")) { //$NON-NLS-1$ - continue; - } - String flagname = a.getMetaData().getLabel(); - BugzillaFlag theFlag = null; - for (BugzillaFlag bugzillaFlag : flags) { - if (flagname.equals(bugzillaFlag.getName())) { - theFlag = bugzillaFlag; - break; - } - } - if (theFlag != null) { - int flagTypeNumber = theFlag.getFlagId(); - id = "flag_type-" + flagTypeNumber; //$NON-NLS-1$ - value = a.getValue(); - if (value.equals("?") && requestee != null) { //$NON-NLS-1$ - fields.put("requestee_type-" + flagTypeNumber, new NameValuePair("requestee_type-" //$NON-NLS-1$ //$NON-NLS-2$ - + flagTypeNumber, requestee.getValue() != null ? requestee.getValue() : "")); //$NON-NLS-1$ - } - } - } else if (id.startsWith("task.common.kind.flag")) { //$NON-NLS-1$ - TaskAttribute flagnumber = a.getAttribute("number"); //$NON-NLS-1$ - TaskAttribute requestee = a.getAttribute("requestee"); //$NON-NLS-1$ - a = a.getAttribute("state"); //$NON-NLS-1$ - id = "flag-" + flagnumber.getValue(); //$NON-NLS-1$ - value = a.getValue(); - if (value.equals(" ")) { //$NON-NLS-1$ - value = "X"; //$NON-NLS-1$ - } - if (value.equals("?") && requestee != null) { //$NON-NLS-1$ - fields.put("requestee-" + flagnumber.getValue(), new NameValuePair("requestee-" //$NON-NLS-1$ //$NON-NLS-2$ - + flagnumber.getValue(), requestee.getValue() != null ? requestee.getValue() : "")); //$NON-NLS-1$ - } - } else if (id.startsWith("task.common.")) { //$NON-NLS-1$ - // Don't post any remaining non-bugzilla specific attributes - continue; - } - fields.put(id, new NameValuePair(id, value != null ? value : "")); //$NON-NLS-1$ - } - } - } - - // when posting the bug id is encoded in a hidden field named 'id' - TaskAttribute attributeBugId = model.getRoot().getAttribute(BugzillaAttribute.BUG_ID.getKey()); - if (attributeBugId != null) { - fields.put(KEY_ID, new NameValuePair(KEY_ID, attributeBugId.getValue())); - } - - // add the operation to the bug post - BugzillaVersion bugzillaVersion = null; - if (repositoryConfiguration != null) { - bugzillaVersion = repositoryConfiguration.getInstallVersion(); - } else { - bugzillaVersion = BugzillaVersion.MIN_VERSION; - } - if (bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_2) < 0) { - - TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - if (attributeOperation == null) { - fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE)); - } else { - TaskAttribute originalOperation = model.getRoot().getAttribute( - TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue()); - if (originalOperation == null) { - // Work around for bug#241012 - fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE)); - } else { - String inputAttributeId = originalOperation.getMetaData().getValue( - TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID); - if (inputAttributeId == null || inputAttributeId.equals("")) { //$NON-NLS-1$ - String sel = attributeOperation.getValue(); - fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, sel)); - } else { - fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, attributeOperation.getValue())); - TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute( - inputAttributeId); - if (inputAttribute != null) { - if (inputAttribute.getOptions().size() > 0) { - String sel = inputAttribute.getValue(); - String knob = inputAttribute.getId(); - if (knob.equals(BugzillaOperation.resolve.getInputId())) { - knob = BugzillaAttribute.RESOLUTION.getKey(); - } - fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel))); - } else { - String sel = inputAttribute.getValue(); - String knob = attributeOperation.getValue(); - if (knob.equals(BugzillaOperation.reassign.toString())) { - knob = BugzillaAttribute.ASSIGNED_TO.getKey(); - } - fields.put(knob, new NameValuePair(knob, sel)); - } - } - } - } - if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null - && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) { - fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute( - TaskAttribute.COMMENT_NEW).getValue())); - } else if (attributeOperation != null - && attributeOperation.getValue().equals(BugzillaOperation.duplicate.toString())) { - // fix for bug#198677 - fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, "")); //$NON-NLS-1$ - } - } - } else { - // A token is required for bugzilla 3.2.1 and newer - tokenRequired = bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_2) > 0; - String fieldName = BugzillaAttribute.BUG_STATUS.getKey(); - TaskAttribute attributeStatus = model.getRoot().getMappedAttribute(TaskAttribute.STATUS); - TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - if (attributeOperation == null) { - fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue())); - } else { - TaskAttribute originalOperation = model.getRoot().getAttribute( - TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue()); - if (originalOperation == null) { - // Work around for bug#241012 - fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue())); - } else { - String inputAttributeId = originalOperation.getMetaData().getValue( - TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID); - if (originalOperation == null) { - fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue())); - } else { - String selOp = attributeOperation.getValue().toUpperCase(); - if (selOp.equals("NONE")) { //$NON-NLS-1$ - selOp = attributeStatus.getValue(); - } - if (selOp.equals("ACCEPT")) { //$NON-NLS-1$ - selOp = "ASSIGNED"; //$NON-NLS-1$ - } - if (selOp.equals("RESOLVE")) { //$NON-NLS-1$ - selOp = "RESOLVED"; //$NON-NLS-1$ - } - if (selOp.equals("VERIFY")) { //$NON-NLS-1$ - selOp = "VERIFIED"; //$NON-NLS-1$ - } - if (selOp.equals("CLOSE")) { //$NON-NLS-1$ - selOp = "CLOSED"; //$NON-NLS-1$ - } - if (selOp.equals("REOPEN")) { //$NON-NLS-1$ - selOp = "REOPENED"; //$NON-NLS-1$ - } - if (selOp.equals("DUPLICATE")) { //$NON-NLS-1$ - selOp = "RESOLVED"; //$NON-NLS-1$ - String knob = BugzillaAttribute.RESOLUTION.getKey(); - fields.put(knob, new NameValuePair(knob, "DUPLICATE")); //$NON-NLS-1$ - } - - fields.put(fieldName, new NameValuePair(fieldName, selOp)); - if (inputAttributeId != null && !inputAttributeId.equals("")) { //$NON-NLS-1$ - TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute( - inputAttributeId); - if (inputAttribute != null) { - if (inputAttribute.getOptions().size() > 0) { - String sel = inputAttribute.getValue(); - String knob = inputAttribute.getId(); - if (knob.equals(BugzillaOperation.resolve.getInputId())) { - knob = BugzillaAttribute.RESOLUTION.getKey(); - } - fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel))); - } else { - String sel = inputAttribute.getValue(); - String knob = attributeOperation.getValue(); - if (knob.equals("duplicate")) { //$NON-NLS-1$ - knob = inputAttributeId; - } - if (knob.equals(BugzillaOperation.reassign.toString())) { - knob = BugzillaAttribute.ASSIGNED_TO.getKey(); - } - fields.put(knob, new NameValuePair(knob, sel)); - } - } - } - } - } - } - - if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null - && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) { - fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute( - TaskAttribute.COMMENT_NEW).getValue())); - } - } - - if (model.getRoot().getMappedAttribute(BugzillaAttribute.SHORT_DESC.getKey()) != null) { - fields.put(KEY_SHORT_DESC, new NameValuePair(KEY_SHORT_DESC, model.getRoot().getMappedAttribute( - BugzillaAttribute.SHORT_DESC.getKey()).getValue())); - } - - TaskAttribute attributeRemoveCC = model.getRoot().getMappedAttribute(BugzillaAttribute.REMOVECC.getKey()); - if (attributeRemoveCC != null) { - List<String> removeCC = attributeRemoveCC.getValues(); - if (removeCC != null && removeCC.size() > 0) { - String[] s = new String[removeCC.size()]; - fields.put(KEY_CC, new NameValuePair(KEY_CC, toCommaSeparatedList(removeCC.toArray(s)))); - fields.put(BugzillaAttribute.REMOVECC.getKey(), new NameValuePair(BugzillaAttribute.REMOVECC.getKey(), - VAL_TRUE)); - } - } - - // check for security token (required for successful submit on Bugzilla 3.2.1 and greater but not in xml until Bugzilla 3.2.3 bug#263318) - - if (groupSecurityEnabled || (!tokenFound && tokenRequired)) { - // get security and token if exists from html and include in post - HtmlInformation htmlInfo = getHtmlOnlyInformation(model, monitor); - - if (groupSecurityEnabled) { - for (String key : htmlInfo.getGroups().keySet()) { - fields.put(key, new NameValuePair(key, htmlInfo.getGroups().get(key))); - } - } - if (htmlInfo.getToken() != null && htmlInfo.getToken().length() > 0 && tokenRequired) { - NameValuePair tokenPair = fields.get(BugzillaAttribute.TOKEN.getKey()); - if (tokenPair != null) { - tokenPair.setValue(htmlInfo.getToken()); - } else { - fields.put(BugzillaAttribute.TOKEN.getKey(), new NameValuePair(BugzillaAttribute.TOKEN.getKey(), - htmlInfo.getToken())); - } - } - } - return fields.values().toArray(new NameValuePair[fields.size()]); - - } - - private HtmlInformation getHtmlOnlyInformation(TaskData taskData, IProgressMonitor monitor) throws CoreException { - HtmlInformation htmlInfo = new HtmlInformation(); - authenticate(new SubProgressMonitor(monitor, 1)); - hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - - String bugUrl = taskData.getRepositoryUrl() + IBugzillaConstants.URL_GET_SHOW_BUG + taskData.getTaskId(); - GzipGetMethod getMethod = new GzipGetMethod(WebUtil.getRequestPath(bugUrl), false); - getMethod.setRequestHeader("Content-Type", "text/xml; charset=" + characterEncoding); //$NON-NLS-1$ //$NON-NLS-2$ - httpClient.getParams().setParameter("http.protocol.single-cookie-header", true); //$NON-NLS-1$ - getMethod.setDoAuthentication(true); - - int code; - InputStream inStream = null; - try { - code = WebUtil.execute(httpClient, hostConfiguration, getMethod, monitor); - if (code == HttpURLConnection.HTTP_OK) { - inStream = getResponseStream(getMethod, monitor); - HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(new BufferedReader(new InputStreamReader( - inStream, characterEncoding)), null); - for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { - if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.INPUT - && !((HtmlTag) (token.getValue())).isEndTag()) { - HtmlTag tag = (HtmlTag) token.getValue(); - // String name = tag.getAttribute("name"); - String id = tag.getAttribute("id"); //$NON-NLS-1$ - String checkedValue = tag.getAttribute("checked"); //$NON-NLS-1$ - String type = tag.getAttribute("type"); //$NON-NLS-1$ - String name = tag.getAttribute("name"); //$NON-NLS-1$ - String value = tag.getAttribute("value"); //$NON-NLS-1$ - if (type != null && type.equalsIgnoreCase("checkbox") && id != null && id.startsWith("bit-")) { //$NON-NLS-1$ //$NON-NLS-2$ - htmlInfo.getGroups().put(id, checkedValue); - } else if (name != null && name.equalsIgnoreCase(BugzillaAttribute.TOKEN.getKey()) - && value != null && value.length() > 0) { - htmlInfo.setToken(value); - } - } - } - } - } catch (Exception e) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - "Unable to retrieve group security information", e)); //$NON-NLS-1$ - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (IOException e) { - //ignore - } - } - } - return htmlInfo; - } - - public static String stripTimeZone(String longTime) { - String result = longTime; - if (longTime != null) { - String[] values = longTime.split(" "); //$NON-NLS-1$ - if (values != null && values.length > 2) { - result = values[0] + " " + values[1]; //$NON-NLS-1$ - } - } - return result; - } - - private static String toCommaSeparatedList(String[] strings) { - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < strings.length; i++) { - buffer.append(strings[i]); - if (i != strings.length - 1) { - buffer.append(","); //$NON-NLS-1$ - } - } - return buffer.toString(); - } - - /** - * Utility method for determining what potential error has occurred from a bugzilla html reponse page - */ - private void parseHtmlError(InputStream inputStream) throws IOException, CoreException { - - BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, characterEncoding)); - parseHtmlError(in); - } - - private void parseHtmlError(BufferedReader in) throws IOException, CoreException { - - HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null); - - boolean isTitle = false; - String title = ""; //$NON-NLS-1$ - String body = ""; //$NON-NLS-1$ - - try { - for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { - body += token.toString(); - if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.TITLE - && !((HtmlTag) (token.getValue())).isEndTag()) { - isTitle = true; - continue; - } - - if (isTitle) { - // get all of the data in the title tag - if (token.getType() != Token.TAG) { - title += ((StringBuffer) token.getValue()).toString().toLowerCase(Locale.ENGLISH) + " "; //$NON-NLS-1$ - continue; - } else if (token.getType() == Token.TAG && ((HtmlTag) token.getValue()).getTagType() == Tag.TITLE - && ((HtmlTag) token.getValue()).isEndTag()) { - - boolean found = false; - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_ERROR_LOGIN).iterator(); iterator.hasNext() && !found;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - found = found || title.indexOf(value) != -1; - } - if (found) { - loggedIn = false; - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); - } - found = false; - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_ERROR_COLLISION).iterator(); iterator.hasNext() - && !found;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - found = found || title.indexOf(value) != -1; - } - if (found) { - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); - } - found = false; - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_ERROR_COMMENT_REQUIRED).iterator(); iterator.hasNext() - && !found;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - found = found || title.indexOf(value) != -1; - } - if (found) { - throw new CoreException(new BugzillaStatus(IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); - } - found = false; - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_SUSPICIOUS_ACTION).iterator(); iterator.hasNext() - && !found;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - found = found || title.indexOf(value) != -1; - } - if (found) { - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION)); - } - found = false; - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_ERROR_LOGGED_OUT).iterator(); iterator.hasNext() - && !found;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - found = found || title.indexOf(value) != -1; - } - if (found) { - loggedIn = false; - // throw new - // BugzillaException(IBugzillaConstants.LOGGED_OUT); - throw new CoreException(new BugzillaStatus(IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.REPOSITORY_LOGGED_OUT, - "You have been logged out. Please retry operation.")); //$NON-NLS-1$ - } - found = false; - for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand( - BugzillaLanguageSettings.COMMAND_CHANGES_SUBMITTED).iterator(); iterator.hasNext() - && !found;) { - String value = iterator.next().toLowerCase(Locale.ENGLISH); - found = found || title.indexOf(value) != -1; - } - if (found) { - return; - } - isTitle = false; - } - } - } - - throw new CoreException(RepositoryStatus.createHtmlStatus(repositoryUrl.toString(), IStatus.INFO, - BugzillaCorePlugin.ID_PLUGIN, RepositoryStatus.ERROR_REPOSITORY, - "A repository error has occurred.", body)); //$NON-NLS-1$ - - } catch (ParseException e) { - loggedIn = false; - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_INTERNAL, "Unable to parse response from " + repositoryUrl.toString() + ".")); //$NON-NLS-1$ //$NON-NLS-2$ - } finally { - in.close(); - } - } - - public TaskHistory getHistory(String taskId, IProgressMonitor monitor) throws IOException, CoreException { - hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - authenticate(monitor); - GzipGetMethod method = null; - try { - String url = repositoryUrl + IBugzillaConstants.SHOW_ACTIVITY + taskId; - method = getConnectGzip(url, monitor); - if (method != null) { - InputStream in = getResponseStream(method, monitor); - try { - BugzillaTaskHistoryParser parser = new BugzillaTaskHistoryParser(in, characterEncoding); - try { - return parser.retrieveHistory(bugzillaLanguageSettings); - } catch (LoginException e) { - loggedIn = false; - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), - IBugzillaConstants.INVALID_CREDENTIALS)); - } catch (ParseException e) { - loggedIn = false; - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_INTERNAL, "Unable to parse response from " //$NON-NLS-1$ - + repositoryUrl.toString() + ".")); //$NON-NLS-1$ - } - } finally { - in.close(); - } - } - - } finally { - if (method != null) { - method.releaseConnection(); - } - } - return null; - } - - public void getTaskData(Set<String> taskIds, final TaskDataCollector collector, final TaskAttributeMapper mapper, - final IProgressMonitor monitor) throws IOException, CoreException { - GzipPostMethod method = null; - HashMap<String, TaskData> taskDataMap = new HashMap<String, TaskData>(); - // make a copy to modify set - taskIds = new HashSet<String>(taskIds); - int authenticationAttempt = 0; - while (taskIds.size() > 0) { - - try { - - Set<String> idsToRetrieve = new HashSet<String>(); - Iterator<String> itr = taskIds.iterator(); - for (int x = 0; itr.hasNext() && x < MAX_RETRIEVED_PER_QUERY; x++) { - idsToRetrieve.add(itr.next()); - } - - NameValuePair[] formData = new NameValuePair[idsToRetrieve.size() + 2]; - - if (idsToRetrieve.size() == 0) { - return; - } - - itr = idsToRetrieve.iterator(); - int x = 0; - for (; itr.hasNext(); x++) { - String taskId = itr.next(); - formData[x] = new NameValuePair("id", taskId); //$NON-NLS-1$ - TaskData taskData = new TaskData(mapper, getConnectorKind(), repositoryUrl.toString(), taskId); - setupExistingBugAttributes(repositoryUrl.toString(), taskData); - taskDataMap.put(taskId, taskData); - } - formData[x++] = new NameValuePair("ctype", "xml"); //$NON-NLS-1$ //$NON-NLS-2$ - formData[x] = new NameValuePair("excludefield", "attachmentdata"); //$NON-NLS-1$ //$NON-NLS-2$ - method = postFormData(IBugzillaConstants.URL_POST_SHOW_BUG, formData, monitor); - if (method == null) { - throw new IOException("Could not post form, client returned null method."); //$NON-NLS-1$ - } - - boolean parseable = false; - if (method.getResponseHeader("Content-Type") != null) { //$NON-NLS-1$ - Header responseTypeHeader = method.getResponseHeader("Content-Type"); //$NON-NLS-1$ - for (String type : VALID_CONFIG_CONTENT_TYPES) { - if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) { - InputStream input = getResponseStream(method, monitor); - try { - MultiBugReportFactory factory = new MultiBugReportFactory(input, characterEncoding); - List<BugzillaCustomField> customFields = new ArrayList<BugzillaCustomField>(); - if (repositoryConfiguration != null) { - customFields = repositoryConfiguration.getCustomFields(); - } - factory.populateReport(taskDataMap, collector, mapper, customFields); - taskIds.removeAll(idsToRetrieve); - parseable = true; - break; - } finally { - input.close(); - } - } - } - } - - if (!parseable) { - parseHtmlError(getResponseStream(method, monitor)); - break; - } - } catch (CoreException c) { - if (c.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN && authenticationAttempt < 1) { - loggedIn = false; - authenticationAttempt++; - //StatusHandler.log(c.getStatus()); - } else { - throw c; - } - } finally { - if (method != null) { - method.releaseConnection(); - } - } - } - } - - protected String getConnectorKind() { - return BugzillaCorePlugin.CONNECTOR_KIND; - } - - public String getConfigurationTimestamp(IProgressMonitor monitor) throws CoreException { - if (!lastModifiedSupported) { - return null; - } - String lastModified = null; - HeadMethod method = null; - try { - method = connectHead(repositoryUrl + IBugzillaConstants.URL_GET_CONFIG_RDF, monitor); - - Header lastModifiedHeader = method.getResponseHeader("Last-Modified"); //$NON-NLS-1$ - if (lastModifiedHeader != null && lastModifiedHeader.getValue() != null - && lastModifiedHeader.getValue().length() > 0) { - lastModified = lastModifiedHeader.getValue(); - } else { - lastModifiedSupported = false; - } - - } catch (Exception e) { - - lastModifiedSupported = false; - - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - "Error retrieving configuration timestamp", e)); //$NON-NLS-1$ - } finally { - if (method != null) { - method.releaseConnection(); - } - } - return lastModified; - } - - private HeadMethod connectHead(String requestURL, IProgressMonitor monitor) throws IOException, CoreException { - hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - for (int attempt = 0; attempt < 2; attempt++) { - // force authentication - authenticate(monitor); - - HeadMethod headMethod = new HeadMethod(WebUtil.getRequestPath(requestURL)); - if (requestURL.contains(QUERY_DELIMITER)) { - headMethod.setQueryString(requestURL.substring(requestURL.indexOf(QUERY_DELIMITER))); - } - - headMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=" //$NON-NLS-1$ //$NON-NLS-2$ - + characterEncoding); - - // WARNING!! Setting browser compatability breaks Bugzilla - // authentication - // getMethod.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); - -// headMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new BugzillaRetryHandler()); - headMethod.setDoAuthentication(true); - - int code; - try { - code = WebUtil.execute(httpClient, hostConfiguration, headMethod, monitor); - } catch (IOException e) { - headMethod.getResponseBody(); - headMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_IO, repositoryUrl.toString(), e)); - } - - if (code == HttpURLConnection.HTTP_OK) { - return headMethod; - } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) { - headMethod.getResponseBody(); - // login or reauthenticate due to an expired session - headMethod.releaseConnection(); - loggedIn = false; - authenticate(monitor); - } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) { - loggedIn = false; - headMethod.getResponseBody(); - headMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), - "Proxy authentication required")); //$NON-NLS-1$ - } else { - headMethod.getResponseBody(); - headMethod.releaseConnection(); - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_NETWORK, "Http error: " + HttpStatus.getStatusText(code))); //$NON-NLS-1$ - // throw new IOException("HttpClient connection error response - // code: " + code); - } - } - - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_INTERNAL, "All connection attempts to " + repositoryUrl.toString() //$NON-NLS-1$ - + " failed. Please verify connection and authentication information.")); //$NON-NLS-1$ - } - - public void setRepositoryConfiguration(RepositoryConfiguration repositoryConfiguration) { - this.repositoryConfiguration = repositoryConfiguration; - } - - public RepositoryConfiguration getRepositoryConfiguration() { - return repositoryConfiguration; - } - - /** - * Break text up into lines so that it is displayed properly in bugzilla - */ - public static String formatTextToLineWrap(String origText, boolean hardWrap) { - if (!hardWrap) { - return origText; - } else { - String newText = ""; //$NON-NLS-1$ - - while (!origText.equals("")) { //$NON-NLS-1$ - int newLine = origText.indexOf('\n'); - if (newLine == -1) { - if (origText.length() > WRAP_LENGTH) { - int spaceIndex = origText.lastIndexOf(" ", WRAP_LENGTH); //$NON-NLS-1$ - if (spaceIndex == -1) { - spaceIndex = WRAP_LENGTH; - } - newText = newText + origText.substring(0, spaceIndex) + "\n"; //$NON-NLS-1$ - origText = origText.substring(spaceIndex + 1, origText.length()); - } else { - newText = newText + origText; - origText = ""; //$NON-NLS-1$ - } - } else { - newText = newText + origText.substring(0, newLine + 1); - origText = origText.substring(newLine + 1, origText.length()); - } - } - return newText; - } - } - - public static boolean isValidUrl(String url) { - if (url.startsWith("https://") || url.startsWith("http://")) { //$NON-NLS-1$//$NON-NLS-2$ - try { - new URI(url, true, "UTF-8"); //$NON-NLS-1$ - return true; - } catch (Exception e) { - return false; - } - } - return false; - } - - private class HtmlInformation { - private final Map<String, String> groups; - - private String token; - - public HtmlInformation() { - groups = new HashMap<String, String>(); - } - - public Map<String, String> getGroups() { - return groups; - } - - public void setToken(String token) { - this.token = token; - } - - public String getToken() { - return token; - } - - } - -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java deleted file mode 100644 index 09fd7f879..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.net.MalformedURLException; - -import org.eclipse.mylyn.commons.net.AbstractWebLocation; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory; - -/** - * @author Steffen Pingel - * @author Robert Elves (adaption for Bugzilla) - */ -public class BugzillaClientFactory { - - protected static TaskRepositoryLocationFactory taskRepositoryLocationFactory = new TaskRepositoryLocationFactory(); - - public static BugzillaClient createClient(TaskRepository taskRepository) throws MalformedURLException { - String language = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING); - if (language == null || language.equals("")) { //$NON-NLS-1$ - language = IBugzillaConstants.DEFAULT_LANG; - } - BugzillaLanguageSettings languageSettings = BugzillaRepositoryConnector.getLanguageSetting(language); - AbstractWebLocation location = taskRepositoryLocationFactory.createWebLocation(taskRepository); - BugzillaClient client = new BugzillaClient(location, taskRepository.getCharacterEncoding(), - taskRepository.getProperties(), languageSettings); - return client; - - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java deleted file mode 100644 index ecb7eaa7b..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.net.MalformedURLException; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.mylyn.tasks.core.IRepositoryListener; -import org.eclipse.mylyn.tasks.core.TaskRepository; - -/** - * @author Steffen Pingel - * @author Robert Elves (adaption for Bugzilla) - */ -public class BugzillaClientManager implements IRepositoryListener { - - private final Map<String, BugzillaClient> clientByUrl = new HashMap<String, BugzillaClient>(); - - public BugzillaClientManager() { - } - - public synchronized BugzillaClient getClient(TaskRepository taskRepository, IProgressMonitor monitor) - throws CoreException { - BugzillaClient client = clientByUrl.get(taskRepository.getRepositoryUrl()); - if (client == null) { - - String language = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING); - if (language == null || language.equals("")) { //$NON-NLS-1$ - language = IBugzillaConstants.DEFAULT_LANG; - } - try { - client = createClient(taskRepository); - } catch (MalformedURLException e) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - "Malformed Repository Url", e)); //$NON-NLS-1$ - } - clientByUrl.put(taskRepository.getRepositoryUrl(), client); - client.setRepositoryConfiguration(BugzillaCorePlugin.getRepositoryConfiguration(taskRepository, false, - monitor)); - } - return client; - } - - protected BugzillaClient createClient(TaskRepository taskRepository) throws MalformedURLException { - return BugzillaClientFactory.createClient(taskRepository); - } - - public synchronized void repositoryAdded(TaskRepository repository) { - // make sure there is no stale client still in the cache, bug #149939 - removeClient(repository); - } - - public synchronized void repositoryRemoved(TaskRepository repository) { - removeClient(repository); - } - - private void removeClient(TaskRepository repository) { - clientByUrl.remove(repository.getRepositoryUrl()); - } - - public synchronized void repositorySettingsChanged(TaskRepository repository) { - removeClient(repository); - } - - public void repositoryUrlChanged(TaskRepository repository, String oldUrl) { - // ignore - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java deleted file mode 100644 index a4a30e4dd..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java +++ /dev/null @@ -1,393 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.mylyn.commons.core.StatusHandler; -import org.eclipse.mylyn.commons.net.Policy; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskData; -import org.osgi.framework.BundleContext; - -/** - * @author Mik Kersten - * @author Rob Elves - */ -public class BugzillaCorePlugin extends Plugin { - - private static final String ERROR_DELETING_CONFIGURATION = "Error removing corrupt repository configuration file."; //$NON-NLS-1$ - - private static final String ERROR_INCOMPATIBLE_CONFIGURATION = "Reset Bugzilla repository configuration cache due to format change"; //$NON-NLS-1$ - - public static final String CONNECTOR_KIND = "bugzilla"; //$NON-NLS-1$ - - public static final String ID_PLUGIN = "org.eclipse.mylyn.bugzilla"; //$NON-NLS-1$ - - private static BugzillaCorePlugin INSTANCE; - - private static boolean cacheFileRead = false; - - private static File repositoryConfigurationFile = null; - - private static BugzillaRepositoryConnector connector; - - private static final String OPTION_ALL = "All"; //$NON-NLS-1$ - - // A Map from Java's Platform to Buzilla's - private final Map<String, String> java2buzillaPlatformMap = new HashMap<String, String>(); - - /** Product configuration for the current server */ - private static Map<String, RepositoryConfiguration> repositoryConfigurations = new HashMap<String, RepositoryConfiguration>(); - - public BugzillaCorePlugin() { - super(); - java2buzillaPlatformMap.put("x86", "PC"); // can be PC or Macintosh! //$NON-NLS-1$ //$NON-NLS-2$ - java2buzillaPlatformMap.put("x86_64", "PC"); //$NON-NLS-1$ //$NON-NLS-2$ - java2buzillaPlatformMap.put("ia64", "PC"); //$NON-NLS-1$ //$NON-NLS-2$ - java2buzillaPlatformMap.put("ia64_32", "PC"); //$NON-NLS-1$ //$NON-NLS-2$ - java2buzillaPlatformMap.put("sparc", "Sun"); //$NON-NLS-1$ //$NON-NLS-2$ - java2buzillaPlatformMap.put("ppc", "Power PC"); // not Power! //$NON-NLS-1$ //$NON-NLS-2$ - - } - - public static BugzillaCorePlugin getDefault() { - return INSTANCE; - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - INSTANCE = this; - } - - @Override - public void stop(BundleContext context) throws Exception { - if (!repositoryConfigurations.isEmpty()) { - writeRepositoryConfigFile(); - } - - INSTANCE = null; - super.stop(context); - } - - static void setConnector(BugzillaRepositoryConnector theConnector) { - connector = theConnector; - } - - public static Map<String, RepositoryConfiguration> getConfigurations() { - if (!cacheFileRead) { - readRepositoryConfigurationFile(); - cacheFileRead = true; - } - return repositoryConfigurations; - } - - public static void setConfigurationCacheFile(File file) { - repositoryConfigurationFile = file; - } - - /** - * @since 2.1 - * @return cached repository configuration. If not already cached, null is returned. - */ - public static RepositoryConfiguration getRepositoryConfiguration(String repositoryUrl) { - if (!cacheFileRead) { - readRepositoryConfigurationFile(); - cacheFileRead = true; - } - return repositoryConfigurations.get(repositoryUrl); - } - - /** - * Retrieves the latest repository configuration from the server - */ - public static RepositoryConfiguration getRepositoryConfiguration(TaskRepository repository, boolean forceRefresh, - IProgressMonitor monitor) throws CoreException { - monitor = Policy.monitorFor(monitor); - try { - if (!cacheFileRead) { - readRepositoryConfigurationFile(); - cacheFileRead = true; - } - if (repositoryConfigurations.get(repository.getRepositoryUrl()) == null || forceRefresh) { - BugzillaClient client = connector.getClientManager().getClient(repository, monitor); - RepositoryConfiguration config = client.getRepositoryConfiguration(monitor); - if (config != null) { - addRepositoryConfiguration(config); - } - - } - return repositoryConfigurations.get(repository.getRepositoryUrl()); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, 1, - "Error retrieving task attributes from repository.\n\n" + e.getMessage(), e)); //$NON-NLS-1$ - } - } - - /** public for testing */ - public static void addRepositoryConfiguration(RepositoryConfiguration config) { - repositoryConfigurations.remove(config.getRepositoryUrl()); - repositoryConfigurations.put(config.getRepositoryUrl(), config); - } - - // /** - // * Returns the path to the file cacheing the product configuration. - // */ - // private static IPath getProductConfigurationCachePath() { - // IPath stateLocation = - // Platform.getStateLocation(BugzillaPlugin.getDefault().getBundle()); - // IPath configFile = stateLocation.append("repositoryConfigurations"); - // return configFile; - // } - - /** public for testing */ - public static void removeConfiguration(RepositoryConfiguration config) { - repositoryConfigurations.remove(config.getRepositoryUrl()); - } - - /** public for testing */ - public static void readRepositoryConfigurationFile() { - // IPath configFile = getProductConfigurationCachePath(); - if (repositoryConfigurationFile == null || !repositoryConfigurationFile.exists()) { - return; - } - ObjectInputStream in = null; - try { - in = new ObjectInputStream(new FileInputStream(repositoryConfigurationFile)); - int size = in.readInt(); - for (int nX = 0; nX < size; nX++) { - RepositoryConfiguration item = (RepositoryConfiguration) in.readObject(); - if (item != null) { - repositoryConfigurations.put(item.getRepositoryUrl(), item); - } - } - } catch (Exception e) { - log(new Status(IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN, ERROR_INCOMPATIBLE_CONFIGURATION)); - try { - if (in != null) { - in.close(); - } - if (repositoryConfigurationFile != null && repositoryConfigurationFile.exists()) { - if (repositoryConfigurationFile.delete()) { - // successfully deleted - } else { - log(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, 0, ERROR_DELETING_CONFIGURATION, e)); - } - } - - } catch (Exception ex) { - log(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, 0, ERROR_DELETING_CONFIGURATION, e)); - } - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - // ignore - } - } - } - } - - /** public for testing */ - public static void writeRepositoryConfigFile() { - // IPath configFile = getProductConfigurationCachePath(); - if (repositoryConfigurationFile != null) { - ObjectOutputStream out = null; - try { - out = new ObjectOutputStream(new FileOutputStream(repositoryConfigurationFile)); - out.writeInt(repositoryConfigurations.size()); - for (String key : repositoryConfigurations.keySet()) { - RepositoryConfiguration item = repositoryConfigurations.get(key); - if (item != null) { - out.writeObject(item); - } - } - } catch (IOException e) { - log(e); - } finally { - if (out != null) { - try { - out.close(); - } catch (IOException e) { - // ignore - } - } - } - } - } - - /** - * Convenience method for logging statuses to the plugin log - * - * @param status - * the status to log - */ - public static void log(IStatus status) { - getDefault().getLog().log(status); - } - - /** - * Convenience method for logging exceptions to the plugin log - * - * @param e - * the exception to log - */ - public static void log(Exception e) { - String message = e.getMessage(); - if (e.getMessage() == null) { - message = e.getClass().toString(); - } - log(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, 0, message, e)); - } - - /** - * Returns the path to the file caching bug reports created while offline. - */ - protected IPath getCachedBugReportPath() { - IPath stateLocation = Platform.getStateLocation(BugzillaCorePlugin.getDefault().getBundle()); - IPath bugFile = stateLocation.append("bugReports"); //$NON-NLS-1$ - return bugFile; - } - - public void setPlatformDefaultsOrGuess(TaskRepository repository, TaskData newBugModel) { - - String platform = repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); - String os = repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_OS); - - // set both or none - if (null != os && null != platform) { - TaskAttribute opSysAttribute = newBugModel.getRoot().getAttribute(BugzillaAttribute.OP_SYS.getKey()); - TaskAttribute platformAttribute = newBugModel.getRoot().getAttribute( - BugzillaAttribute.REP_PLATFORM.getKey()); - - // TODO something can still go wrong when the allowed values on the repository change... - opSysAttribute.setValue(os); - platformAttribute.setValue(platform); - return; - } - // fall through to old code - setPlatformOptions(newBugModel); - } - - public void setPlatformOptions(TaskData newBugModel) { - try { - - // Get OS Lookup Map - // Check that the result is in Values, if it is not, set it to other - // Defaults to the first of each (sorted) list All, All - TaskAttribute opSysAttribute = newBugModel.getRoot().getAttribute(BugzillaAttribute.OP_SYS.getKey()); - TaskAttribute platformAttribute = newBugModel.getRoot().getAttribute( - BugzillaAttribute.REP_PLATFORM.getKey()); - - String OS = Platform.getOS(); - String platform = Platform.getOSArch(); - - String bugzillaOS = null; // Bugzilla String for OS - String bugzillaPlatform = null; // Bugzilla String for Platform -/* - AIX -> AIX - Linux -> Linux - HP-UX -> HP-UX - Solaris -> Solaris - MacOS X -> Mac OS X - */ - - bugzillaOS = System.getProperty("os.name") + " " + System.getProperty("os.version"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - // We start with the most specific Value as the Search String. - // If we didn't find it we remove the last part of the version String or the OS Name from - // the Search String and continue with the test until we found it or the Search String is empty. - // - // The search in casesensitive. - if (opSysAttribute != null) { - while (bugzillaOS != null && opSysAttribute.getOption(bugzillaOS) == null) { - int dotindex = bugzillaOS.lastIndexOf('.'); - if (dotindex > 0) { - bugzillaOS = bugzillaOS.substring(0, dotindex); - } else { - int spaceindex = bugzillaOS.lastIndexOf(' '); - if (spaceindex > 0) { - bugzillaOS = bugzillaOS.substring(0, spaceindex); - } else { - bugzillaOS = null; - } - } - } - } else { - bugzillaOS = null; - } - - if (platform != null && java2buzillaPlatformMap.containsKey(platform)) { - bugzillaPlatform = java2buzillaPlatformMap.get(platform); - // Bugzilla knows the following Platforms [All, Macintosh, Other, PC, Power PC, Sun] - // Platform.getOSArch() returns "x86" on Intel Mac's and "ppc" on Power Mac's - // so bugzillaPlatform is "Power" or "PC". - // - // If the OS is "macosx" we change the Platform to "Macintosh" - // - if (bugzillaPlatform != null - && (bugzillaPlatform.compareTo("Power") == 0 || bugzillaPlatform.compareTo("PC") == 0) //$NON-NLS-1$ //$NON-NLS-2$ - && OS != null && OS.compareTo("macosx") == 0) { //$NON-NLS-1$ - // TODO: this may not even be a legal value in another repository! - bugzillaPlatform = "Macintosh"; //$NON-NLS-1$ - } else if (platformAttribute != null && platformAttribute.getOption(bugzillaPlatform) == null) { - // If the platform we found is not int the list of available - // optinos, set the - // Bugzilla Platform to null, and juse use "other" - bugzillaPlatform = null; - } - } - // Set the OS and the Platform in the taskData - if (bugzillaOS != null && opSysAttribute != null) { - opSysAttribute.setValue(bugzillaOS); - } else if (opSysAttribute != null && opSysAttribute.getOption(OPTION_ALL) != null) { - opSysAttribute.setValue(OPTION_ALL); - } - - if (bugzillaPlatform != null && platformAttribute != null) { - platformAttribute.setValue(bugzillaPlatform); - } else if (opSysAttribute != null && platformAttribute != null - && platformAttribute.getOption(OPTION_ALL) != null) { - opSysAttribute.setValue(OPTION_ALL); - } - - } catch (Exception e) { - StatusHandler.log(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "could not set platform options", //$NON-NLS-1$ - e)); - } - } - - public Set<BugzillaLanguageSettings> getLanguageSettings() { - return BugzillaRepositoryConnector.getLanguageSettings(); - } - - public BugzillaLanguageSettings getLanguageSetting(String language) { - return BugzillaRepositoryConnector.getLanguageSetting(language); - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java deleted file mode 100644 index 62f4a2f2d..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Frank Becker 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: - * Frank Becker - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Class describing a custom Fields for a given Bugzilla installation. - * - * @author Frank Becker - * @since 2.3 - */ -public class BugzillaCustomField implements Serializable { - - // old version private static final long serialVersionUID = 5703683576871326128L; - private static final long serialVersionUID = 7273310489883205486L; - - public static final String CUSTOM_FIELD_PREFIX = "cf_"; //$NON-NLS-1$ - - private final String name; - - private final String description; - - private List<String> options = new ArrayList<String>(); - - final private int type; - - final private String typeDesc; - - final private boolean enterBug; - - public BugzillaCustomField(String description, String name, String type, String typeDesc, String enterBug) { - this.description = description; - this.name = name; - - this.type = parseInt(type); - this.typeDesc = typeDesc; - this.enterBug = "1".equals(enterBug); //$NON-NLS-1$ - } - - private int parseInt(String type) { - try { - return Integer.parseInt(type); - } catch (NumberFormatException e) { - return -1; - } - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public List<String> getOptions() { - return options; - } - - public void setOptions(List<String> options) { - this.options = options; - } - - public void addOption(String option) { - this.options.add(option); - } - - /* - * @since 3.0.2 - */ - public int getType() { - return type; - } - - /* - * @since 3.0.2 - */ - public String getTypeDesc() { - return typeDesc; - } - - /* - * @since 3.0.2 - */ - public boolean isEnterBug() { - return enterBug; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaFlag.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaFlag.java deleted file mode 100644 index 0c6a09001..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaFlag.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Frank Becker 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: - * Frank Becker - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author Frank Becker - */ -public class BugzillaFlag implements Serializable { - -// old private static final long serialVersionUID = 4920551884607344418L; - private static final long serialVersionUID = -3149026741475639885L; - - private final String name; - - private final String description; - - private final String type; - - private final boolean requestable; - - private final boolean specifically_requestable; - - private final boolean multiplicable; - - private final int flagId; - - private final Map<String, List<String>> used = new HashMap<String, List<String>>(); - - public BugzillaFlag(String name, String description, String type, String requestable, - String specifically_requestable, String multiplicable, int flagId) { - this.description = description; - this.name = name; - this.type = type; - this.flagId = flagId; - - if (multiplicable != null && !multiplicable.equals("")) { //$NON-NLS-1$ - this.multiplicable = multiplicable.equals("1"); //$NON-NLS-1$ - } else { - this.multiplicable = false; - } - - if (requestable != null && !requestable.equals("")) { //$NON-NLS-1$ - this.requestable = requestable.equals("1"); //$NON-NLS-1$ - } else { - this.requestable = false; - } - - if (specifically_requestable != null && !specifically_requestable.equals("")) { //$NON-NLS-1$ - this.specifically_requestable = specifically_requestable.equals("1"); //$NON-NLS-1$ - } else { - this.specifically_requestable = false; - } - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getType() { - return type; - } - - public boolean isRequestable() { - return requestable; - } - - public boolean isSpecifically_requestable() { - return specifically_requestable; - } - - public boolean isMultiplicable() { - return multiplicable; - } - - public int getFlagId() { - return flagId; - } - - public void addUsed(String product, String component) { - List<String> componentList = used.get(product); - if (componentList == null) { - componentList = new ArrayList<String>(); - used.put(product, componentList); - } - if (!componentList.contains(component)) { - componentList.add(component); - } - } - - public boolean isUsedIn(String product, String component) { - List<String> componentList = used.get(product); - if (componentList != null && componentList.contains(component)) { - return true; - } - return false; - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaFlagMapper.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaFlagMapper.java deleted file mode 100644 index f50f5db10..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaFlagMapper.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData; -import org.eclipse.mylyn.tasks.core.data.TaskData; - -/** - * @author Frank Becker - * @since 3.1 - */ -public class BugzillaFlagMapper { - - private String requestee; - - private String setter; - - private String state; - - private String flagId; - - private int number; - - public String getRequestee() { - return requestee; - } - - public void setRequestee(String requestee) { - this.requestee = requestee; - } - - public String getSetter() { - return setter; - } - - public void setSetter(String setter) { - this.setter = setter; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getFlagId() { - return flagId; - } - - public void setFlagId(String flagId) { - this.flagId = flagId; - } - - public int getNumber() { - return number; - } - - public void setNumber(int number) { - this.number = number; - } - - private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public void applyTo(TaskAttribute taskAttribute) { - Assert.isNotNull(taskAttribute); - TaskData taskData = taskAttribute.getTaskData(); - TaskAttributeMapper mapper = taskData.getAttributeMapper(); - TaskAttributeMetaData meta = taskAttribute.getMetaData().defaults(); - meta.setType(IBugzillaConstants.EDITOR_TYPE_FLAG); - meta.setLabel(description); - BugzillaVersion bugzillaVersion = null; - RepositoryConfiguration repositoryConfiguration; - try { - repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(mapper.getTaskRepository(), false, - new NullProgressMonitor()); - bugzillaVersion = repositoryConfiguration.getInstallVersion(); - } catch (CoreException e) { - bugzillaVersion = BugzillaVersion.MIN_VERSION; - } - - if (bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_2) >= 0) { - meta.setKind(TaskAttribute.KIND_DEFAULT); - } - meta.setReadOnly(false); - - if (getNumber() != 0) { - TaskAttribute child = taskAttribute.createMappedAttribute("number"); //$NON-NLS-1$ - child.getMetaData().defaults().setType(TaskAttribute.TYPE_INTEGER); - mapper.setIntegerValue(child, getNumber()); - } - if (getRequestee() != null) { - TaskAttribute child = taskAttribute.createMappedAttribute("requestee"); //$NON-NLS-1$ - child.getMetaData().defaults().setType(TaskAttribute.TYPE_SHORT_TEXT); - mapper.setValue(child, getRequestee()); - } - if (getSetter() != null) { - TaskAttribute child = taskAttribute.createMappedAttribute("setter"); //$NON-NLS-1$ - child.getMetaData().defaults().setType(TaskAttribute.TYPE_SHORT_TEXT); - mapper.setValue(child, getSetter()); - } - if (getState() != null) { - TaskAttribute child = taskAttribute.createMappedAttribute("state"); //$NON-NLS-1$ - child.getMetaData().defaults().setType(TaskAttribute.TYPE_SINGLE_SELECT); - child.getMetaData().setLabel(flagId); - child.getMetaData().setReadOnly(false); - mapper.setValue(child, getState()); - taskAttribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, "state"); //$NON-NLS-1$ - - } - } - -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java deleted file mode 100644 index c0e6cd62d..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Frank Becker 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: - * Frank Becker - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * Class describing the html response of Bugzilla requests which are used within Mylyn. - * - * Strings should be in the language which is the default for an Bugzilla instance. - * - * @author Frank Becker - */ - -public class BugzillaLanguageSettings { - private String languageName = "<unknown>"; //$NON-NLS-1$ - - public static final String COMMAND_ERROR_LOGIN = "error_login"; //$NON-NLS-1$ - - public static final String COMMAND_ERROR_COLLISION = "error_collision"; //$NON-NLS-1$ - - public static final String COMMAND_ERROR_COMMENT_REQUIRED = "error_comment_required"; //$NON-NLS-1$ - - public static final String COMMAND_ERROR_LOGGED_OUT = "error_logged_out"; //$NON-NLS-1$ - - public static final String COMMAND_BAD_LOGIN = "bad_login"; //$NON-NLS-1$ - - public static final String COMMAND_PROCESSED = "processed"; //$NON-NLS-1$ - - public static final String COMMAND_CHANGES_SUBMITTED = "changes_submitted"; //$NON-NLS-1$ - - public static final String COMMAND_SUSPICIOUS_ACTION = "suspicious_action"; //$NON-NLS-1$ - - public static final String COMMAND_BUG = "bug"; //$NON-NLS-1$ - - public static final String COMMAND_SUBMITTED = "submitted"; //$NON-NLS-1$ - - private final Map<String, List<String>> languageAttributes = new LinkedHashMap<String, List<String>>(); - - public BugzillaLanguageSettings(String languageName) { - super(); - this.languageName = languageName; - } - - public String getLanguageName() { - return languageName; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((languageName == null) ? 0 : languageName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - BugzillaLanguageSettings other = (BugzillaLanguageSettings) obj; - if (languageName == null) { - if (other.languageName != null) { - return false; - } - } else if (!languageName.equals(other.languageName)) { - return false; - } - return true; - } - - public void setLanguageName(String languageName) { - this.languageName = languageName; - } - - public void addLanguageAttribute(String command, String response) { - List<String> commandList = languageAttributes.get(command); - if (commandList == null) { - commandList = new LinkedList<String>(); - languageAttributes.put(command.toLowerCase(), commandList); - } - commandList.add(response); - } - - public List<String> getResponseForCommand(String command) { - return languageAttributes.get(command); - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java deleted file mode 100644 index a3e681d5d..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; - -/** - * @author Rob Elves - * @since 3.0 - */ -public enum BugzillaOperation { - - none(Messages.BugzillaOperation_Leave_as_X_X), - - accept(Messages.BugzillaOperation_Accept_to_ASSIGNED), - - resolve(Messages.BugzillaOperation_Resolve_as, "resolutionInput", TaskAttribute.TYPE_SINGLE_SELECT), //$NON-NLS-1$ - - duplicate(Messages.BugzillaOperation_Duplicate_of, "dup_id", TaskAttribute.TYPE_TASK_DEPENDENCY), //$NON-NLS-1$ - - reassign(Messages.BugzillaOperation_Reassign_to, "reassignInput", TaskAttribute.TYPE_PERSON), //$NON-NLS-1$ - - reassignbycomponent(Messages.BugzillaOperation_Reassign_to_default_assignee), - - reopen(Messages.BugzillaOperation_Reopen_bug), - - verify(Messages.BugzillaOperation_Mark_as_VERIFIED), - - close(Messages.BugzillaOperation_Mark_as_CLOSED); - - private final String label; - - private final String inputId; - - private final String inputType; - - BugzillaOperation(String label) { - this(label, null, TaskAttribute.TYPE_SHORT_TEXT); - } - - BugzillaOperation(String label, String inputId, String type) { - this.label = label; - this.inputId = inputId; - this.inputType = type; - } - - public String getLabel() { - return label; - } - - public String getInputId() { - return inputId; - } - - public String getInputType() { - return inputType; - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java deleted file mode 100644 index 944ac42c5..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java +++ /dev/null @@ -1,545 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.text.MessageFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.mylyn.commons.core.StatusHandler; -import org.eclipse.mylyn.commons.net.Policy; -import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery; -import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.ITask; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler; -import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; -import org.eclipse.mylyn.tasks.core.data.TaskData; -import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; -import org.eclipse.mylyn.tasks.core.data.TaskMapper; -import org.eclipse.mylyn.tasks.core.data.TaskRelation; -import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession; - -/** - * @author Mik Kersten - * @author Rob Elves - */ -public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { - - private static final String BUG_ID = "&bug_id="; //$NON-NLS-1$ - - private static final String CHANGED_BUGS_CGI_ENDDATE = "&chfieldto=Now"; //$NON-NLS-1$ - - private static final String CHANGED_BUGS_CGI_QUERY = "/buglist.cgi?query_format=advanced&chfieldfrom="; //$NON-NLS-1$ - - private static final String CLIENT_LABEL = Messages.BugzillaRepositoryConnector_BUGZILLA_SUPPORTS_2_18_TO_3_0; - - private static final String COMMENT_FORMAT = "yyyy-MM-dd HH:mm"; //$NON-NLS-1$ - - private static final String DEADLINE_FORMAT = "yyyy-MM-dd"; //$NON-NLS-1$ - - private final BugzillaTaskAttachmentHandler attachmentHandler = new BugzillaTaskAttachmentHandler(this); - - private final BugzillaTaskDataHandler taskDataHandler = new BugzillaTaskDataHandler(this); - - protected BugzillaClientManager clientManager; - - protected static BugzillaLanguageSettings enSetting; - - protected final static Set<BugzillaLanguageSettings> languages = new LinkedHashSet<BugzillaLanguageSettings>(); - - @Override - public String getLabel() { - return CLIENT_LABEL; - } - - @Override - public AbstractTaskAttachmentHandler getTaskAttachmentHandler() { - return attachmentHandler; - } - - @Override - public String getConnectorKind() { - return BugzillaCorePlugin.CONNECTOR_KIND; - } - - @Override - public void updateTaskFromTaskData(TaskRepository repository, ITask task, TaskData taskData) { - TaskMapper scheme = new TaskMapper(taskData); - scheme.applyTo(task); - - task.setUrl(BugzillaClient.getBugUrlWithoutLogin(repository.getRepositoryUrl(), taskData.getTaskId())); - - boolean isComplete = false; - TaskAttribute attributeStatus = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - if (attributeStatus != null) { - isComplete = attributeStatus.getValue().equals(IBugzillaConstants.VALUE_STATUS_RESOLVED) - || attributeStatus.getValue().equals(IBugzillaConstants.VALUE_STATUS_CLOSED) - || attributeStatus.getValue().equals(IBugzillaConstants.VALUE_STATUS_VERIFIED); - } - - if (taskData.isPartial()) { - if (isComplete) { - if (task.getCompletionDate() == null) { - task.setCompletionDate(new Date(0)); - } - } else { - if (task.getCompletionDate() != null) { - task.setCompletionDate(null); - } - } - } else { - // Completion Date - if (isComplete) { - Date completionDate = null; - - List<TaskAttribute> taskComments = taskData.getAttributeMapper().getAttributesByType(taskData, - TaskAttribute.TYPE_COMMENT); - if (taskComments != null && taskComments.size() > 0) { - TaskAttribute lastComment = taskComments.get(taskComments.size() - 1); - if (lastComment != null) { - TaskAttribute attributeCommentDate = lastComment.getMappedAttribute(TaskAttribute.COMMENT_DATE); - if (attributeCommentDate != null) { - try { - completionDate = new SimpleDateFormat(COMMENT_FORMAT).parse(attributeCommentDate.getValue()); - } catch (ParseException e) { - // ignore - } - } - } - } - - if (completionDate == null) { - // Use last modified date - TaskAttribute attributeLastModified = taskData.getRoot().getMappedAttribute( - TaskAttribute.DATE_MODIFICATION); - if (attributeLastModified != null && attributeLastModified.getValue().length() > 0) { - completionDate = taskData.getAttributeMapper().getDateValue(attributeLastModified); - } - } - - if (completionDate == null) { - completionDate = new Date(); - } - - task.setCompletionDate(completionDate); - } else { - task.setCompletionDate(null); - } - - // Bugzilla Specific Attributes - - // Product - if (scheme.getProduct() != null) { - task.setAttribute(TaskAttribute.PRODUCT, scheme.getProduct()); - } - - // Severity - TaskAttribute attrSeverity = taskData.getRoot().getMappedAttribute(BugzillaAttribute.BUG_SEVERITY.getKey()); - if (attrSeverity != null && !attrSeverity.getValue().equals("")) { //$NON-NLS-1$ - task.setAttribute(BugzillaAttribute.BUG_SEVERITY.getKey(), attrSeverity.getValue()); - } - - // Due Date - if (taskData.getRoot().getMappedAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()) != null) { - Date dueDate = null; - // HACK: if estimated_time field exists, time tracking is - // enabled - try { - TaskAttribute attributeDeadline = taskData.getRoot().getMappedAttribute( - BugzillaAttribute.DEADLINE.getKey()); - if (attributeDeadline != null) { - dueDate = new SimpleDateFormat(DEADLINE_FORMAT).parse(attributeDeadline.getValue()); - } - } catch (Exception e) { - // ignore - } - task.setDueDate(dueDate); - } - } - - updateExtendedAttributes(task, taskData); - } - - private void updateExtendedAttributes(ITask task, TaskData taskData) { - // Set meta bugzilla task attribute values - for (BugzillaAttribute bugzillaReportElement : BugzillaAttribute.EXTENDED_ATTRIBUTES) { - TaskAttribute taskAttribute = taskData.getRoot().getAttribute(bugzillaReportElement.getKey()); - if (taskAttribute != null) { - task.setAttribute(bugzillaReportElement.getKey(), taskAttribute.getValue()); - } - } - } - - @Override - public void preSynchronization(ISynchronizationSession session, IProgressMonitor monitor) throws CoreException { - TaskRepository repository = session.getTaskRepository(); - if (session.getTasks().isEmpty()) { - return; - } - - monitor = Policy.monitorFor(monitor); - try { - monitor.beginTask(Messages.BugzillaRepositoryConnector_checking_for_changed_tasks, session.getTasks() - .size()); - - if (repository.getSynchronizationTimeStamp() == null) { - for (ITask task : session.getTasks()) { - session.markStale(task); - } - return; - } - - String dateString = repository.getSynchronizationTimeStamp(); - if (dateString == null) { - dateString = ""; //$NON-NLS-1$ - } - - String urlQueryBase = repository.getRepositoryUrl() + CHANGED_BUGS_CGI_QUERY - + URLEncoder.encode(dateString, repository.getCharacterEncoding()) + CHANGED_BUGS_CGI_ENDDATE; - - String urlQueryString = urlQueryBase + BUG_ID; - - Set<ITask> changedTasks = new HashSet<ITask>(); - Iterator<ITask> itr = session.getTasks().iterator(); - int queryCounter = 0; - Set<ITask> checking = new HashSet<ITask>(); - while (itr.hasNext()) { - ITask task = itr.next(); - checking.add(task); - queryCounter++; - String newurlQueryString = URLEncoder.encode(task.getTaskId() + ",", repository.getCharacterEncoding()); //$NON-NLS-1$ - urlQueryString += newurlQueryString; - if (queryCounter >= 1000) { - queryForChanged(repository, changedTasks, urlQueryString, session, new SubProgressMonitor(monitor, - queryCounter)); - - queryCounter = 0; - urlQueryString = urlQueryBase + BUG_ID; - newurlQueryString = ""; //$NON-NLS-1$ - } - - if (!itr.hasNext() && queryCounter != 0) { - queryForChanged(repository, changedTasks, urlQueryString, session, new SubProgressMonitor(monitor, - queryCounter)); - } - } - - for (ITask task : session.getTasks()) { - if (changedTasks.contains(task)) { - session.markStale(task); - } - } - - } catch (UnsupportedEncodingException e) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - "Repository configured with unsupported encoding: " + repository.getCharacterEncoding() //$NON-NLS-1$ - + "\n\n Unable to determine changed tasks.", e)); //$NON-NLS-1$ - } finally { - monitor.done(); - } - } - - /** - * TODO: clean up use of BugzillaTaskDataCollector - */ - private void queryForChanged(final TaskRepository repository, Set<ITask> changedTasks, String urlQueryString, - ISynchronizationSession context, IProgressMonitor monitor) throws UnsupportedEncodingException, - CoreException { - - HashMap<String, ITask> taskById = new HashMap<String, ITask>(); - for (ITask task : context.getTasks()) { - taskById.put(task.getTaskId(), task); - } - final Set<TaskData> changedTaskData = new HashSet<TaskData>(); - TaskDataCollector collector = new TaskDataCollector() { - - @Override - public void accept(TaskData taskData) { - changedTaskData.add(taskData); - } - }; - - // TODO: Decouple from internals - IRepositoryQuery query = new RepositoryQuery(repository.getConnectorKind(), ""); //$NON-NLS-1$ - query.setSummary(Messages.BugzillaRepositoryConnector_Query_for_changed_tasks); - query.setUrl(urlQueryString); - performQuery(repository, query, collector, context, monitor); - - for (TaskData data : changedTaskData) { - ITask changedTask = taskById.get(data.getTaskId()); - if (changedTask != null) { - changedTasks.add(changedTask); - } - } - - } - - @Override - public boolean canCreateTaskFromKey(TaskRepository repository) { - return true; - } - - @Override - public boolean canCreateNewTask(TaskRepository repository) { - return true; - } - - @Override - public IStatus performQuery(TaskRepository repository, final IRepositoryQuery query, - TaskDataCollector resultCollector, ISynchronizationSession event, IProgressMonitor monitor) { - - monitor = Policy.monitorFor(monitor); - try { - monitor.beginTask(Messages.BugzillaRepositoryConnector_running_query, IProgressMonitor.UNKNOWN); - BugzillaClient client = getClientManager().getClient(repository, new SubProgressMonitor(monitor, 1)); - TaskAttributeMapper mapper = getTaskDataHandler().getAttributeMapper(repository); - boolean hitsReceived = client.getSearchHits(query, resultCollector, mapper, monitor); - if (!hitsReceived) { - // XXX: HACK in case of ip change bugzilla can return 0 hits - // due to invalid authorization token, forcing relogin fixes - client.logout(monitor); - client.getSearchHits(query, resultCollector, mapper, monitor); - } - - return Status.OK_STATUS; - } catch (UnrecognizedReponseException e) { - return new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, IStatus.INFO, - Messages.BugzillaRepositoryConnector_Unrecognized_response_from_server, e); - } catch (IOException e) { - return new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, IStatus.ERROR, MessageFormat.format( - Messages.BugzillaRepositoryConnector_Check_repository_configuration, e.getMessage()), e); - } catch (CoreException e) { - return e.getStatus(); - } finally { - monitor.done(); - } - } - - @Override - public String getRepositoryUrlFromTaskUrl(String url) { - if (url == null) { - return null; - } - int index = url.indexOf(IBugzillaConstants.URL_GET_SHOW_BUG); - return index == -1 ? null : url.substring(0, index); - } - - @Override - public String getTaskIdFromTaskUrl(String url) { - if (url == null) { - return null; - } - int anchorIndex = url.lastIndexOf("#"); //$NON-NLS-1$ - String bugUrl = url; - if (anchorIndex != -1) { - bugUrl = url.substring(0, anchorIndex); - } - - int index = bugUrl.indexOf(IBugzillaConstants.URL_GET_SHOW_BUG); - return index == -1 ? null : bugUrl.substring(index + IBugzillaConstants.URL_GET_SHOW_BUG.length()); - } - - @Override - public String getTaskUrl(String repositoryUrl, String taskId) { - try { - return BugzillaClient.getBugUrlWithoutLogin(repositoryUrl, taskId); - } catch (Exception e) { - StatusHandler.log(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - "Error constructing task url for " + repositoryUrl + " id:" + taskId, e)); //$NON-NLS-1$ //$NON-NLS-2$ - } - return null; - } - - @Override - public String getTaskIdPrefix() { - return "bug"; //$NON-NLS-1$ - } - - public BugzillaClientManager getClientManager() { - if (clientManager == null) { - clientManager = new BugzillaClientManager(); - // TODO: Move this initialization elsewhere - BugzillaCorePlugin.setConnector(this); - enSetting = new BugzillaLanguageSettings(IBugzillaConstants.DEFAULT_LANG); - enSetting.addLanguageAttribute("error_login", "Login"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("error_login", "log in"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("error_login", "check e-mail"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("error_login", "Invalid Username Or Password"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("error_collision", "Mid-air collision!"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("error_comment_required", "Comment Required"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("error_logged_out", "logged out"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("bad_login", "Login"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("bad_login", "log in"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("bad_login", "check e-mail"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("bad_login", "Invalid Username Or Password"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("bad_login", "error"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("processed", "processed"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("changes_submitted", "Changes submitted"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("changes_submitted", "added to Bug"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("bug", "Bug"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("bug", "Issue"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("submitted", "Submitted"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("submitted", "posted"); //$NON-NLS-1$ //$NON-NLS-2$ - enSetting.addLanguageAttribute("suspicious_action", "Suspicious action"); //$NON-NLS-1$ //$NON-NLS-2$ - languages.add(enSetting); - - } - return clientManager; - } - - @Override - public void updateRepositoryConfiguration(TaskRepository repository, IProgressMonitor monitor) throws CoreException { - if (repository != null) { - BugzillaCorePlugin.getRepositoryConfiguration(repository, true, monitor); - } - } - - @Override - public boolean isRepositoryConfigurationStale(TaskRepository repository, IProgressMonitor monitor) - throws CoreException { - if (super.isRepositoryConfigurationStale(repository, monitor)) { - boolean result = true; - BugzillaClient client = getClientManager().getClient(repository, monitor); - if (client != null) { - String timestamp = client.getConfigurationTimestamp(monitor); - if (timestamp != null) { - String oldTimestamp = repository.getProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP); - if (oldTimestamp != null) { - result = !timestamp.equals(oldTimestamp); - } - repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP, timestamp); - } - } - return result; - } - return false; - } - - public static void addLanguageSetting(BugzillaLanguageSettings language) { - if (!languages.contains(language)) { - BugzillaRepositoryConnector.languages.add(language); - } - } - - public static Set<BugzillaLanguageSettings> getLanguageSettings() { - return languages; - } - - /** returns default language if language not found */ - public static BugzillaLanguageSettings getLanguageSetting(String label) { - for (BugzillaLanguageSettings language : getLanguageSettings()) { - if (language.getLanguageName().equals(label)) { - return language; - } - } - return enSetting; - } - - @Override - public void postSynchronization(ISynchronizationSession event, IProgressMonitor monitor) throws CoreException { - try { - monitor.beginTask("", 1); //$NON-NLS-1$ - if (event.isFullSynchronization() && event.getStatus() == null) { - event.getTaskRepository().setSynchronizationTimeStamp(getSynchronizationTimestamp(event)); - } - } finally { - monitor.done(); - } - } - - @Override - public TaskData getTaskData(TaskRepository repository, String taskId, IProgressMonitor monitor) - throws CoreException { - return taskDataHandler.getTaskData(repository, taskId, monitor); - } - - @Override - public AbstractTaskDataHandler getTaskDataHandler() { - return taskDataHandler; - } - - @Override - public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData) { - if (taskData.isPartial() && task.getCreationDate() != null) { - return false; - } - - // Security token - // Updated on the task upon each open (synch) to keep the most current token available for submission - bug#263318 - TaskAttribute attrSecurityToken = taskData.getRoot().getMappedAttribute(BugzillaAttribute.TOKEN.getKey()); - if (attrSecurityToken != null && !attrSecurityToken.getValue().equals("")) { //$NON-NLS-1$ - task.setAttribute(BugzillaAttribute.TOKEN.getKey(), attrSecurityToken.getValue()); - } - - String lastKnownMod = task.getAttribute(BugzillaAttribute.DELTA_TS.getKey()); - if (lastKnownMod != null) { - TaskAttribute attrModification = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION); - if (attrModification != null) { - return !lastKnownMod.equals(attrModification.getValue()); - } - - } - return true; - } - - @Override - public Collection<TaskRelation> getTaskRelations(TaskData taskData) { - List<TaskRelation> relations = new ArrayList<TaskRelation>(); - TaskAttribute attribute = taskData.getRoot().getAttribute(BugzillaAttribute.DEPENDSON.getKey()); - if (attribute != null && attribute.getValue().length() > 0) { - for (String taskId : attribute.getValue().split(",")) { //$NON-NLS-1$ - relations.add(TaskRelation.subtask(taskId.trim())); - } - } - return relations; - } - - private String getSynchronizationTimestamp(ISynchronizationSession event) { - Date mostRecent = new Date(0); - String mostRecentTimeStamp = event.getTaskRepository().getSynchronizationTimeStamp(); - for (ITask task : event.getChangedTasks()) { - Date taskModifiedDate = task.getModificationDate(); - if (taskModifiedDate != null && taskModifiedDate.after(mostRecent)) { - mostRecent = taskModifiedDate; - mostRecentTimeStamp = task.getAttribute(BugzillaAttribute.DELTA_TS.getKey()); - } - } - return mostRecentTimeStamp; - } - - @Override - public boolean hasRepositoryDueDate(TaskRepository taskRepository, ITask task, TaskData taskData) { - return taskData.getRoot().getAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()) != null; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaStatus.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaStatus.java deleted file mode 100644 index 562b2cdba..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaStatus.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import org.eclipse.core.runtime.Status; -import org.eclipse.mylyn.tasks.core.RepositoryStatus; -import org.eclipse.osgi.util.NLS; - -/** - * @author Rob Elves - */ -public class BugzillaStatus extends Status { - - private final String errorMessage; - - private String repositoryUrl = ""; //$NON-NLS-1$ - - public BugzillaStatus(int severity, String pluginId, int code) { - super(severity, pluginId, code, "MylynStatus", null); //$NON-NLS-1$ - this.errorMessage = null; - } - - public BugzillaStatus(int severity, String pluginId, int code, String errorMessage) { - super(severity, pluginId, code, "MylynStatus", null); //$NON-NLS-1$ - this.errorMessage = errorMessage; - } - - public BugzillaStatus(int severity, String pluginId, int code, String repositoryUrl, Throwable e) { - super(severity, pluginId, code, "MylynStatus", e); //$NON-NLS-1$ - this.repositoryUrl = repositoryUrl; - this.errorMessage = e.getMessage(); - } - - public BugzillaStatus(int severity, String pluginId, int code, String repositoryUrl, String errorMessage) { - super(severity, pluginId, code, "MylynStatus", null); //$NON-NLS-1$ - this.errorMessage = errorMessage; - this.repositoryUrl = repositoryUrl; - } - - public BugzillaStatus(int severity, String pluginId, int code, String repositoryUrl, String errorMessage, - Throwable e) { - super(severity, pluginId, code, "MylynStatus", e); //$NON-NLS-1$ - this.errorMessage = errorMessage; - this.repositoryUrl = repositoryUrl; - } - - /** - * Returns the message that is relevant to the code of this status. - */ - @Override - public String getMessage() { - - switch (getCode()) { - case RepositoryStatus.ERROR_REPOSITORY_LOGIN: - return NLS.bind(Messages.BugzillaStatus_repositoryLoginFailure, this.getRepositoryUrl(), this.errorMessage); - case RepositoryStatus.ERROR_REPOSITORY_NOT_FOUND: - return NLS.bind(Messages.BugzillaStatus_repositoryNotFound, this.errorMessage); - case RepositoryStatus.ERROR_REPOSITORY: - return NLS.bind(Messages.BugzillaStatus_errorRepository, this.getRepositoryUrl(), this.errorMessage); - case RepositoryStatus.ERROR_IO: - String string1 = "Unknown IO error occurred"; //$NON-NLS-1$ - String string2 = "No message provided"; //$NON-NLS-1$ - if (getException() != null) { - string1 = getException().getClass().getSimpleName(); - string2 = getException().getMessage(); - } - Object[] strings = { getRepositoryUrl(), string1, string2 }; - return NLS.bind(Messages.BugzillaStatus_errorIo, strings); - case RepositoryStatus.ERROR_INTERNAL: - return NLS.bind(Messages.BugzillaStatus_errorInternal, this.errorMessage); - case RepositoryStatus.OPERATION_CANCELLED: - return NLS.bind(Messages.BugzillaStatus_operationCancelled, this.errorMessage); - case RepositoryStatus.REPOSITORY_COLLISION: - return NLS.bind(Messages.BugzillaStatus_repositoryCollision, this.errorMessage); - case RepositoryStatus.REPOSITORY_COMMENT_REQUIRED: - if (errorMessage == null) { - return Messages.BugzillaStatus_repositoryCommentRequired; - } else { - return errorMessage; - } - } - if (errorMessage != null) { - return errorMessage; - } else if (getException() != null) { - String message = getException().getMessage(); - if (message != null) { - return message; - } else { - return getException().toString(); - } - } - return "Unknown"; //$NON-NLS-1$ - } - - public String getRepositoryUrl() { - return repositoryUrl; - } - - public void setRepositoryUrl(String repositoryUrl) { - this.repositoryUrl = repositoryUrl; - } -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskAttachmentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskAttachmentHandler.java deleted file mode 100644 index 8c18538b2..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskAttachmentHandler.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.mylyn.tasks.core.ITask; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler; -import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource; -import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; - -/** - * @author Rob Elves - * @since 3.0 - */ -public class BugzillaTaskAttachmentHandler extends AbstractTaskAttachmentHandler { - - private final BugzillaRepositoryConnector connector; - - public BugzillaTaskAttachmentHandler(BugzillaRepositoryConnector connector) { - this.connector = connector; - } - - @Override - public boolean canGetContent(TaskRepository repository, ITask task) { - // ignore - return true; - } - - @Override - public boolean canPostContent(TaskRepository repository, ITask task) { - // ignore - return true; - } - - @Override - public InputStream getContent(TaskRepository repository, ITask task, TaskAttribute attachmentAttribute, - IProgressMonitor monitor) throws CoreException { - try { - monitor.beginTask(Messages.BugzillaTaskAttachmentHandler_Getting_attachment, IProgressMonitor.UNKNOWN); - TaskAttachmentMapper attachment = TaskAttachmentMapper.createFrom(attachmentAttribute); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - downloadAttachment(repository, task, attachment.getAttachmentId(), out, monitor); - return new ByteArrayInputStream(out.toByteArray()); - } finally { - monitor.done(); - } - } - - @Override - public void postContent(TaskRepository repository, ITask task, AbstractTaskAttachmentSource source, String comment, - TaskAttribute attachmentAttribute, IProgressMonitor monitor) throws CoreException { - try { - monitor.beginTask(Messages.BugzillaTaskAttachmentHandler_Sending_attachment, IProgressMonitor.UNKNOWN); - BugzillaClient client = connector.getClientManager().getClient(repository, - new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); - - client.postAttachment(task.getTaskId(), comment, source, attachmentAttribute, monitor); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - Messages.BugzillaTaskAttachmentHandler_unable_to_submit_attachment, e)); - } finally { - monitor.done(); - } - - } - - private void downloadAttachment(TaskRepository repository, ITask task, String attachmentId, OutputStream out, - IProgressMonitor monitor) throws CoreException { - BugzillaClient client; - try { - client = connector.getClientManager().getClient(repository, - new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); - client.getAttachmentData(attachmentId, out, monitor); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - "Unable to retrieve attachment", e)); //$NON-NLS-1$ - } - } - -} diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java deleted file mode 100644 index 0e5b29e8d..000000000 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java +++ /dev/null @@ -1,610 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.core; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.mylyn.commons.net.AuthenticationCredentials; -import org.eclipse.mylyn.commons.net.AuthenticationType; -import org.eclipse.mylyn.commons.net.Policy; -import org.eclipse.mylyn.tasks.core.ITask; -import org.eclipse.mylyn.tasks.core.ITaskMapping; -import org.eclipse.mylyn.tasks.core.RepositoryResponse; -import org.eclipse.mylyn.tasks.core.RepositoryStatus; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; -import org.eclipse.mylyn.tasks.core.data.TaskData; -import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; -import org.eclipse.mylyn.tasks.core.data.TaskMapper; - -/** - * @author Mik Kersten - * @author Rob Elves - */ -public class BugzillaTaskDataHandler extends AbstractTaskDataHandler { - - private enum TaskDataVersion { - - VERSION_0(0f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - // ignore - } - }, - - VERSION_1_0(1.0f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - // 1: the value was stored in the attribute rather than the key - for (TaskAttribute attribute : new ArrayList<TaskAttribute>(data.getRoot().getAttributes().values())) { - if (attribute.getId().equals(BugzillaAttribute.DESC.getKey())) { - TaskAttribute attrLongDesc = createAttribute(data, BugzillaAttribute.LONG_DESC); - attrLongDesc.setValue(attribute.getValue()); - data.getRoot().removeAttribute(BugzillaAttribute.DESC.getKey()); - } - } - // Old actions not saved so recreate them upon migration - // delete legacy operations: - Set<TaskAttribute> operationsToRemove = new HashSet<TaskAttribute>(); - for (TaskAttribute attribute : data.getAttributeMapper().getAttributesByType(data, - TaskAttribute.TYPE_OPERATION)) { - operationsToRemove.add(attribute); - } - for (TaskAttribute taskAttribute : operationsToRemove) { - data.getRoot().removeAttribute(taskAttribute.getId()); - } - RepositoryConfiguration configuration = BugzillaCorePlugin.getRepositoryConfiguration(repository.getRepositoryUrl()); - if (configuration != null) { - configuration.addValidOperations(data); - } - } - }, - VERSION_2_0(2.0f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - updateAttribute(data, BugzillaAttribute.LONG_DESC); - } - }, - VERSION_3_0(3.0f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - updateAttribute(data, BugzillaAttribute.NEW_COMMENT); - } - }, - VERSION_4_0(4.0f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - updateAttribute(data, BugzillaAttribute.DEADLINE); - updateAttribute(data, BugzillaAttribute.ACTUAL_TIME); - } - }, - VERSION_4_1(4.1f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - updateAttribute(data, BugzillaAttribute.VOTES); - TaskAttribute attrDeadline = data.getRoot().getMappedAttribute(BugzillaAttribute.VOTES.getKey()); - if (attrDeadline != null) { - attrDeadline.getMetaData().setType(BugzillaAttribute.VOTES.getType()); - } - } - }, - VERSION_4_2(4.2f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - updateAttribute(data, BugzillaAttribute.CC); - updateAttribute(data, BugzillaAttribute.DEPENDSON); - updateAttribute(data, BugzillaAttribute.BLOCKED); - updateAttribute(data, BugzillaAttribute.BUG_FILE_LOC); - updateAttribute(data, BugzillaAttribute.KEYWORDS); - updateAttribute(data, BugzillaAttribute.STATUS_WHITEBOARD); - updateAttribute(data, BugzillaAttribute.QA_CONTACT); - updateAttribute(data, BugzillaAttribute.NEWCC); - } - }, - VERSION_4_3(4.3f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - // migrate custom attributes - for (TaskAttribute attribute : data.getRoot().getAttributes().values()) { - if (attribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { - attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT); - attribute.getMetaData().setReadOnly(false); - if (attribute.getOptions().size() > 0) { - attribute.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); - } else { - attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); - } - } - } - } - }, - VERSION_4_4(4.4f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - // summary didn't have spell checking, update to short rich text - updateAttribute(data, BugzillaAttribute.SHORT_DESC); - } - }, - VERSION_4_5(4.5f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - // migrate custom attributes - RepositoryConfiguration configuration = BugzillaCorePlugin.getRepositoryConfiguration(repository.getRepositoryUrl()); - - if (configuration == null) { - return; - } - - for (TaskAttribute attribute : data.getRoot().getAttributes().values()) { - if (attribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { - - BugzillaCustomField customField = null; - String actName = attribute.getId(); - for (BugzillaCustomField bugzillaCustomField : configuration.getCustomFields()) { - if (actName.equals(bugzillaCustomField.getName())) { - customField = bugzillaCustomField; - break; - } - } - if (customField != null) { - String desc = customField.getDescription(); - attribute.getMetaData().defaults().setLabel(desc).setReadOnly(false); - attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT); - attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); - switch (customField.getType()) { - case 1: // Free Text - attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); - break; - case 2: // Drop Down - attribute.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); - break; - case 3: // Multiple-Selection Box - attribute.getMetaData().setType(TaskAttribute.TYPE_MULTI_SELECT); - break; - case 4: // Large Text Box - attribute.getMetaData().setType(TaskAttribute.TYPE_LONG_TEXT); - break; - case 5: // Date/Time - attribute.getMetaData().setType(TaskAttribute.TYPE_DATETIME); - break; - - default: - List<String> options = customField.getOptions(); - if (options.size() > 0) { - attribute.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); - } else { - attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); - } - } - attribute.getMetaData().setReadOnly(false); - } - } - } - } - }, - VERSION_CURRENT(4.6f) { - @Override - void migrate(TaskRepository repository, TaskData data) { - data.setVersion(TaskDataVersion.VERSION_CURRENT.toString()); - } - }; - - private float versionNumber = 0; - - TaskDataVersion(float verNum) { - versionNumber = verNum; - } - - public float getVersionNum() { - return versionNumber; - } - - abstract void migrate(TaskRepository repository, TaskData data); - - @Override - public String toString() { - return "" + getVersionNum(); //$NON-NLS-1$ - } - - private static void updateAttribute(TaskData data, BugzillaAttribute bugAttribute) { - TaskAttribute attribute = data.getRoot().getMappedAttribute(bugAttribute.getKey()); - if (attribute != null) { - attribute.getMetaData().setType(bugAttribute.getType()); - attribute.getMetaData().setReadOnly(bugAttribute.isReadOnly()); - attribute.getMetaData().setKind(bugAttribute.getKind()); - } - } - } - - private final BugzillaRepositoryConnector connector; - - public BugzillaTaskDataHandler(BugzillaRepositoryConnector connector) { - this.connector = connector; - } - - public TaskData getTaskData(TaskRepository repository, String taskId, IProgressMonitor monitor) - throws CoreException { - - Set<String> taskIds = new HashSet<String>(); - taskIds.add(taskId); - final TaskData[] retrievedData = new TaskData[1]; - TaskDataCollector collector = new TaskDataCollector() { - - @Override - public void accept(TaskData taskData) { - retrievedData[0] = taskData; - } - }; - getMultiTaskData(repository, taskIds, collector, monitor); - - if (retrievedData[0] == null) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - "Task data could not be retrieved. Please re-synchronize task")); //$NON-NLS-1$ - } - return retrievedData[0]; - -// monitor = Policy.monitorFor(monitor); -// try { -// monitor.beginTask("Receiving task", IProgressMonitor.UNKNOWN); -// BugzillaClient client = connector.getClientManager().getClient(repository, monitor); -// int bugId = BugzillaRepositoryConnector.getBugId(taskId); -// TaskData taskData = client.getTaskData(bugId, getAttributeMapper(repository), monitor); -// if (taskData == null) { -// throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, -// "Task data could not be retrieved. Please re-synchronize task")); -// } -// return taskData; -// } catch (IOException e) { -// throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, -// RepositoryStatus.ERROR_IO, repository.getRepositoryUrl(), e)); -// } finally { -// monitor.done(); -// } - } - - @Override - public void getMultiTaskData(final TaskRepository repository, Set<String> taskIds, - final TaskDataCollector collector, IProgressMonitor monitor) throws CoreException { - - monitor = Policy.monitorFor(monitor); - - try { - monitor.beginTask(Messages.BugzillaTaskDataHandler_Receiving_tasks, taskIds.size()); - BugzillaClient client = connector.getClientManager().getClient(repository, monitor); - final CoreException[] collectionException = new CoreException[1]; - - class CollectorWrapper extends TaskDataCollector { - - private final IProgressMonitor monitor2; - - private final TaskDataCollector collector; - - public CollectorWrapper(TaskDataCollector collector, IProgressMonitor monitor2) { - this.collector = collector; - this.monitor2 = monitor2; - } - - @Override - public void accept(TaskData taskData) { - try { - initializeTaskData(repository, taskData, null, new SubProgressMonitor(monitor2, 1)); - } catch (CoreException e) { - if (collectionException[0] == null) { - collectionException[0] = e; - } - } - collector.accept(taskData); - monitor2.worked(1); - } - } - - TaskDataCollector collector2 = new CollectorWrapper(collector, monitor); - - client.getTaskData(taskIds, collector2, getAttributeMapper(repository), monitor); - - if (collectionException[0] != null) { - throw collectionException[0]; - } - } catch (IOException e) { - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_IO, repository.getRepositoryUrl(), e)); - } finally { - monitor.done(); - } - } - - @Override - public void migrateTaskData(TaskRepository taskRepository, TaskData taskData) { - - float bugzillaTaskDataVersion = 0; - { - String taskDataVersion = taskData.getVersion(); - if (taskDataVersion != null) { - try { - bugzillaTaskDataVersion = Float.parseFloat(taskDataVersion); - } catch (NumberFormatException e) { - bugzillaTaskDataVersion = 0; - } - } - } - - for (TaskDataVersion version : TaskDataVersion.values()) { - if (bugzillaTaskDataVersion <= version.getVersionNum()) { - version.migrate(taskRepository, taskData); - } - } - } - - @Override - public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, - Set<TaskAttribute> changedAttributes, IProgressMonitor monitor) throws CoreException { - monitor = Policy.monitorFor(monitor); - try { - monitor.beginTask(Messages.BugzillaTaskDataHandler_Submitting_task, IProgressMonitor.UNKNOWN); - BugzillaClient client = connector.getClientManager().getClient(repository, monitor); - try { - return client.postTaskData(taskData, monitor); - } catch (CoreException e) { - // TODO: Move retry handling into client - if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) { - return client.postTaskData(taskData, monitor); - } else if (e.getStatus().getCode() == IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION) { - taskData.getRoot().removeAttribute(BugzillaAttribute.TOKEN.getKey()); - return client.postTaskData(taskData, monitor); - } else { - throw e; - } - } - } catch (IOException e) { - throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_IO, repository.getRepositoryUrl(), e)); - } finally { - monitor.done(); - } - } - - @Override - public boolean initializeTaskData(TaskRepository repository, TaskData taskData, ITaskMapping initializationData, - IProgressMonitor monitor) throws CoreException { - - // Note: setting current version to latest assumes the data arriving here is either for a new task or is - // fresh from the repository (not locally stored data that may not have been migrated). - taskData.setVersion(TaskDataVersion.VERSION_CURRENT.toString()); - - RepositoryConfiguration repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(repository, - false, monitor); - - if (repositoryConfiguration == null) { - return false; - } - - if (taskData.isNew()) { - String product = null; - if (initializationData == null || initializationData.getProduct() == null) { - if (repositoryConfiguration.getProducts().size() > 0) { - |