Merge remote-tracking branch 'upstream/master'

Conflicts:
	src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java
This commit is contained in:
Jani Halinen 2014-05-30 00:07:01 +03:00
commit 50078f449e
28 changed files with 363 additions and 761 deletions

View file

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="2">
<profile kind="CleanUpProfile" name="ROME" version="2">
<setting id="cleanup.remove_unused_private_fields" value="true"/>
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.never_use_blocks" value="false"/>
<setting id="cleanup.remove_unused_private_methods" value="true"/>
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
<setting id="cleanup.convert_to_enhanced_for_loop" value="true"/>
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
<setting id="cleanup.sort_members" value="false"/>
<setting id="cleanup.remove_unused_local_variables" value="false"/>
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.remove_unused_private_members" value="false"/>
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
<setting id="cleanup.make_parameters_final" value="true"/>
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
<setting id="cleanup.remove_private_constructors" value="true"/>
<setting id="cleanup.use_blocks" value="true"/>
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
<setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/>
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/>
<setting id="cleanup.add_default_serial_version_id" value="true"/>
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
<setting id="cleanup.make_variable_declarations_final" value="true"/>
<setting id="cleanup.add_missing_nls_tags" value="false"/>
<setting id="cleanup.format_source_code" value="true"/>
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_missing_override_annotations" value="true"/>
<setting id="cleanup.remove_unused_private_types" value="true"/>
<setting id="cleanup.add_missing_methods" value="false"/>
<setting id="cleanup.make_local_variable_final" value="true"/>
<setting id="cleanup.correct_indentation" value="true"/>
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
<setting id="cleanup.remove_unused_imports" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
<setting id="cleanup.make_private_fields_final" value="true"/>
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
<setting id="cleanup.organize_imports" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
<setting id="cleanup.sort_members_all" value="false"/>
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
<setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
<setting id="cleanup.add_serial_version_id" value="false"/>
<setting id="cleanup.format_source_code_changes_only" value="false"/>
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
<setting id="cleanup.always_use_blocks" value="true"/>
</profile>
</profiles>

View file

@ -1,291 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="ROME" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="160"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
</profile>
</profiles>

264
pom.xml
View file

@ -1,207 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.rometools</groupId>
<artifactId>rome-fetcher</artifactId>
<version>2.0.0-SNAPSHOT</version>
<parent>
<groupId>com.rometools</groupId>
<artifactId>rome-parent</artifactId>
<version>1.5.0-SNAPSHOT</version>
</parent>
<name>rome-fetcher</name>
<artifactId>rome-fetcher</artifactId>
<packaging>jar</packaging>
<description>A well behaved feed fetcher API for ROME</description>
<name>rome-fetcher</name>
<inceptionYear>2004</inceptionYear>
<description>A well behaved feed fetcher API for ROME</description>
<url>http://rometools.github.io/rome-fetcher/</url>
<url>http://rometools.github.io/rome-fetcher/</url>
<organization>
<name>ROME Project</name>
<url>https://github.com/rometools/</url>
</organization>
<scm>
<connection>scm:git:git@github.com:rometools/rome-fetcher.git</connection>
<developerConnection>scm:git:git@github.com:rometools/rome-fetcher.git</developerConnection>
<url>https://github.com/rometools/rome-fetcher/</url>
</scm>
<issueManagement>
<url>https://github.com/rometools/rome-fetcher/issues</url>
</issueManagement>
<scm>
<connection>scm:git:git@github.com:rometools/rome-fetcher.git</connection>
<developerConnection>scm:git:git@github.com:rometools/rome-fetcher.git</developerConnection>
<url>https://github.com/rometools/rome-fetcher/</url>
</scm>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>kebernet</id>
<name>Robert Cooper</name>
<email>kebernet@gmail.comM</email>
</developer>
<developer>
<name>Nick Lothian</name>
<url>http://nicklothian.com</url>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<distributionManagement>
<repository>
<id>central.staging</id>
<url>http://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
<snapshotRepository>
<id>sonatype.snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<developers>
<developer>
<name>Nick Lothian</name>
<url>http://nicklothian.com</url>
</developer>
<developer>
<name>Robert Cooper</name>
<email>kebernet@gmail.comM</email>
</developer>
</developers>
<repositories>
<repository>
<id>sonatype.snapshots</id>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>1.0-beta-2</version>
<configuration>
<scmBranch>gh-pages</scmBranch>
<pubScmUrl>scm:git:git@github.com:rometools/rome-fetcher.git</pubScmUrl>
<content>${project.build.directory}/site</content>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<configuration>
<scmBranch>gh-pages</scmBranch>
<pubScmUrl>${project.scm.developerConnection}</pubScmUrl>
<content>${project.build.directory}/site</content>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<reportSets>
<reportSet>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
<reportSet>
<id>aggregate</id>
<inherited>false</inherited>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<optional />
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
<optional />
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>1.1</version>
<optional />
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jetty</groupId>
<artifactId>jetty</artifactId>
<version>4.2.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<optional />
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jetty</groupId>
<artifactId>jetty</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.fetcher;
package com.rometools.fetcher;
import java.io.IOException;
import java.net.URL;
@ -25,13 +25,15 @@ import com.sun.syndication.io.FeedException;
public interface FeedFetcher {
/**
* <p>
* The default user agent. It is not marked final so buggy java compiler will not write this string into all classes that reference it.
* The default user agent. It is not marked final so buggy java compiler will not write this
* string into all classes that reference it.
* </p>
*
*
* <p>
* http://tinyurl.com/64t5n points to https://rome.dev.java.net Some servers ban user agents with "Java" in the name.
* http://tinyurl.com/64t5n points to https://rome.dev.java.net Some servers ban user agents
* with "Java" in the name.
* </p>
*
*
*/
public static String DEFAULT_USER_AGENT = "Rome Client (http://tinyurl.com/64t5n)";
@ -49,15 +51,16 @@ public interface FeedFetcher {
* <p>
* Turn on or off rfc3229 delta encoding
* </p>
*
*
* <p>
* See http://www.ietf.org/rfc/rfc3229.txt and http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html
* See http://www.ietf.org/rfc/rfc3229.txt and
* http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html
* </p>
*
*
* <p>
* NOTE: This is experimental and feedback is welcome!
* </p>
*
*
* @param useDeltaEncoding
*/
public abstract void setUsingDeltaEncoding(boolean useDeltaEncoding);
@ -66,7 +69,7 @@ public interface FeedFetcher {
* <p>
* Is this fetcher using rfc3229 delta encoding?
* </p>
*
*
* @return
*/
public abstract boolean isUsingDeltaEncoding();
@ -75,11 +78,12 @@ public interface FeedFetcher {
* <p>
* Add a FetcherListener.
* </p>
*
*
* <p>
* The FetcherListener will receive an FetcherEvent when a Fetcher event (feed polled, retrieved, etc) occurs
* The FetcherListener will receive an FetcherEvent when a Fetcher event (feed polled,
* retrieved, etc) occurs
* </p>
*
*
* @param listener The FetcherListener to recieve the event
*/
public abstract void addFetcherEventListener(FetcherListener listener);
@ -88,14 +92,14 @@ public interface FeedFetcher {
* <p>
* Remove a FetcherListener
* </p>
*
*
* @param listener The FetcherListener to remove
*/
public abstract void removeFetcherEventListener(FetcherListener listener);
/**
* Retrieve a feed over HTTP
*
*
* @param feedUrl A non-null URL of a RSS/Atom feed to retrieve
* @return A {@link com.sun.syndication.feed.synd.SyndFeed} object
* @throws IllegalArgumentException if the URL is null;
@ -108,8 +112,9 @@ public interface FeedFetcher {
public SyndFeed retrieveFeed(String userAgent, URL url) throws IllegalArgumentException, IOException, FeedException, FetcherException;
/**
* If set to true, the WireFeed will be made accessible from the SyndFeed object returned from the Fetcher via the originalWireFeed() method. Each Entry in
* the feed will have the corresponding wireEntry property set.
* If set to true, the WireFeed will be made accessible from the SyndFeed object returned from
* the Fetcher via the originalWireFeed() method. Each Entry in the feed will have the
* corresponding wireEntry property set.
*/
void setPreserveWireFeed(boolean preserveWireFeed);
}

View file

@ -1,18 +1,19 @@
package org.rometools.fetcher;
package com.rometools.fetcher;
import java.util.EventObject;
import com.sun.syndication.feed.synd.SyndFeed;
/**
* Implementation note: FetcherEvent is not thread safe. Make sure that they are only ever accessed by one thread. If necessary, make all getters and setters
* synchronized, or alternatively make all fields final.
*
* Implementation note: FetcherEvent is not thread safe. Make sure that they are only ever accessed
* by one thread. If necessary, make all getters and setters synchronized, or alternatively make all
* fields final.
*
* @author nl
*/
public class FetcherEvent extends EventObject {
private static final long serialVersionUID = 3985600601904140103L;
private static final long serialVersionUID = 1L;
public static final String EVENT_TYPE_FEED_POLLED = "FEED_POLLED";
public static final String EVENT_TYPE_FEED_RETRIEVED = "FEED_RETRIEVED";
@ -39,7 +40,7 @@ public class FetcherEvent extends EventObject {
/**
* @return Returns the feed.
*
*
* <p>
* The feed will only be set if the eventType is EVENT_TYPE_FEED_RETRIEVED
* </p>
@ -50,7 +51,7 @@ public class FetcherEvent extends EventObject {
/**
* @param feed The feed to set.
*
*
* <p>
* The feed will only be set if the eventType is EVENT_TYPE_FEED_RETRIEVED
* </p>

View file

@ -14,14 +14,14 @@
* limitations under the License.
*
*/
package org.rometools.fetcher;
package com.rometools.fetcher;
/**
* @author Nick Lothian
*
*
*/
public class FetcherException extends Exception {
private static final long serialVersionUID = -7479645796948092380L;
private static final long serialVersionUID = 1L;
int responseCode;

View file

@ -1,4 +1,4 @@
package org.rometools.fetcher;
package com.rometools.fetcher;
import java.util.EventListener;
@ -8,7 +8,7 @@ public interface FetcherListener extends EventListener {
* <p>
* Called when a fetcher event occurs
* </p>
*
*
* @param event the event that fired
*/
public void fetcherEvent(FetcherEvent event);

View file

@ -15,25 +15,29 @@
*
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLConnection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import org.rometools.fetcher.FeedFetcher;
import org.rometools.fetcher.FetcherEvent;
import org.rometools.fetcher.FetcherException;
import org.rometools.fetcher.FetcherListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
import com.rometools.fetcher.FetcherListener;
import com.sun.syndication.feed.synd.SyndFeed;
public abstract class AbstractFeedFetcher implements FeedFetcher {
private static final Logger LOG = LoggerFactory.getLogger(AbstractFeedFetcher.class);
private final Set<FetcherListener> fetcherEventListeners;
private String userAgent;
private boolean usingDeltaEncoding;
@ -55,11 +59,11 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
System.getProperties().putAll(props);
inputStream.close();
} else {
System.err.println("Could not find " + resourceName + " on classpath");
LOG.warn("Could not find {} on classpath", resourceName);
}
} catch (final IOException e) {
// do nothing - we don't want to fail just because we could not find the version
System.err.println("Error reading " + resourceName + " from classpath: " + e.getMessage());
LOG.error("Error reading {} from classpath: {}", resourceName, e.getMessage());
}
setUserAgent(DEFAULT_USER_AGENT + " Ver: " + System.getProperty("rome.fetcher.version", "UNKNOWN"));
@ -114,28 +118,19 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
protected void fireEvent(final String eventType, final String urlStr, final SyndFeed feed) {
final FetcherEvent fetcherEvent = new FetcherEvent(this, urlStr, eventType, feed);
synchronized (fetcherEventListeners) {
final Iterator<FetcherListener> iter = fetcherEventListeners.iterator();
while (iter.hasNext()) {
final FetcherListener fetcherEventListener = iter.next();
for (final FetcherListener fetcherEventListener : fetcherEventListeners) {
fetcherEventListener.fetcherEvent(fetcherEvent);
}
}
}
/**
* @see com.sun.syndication.fetcher.FeedFetcher#addFetcherEventListener(com.sun.syndication.fetcher.FetcherListener)
*/
@Override
public void addFetcherEventListener(final FetcherListener listener) {
if (listener != null) {
fetcherEventListeners.add(listener);
}
}
/**
* @see com.sun.syndication.fetcher.FeedFetcher#removeFetcherEventListener(com.sun.syndication.fetcher.FetcherListener)
*/
@Override
public void removeFetcherEventListener(final FetcherListener listener) {
if (listener != null) {
@ -163,7 +158,7 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
* <p>
* Handles HTTP error codes.
* </p>
*
*
* @param responseCode the HTTP response code
* @throws FetcherException if response code is in the range 400 to 599 inclusive
*/
@ -192,11 +187,12 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
* <p>
* Combine the entries in two feeds into a single feed.
* </p>
*
*
* <p>
* The returned feed will have the same data as the newFeed parameter, with the entries from originalFeed appended to the end of its entries.
* The returned feed will have the same data as the newFeed parameter, with the entries from
* originalFeed appended to the end of its entries.
* </p>
*
*
* @param originalFeed
* @param newFeed
* @return
@ -205,9 +201,7 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
SyndFeed result;
try {
result = (SyndFeed) newFeed.clone();
result.getEntries().addAll(result.getEntries().size(), originalFeed.getEntries());
return result;
} catch (final CloneNotSupportedException e) {
final IllegalArgumentException iae = new IllegalArgumentException("Cannot clone feed");

View file

@ -1,18 +1,20 @@
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.beans.EventSetDescriptor;
import java.beans.SimpleBeanInfo;
import java.lang.reflect.Method;
import org.rometools.fetcher.FetcherEvent;
import org.rometools.fetcher.FetcherListener;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherListener;
public class AbstractFeedFetcherBeanInfo extends SimpleBeanInfo {
@Override
public EventSetDescriptor[] getEventSetDescriptors() {
try {
final Class<AbstractFeedFetcher> clz = AbstractFeedFetcher.class; // get the class object which we'll describe
final Class<AbstractFeedFetcher> clz = AbstractFeedFetcher.class; // get the class
// object which we'll
// describe
final Method addMethod = clz.getMethod("addFetcherEventListener", new Class[] { FetcherListener.class });
final Method removeMethod = clz.getMethod("removeFetcherEventListener", new Class[] { FetcherListener.class });
final Method listenerMethod = FetcherListener.class.getMethod("fetcherEvent", new Class[] { FetcherEvent.class });
@ -20,7 +22,8 @@ public class AbstractFeedFetcherBeanInfo extends SimpleBeanInfo {
final EventSetDescriptor[] results = new EventSetDescriptor[] { est };
return results;
} catch (final Exception e) {
// IntrospectionException, SecurityException and/or NoSuchMethodException can be thrown here
// IntrospectionException, SecurityException and/or NoSuchMethodException can be thrown
// here
// the best we can do is to convert them to runtime exceptions
throw new RuntimeException(e);
}

View file

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.io.File;
import java.io.FileInputStream;
@ -121,27 +121,28 @@ public class DiskFeedInfoCache implements FeedFetcherCache {
@Override
public SyndFeedInfo remove(final URL url) {
SyndFeedInfo info = null;
final String fileName = cachePath + File.separator + "feed_" + replaceNonAlphanumeric(url.toString(), '_').trim();
FileInputStream fis = null;
ObjectInputStream ois = null;
boolean consumed = false;
try {
fis = new FileInputStream(fileName);
ois = new ObjectInputStream(fis);
info = (SyndFeedInfo) ois.readObject();
consumed = true;
final File file = new File(fileName);
if (file.exists()) {
file.delete();
}
} catch (final FileNotFoundException fnfe) {
} catch (final FileNotFoundException e) {
// That's OK, we'l return null
} catch (final ClassNotFoundException cnfe) {
// Error writing to cahce is fatal
throw new RuntimeException("Attempting to read from cache", cnfe);
} catch (final IOException fnfe) {
// Error writing to cahce is fatal
throw new RuntimeException("Attempting to read from cache", fnfe);
} catch (final ClassNotFoundException e) {
// Error writing to cache is fatal
throw new RuntimeException("Attempting to read from cache", e);
} catch (final IOException e) {
// Error writing to cache is fatal
throw new RuntimeException("Attempting to read from cache", e);
} finally {
if (fis != null) {
try {
@ -155,7 +156,15 @@ public class DiskFeedInfoCache implements FeedFetcherCache {
} catch (final IOException e) {
}
}
if (consumed) {
final File file = new File(fileName);
if (file.exists()) {
file.delete();
}
}
}
return info;
}
}

View file

@ -14,23 +14,23 @@
* limitations under the License.
*
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.net.URL;
/**
* <p>
* An interface to allow caching of feed details. Implementing this allows the {@link org.rometools.fetcher.io.HttpURLFeedFetcher} class to enable conditional
* gets
* An interface to allow caching of feed details. Implementing this allows the
* {@link com.rometools.fetcher.io.HttpURLFeedFetcher} class to enable conditional gets
* </p>
*
*
* @author Nick Lothian
*
*
*/
public interface FeedFetcherCache {
/**
* Get a SyndFeedInfo object from the cache.
*
*
* @param feedUrl The url of the feed
* @return A SyndFeedInfo or null if it is not in the cache
*/
@ -38,7 +38,7 @@ public interface FeedFetcherCache {
/**
* Add a SyndFeedInfo object to the cache
*
*
* @param feedUrl The url of the feed
* @param syndFeedInfo A SyndFeedInfo for the feed
*/
@ -51,7 +51,7 @@ public interface FeedFetcherCache {
/**
* Removes the SyndFeedInfo identified by the url from the cache.
*
*
* @return The removed SyndFeedInfo
*/
public SyndFeedInfo remove(URL feedUrl);

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.io.Serializable;
import java.net.URL;
@ -24,19 +24,21 @@ import java.util.Map;
/**
* <p>
* A very simple implementation of the {@link org.rometools.fetcher.impl.FeedFetcherCache} interface.
* A very simple implementation of the {@link com.rometools.fetcher.impl.FeedFetcherCache}
* interface.
* </p>
*
*
* <p>
* This implementation uses a HashMap to cache retrieved feeds. This implementation is most suitible for sort term (client aggregator?) use, as the memory usage
* will increase over time as the number of feeds in the cache increases.
* This implementation uses a HashMap to cache retrieved feeds. This implementation is most suitible
* for sort term (client aggregator?) use, as the memory usage will increase over time as the number
* of feeds in the cache increases.
* </p>
*
*
* @author Nick Lothian
*
*
*/
public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
private static final long serialVersionUID = -1594665619950916222L;
private static final long serialVersionUID = 1L;
static HashMapFeedInfoCache _instance;
@ -46,11 +48,12 @@ public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
* <p>
* Constructor for HashMapFeedInfoCache
* </p>
*
*
* <p>
* Only use this if you want multiple instances of the cache. Usually getInstance() is more appropriate.
* Only use this if you want multiple instances of the cache. Usually getInstance() is more
* appropriate.
* </p>
*
*
*/
public HashMapFeedInfoCache() {
setInfoCache(createInfoCache());
@ -58,7 +61,7 @@ public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
/**
* Get the global instance of the cache
*
*
* @return an implementation of FeedFetcherCache
*/
public static synchronized FeedFetcherCache getInstance() {
@ -101,8 +104,9 @@ public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
}
/**
* The API of this class indicates that map must thread safe. In other words, be sure to wrap it in a synchronized map unless you know what you are doing.
*
* The API of this class indicates that map must thread safe. In other words, be sure to wrap it
* in a synchronized map unless you know what you are doing.
*
* @param map the map to use as the info cache.
*/
protected synchronized final void setInfoCache(final Map<String, SyndFeedInfo> map) {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.io.IOException;
import java.io.InputStream;
@ -29,12 +29,13 @@ import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.HttpMethodRetryHandler;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.rometools.fetcher.FetcherEvent;
import org.rometools.fetcher.FetcherException;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
@ -75,18 +76,20 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
}
/**
* @param timeout Sets the connect timeout for the HttpClient but using the URLConnection method name. Uses the HttpClientParams method
* setConnectionManagerTimeout instead of setConnectTimeout
*
* @param timeout Sets the connect timeout for the HttpClient but using the URLConnection method
* name. Uses the HttpClientParams method setConnectionManagerTimeout instead of
* setConnectTimeout
*
*/
public synchronized void setConnectTimeout(final int timeout) {
httpClientParams.setConnectionManagerTimeout(timeout);
}
/**
* @return The currently used connect timeout for the HttpClient but using the URLConnection method name. Uses the HttpClientParams method
* getConnectionManagerTimeout instead of getConnectTimeout
*
* @return The currently used connect timeout for the HttpClient but using the URLConnection
* method name. Uses the HttpClientParams method getConnectionManagerTimeout instead of
* getConnectTimeout
*
*/
public int getConnectTimeout() {
return (int) getHttpClientParams().getConnectionManagerTimeout();
@ -143,14 +146,16 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
}
/**
* @return The currently used read timeout for the URLConnection, 0 is unlimited, i.e. no timeout
* @return The currently used read timeout for the URLConnection, 0 is unlimited, i.e. no
* timeout
*/
public synchronized void setReadTimeout(final int timeout) {
httpClientParams.setSoTimeout(timeout);
}
/**
* @return timeout the read timeout for the URLConnection to a specified timeout, in milliseconds.
* @return timeout the read timeout for the URLConnection to a specified timeout, in
* milliseconds.
*/
public int getReadTimeout() {
return getHttpClientParams().getSoTimeout();
@ -162,27 +167,28 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
}
/**
* @see org.rometools.fetcher.FeedFetcher#retrieveFeed(java.net.URL)
* @see com.rometools.fetcher.FeedFetcher#retrieveFeed(java.net.URL)
*/
@Override
public SyndFeed retrieveFeed(final String userAgent, final URL feedUrl) throws IllegalArgumentException, IOException, FeedException, FetcherException {
if (feedUrl == null) {
throw new IllegalArgumentException("null is not a valid URL");
}
// TODO Fix this
// System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
final HttpClient client = new HttpClient(httpClientParams);
if (getCredentialSupplier() != null) {
client.getState().setAuthenticationPreemptive(true);
// TODO what should realm be here?
final Credentials credentials = getCredentialSupplier().getCredentials(null, feedUrl.getHost());
client.getParams().setAuthenticationPreemptive(true);
final String host = feedUrl.getHost();
final Credentials credentials = getCredentialSupplier().getCredentials(null, host);
if (credentials != null) {
client.getState().setCredentials(null, feedUrl.getHost(), credentials);
final AuthScope authScope = new AuthScope(host, -1);
client.getState().setCredentials(authScope, credentials);
}
}
System.setProperty("httpclient.useragent", userAgent);
@ -238,7 +244,6 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
return feed;
} finally {
method.releaseConnection();
method.recycle();
}
} else {
// cache is not in use
@ -250,16 +255,15 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
return getFeed(null, urlStr, method, statusCode);
} finally {
method.releaseConnection();
method.recycle();
}
}
}
private SyndFeed getFeed(final SyndFeedInfo syndFeedInfo, final String urlStr, final HttpMethod method, final int statusCode) throws IOException,
HttpException, FetcherException, FeedException {
if (statusCode == HttpURLConnection.HTTP_NOT_MODIFIED && syndFeedInfo != null) {
fireEvent(FetcherEvent.EVENT_TYPE_FEED_UNCHANGED, urlStr);
return syndFeedInfo.getSyndFeed();
}
@ -279,6 +283,7 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
*/
private SyndFeedInfo buildSyndFeedInfo(final URL feedUrl, final String urlStr, final HttpMethod method, SyndFeed feed, final int statusCode)
throws MalformedURLException {
SyndFeedInfo syndFeedInfo;
syndFeedInfo = new SyndFeedInfo();
@ -292,7 +297,8 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
final FeedFetcherCache cache = getFeedInfoCache();
if (cache != null && statusCode == 226) {
// client is setup to use http delta encoding and the server supports it and has returned a delta encoded response
// client is setup to use http delta encoding and the server supports it and has
// returned a delta encoded response
// This response only includes new items
final SyndFeedInfo cachedInfo = cache.getFeedInfo(feedUrl);
@ -333,6 +339,7 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
* @throws FeedException
*/
private SyndFeed retrieveFeed(final String urlStr, final HttpMethod method) throws IOException, HttpException, FetcherException, FeedException {
InputStream stream = null;
if (method.getResponseHeader("Content-Encoding") != null && "gzip".equalsIgnoreCase(method.getResponseHeader("Content-Encoding").getValue())) {
@ -367,11 +374,13 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
public interface HttpClientMethodCallbackIntf {
/**
* Allows access to the underlying HttpClient HttpMethod object. Note that in most cases, method.setRequestHeader(String, String) is what you want to do
* (rather than method.addRequestHeader(String, String))
*
* Allows access to the underlying HttpClient HttpMethod object. Note that in most cases,
* method.setRequestHeader(String, String) is what you want to do (rather than
* method.addRequestHeader(String, String))
*
* @param method
*/
public void afterHttpClientMethodCreate(HttpMethod method);
}
}

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.io.BufferedInputStream;
import java.io.IOException;
@ -24,9 +24,8 @@ import java.net.URL;
import java.net.URLConnection;
import java.util.zip.GZIPInputStream;
import org.rometools.fetcher.FetcherEvent;
import org.rometools.fetcher.FetcherException;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
@ -36,18 +35,20 @@ import com.sun.syndication.io.XmlReader;
* <p>
* Class to retrieve syndication files via HTTP.
* </p>
*
*
* <p>
* If passed a {@link org.rometools.fetcher.impl.FeedFetcherCache} in the constructor it will use conditional gets to only retrieve modified content.
* If passed a {@link com.rometools.fetcher.impl.FeedFetcherCache} in the constructor it will use
* conditional gets to only retrieve modified content.
* </p>
*
*
* <p>
* The class uses the Accept-Encoding: gzip header to retrieve gzipped feeds where supported by the server.
* The class uses the Accept-Encoding: gzip header to retrieve gzipped feeds where supported by the
* server.
* </p>
*
*
* <p>
* Simple usage:
*
*
* <pre>
* // create the cache
* FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getFeedInfoCache();
@ -56,14 +57,15 @@ import com.sun.syndication.io.XmlReader;
* // retrieve the resource if it has changed
* SyndFeed feed = new HttpURLFeedFetcher(feedInfoCache).retrieveFeed(feedUrl);
* </pre>
*
*
* </p>
*
*
* @see <a
* href="http://fishbowl.pastiche.org/2002/10/21/http_conditional_get_for_rss_hackers">http://fishbowl.pastiche.org/2002/10/21/http_conditional_get_for_rss_hackers</a>
* @see <a
* href="http://diveintomark.org/archives/2003/07/21/atom_aggregator_behavior_http_level">http://diveintomark.org/archives/2003/07/21/atom_aggregator_behavior_http_level</a>
* @see <a href="http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html">http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html</a>
* @see <a
* href="http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html">http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html</a>
* @author Nick Lothian
*/
public class HttpURLFeedFetcher extends AbstractFeedFetcher {
@ -76,7 +78,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
/**
* Constructor to use HttpURLFeedFetcher without caching of feeds
*
*
*/
public HttpURLFeedFetcher() {
super();
@ -84,7 +86,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
/**
* Constructor to enable HttpURLFeedFetcher to cache feeds
*
*
* @param feedCache - an instance of the FeedFetcherCache interface
*/
public HttpURLFeedFetcher(final FeedFetcherCache feedInfoCache) {
@ -99,7 +101,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
/**
* Retrieve a feed over HTTP
*
*
* @param feedUrl A non-null URL of a RSS/Atom feed to retrieve
* @return A {@link com.sun.syndication.feed.synd.SyndFeed} object
* @throws IllegalArgumentException if the URL is null;
@ -121,7 +123,8 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
if (connectTimeout >= 0) {
httpConnection.setConnectTimeout(connectTimeout);
}
// httpConnection.setInstanceFollowRedirects(true); // this is true by default, but can be changed on a claswide basis
// httpConnection.setInstanceFollowRedirects(true); // this is true by default, but can be
// changed on a claswide basis
final FeedFetcherCache cache = getFeedInfoCache();
if (cache != null) {
@ -217,7 +220,8 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
if (isUsingDeltaEncoding() && imHeader != null && imHeader.indexOf("feed") >= 0) {
final FeedFetcherCache cache = getFeedInfoCache();
if (cache != null && connection.getResponseCode() == 226) {
// client is setup to use http delta encoding and the server supports it and has returned a delta encoded response
// client is setup to use http delta encoding and the server supports it and has
// returned a delta encoded response
// This response only includes new items
final SyndFeedInfo cachedInfo = cache.getFeedInfo(orignalUrl);
if (cachedInfo != null) {
@ -241,7 +245,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
* <p>
* Set appropriate HTTP headers, including conditional get and gzip encoding headers
* </p>
*
*
* @param connection A URLConnection
* @param syndFeedInfo The SyndFeedInfo for the feed to be retrieved. May be null
*/
@ -278,7 +282,8 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
is = new BufferedInputStream(inputStream);
}
// InputStreamReader reader = new InputStreamReader(is, ResponseHandler.getCharacterEncoding(connection));
// InputStreamReader reader = new InputStreamReader(is,
// ResponseHandler.getCharacterEncoding(connection));
// SyndFeedInput input = new SyndFeedInput();
@ -322,5 +327,5 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
*/
public synchronized void setConnectTimeout(final int timeout) {
connectTimeout = timeout;
}
}
}

View file

@ -1,4 +1,4 @@
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.util.Collections;
import java.util.LinkedHashMap;
@ -6,22 +6,22 @@ import java.util.Map;
/**
* <p>
* An implementation of the {@link org.rometools.fetcher.impl.FeedFetcherCache} interface.
* An implementation of the {@link com.rometools.fetcher.impl.FeedFetcherCache} interface.
* </p>
*
*
* <p>
* Unlike the HashMapFeedInfoCache this implementation will not grow unbound
* </p>
*
*
* @author Javier Kohen
* @author Nick Lothian
*
*
*/
public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
private final class CacheImpl extends LinkedHashMap<String, SyndFeedInfo> {
private static final long serialVersionUID = -6977191330127794920L;
private static final long serialVersionUID = 1L;
public CacheImpl() {
super(16, 0.75F, true);
@ -35,14 +35,14 @@ public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
}
private static final int DEFAULT_MAX_ENTRIES = 20;
private static final long serialVersionUID = 1694228973357997417L;
private static final long serialVersionUID = 1L;
private static final LinkedHashMapFeedInfoCache _instance = new LinkedHashMapFeedInfoCache();
private int maxEntries = DEFAULT_MAX_ENTRIES;
/**
* Get the global instance of the cache
*
*
* @return an implementation of FeedFetcherCache
*/
public static final FeedFetcherCache getInstance() {
@ -53,11 +53,12 @@ public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
* <p>
* Constructor for HashMapFeedInfoCache
* </p>
*
*
* <p>
* Only use this if you want multiple instances of the cache. Usually {@link #getInstance()} is more appropriate.
* Only use this if you want multiple instances of the cache. Usually {@link #getInstance()} is
* more appropriate.
* </p>
*
*
* @see #getInstance()
*/
public LinkedHashMapFeedInfoCache() {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.net.URLConnection;
import java.util.regex.Matcher;
@ -22,7 +22,7 @@ import java.util.regex.Pattern;
/**
* Utility class to help deal with HTTP responses
*
*
*/
public class ResponseHandler {
public static final String defaultCharacterEncoding = "ISO-8859-1";
@ -34,12 +34,14 @@ public class ResponseHandler {
}
/**
*
*
* <p>
* Gets the character encoding of a response. (Note that this is different to the content-encoding)
* Gets the character encoding of a response. (Note that this is different to the
* content-encoding)
* </p>
*
* @param contentTypeHeader the value of the content-type HTTP header eg: text/html; charset=ISO-8859-4
*
* @param contentTypeHeader the value of the content-type HTTP header eg: text/html;
* charset=ISO-8859-4
* @return the character encoding, eg: ISO-8859-4
*/
public static String getCharacterEncoding(final String contentTypeHeader) {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.fetcher.impl;
package com.rometools.fetcher.impl;
import java.io.Serializable;
import java.net.URL;
@ -24,17 +24,18 @@ import com.sun.syndication.feed.synd.SyndFeed;
/**
* <p>
* A class to represent a {@link com.sun.syndication.feed.synd.SyndFeed} and some useful information about it.
* A class to represent a {@link com.sun.syndication.feed.synd.SyndFeed} and some useful information
* about it.
* </p>
*
*
* <p>
* This class is thread safe, as expected by the different feed fetcher implementations.
* </p>
*
*
* @author Nick Lothian
*/
public class SyndFeedInfo implements Cloneable, Serializable {
private static final long serialVersionUID = -1874786860901426015L;
private static final long serialVersionUID = 1L;
private final ObjectBean _objBean;
private String id;
@ -50,10 +51,10 @@ public class SyndFeedInfo implements Cloneable, Serializable {
/**
* Creates a deep 'bean' clone of the object.
* <p>
*
*
* @return a clone of the object.
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
*
*
*/
@Override
public Object clone() throws CloneNotSupportedException {
@ -61,12 +62,13 @@ public class SyndFeedInfo implements Cloneable, Serializable {
}
/**
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* Indicates whether some other object is "equal to" this one as defined by the Object equals()
* method.
* <p>
*
*
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*
*/
@Override
public boolean equals(final Object other) {
@ -78,9 +80,9 @@ public class SyndFeedInfo implements Cloneable, Serializable {
* <p>
* It follows the contract defined by the Object hashCode() method.
* <p>
*
*
* @return the hashcode of the bean object.
*
*
*/
@Override
public int hashCode() {
@ -90,9 +92,9 @@ public class SyndFeedInfo implements Cloneable, Serializable {
/**
* Returns the String representation for the object.
* <p>
*
*
* @return String representation for the object.
*
*
*/
@Override
public String toString() {
@ -148,7 +150,8 @@ public class SyndFeedInfo implements Cloneable, Serializable {
}
/**
* @param string A unique ID to identify the feed. Note that if the URL of the feed changes this will remain the same
* @param string A unique ID to identify the feed. Note that if the URL of the feed changes this
* will remain the same
*/
public synchronized void setId(final String string) {
id = string;

View file

@ -14,18 +14,17 @@
* limitations under the License.
*
*/
package org.rometools.fetcher.samples;
package com.rometools.fetcher.samples;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.rometools.fetcher.FeedFetcher;
import org.rometools.fetcher.impl.FeedFetcherCache;
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
@ -33,16 +32,17 @@ import com.sun.syndication.io.SyndFeedOutput;
/**
* <p>
* It aggregates a list of RSS/Atom feeds (they can be of different types) into a single feed of the specified type.
* It aggregates a list of RSS/Atom feeds (they can be of different types) into a single feed of the
* specified type.
* </p>
*
*
* <p>
* Converted from the original FeedAggregator sample
* </p>
*
*
* @author Alejandro Abdelnur
* @author Nick Lothian
*
*
*/
public class FeedAggregator {

View file

@ -15,26 +15,25 @@
*
*/
package org.rometools.fetcher.samples;
package com.rometools.fetcher.samples;
import java.net.URL;
import org.rometools.fetcher.FeedFetcher;
import org.rometools.fetcher.FetcherEvent;
import org.rometools.fetcher.FetcherListener;
import org.rometools.fetcher.impl.FeedFetcherCache;
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherListener;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.sun.syndication.feed.synd.SyndFeed;
/**
* Reads and prints any RSS/Atom feed type. Converted from the original Rome sample FeedReader
* <p>
*
*
* @author Alejandro Abdelnur
* @author Nick Lothian
*
*
*/
public class FeedReader {
public static void main(final String[] args) {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.test;
package com.rometools.test;
import java.net.URL;
@ -29,13 +29,15 @@ import org.mortbay.http.SocketListener;
import org.mortbay.http.UserRealm;
import org.mortbay.http.handler.SecurityHandler;
import org.mortbay.jetty.servlet.ServletHandler;
import org.rometools.fetcher.FeedFetcher;
import org.rometools.fetcher.FetcherEvent;
import org.rometools.fetcher.FetcherException;
import org.rometools.fetcher.FetcherListener;
import org.rometools.fetcher.impl.FeedFetcherCache;
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
import com.rometools.fetcher.FetcherListener;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
@ -45,6 +47,8 @@ import com.sun.syndication.feed.synd.SyndFeed;
*/
public abstract class AbstractJettyTest extends TestCase {
private static final Logger LOG = LoggerFactory.getLogger(AbstractJettyTest.class);
private HttpServer server;
private final int testPort = 8283;
@ -84,6 +88,7 @@ public abstract class AbstractJettyTest extends TestCase {
* @throws InterruptedException
*/
private void setupServer() throws InterruptedException {
// Create the server
if (server != null) {
server.stop();
@ -102,8 +107,8 @@ public abstract class AbstractJettyTest extends TestCase {
*/
private ServletHandler createServletHandler() {
final ServletHandler servlets = new ServletHandler();
servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING, "org.rometools.test.FetcherTestServlet");
servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING2, "org.rometools.test.FetcherTestServlet");
servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING, "com.rometools.test.FetcherTestServlet");
servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING2, "com.rometools.test.FetcherTestServlet");
return servlets;
}
@ -146,13 +151,13 @@ public abstract class AbstractJettyTest extends TestCase {
public void fetcherEvent(final FetcherEvent event) {
final String eventType = event.getEventType();
if (FetcherEvent.EVENT_TYPE_FEED_POLLED.equals(eventType)) {
System.err.println("\tEVENT: Feed Polled. URL = " + event.getUrlString());
LOG.debug("\tEVENT: Feed Polled. URL = " + event.getUrlString());
polled = true;
} else if (FetcherEvent.EVENT_TYPE_FEED_RETRIEVED.equals(eventType)) {
System.err.println("\tEVENT: Feed Retrieved. URL = " + event.getUrlString());
LOG.debug("\tEVENT: Feed Retrieved. URL = " + event.getUrlString());
retrieved = true;
} else if (FetcherEvent.EVENT_TYPE_FEED_UNCHANGED.equals(eventType)) {
System.err.println("\tEVENT: Feed Unchanged. URL = " + event.getUrlString());
LOG.debug("\tEVENT: Feed Unchanged. URL = " + event.getUrlString());
unchanged = true;
}
}
@ -215,7 +220,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test getting a feed via a http 301 redirect
*
*
*/
public void testRetrieveRedirectedFeed() {
final FeedFetcher feedFetcher = getFeedFetcher();
@ -231,7 +236,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test error handling
*
*
*/
public void testErrorHandling() {
final FeedFetcher feedFetcher = getFeedFetcher();
@ -260,14 +265,14 @@ public abstract class AbstractJettyTest extends TestCase {
public void testUserAgent() {
final FeedFetcher feedFetcher = getFeedFetcher();
// System.out.println(feedFetcher.getUserAgent());
// System.out.println(System.getProperty("rome.fetcher.version", "UNKNOWN"));
// LOG.debug(feedFetcher.getUserAgent());
// LOG.debug(System.getProperty("rome.fetcher.version", "UNKNOWN"));
assertEquals("Rome Client (http://tinyurl.com/64t5n) Ver: " + System.getProperty("rome.fetcher.version", "UNKNOWN"), feedFetcher.getUserAgent());
}
/**
* Test events fired when there is no cache in use
*
*
*/
public void testFetchEvents() {
final FeedFetcher feedFetcher = getFeedFetcher();
@ -297,7 +302,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test events fired when there is a cache in use
*
*
*/
public void testFetchEventsWithCache() {
final FeedFetcherCache feedInfoCache = new HashMapFeedInfoCache();
@ -336,7 +341,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test handling of GZipped feed
*
*
*/
public void testGZippedFeed() {
final FeedFetcher feedFetcher = getFeedFetcher();

View file

@ -1,12 +1,12 @@
package org.rometools.test;
package com.rometools.test;
import java.io.File;
import java.net.URL;
import junit.framework.TestCase;
import org.rometools.fetcher.impl.DiskFeedInfoCache;
import org.rometools.fetcher.impl.SyndFeedInfo;
import com.rometools.fetcher.impl.DiskFeedInfoCache;
import com.rometools.fetcher.impl.SyndFeedInfo;
public class DiskFeedInfoCacheTest extends TestCase {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.test;
package com.rometools.test;
import java.io.BufferedReader;
import java.io.IOException;
@ -45,6 +45,8 @@ import com.sun.syndication.io.SyndFeedOutput;
public class FetcherTestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public static final String ETAG_1 = "ETAG-1";
public static final String ETAG_2 = "ETAG-2";
@ -57,7 +59,8 @@ public class FetcherTestServlet extends HttpServlet {
/**
* @throws IOException
* @throws
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {

View file

@ -1,11 +1,11 @@
package org.rometools.test;
package com.rometools.test;
import java.net.URL;
import junit.framework.TestCase;
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.rometools.fetcher.impl.SyndFeedInfo;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.SyndFeedInfo;
public class HashMapFeedInfoCacheTest extends TestCase {

View file

@ -14,13 +14,14 @@
* limitations under the License.
*
*/
package org.rometools.test;
package com.rometools.test;
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.rometools.fetcher.FeedFetcher;
import org.rometools.fetcher.impl.FeedFetcherCache;
import org.rometools.fetcher.impl.HttpClientFeedFetcher;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HttpClientFeedFetcher;
/**
* @author Nick Lothian

View file

@ -14,11 +14,11 @@
* limitations under the License.
*
*/
package org.rometools.test;
package com.rometools.test;
import org.rometools.fetcher.FeedFetcher;
import org.rometools.fetcher.impl.FeedFetcherCache;
import org.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
public class HttpURLFeedFetcherTest extends AbstractJettyTest {

View file

@ -14,11 +14,11 @@
* limitations under the License.
*
*/
package org.rometools.test;
package com.rometools.test;
import junit.framework.TestCase;
import org.rometools.fetcher.impl.ResponseHandler;
import com.rometools.fetcher.impl.ResponseHandler;
public class ResponseHandlerTest extends TestCase {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package org.rometools.test;
package com.rometools.test;
import java.net.Authenticator;
import java.net.PasswordAuthentication;

View file

@ -0,0 +1,13 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>