diff --git a/.project b/.project index 232deb10cb..33b0179d6b 100644 --- a/.project +++ b/.project @@ -1,23 +1,23 @@ - - - JDownloader - - - - - - org.eclipse.jdt.core.javabuilder - - - - - net.sf.eclipsensis.installoptions.InstallOptionsBuilder - - - - - - org.eclipse.jdt.core.javanature - net.sf.eclipsensis.installoptions.InstallOptionsNature - - + + + JDownloader + + + + + + org.eclipse.jdt.core.javabuilder + + + + + net.sf.eclipsensis.installoptions.InstallOptionsBuilder + + + + + + org.eclipse.jdt.core.javanature + net.sf.eclipsensis.installoptions.InstallOptionsNature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 2fd22a78ac..7df8f88f0b 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,280 +1,12 @@ -#Sat Sep 04 19:56:29 CEST 2010 -eclipse.preferences.version=1 -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.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=true -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -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_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=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=true -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=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -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.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -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_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_label=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.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -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=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=900 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +#Thu Mar 24 18:14:17 CET 2011 +eclipse.preferences.version=1 +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.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs index c7c3975139..e726ae186c 100644 --- a/.settings/org.eclipse.jdt.ui.prefs +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -1,57 +1,58 @@ -#Tue Jan 18 10:33:08 CET 2011 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_settings_version=11 -org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.text.custom_code_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=false -sp_cleanup.correct_indentation=false -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_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +#Thu Mar 24 18:14:17 CET 2011 +cleanup_settings_version=2 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_settings_version=11 +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.text.custom_code_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=false +sp_cleanup.correct_indentation=false +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_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/src/jd/Main.java b/src/jd/Main.java index 6045df7df4..15b721a800 100644 --- a/src/jd/Main.java +++ b/src/jd/Main.java @@ -60,8 +60,6 @@ import org.appwork.utils.singleapp.SingleAppInstance; import org.jdownloader.gui.uiserio.JDSwingUserIO; import org.jdownloader.gui.uiserio.NewUIO; import org.jdownloader.images.NewTheme; -import org.jdownloader.plugins.controller.crawler.CrawlerPluginController; -import org.jdownloader.plugins.controller.host.HostPluginController; import org.jdownloader.translate._JDT; import org.jdownloader.update.JDUpdater; @@ -444,8 +442,6 @@ public class Main { return null; } }.waitForEDT(); - CrawlerPluginController.getInstance().init(); - HostPluginController.getInstance().init(); init.initPlugins(); diff --git a/src/jd/PluginWrapper.java b/src/jd/PluginWrapper.java index 2c17d14394..13e55b0516 100644 --- a/src/jd/PluginWrapper.java +++ b/src/jd/PluginWrapper.java @@ -33,6 +33,8 @@ import jd.nutils.JDFlags; import jd.plugins.Plugin; import jd.utils.JDUtilities; +import org.jdownloader.plugins.controller.LazyPlugin; + /** * A Container for {@link Plugin Plugins}. Plugins usually do not get * instantiated after program start. {@link JDInit#initPlugins()} reads all @@ -73,17 +75,17 @@ public abstract class PluginWrapper implements Comparable { * The Regular expression pattern. This pattern defines which urls can be * handeled by this plugin */ - private final Pattern pattern; + private Pattern pattern; /** * The domain of this plugin, which is the plugin's name, too */ - private final String host; + private String host; /** * Full qualified classname */ - private final String className; + private String className; /** * internal logger instance @@ -105,9 +107,11 @@ public abstract class PluginWrapper implements Comparable { * {@link PluginWrapper#DEBUG_ONLY}
{@link PluginWrapper#LOAD_ON_INIT}
* {@link PluginWrapper#PATTERN_ACCEPTS_INVALID_URI} */ - private final int flags; + private int flags; - private final long revision; + private long revision; + + private transient LazyPlugin lazy; /** * Static classloader. gets created when the first plugin should be @@ -141,6 +145,14 @@ public abstract class PluginWrapper implements Comparable { * @param revision * String that contains the revision of the plugin */ + public PluginWrapper(final LazyPlugin lazy) { + this.lazy = lazy; + } + + public LazyPlugin getLazy() { + return lazy; + } + public PluginWrapper(final String host, final String classNamePrefix, final String className, final String pattern, final int flags, final String revision) { this.pattern = (pattern != null) ? Pattern.compile(pattern, Pattern.CASE_INSENSITIVE) : null; this.host = host.toLowerCase(Locale.ENGLISH); @@ -168,6 +180,9 @@ public abstract class PluginWrapper implements Comparable { } } + public PluginWrapper() { + } + /** * Should always return lifetime id. This means that this id never changes! * It is used as config key to save settings diff --git a/src/jd/Tester.java b/src/jd/Tester.java index 3ea995c7af..eb9048b4af 100644 --- a/src/jd/Tester.java +++ b/src/jd/Tester.java @@ -1,64 +1,140 @@ -package jd; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.net.URL; -import java.net.URLConnection; - -import jd.http.Browser; -import jd.nutils.encoding.Encoding; - -public class Tester { - - public static void main(String[] args) throws Throwable { - Browser br = new Browser(); - br.setDebug(true); - System.out.println(Encoding.htmlDecode("14300921004cb82f694cbed%0D%0A")); - } - - @SuppressWarnings("unused") - private static String runCommand(final String serviceType, final String controlUrl, final String command) throws IOException { - String data = " "; - // this works for fritz box. - // old code did NOT work: - - // data = - // "\n\n \n\n" - // + " \n" + ""; - - final URL url = new URL(controlUrl); - final URLConnection conn = url.openConnection(); - conn.setDoOutput(true); - conn.addRequestProperty("Content-Type", "text/xml; charset=\"utf-8\""); - conn.addRequestProperty("SOAPAction", serviceType + "#" + command); - // conn.addRequestProperty("SOAPAction", serviceType + "#" + command + - // "\""); - OutputStreamWriter wr = null; - BufferedReader rd = null; - try { - wr = new OutputStreamWriter(conn.getOutputStream()); - wr.write(data); - wr.flush(); - rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String xmlstr = ""; - String nextln; - while ((nextln = rd.readLine()) != null) { - xmlstr += nextln.trim(); - } - return xmlstr; - - } finally { - if (wr != null) { - wr.close(); - } - if (rd != null) { - rd.close(); - } - } - - } - -} \ No newline at end of file +package jd; + +/* + * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle or the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.SecretKeySpec; +import javax.swing.JPanel; + +import jd.http.Browser; +import jd.nutils.encoding.Base64; +import jd.nutils.encoding.Encoding; +import jd.parser.Regex; + +public class Tester extends JPanel { + + public static String loginAPI(Browser br) throws IOException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { + if (br == null) br = new Browser(); + try { + br.getHeaders().put("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.4952)"); + br.getHeaders().put("SOAPAction", "\"urn:FileserveAPIWebServiceAction\""); + br.postPage("http://api.fileserve.com/api/fileserveAPIServer.php", "JDAffiliate2xDKKb6585"); + } finally { + br.getHeaders().remove("SOAPAction"); + } + String loginResp = br.getRegex("(.*?) test2 = new ArrayList(); + for (int i = 0; i < 2000000; i++) { + test2.add(null); + } + + long a = System.currentTimeMillis(); + for (int o = 0; o < 100000; o++) { + for (int i = 0; i < 2000000; i++) { + Object kk = test1[i]; + } + } + System.out.println(System.currentTimeMillis() - a); + + a = System.currentTimeMillis(); + for (int o = 0; o < 100000; o++) { + for (int i = 0; i < 2000000; i++) { + Object kk = test2.get(i); + } + } + System.out.println(System.currentTimeMillis() - a); + System.out.println(new Browser().getPage("https://www.1fichier.com/en/login.pl")); + // String login = loginAPI(br); + // String jj = + // decrypt("0J5fKHNZ2NV5dULQ4BQwAnr7SiYmQDaRYYMK7CXKXGReo9G4NrVoAf6oi0s2DUd7DLif4sGAu+5HdAfVF82mUWrKnVzTsd0q/yJwRPxNVZzBGzAmEPc2eQwzpg2iQAsdn94OZa6oOZiZ16BIJ6X7x5yGwvMsS5iJzG3md0LcfDTOE999xVY7X4UQCaiQelrVDVXIrRxbveVnDwdJ68qO++5gIrSV/J+QNXmAzitc17/7GIJsaIMa+uV9nPoIe0NWJfGL/0dkrDj/YxLaCBm5ODqSjKQwVKjIw1ecBOETPdlGZFczVW6sa3buo7AC6FnyzGT7Sh+EY5afFCad/KSDam/90A17imMJLv4SzftoBwik3yIWtYev3OVYOdyrTKGfrf9C8DCqvs/x6rYxfRqbpg=="); + // ArrayList dd = JACMethod.parseJACInfo(new + // File("/home/daniel/test")); + // int oo = 2; + // Browser br = new Browser(); + // Logger log = Logger.getLogger("bla"); + // log.setLevel(Level.ALL); + // ConsoleHandler c; + // log.addHandler(c = new ConsoleHandler()); + // c.setLevel(Level.ALL); + // br.setVerbose(true); + // br.setLogger(log); + // br.getPage("http://update3.jdownloader.org/advert/getLanguage.php?r=bla"); + // br.getPage("http://update3.jdownloader.org/advert/getLanguage.php?r=bla"); + + } + + public static String[][] getGrid(String data, String deliminator) { + String[] lines = getLines(data); + String[][] ret = new String[lines.length][]; + for (int i = 0; i < ret.length; i++) { + ret[i] = lines[i].split(deliminator, -1); + } + return ret; + } + + /** + * Splits multiple rows to a String array. Row Deliminator is "\r\n" + * + * @param data + * @return + */ + public static String[] getLines(String data) { + return data.split("[\r\n]+"); + } +} diff --git a/src/jd/controlling/DistributeData.java b/src/jd/controlling/DistributeData.java index ca37dfca9c..c162e8e5fa 100644 --- a/src/jd/controlling/DistributeData.java +++ b/src/jd/controlling/DistributeData.java @@ -21,13 +21,10 @@ import java.util.ArrayList; import jd.CPluginWrapper; import jd.controlling.linkcrawler.CrawledLink; import jd.controlling.linkcrawler.LinkCrawler; -import jd.nutils.encoding.Encoding; import jd.parser.html.HTMLParser; import jd.plugins.DownloadLink; import org.appwork.utils.Regex; -import org.jdownloader.plugins.controller.crawler.CrawlerPluginController; -import org.jdownloader.plugins.controller.host.HostPluginController; /** * Diese Klasse läuft in einem Thread und verteilt den Inhalt der Zwischenablage @@ -80,24 +77,7 @@ public class DistributeData extends Thread { @Deprecated public static boolean hasPluginFor(final String tmp, final boolean filterNormalHTTP) { - - String data = tmp; - data = data.replaceAll("jd://", "http://"); - - if (CrawlerPluginController.getInstance().canHandle(data)) return true; - - if (HostPluginController.getInstance().canHandle(data)) return true; - data = Encoding.urlDecode(data, true); - if (CrawlerPluginController.getInstance().canHandle(data)) return true; - if (HostPluginController.getInstance().canHandle(data)) return true; - if (!filterNormalHTTP) { - data = data.replaceAll("http://", "httpviajd://"); - data = data.replaceAll("https://", "httpsviajd://"); - if (CrawlerPluginController.getInstance().canHandle(data)) return true; - if (HostPluginController.getInstance().canHandle(data)) return true; - } - - return false; + return true; } @Deprecated diff --git a/src/jd/controlling/LinkCheck.java b/src/jd/controlling/LinkCheck.java index 5227c000ba..422c754dd1 100644 --- a/src/jd/controlling/LinkCheck.java +++ b/src/jd/controlling/LinkCheck.java @@ -33,6 +33,7 @@ import jd.plugins.PluginForHost; import org.appwork.utils.event.Eventsender; import org.jdownloader.plugins.controller.host.HostPluginController; +import org.jdownloader.plugins.controller.host.LazyHostPlugin; import org.jdownloader.translate._JDT; class LinkCheckBroadcaster extends Eventsender { @@ -142,7 +143,8 @@ public class LinkCheck implements ActionListener, ProgressControllerListener { private void checkHosterList(ArrayList hosterList) { if (hosterList.size() != 0) { DownloadLink link = hosterList.get(0); - PluginForHost plg = HostPluginController.getInstance().newInstance(link.getDefaultPlugin().getClass()); + LazyHostPlugin lazyp = HostPluginController.getInstance().get(link.getHost()); + PluginForHost plg = lazyp.newInstance(); plg.setBrowser(new Browser()); plg.init(); try { diff --git a/src/jd/controlling/SingleDownloadController.java b/src/jd/controlling/SingleDownloadController.java index d8aa998fcb..a95e00a2de 100644 --- a/src/jd/controlling/SingleDownloadController.java +++ b/src/jd/controlling/SingleDownloadController.java @@ -52,6 +52,7 @@ import org.appwork.utils.Regex; import org.appwork.utils.net.httpconnection.HTTPProxy; import org.jdownloader.images.NewTheme; import org.jdownloader.plugins.controller.host.HostPluginController; +import org.jdownloader.plugins.controller.host.LazyHostPlugin; import org.jdownloader.settings.GeneralSettings; import org.jdownloader.settings.IfFileExistsAction; import org.jdownloader.translate._JDT; @@ -687,7 +688,8 @@ public class SingleDownloadController extends BrowserSettingsThread implements S * we are going to download this link, create new liveplugin * instance here */ - downloadLink.setLivePlugin(HostPluginController.getInstance().newInstance(downloadLink.getDefaultPlugin().getClass())); + LazyHostPlugin lazyp = HostPluginController.getInstance().get(downloadLink.getDefaultPlugin().getHost()); + downloadLink.setLivePlugin(lazyp.newInstance()); currentPlugin = downloadLink.getLivePlugin(); currentPlugin.setIOPermission(ioP); currentPlugin.setLogger(logger = new JDPluginLogger(downloadLink.getHost() + ":" + downloadLink.getName())); diff --git a/src/jd/controlling/linkchecker/LinkChecker.java b/src/jd/controlling/linkchecker/LinkChecker.java index f14ecb8e0c..b937dc884d 100644 --- a/src/jd/controlling/linkchecker/LinkChecker.java +++ b/src/jd/controlling/linkchecker/LinkChecker.java @@ -20,6 +20,7 @@ import jd.plugins.PluginForHost; import org.appwork.storage.config.JsonConfig; import org.appwork.utils.logging.Log; import org.jdownloader.plugins.controller.host.HostPluginController; +import org.jdownloader.plugins.controller.host.LazyHostPlugin; public class LinkChecker { @@ -231,7 +232,8 @@ public class LinkChecker { /* now we check the links */ if (plg == null) { /* create plugin if not done yet */ - plg = HostPluginController.getInstance().newInstance(linksList[0].getDefaultPlugin().getClass()); + LazyHostPlugin lazyp = HostPluginController.getInstance().get(linksList[0].getDefaultPlugin().getHost()); + plg = lazyp.newInstance(); plg.setBrowser(br); plg.init(); } diff --git a/src/jd/controlling/linkcrawler/LinkCrawler.java b/src/jd/controlling/linkcrawler/LinkCrawler.java index 9064bf9c17..db31b1e3c0 100644 --- a/src/jd/controlling/linkcrawler/LinkCrawler.java +++ b/src/jd/controlling/linkcrawler/LinkCrawler.java @@ -537,7 +537,8 @@ public class LinkCrawler implements IOPermission { } if (cryptedLink == null || cryptedLink.getdPlugin() == null || cryptedLink.getCryptedLink() == null) return; /* we have to create new plugin instance here */ - PluginForDecrypt plg = CrawlerPluginController.getInstance().newInstance(cryptedLink.getdPlugin().getClass()); + LazyCrawlerPlugin lazyC = CrawlerPluginController.getInstance().get(cryptedLink.getdPlugin().getHost()); + PluginForDecrypt plg = lazyC.newInstance(); plg.setIOPermission(this); plg.setBrowser(new Browser()); /* now we run the plugin and let it find some links */ diff --git a/src/jd/gui/swing/dialog/AddAccountDialog.java b/src/jd/gui/swing/dialog/AddAccountDialog.java index c71facc957..a375847a12 100644 --- a/src/jd/gui/swing/dialog/AddAccountDialog.java +++ b/src/jd/gui/swing/dialog/AddAccountDialog.java @@ -37,7 +37,6 @@ import jd.gui.UserIO; import jd.gui.swing.jdgui.views.settings.panels.accountmanager.BuyAction; import jd.plugins.Account; import jd.plugins.PluginForHost; -import jd.plugins.hoster.FileSonicCom; import net.miginfocom.swing.MigLayout; import org.appwork.swing.components.searchcombo.SearchComboBox; @@ -184,7 +183,7 @@ public class AddAccountDialog extends AbstractDialog { @Override public JComponent layoutDialogContent() { - final ArrayList plugins = HostPluginController.getInstance().list(); + final ArrayList plugins = new ArrayList(HostPluginController.getInstance().list()); Collections.sort(plugins, new Comparator() { public int compare(final LazyHostPlugin a, final LazyHostPlugin b) { return a.getDisplayName().compareToIgnoreCase(b.getDisplayName()); @@ -210,11 +209,12 @@ public class AddAccountDialog extends AbstractDialog { if (this.plugin != null) { try { - this.hoster.setSelectedItem(HostPluginController.getInstance().newInstance(plugin.getClass())); + LazyHostPlugin lazyp = HostPluginController.getInstance().get(plugin.getHost()); + if (lazyp != null) this.hoster.setSelectedItem(lazyp); } catch (final Exception e) { } } else { - LazyHostPlugin plg = HostPluginController.getInstance().get(FileSonicCom.class); + LazyHostPlugin plg = HostPluginController.getInstance().get("filesonic.com"); if (plg != null) { try { hoster.setSelectedItem(plg); diff --git a/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/BuyAction.java b/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/BuyAction.java index 92f6ff102d..5b6d4e559d 100644 --- a/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/BuyAction.java +++ b/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/BuyAction.java @@ -13,7 +13,6 @@ import javax.swing.JComboBox; import jd.controlling.IOEQ; import jd.plugins.Account; -import jd.plugins.hoster.FileSonicCom; import org.appwork.swing.components.searchcombo.SearchComboBox; import org.appwork.utils.os.CrossSystem; @@ -54,7 +53,7 @@ public class BuyAction extends AbstractAction { public void actionPerformed(ActionEvent e) { IOEQ.add(new Runnable() { public void run() { - final ArrayList plugins = HostPluginController.getInstance().list(); + final ArrayList plugins = new ArrayList(HostPluginController.getInstance().list()); Collections.sort(plugins, new Comparator() { public int compare(final LazyHostPlugin a, final LazyHostPlugin b) { return a.getDisplayName().compareToIgnoreCase(b.getDisplayName()); @@ -76,7 +75,7 @@ public class BuyAction extends AbstractAction { } } if (plg == null) { - plg = HostPluginController.getInstance().get(FileSonicCom.class); + plg = HostPluginController.getInstance().get("filesonic.com"); } final LazyHostPlugin defaultSelection = plg; try { diff --git a/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/RefreshAction.java b/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/RefreshAction.java index 64bb7a2e16..57cdefbfdd 100644 --- a/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/RefreshAction.java +++ b/src/jd/gui/swing/jdgui/views/settings/panels/accountmanager/RefreshAction.java @@ -2,6 +2,7 @@ package jd.gui.swing.jdgui.views.settings.panels.accountmanager; import java.awt.event.ActionEvent; import java.util.ArrayList; +import java.util.List; import javax.swing.AbstractAction; @@ -40,7 +41,7 @@ public class RefreshAction extends AbstractAction { public void run() { if (selection == null) { selection = new ArrayList(); - final ArrayList plugins = HostPluginController.getInstance().list(); + final List plugins = HostPluginController.getInstance().list(); for (LazyHostPlugin plugin : plugins) { ArrayList accs = AccountController.getInstance().getAllAccounts(plugin.getDisplayName()); if (accs != null) { diff --git a/src/jd/plugins/DownloadLink.java b/src/jd/plugins/DownloadLink.java index b619aeddd1..fe737dfd24 100644 --- a/src/jd/plugins/DownloadLink.java +++ b/src/jd/plugins/DownloadLink.java @@ -51,6 +51,7 @@ import org.appwork.utils.os.CrossSystem; import org.jdownloader.DomainInfo; import org.jdownloader.images.NewTheme; import org.jdownloader.plugins.controller.host.HostPluginController; +import org.jdownloader.plugins.controller.host.LazyHostPlugin; import org.jdownloader.settings.GeneralSettings; /** @@ -62,7 +63,10 @@ import org.jdownloader.settings.GeneralSettings; public class DownloadLink extends Property implements Serializable, Comparable, AbstractPackageChildrenNode, CheckableLink { public static enum AvailableStatus { - UNCHECKED, FALSE, UNCHECKABLE, TRUE; + UNCHECKED, + FALSE, + UNCHECKABLE, + TRUE; } public static final int LINKTYPE_CONTAINER = 1; @@ -588,7 +592,8 @@ public class DownloadLink extends Property implements Serializable, Comparable 0) { + if (getConfig() != null && getConfig().getEntries().size() > 0) { m = new MenuAction(_GUI._.action_plugin_config(), "plugins.configs", 1) { private static final long serialVersionUID = -5376242428242330373L; diff --git a/src/jd/plugins/PluginsC.java b/src/jd/plugins/PluginsC.java index dc1f0bf798..b712fa723d 100644 --- a/src/jd/plugins/PluginsC.java +++ b/src/jd/plugins/PluginsC.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Iterator; import jd.PluginWrapper; +import jd.config.SubConfiguration; import jd.controlling.DistributeData; import jd.controlling.JDLogger; import jd.controlling.JDPluginLogger; @@ -36,6 +37,7 @@ import jd.nutils.io.JDIO; import jd.utils.JDUtilities; import jd.utils.WebUpdate; +import org.appwork.exceptions.WTFException; import org.appwork.utils.Regex; import org.jdownloader.plugins.controller.host.HostPluginController; import org.jdownloader.plugins.controller.host.LazyHostPlugin; @@ -87,6 +89,11 @@ public abstract class PluginsC extends Plugin { return null; } + @Override + public SubConfiguration getPluginConfig() { + throw new WTFException("WW"); + } + // @Override public ArrayList createMenuitems() { return null; diff --git a/src/jd/plugins/a/AMZ.java b/src/jd/plugins/a/AMZ.java index c6990ec8a0..127033d347 100644 --- a/src/jd/plugins/a/AMZ.java +++ b/src/jd/plugins/a/AMZ.java @@ -4,6 +4,7 @@ import java.io.File; import java.security.spec.AlgorithmParameterSpec; import java.util.ArrayList; import java.util.HashMap; +import java.util.regex.Pattern; import javax.crypto.Cipher; import javax.crypto.SecretKey; @@ -95,4 +96,14 @@ public class AMZ extends PluginsC { return 1; } + @Override + public String getHost() { + return null; + } + + @Override + public Pattern getSupportedLinks() { + return null; + } + } diff --git a/src/jd/plugins/a/C.java b/src/jd/plugins/a/C.java index 722c695b1d..05ff1c9652 100644 --- a/src/jd/plugins/a/C.java +++ b/src/jd/plugins/a/C.java @@ -28,6 +28,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.Vector; +import java.util.regex.Pattern; import jd.PluginWrapper; import jd.controlling.JDLogger; @@ -193,4 +194,14 @@ public class C extends PluginsC { callDecryption(new File(filename)); } + @Override + public String getHost() { + return null; + } + + @Override + public Pattern getSupportedLinks() { + return null; + } + } \ No newline at end of file diff --git a/src/jd/plugins/a/D.java b/src/jd/plugins/a/D.java index d4c1b6fa78..ffd062ad9d 100644 --- a/src/jd/plugins/a/D.java +++ b/src/jd/plugins/a/D.java @@ -15,6 +15,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.regex.Pattern; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; @@ -1069,4 +1070,14 @@ public class D extends PluginsC { return null; } + @Override + public String getHost() { + return null; + } + + @Override + public Pattern getSupportedLinks() { + return null; + } + } \ No newline at end of file diff --git a/src/jd/plugins/a/J.java b/src/jd/plugins/a/J.java index d49223699c..4b1fdc5c6a 100644 --- a/src/jd/plugins/a/J.java +++ b/src/jd/plugins/a/J.java @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.ObjectInputStream; import java.util.ArrayList; +import java.util.regex.Pattern; import jd.PluginWrapper; import jd.config.SubConfiguration; @@ -147,7 +148,7 @@ public class J extends PluginsC { // logger.info("pHost: "+pHost); if (pHost != null) { - DownloadLink dl = new DownloadLink((PluginForHost) pHost.getWrapper().getPlugin(), l.getName(), l.getHost(), l.getDownloadURL(), l.isEnabled()); + DownloadLink dl = new DownloadLink(pHost, l.getName(), l.getHost(), l.getDownloadURL(), l.isEnabled()); dl.setDownloadSize(l.getDownloadSize()); dl.setBrowserUrl(l.getBrowserUrl()); @@ -198,4 +199,14 @@ public class J extends PluginsC { return 1; } + @Override + public String getHost() { + return null; + } + + @Override + public Pattern getSupportedLinks() { + return null; + } + } \ No newline at end of file diff --git a/src/jd/plugins/a/MetaLink.java b/src/jd/plugins/a/MetaLink.java index aa33a5c885..523e391676 100644 --- a/src/jd/plugins/a/MetaLink.java +++ b/src/jd/plugins/a/MetaLink.java @@ -18,6 +18,7 @@ package jd.plugins.a; import java.io.File; import java.util.ArrayList; +import java.util.regex.Pattern; import jd.PluginWrapper; import jd.nutils.io.JDIO; @@ -73,4 +74,14 @@ public class MetaLink extends PluginsC { return false; } + @Override + public String getHost() { + return null; + } + + @Override + public Pattern getSupportedLinks() { + return null; + } + } \ No newline at end of file diff --git a/src/jd/plugins/a/R.java b/src/jd/plugins/a/R.java index 16549a1824..15c202dbf0 100644 --- a/src/jd/plugins/a/R.java +++ b/src/jd/plugins/a/R.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; +import java.util.regex.Pattern; import jd.PluginWrapper; import jd.controlling.JDLogger; @@ -87,7 +88,7 @@ public class R extends PluginsC { // logger.info("pHost: "+pHost); if (pHost != null) { - newLink = new DownloadLink((PluginForHost) pHost.getWrapper().getPlugin(), element.substring(element.lastIndexOf("/") + 1), pHost.getHost(), null, true); + newLink = new DownloadLink(pHost, element.substring(element.lastIndexOf("/") + 1), pHost.getHost(), null, true); newLink.setLoadedPluginForContainer(this); newLink.setContainerFile(lc.getAbsolutePath()); newLink.setContainerIndex(c); @@ -316,4 +317,14 @@ public class R extends PluginsC { return null; } + @Override + public String getHost() { + return null; + } + + @Override + public Pattern getSupportedLinks() { + return null; + } + } \ No newline at end of file diff --git a/src/jd/plugins/decrypter/MndCm.java b/src/jd/plugins/decrypter/MndCm.java index 96d808232c..c3877a4384 100644 --- a/src/jd/plugins/decrypter/MndCm.java +++ b/src/jd/plugins/decrypter/MndCm.java @@ -86,8 +86,8 @@ public class MndCm extends PluginForDecrypt { * TODO: Umbauen! */ private void setConfigElements() { - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), ENABLE_SUBFOLDERS, JDL.L("plugins.decrypt.jamendo", "Create a subfolder for each album")).setDefaultValue(false)); - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), PREFER_WHOLEALBUM, JDL.L("plugins.decrypt.jamendoalbum", "Prefer whole Album as Zip")).setDefaultValue(true)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), ENABLE_SUBFOLDERS, JDL.L("plugins.decrypt.jamendo", "Create a subfolder for each album")).setDefaultValue(false)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), PREFER_WHOLEALBUM, JDL.L("plugins.decrypt.jamendoalbum", "Prefer whole Album as Zip")).setDefaultValue(true)); } } diff --git a/src/jd/plugins/hoster/CreaFileCom.java b/src/jd/plugins/hoster/CreaFileCom.java index 6ee8b4f768..da007b61b8 100644 --- a/src/jd/plugins/hoster/CreaFileCom.java +++ b/src/jd/plugins/hoster/CreaFileCom.java @@ -44,17 +44,17 @@ public class CreaFileCom extends PluginForHost { setConfigElements(); } - private static final String WAIT1 = "WAIT1"; - private static final String WAIT2 = "WAIT2"; + private static final String WAIT1 = "WAIT1"; + private static final String WAIT2 = "WAIT2"; private static final String CHUNKS = "CHUNKS2"; private void setConfigElements() { ConfigEntry cond = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), WAIT1, "Activate waittime1").setDefaultValue(false); ConfigEntry cond1 = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), WAIT2, "Activate waittime2").setDefaultValue(false); ConfigEntry cond2 = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), CHUNKS, "Activate unlimited Max.Con. (speeds up the downloads but may causes errors)").setDefaultValue(false); - config.addEntry(cond); - config.addEntry(cond1); - config.addEntry(cond2); + getConfig().addEntry(cond); + getConfig().addEntry(cond1); + getConfig().addEntry(cond2); } @Override diff --git a/src/jd/plugins/hoster/DirectHTTP.java b/src/jd/plugins/hoster/DirectHTTP.java index ca6fed4ce2..0f216fedce 100644 --- a/src/jd/plugins/hoster/DirectHTTP.java +++ b/src/jd/plugins/hoster/DirectHTTP.java @@ -690,10 +690,10 @@ public class DirectHTTP extends PluginForHost { private void setConfigElements() { if (oldStyle()) { - this.config.addEntry(new ConfigEntry(ConfigContainer.TYPE_LISTCONTROLLED, HTACCESSController.getInstance(), JDL.L("plugins.http.htaccess", "List of all HTAccess passwords. Each line one password."))); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_LISTCONTROLLED, HTACCESSController.getInstance(), JDL.L("plugins.http.htaccess", "List of all HTAccess passwords. Each line one password."))); } else { ConfigEntry ce; - this.config.addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), LASTMODIFIED, JDL.L("plugins.http.lastmodified", "Set file time to last modified time(server)."))); + getConfig().addEntry(ce = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), LASTMODIFIED, JDL.L("plugins.http.lastmodified", "Set file time to last modified time(server)."))); ce.setDefaultValue(true); } } diff --git a/src/jd/plugins/hoster/FilesHackCom.java b/src/jd/plugins/hoster/FilesHackCom.java index ac1888e887..5c89cdd038 100644 --- a/src/jd/plugins/hoster/FilesHackCom.java +++ b/src/jd/plugins/hoster/FilesHackCom.java @@ -40,25 +40,25 @@ import org.appwork.utils.formatter.SizeFormatter; @HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "fileshack.com" }, urls = { "http://[\\w\\.]*?fileshack\\.com/(file|file_download)\\.x/[0-9]+" }, flags = { 2 }) public class FilesHackCom extends PluginForHost { - private static final String fileshackservers = "fileshackservers"; + private static final String fileshackservers = "fileshackservers"; /** The list of servers displayed in the plugin configuration pane */ - private static final String[] FILESHACK_SERVERS = new String[] { "Public Central USA", "Public Eastern USA", "Public Europe", "Public Western USA" }; + private static final String[] FILESHACK_SERVERS = new String[] { "Public Central USA", "Public Eastern USA", "Public Europe", "Public Western USA" }; /** * The number of the default server [used if no server is configured or if * the configured server was not found in the list of obtained servers] */ - private static final int DEFAULT_SERVER_NUMBER = 2; + private static final int DEFAULT_SERVER_NUMBER = 2; /** * The name of the default server [used if no server is configured or if the * configured server was not found in the list of obtained servers] */ - private static final String DEFAULT_SERVER_NAME = FILESHACK_SERVERS[DEFAULT_SERVER_NUMBER]; + private static final String DEFAULT_SERVER_NAME = FILESHACK_SERVERS[DEFAULT_SERVER_NUMBER]; /** The {@link Pattern} used to get the server strings from the HTML page */ - private static final Pattern SERVERS_STRINGS_PATTERN = Pattern.compile("'(/popup\\..*?(central|east|europe|west)\\.public.*?pay=0)'"); + private static final Pattern SERVERS_STRINGS_PATTERN = Pattern.compile("'(/popup\\..*?(central|east|europe|west)\\.public.*?pay=0)'"); public FilesHackCom(PluginWrapper wrapper) { super(wrapper); @@ -76,7 +76,7 @@ public class FilesHackCom extends PluginForHost { } private void setConfigElements() { - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, getPluginConfig(), fileshackservers, FILESHACK_SERVERS, JDL.L("plugins.host.FilesHackCom.servers", "Use this server:")).setDefaultValue(0)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, getPluginConfig(), fileshackservers, FILESHACK_SERVERS, JDL.L("plugins.host.FilesHackCom.servers", "Use this server:")).setDefaultValue(0)); } // thx to jiaz & bogdan.solga for the help ;) diff --git a/src/jd/plugins/hoster/FilesMonsterCom.java b/src/jd/plugins/hoster/FilesMonsterCom.java index 0ff5b9cd49..225aec6009 100644 --- a/src/jd/plugins/hoster/FilesMonsterCom.java +++ b/src/jd/plugins/hoster/FilesMonsterCom.java @@ -28,11 +28,11 @@ import jd.parser.Regex; import jd.plugins.Account; import jd.plugins.AccountInfo; import jd.plugins.DownloadLink; +import jd.plugins.DownloadLink.AvailableStatus; import jd.plugins.HostPlugin; import jd.plugins.LinkStatus; import jd.plugins.PluginException; import jd.plugins.PluginForHost; -import jd.plugins.DownloadLink.AvailableStatus; import jd.utils.JDUtilities; import jd.utils.locale.JDL; @@ -57,7 +57,7 @@ public class FilesMonsterCom extends PluginForHost { @SuppressWarnings("deprecation") private void setConfigElements() { - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_SPINNER, getPluginConfig(), PROPERTY_NO_SLOT_WAIT_TIME, JDL.L("plugins.hoster.filesmonstercom.noslotwaittime", "No slot wait time (seconds)"), 30, 86400).setDefaultValue(60).setStep(30)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_SPINNER, getPluginConfig(), PROPERTY_NO_SLOT_WAIT_TIME, JDL.L("plugins.hoster.filesmonstercom.noslotwaittime", "No slot wait time (seconds)"), 30, 86400).setDefaultValue(60).setStep(30)); } public void correctDownloadLink(DownloadLink link) { diff --git a/src/jd/plugins/hoster/Freaksharenet.java b/src/jd/plugins/hoster/Freaksharenet.java index b48f82a2f2..bcce09c7c5 100644 --- a/src/jd/plugins/hoster/Freaksharenet.java +++ b/src/jd/plugins/hoster/Freaksharenet.java @@ -30,11 +30,11 @@ import jd.parser.html.Form; import jd.plugins.Account; import jd.plugins.AccountInfo; import jd.plugins.DownloadLink; +import jd.plugins.DownloadLink.AvailableStatus; import jd.plugins.HostPlugin; import jd.plugins.LinkStatus; import jd.plugins.PluginException; import jd.plugins.PluginForHost; -import jd.plugins.DownloadLink.AvailableStatus; import jd.utils.JDUtilities; import jd.utils.locale.JDL; @@ -325,6 +325,6 @@ public class Freaksharenet extends PluginForHost { private void setConfigElements() { final ConfigEntry cond = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), WAIT1, JDL.L("plugins.hoster.Freaksharenet.waitInsteadOfReconnect", "Wait 10 minutes instead of reconnecting")).setDefaultValue(true); - config.addEntry(cond); + getConfig().addEntry(cond); } } diff --git a/src/jd/plugins/hoster/HotFileCom.java b/src/jd/plugins/hoster/HotFileCom.java index 30e291a86b..27d2452523 100644 --- a/src/jd/plugins/hoster/HotFileCom.java +++ b/src/jd/plugins/hoster/HotFileCom.java @@ -601,11 +601,11 @@ public class HotFileCom extends PluginForHost { @SuppressWarnings("deprecation") private void setConfigElements() { ConfigEntry cond = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), HotFileCom.TRY_IWL_BYPASS, JDL.L("plugins.hoster.HotFileCom.TRYIWLBYPASS", "Try IWL-Filter list bypass?")).setDefaultValue(false); - config.addEntry(cond); - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_SPINNER, getPluginConfig(), HotFileCom.CAPTCHARETRIES, JDL.L("plugins.hoster.HotFileCom.captcharetries", "Captcha retries"), 1, 86400).setDefaultValue(60).setStep(20)); + getConfig().addEntry(cond); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_SPINNER, getPluginConfig(), HotFileCom.CAPTCHARETRIES, JDL.L("plugins.hoster.HotFileCom.captcharetries", "Captcha retries"), 1, 86400).setDefaultValue(60).setStep(20)); cond = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), HotFileCom.UNLIMITEDMAXCON, JDL.L("plugins.hoster.HotFileCom.SetUnlimitedConnectionsForPremium", "Allow more than 5 connections per file for premium (default maximum = 5). Enabling this can cause errors!!")).setDefaultValue(false); - config.addEntry(cond); + getConfig().addEntry(cond); } private void submit(final Browser br, final Form form) throws Exception { diff --git a/src/jd/plugins/hoster/JamendoCom.java b/src/jd/plugins/hoster/JamendoCom.java index 061c63901f..0cfee285c4 100644 --- a/src/jd/plugins/hoster/JamendoCom.java +++ b/src/jd/plugins/hoster/JamendoCom.java @@ -174,7 +174,7 @@ public class JamendoCom extends PluginForHost { } private void setConfigElements() { - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), PREFER_HIGHQUALITY, JDL.L("plugins.hoster.jamendo", "Prefer High Quality Download")).setDefaultValue(true)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), PREFER_HIGHQUALITY, JDL.L("plugins.hoster.jamendo", "Prefer High Quality Download")).setDefaultValue(true)); } @Override diff --git a/src/jd/plugins/hoster/L4dMapsCom.java b/src/jd/plugins/hoster/L4dMapsCom.java index 94cd3b9374..a6dbebd601 100644 --- a/src/jd/plugins/hoster/L4dMapsCom.java +++ b/src/jd/plugins/hoster/L4dMapsCom.java @@ -23,11 +23,11 @@ import jd.nutils.encoding.Encoding; import jd.parser.Regex; import jd.plugins.BrowserAdapter; import jd.plugins.DownloadLink; +import jd.plugins.DownloadLink.AvailableStatus; import jd.plugins.HostPlugin; import jd.plugins.LinkStatus; import jd.plugins.PluginException; import jd.plugins.PluginForHost; -import jd.plugins.DownloadLink.AvailableStatus; import jd.utils.locale.JDL; import org.appwork.utils.formatter.SizeFormatter; @@ -59,7 +59,7 @@ public class L4dMapsCom extends PluginForHost { } private void setConfigElements() { - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, getPluginConfig(), l4dservers, servers, JDL.L("plugins.host.L4dMapsCom.servers", "Use this server:")).setDefaultValue(0)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, getPluginConfig(), l4dservers, servers, JDL.L("plugins.host.L4dMapsCom.servers", "Use this server:")).setDefaultValue(0)); } /** diff --git a/src/jd/plugins/hoster/MegaPornCom.java b/src/jd/plugins/hoster/MegaPornCom.java index 177100eaf6..39b153cf19 100644 --- a/src/jd/plugins/hoster/MegaPornCom.java +++ b/src/jd/plugins/hoster/MegaPornCom.java @@ -56,16 +56,19 @@ import org.appwork.utils.formatter.SizeFormatter; public class MegaPornCom extends PluginForHost { private static enum STATUS { - ONLINE, OFFLINE, API, BLOCKED + ONLINE, + OFFLINE, + API, + BLOCKED } - private static final String MU_PARAM_PORT = "MU_PARAM_PORT_NEW1"; - private final static String[] ports = new String[] { "80", "800", "1723" }; - private static String wwwWorkaround = null; - private static final Object LOCK = new Object(); + private static final String MU_PARAM_PORT = "MU_PARAM_PORT_NEW1"; + private final static String[] ports = new String[] { "80", "800", "1723" }; + private static String wwwWorkaround = null; + private static final Object LOCK = new Object(); - private static final Object LOGINLOCK = new Object(); - private static int simultanpremium = 1; + private static final Object LOGINLOCK = new Object(); + private static int simultanpremium = 1; @Override public void correctDownloadLink(DownloadLink link) { @@ -114,11 +117,11 @@ public class MegaPornCom extends PluginForHost { } } - private boolean onlyapi = false; + private boolean onlyapi = false; - private String wait = null; + private String wait = null; - private static String agent = RandomUserAgent.generate(); + private static String agent = RandomUserAgent.generate(); /* * every jd session starts with 1=default, because no waittime does not work @@ -127,9 +130,9 @@ public class MegaPornCom extends PluginForHost { * try to workaround the waittime, 0=no waittime, 1 = default, other = 60 * secs */ - private static int WaittimeWorkaround = 1; + private static int WaittimeWorkaround = 1; - private static final Object PREMLOCK = new Object(); + private static final Object PREMLOCK = new Object(); public MegaPornCom(final PluginWrapper wrapper) { super(wrapper); @@ -952,7 +955,7 @@ public class MegaPornCom extends PluginForHost { } private void setConfigElements() { - this.config.addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, this.getPluginConfig(), MU_PARAM_PORT, ports, JDL.L("plugins.host.megaporn.ports", "Use this port:")).setDefaultValue(0)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, this.getPluginConfig(), MU_PARAM_PORT, ports, JDL.L("plugins.host.megaporn.ports", "Use this port:")).setDefaultValue(0)); } public int usePort(final DownloadLink link) { diff --git a/src/jd/plugins/hoster/Megauploadcom.java b/src/jd/plugins/hoster/Megauploadcom.java index 461b8d4dfc..fd48832733 100644 --- a/src/jd/plugins/hoster/Megauploadcom.java +++ b/src/jd/plugins/hoster/Megauploadcom.java @@ -1009,7 +1009,7 @@ public class Megauploadcom extends PluginForHost { } private void setConfigElements() { - this.config.addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, this.getPluginConfig(), Megauploadcom.MU_PARAM_PORT, Megauploadcom.ports, JDL.L("plugins.host.megaupload.ports", "Use this port:")).setDefaultValue(0)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, this.getPluginConfig(), Megauploadcom.MU_PARAM_PORT, Megauploadcom.ports, JDL.L("plugins.host.megaupload.ports", "Use this port:")).setDefaultValue(0)); } public int usePort(final DownloadLink link) { diff --git a/src/jd/plugins/hoster/ModDbCom.java b/src/jd/plugins/hoster/ModDbCom.java index dd97610ad3..f5ee4ab425 100644 --- a/src/jd/plugins/hoster/ModDbCom.java +++ b/src/jd/plugins/hoster/ModDbCom.java @@ -39,7 +39,7 @@ public class ModDbCom extends PluginForHost { setConfigElements(); } - private static final String moddbservers = "moddbservers"; + private static final String moddbservers = "moddbservers"; /** The list of server values displayed to the user */ private static final String[] servers; @@ -49,7 +49,7 @@ public class ModDbCom extends PluginForHost { } private void setConfigElements() { - config.addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, getPluginConfig(), moddbservers, servers, JDL.L("plugins.host.L4dMapsCom.servers", "Use this server:")).setDefaultValue(0)); + getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_COMBOBOX_INDEX, getPluginConfig(), moddbservers, servers, JDL.L("plugins.host.L4dMapsCom.servers", "Use this server:")).setDefaultValue(0)); } private int getConfiguredServer() { @@ -99,12 +99,12 @@ public class ModDbCom extends PluginForHost { return AvailableStatus.TRUE; } - private String FDCCDNREGEX1 = "Mirror provided by FDCCDN.*? plugins = HostPluginController.getInstance().list(); + ArrayList plugins = new ArrayList(HostPluginController.getInstance().list()); Collections.sort(plugins, new Comparator() { public int compare(LazyHostPlugin a, LazyHostPlugin b) { return a.getHost().compareToIgnoreCase(b.getHost()); diff --git a/src/org/jdownloader/extensions/jdpremclient/PremiumCompoundExtension.java b/src/org/jdownloader/extensions/jdpremclient/PremiumCompoundExtension.java index f6ef0b6677..2bd3967277 100644 --- a/src/org/jdownloader/extensions/jdpremclient/PremiumCompoundExtension.java +++ b/src/org/jdownloader/extensions/jdpremclient/PremiumCompoundExtension.java @@ -62,7 +62,9 @@ public class PremiumCompoundExtension extends AbstractExtension all = JDUtilities.getPremiumPluginsForHost(); - for (String key : premShareHosts.keySet()) { - if (AccountController.getInstance().hasAccounts(key)) { - for (HostPluginWrapper plugin : all) { - /* we do not replace youtube */ - if (plugin.getHost().contains("youtube")) continue; - /* and no DIRECTHTTP */ - if (plugin.getHost().contains("DIRECTHTTP") || plugin.getHost().contains("http links")) continue; - /* and no ftp */ - if (plugin.getHost().contains("ftp")) continue; - /* do not replace the premshare plugins ;) */ - if (premShareHosts.containsKey(plugin.getHost()) && plugin.getPattern().pattern().startsWith("NEVERUSETHISREGEX" + plugin.getHost())) { - continue; - } - replaceHosterPlugin(plugin.getHost(), premShareHosts.get(key)); - } - PluginForHost ret = JDUtilities.getPluginForHost(key); - if (ret != null && ret instanceof JDPremInterface) { - ((JDPremInterface) ret).enablePlugin(); - } - } - } + // ArrayList all = + // JDUtilities.getPremiumPluginsForHost(); + // for (String key : premShareHosts.keySet()) { + // if (AccountController.getInstance().hasAccounts(key)) { + // for (HostPluginWrapper plugin : all) { + // /* we do not replace youtube */ + // if (plugin.getHost().contains("youtube")) continue; + // /* and no DIRECTHTTP */ + // if (plugin.getHost().contains("DIRECTHTTP") || + // plugin.getHost().contains("http links")) continue; + // /* and no ftp */ + // if (plugin.getHost().contains("ftp")) continue; + // /* do not replace the premshare plugins ;) */ + // if (premShareHosts.containsKey(plugin.getHost()) && + // plugin.getPattern().pattern().startsWith("NEVERUSETHISREGEX" + // + plugin.getHost())) { + // continue; + // } + // replaceHosterPlugin(plugin.getHost(), + // premShareHosts.get(key)); + // } + // PluginForHost ret = JDUtilities.getPluginForHost(key); + // if (ret != null && ret instanceof JDPremInterface) { + // ((JDPremInterface) ret).enablePlugin(); + // } + // } + // } replaced = true; } if (replaced) { @@ -253,12 +260,15 @@ public class PremiumCompoundExtension extends AbstractExtension[ ]+.*?[ ].*?[ ]+(\\d+\\.?\\d?[K|M|G]?)").getMatch(0))); - dLink.setBrowserUrl(source); - dLink.setAvailable(true); - dLink.setProperty(PROPERTY_DOWNLOADDIR, downloadDir); - - fp.add(dLink); - - result.add(dLink); + // dLink = new DownloadLink(hpw.getPlugin(), link, + // hpw.getHost(), source + link, true); + // dLink.setFinalFileName(link); + // dLink.setDownloadSize(getSize(new Regex(page, link + + // "[ ]+.*?[ ].*?[ ]+(\\d+\\.?\\d?[K|M|G]?)").getMatch(0))); + // dLink.setBrowserUrl(source); + // dLink.setAvailable(true); + // dLink.setProperty(PROPERTY_DOWNLOADDIR, downloadDir); + // + // fp.add(dLink); + // + // result.add(dLink); } } @@ -159,16 +159,18 @@ public class LecturnityDownloaderExtension extends AbstractExtension { } public T newInstance() { - try { getConstructor(); return constructor.newInstance(constructorParameters); - } catch (InstantiationException e) { - throw new WTFException(e); - } catch (IllegalAccessException e) { - throw new WTFException(e); - } catch (IllegalArgumentException e) { - throw new WTFException(e); - } catch (InvocationTargetException e) { + } catch (final Throwable e) { throw new WTFException(e); } @@ -83,17 +75,15 @@ public abstract class LazyPlugin { try { constructor = getPluginClass().getConstructor(new Class[] {}); constructorParameters = EMPTY; - } catch (NoSuchMethodException e) { + } catch (Throwable e) { try { constructor = getPluginClass().getConstructor(new Class[] { PluginWrapper.class }); - constructorParameters = OLD; - } catch (NoSuchMethodException e1) { - throw new WTFException(e1); - } catch (SecurityException e1) { - throw new WTFException(e1); + constructorParameters = new Object[] { new PluginWrapper(this) { + + } }; + } catch (final Throwable e2) { + throw new WTFException(e2); } - } catch (SecurityException e) { - throw new WTFException(e); } return constructor; } @@ -103,13 +93,10 @@ public abstract class LazyPlugin { protected Class getPluginClass() { if (pluginClass != null) return pluginClass; synchronized (this) { - // try again synched if (pluginClass != null) return pluginClass; try { - System.out.println("Load Plugin:" + classname); - pluginClass = (Class) PluginClassLoader.getInstance().loadClass(classname); - } catch (ClassNotFoundException e) { + } catch (Throwable e) { throw new WTFException(e); } return pluginClass; diff --git a/src/org/jdownloader/plugins/controller/crawler/CrawlerPluginController.java b/src/org/jdownloader/plugins/controller/crawler/CrawlerPluginController.java index 4860c3fb4d..fef426e4df 100644 --- a/src/org/jdownloader/plugins/controller/crawler/CrawlerPluginController.java +++ b/src/org/jdownloader/plugins/controller/crawler/CrawlerPluginController.java @@ -2,8 +2,11 @@ package org.jdownloader.plugins.controller.crawler; import java.net.MalformedURLException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.List; +import jd.DecryptPluginWrapper; import jd.JDInitFlags; import jd.PluginWrapper; import jd.plugins.DecrypterPlugin; @@ -32,140 +35,142 @@ public class CrawlerPluginController extends PluginController return CrawlerPluginController.INSTANCE; } - private HashMap classNameMap; - private ArrayList list; + private HashMap crawlerPluginMap; + private List list; /** * Create a new instance of HostPluginController. This is a singleton class. * Access the only existing instance by using {@link #getInstance()}. */ private CrawlerPluginController() { - this.classNameMap = new HashMap(); - this.list = new ArrayList(); + crawlerPluginMap = new HashMap(); + list = null; } public void init() { - - if (JDInitFlags.REFRESH_CACHE || JDInitFlags.SWITCH_RETURNED_FROM_UPDATE) { - long t = System.currentTimeMillis(); - try { - update(); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - System.out.println("Crawler Plugin Scanner Loader: " + (System.currentTimeMillis() - t)); - } else { - // from cache - long t = System.currentTimeMillis(); - loadFromCache(); - System.out.println("Crawler Plugin Cached Loader: " + (System.currentTimeMillis() - t)); - if (list.size() == 0) { - // cache empty or damaged? - t = System.currentTimeMillis(); + List plugins = new ArrayList(); + final long t = System.currentTimeMillis(); + try { + if (JDInitFlags.REFRESH_CACHE || JDInitFlags.SWITCH_RETURNED_FROM_UPDATE) { try { - update(); - } catch (MalformedURLException e) { - e.printStackTrace(); + /* do a fresh scan */ + plugins = update(); + } catch (Throwable e) { + Log.L.severe("@CrawlerPluginController: update failed!"); + Log.exception(e); + } + } else { + /* try to load from cache */ + try { + plugins = loadFromCache(); + } catch (Throwable e) { + Log.L.severe("@CrawlerPluginController: cache failed!"); + Log.exception(e); + } + if (plugins.size() == 0) { + try { + /* do a fresh scan */ + plugins = update(); + } catch (Throwable e) { + Log.L.severe("@CrawlerPluginController: update failed!"); + e.printStackTrace(); + } } - System.out.println("Crawler Plugin Scanner Loader: " + (System.currentTimeMillis() - t)); } + } finally { + System.out.println("@CrawlerPluginController: init " + (System.currentTimeMillis() - t)); } - + if (plugins.size() == 0) { + Log.L.severe("@CrawlerPluginController: WTF, no plugins!"); + } + list = Collections.unmodifiableList(plugins); for (LazyCrawlerPlugin l : list) { - classNameMap.put(l.getClassname(), l); + crawlerPluginMap.put(l.getDisplayName(), l); } - System.out.println(list); - } - private void loadFromCache() { - + private List loadFromCache() { + List ret = new ArrayList(); for (AbstractCrawlerPlugin ap : JSonStorage.restoreFrom(Application.getResource(CACHE_PATH), false, KEY, new TypeRef>() { }, new ArrayList())) { LazyCrawlerPlugin l = new LazyCrawlerPlugin(ap); - list.add(l); + ret.add(l); } - + return ret; } static public byte[] KEY = new byte[] { 0x01, 0x03, 0x11, 0x01, 0x01, 0x54, 0x01, 0x01, 0x01, 0x01, 0x12, 0x01, 0x01, 0x01, 0x22, 0x01 }; - private void update() throws MalformedURLException { + private List update() throws MalformedURLException { + List ret = new ArrayList(); ArrayList save = new ArrayList(); for (PluginInfo c : scan(PLUGIN_FOLDER_PATH)) { - DecrypterPlugin a = c.getClazz().getAnnotation(DecrypterPlugin.class); if (a != null) { - String[] names = a.names(); - String[] patterns = a.urls(); - if (names.length == 0) { - try { + try { + String[] names = a.names(); + String[] patterns = a.urls(); + if (names.length == 0) { + /* create multiple crawler plugins from one source */ patterns = (String[]) c.getClazz().getDeclaredMethod("getAnnotationUrls", new Class[] {}).invoke(null, new Object[] {}); names = (String[]) c.getClazz().getDeclaredMethod("getAnnotationNames", new Class[] {}).invoke(null, new Object[] {}); - - } catch (Throwable e) { - Log.exception(e); } - } - - if (names.length > 0) { throw new WTFException(); } - for (int i = 0; i < names.length; i++) { - try { - AbstractCrawlerPlugin ap = new AbstractCrawlerPlugin(c.getClazz().getSimpleName()); - ap.setDisplayName(names[i]); - ap.setPattern(patterns[i]); - PluginForDecrypt plg; + if (patterns.length != names.length) throw new WTFException("names.length != patterns.length"); + if (names.length == 0) { throw new WTFException("names.length=0"); } + for (int i = 0; i < names.length; i++) { try { - plg = (PluginForDecrypt) c.getClazz().newInstance(); - } catch (java.lang.InstantiationException e) { - plg = (PluginForDecrypt) c.getClazz().getConstructor(new Class[] { PluginWrapper.class }).newInstance(new Object[] { null }); + AbstractCrawlerPlugin ap = new AbstractCrawlerPlugin(c.getClazz().getSimpleName()); + ap.setDisplayName(names[i]); + ap.setPattern(patterns[i]); + PluginForDecrypt plg = null; + try { + plg = (PluginForDecrypt) c.getClazz().newInstance(); + } catch (java.lang.InstantiationException e) { + plg = (PluginForDecrypt) c.getClazz().getConstructor(new Class[] { PluginWrapper.class }).newInstance(new DecryptPluginWrapper(names[i], c.getClazz().getSimpleName(), patterns[i], 0, a.revision())); + } + LazyCrawlerPlugin l = new LazyCrawlerPlugin(ap, c.getClazz(), plg); + ret.add(l); + save.add(ap); + Log.L.severe("@CrawlerPlugin ok:" + c); + } catch (Throwable e) { + Log.L.severe("@CrawlerPlugin failed:" + c + ":" + names[i]); + Log.exception(e); } - - LazyCrawlerPlugin l = new LazyCrawlerPlugin(ap, c.getClazz(), plg); - list.add(l); - save.add(ap); - - } catch (Throwable e) { - e.printStackTrace(); } - + } catch (final Throwable e) { + Log.L.severe("@CrawlerPlugin failed:" + c); + Log.exception(e); } - System.out.println(c); - } else { - Log.L.severe("@HostPlugin missing for " + c); + Log.L.severe("@CrawlerPlugin missing:" + c); } } save(save); - + return ret; } - private void save(ArrayList save) { + private void save(List save) { JSonStorage.saveTo(Application.getResource(CACHE_PATH), false, KEY, JSonStorage.serializeToJson(save)); } private static final String PLUGIN_FOLDER_PATH = "jd/plugins/decrypter"; - public ArrayList list() { + public List list() { + lazyInit(); return list; } - public LazyCrawlerPlugin get(Class class1) { - return classNameMap.get(class1.getName()); - } - - @SuppressWarnings("unchecked") - public T newInstance(Class class1) { - - return (T) get(class1).newInstance(); - } - - public boolean canHandle(String data) { - ArrayList list = this.list; - for (LazyCrawlerPlugin l : list) { - if (l.canHandle(data)) return true; + private void lazyInit() { + if (list != null) return; + synchronized (this) { + if (list != null) return; + init(); } - return false; + } + + public LazyCrawlerPlugin get(String displayName) { + lazyInit(); + return crawlerPluginMap.get(displayName); } } diff --git a/src/org/jdownloader/plugins/controller/crawler/LazyCrawlerPlugin.java b/src/org/jdownloader/plugins/controller/crawler/LazyCrawlerPlugin.java index c6dd14b65f..e5f08e9e6b 100644 --- a/src/org/jdownloader/plugins/controller/crawler/LazyCrawlerPlugin.java +++ b/src/org/jdownloader/plugins/controller/crawler/LazyCrawlerPlugin.java @@ -20,4 +20,10 @@ public class LazyCrawlerPlugin extends LazyPlugin { super(ap.getPattern(), JD_PLUGINS_DECRYPTER + ap.getClassname(), ap.getDisplayName()); } + @Override + public PluginForDecrypt newInstance() { + PluginForDecrypt ret = super.newInstance(); + ret.setLazyC(this); + return ret; + } } diff --git a/src/org/jdownloader/plugins/controller/host/HostPluginController.java b/src/org/jdownloader/plugins/controller/host/HostPluginController.java index 6e9124fde7..915ea5e3e1 100644 --- a/src/org/jdownloader/plugins/controller/host/HostPluginController.java +++ b/src/org/jdownloader/plugins/controller/host/HostPluginController.java @@ -2,15 +2,17 @@ package org.jdownloader.plugins.controller.host; import java.net.MalformedURLException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.List; import jd.JDInitFlags; import jd.PluginWrapper; import jd.nutils.encoding.Encoding; import jd.plugins.HostPlugin; import jd.plugins.PluginForHost; -import jd.plugins.PluginForHost; +import org.appwork.exceptions.WTFException; import org.appwork.storage.JSonStorage; import org.appwork.storage.TypeRef; import org.appwork.utils.Application; @@ -33,140 +35,144 @@ public class HostPluginController extends PluginController { return HostPluginController.INSTANCE; } - private HashMap classNameMap; - private ArrayList list; + private HashMap hosterPluginMap; + private List list; /** * Create a new instance of HostPluginController. This is a singleton class. * Access the only existing instance by using {@link #getInstance()}. */ private HostPluginController() { - this.classNameMap = new HashMap(); - this.list = new ArrayList(); + this.hosterPluginMap = new HashMap(); + this.list = null; } public void init() { - - if (JDInitFlags.REFRESH_CACHE || JDInitFlags.SWITCH_RETURNED_FROM_UPDATE) { - long t = System.currentTimeMillis(); - try { - update(); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - System.out.println("Plugin Scanner Loader: " + (System.currentTimeMillis() - t)); - } else { - // from cache - long t = System.currentTimeMillis(); - loadFromCache(); - System.out.println("Plugin Cached Loader: " + (System.currentTimeMillis() - t)); - if (list.size() == 0) { - // cache empty or damaged? - t = System.currentTimeMillis(); + List plugins = new ArrayList(); + final long t = System.currentTimeMillis(); + try { + if (JDInitFlags.REFRESH_CACHE || JDInitFlags.SWITCH_RETURNED_FROM_UPDATE) { try { - update(); - } catch (MalformedURLException e) { - e.printStackTrace(); + /* do a fresh scan */ + plugins = update(); + } catch (Throwable e) { + Log.L.severe("@HostPluginController: update failed!"); + Log.exception(e); + } + } else { + /* try to load from cache */ + try { + plugins = loadFromCache(); + } catch (Throwable e) { + Log.L.severe("@HostPluginController: cache failed!"); + Log.exception(e); + } + if (plugins.size() == 0) { + try { + /* do a fresh scan */ + plugins = update(); + } catch (Throwable e) { + Log.L.severe("@HostPluginController: update failed!"); + e.printStackTrace(); + } } - System.out.println("Plugin Scanner Loader: " + (System.currentTimeMillis() - t)); } + } finally { + System.out.println("@HostPluginController: init " + (System.currentTimeMillis() - t)); } - + if (plugins.size() == 0) { + Log.L.severe("@HostPluginController: WTF, no plugins!"); + } + list = Collections.unmodifiableList(plugins); for (LazyHostPlugin l : list) { - classNameMap.put(l.getClassname(), l); + hosterPluginMap.put(l.getDisplayName(), l); } - System.out.println(list); - } - private void loadFromCache() { - + private List loadFromCache() { + List ret = new ArrayList(); for (AbstractHostPlugin ap : JSonStorage.restoreFrom(Application.getResource(TMP_HOSTS_JSON), true, null, new TypeRef>() { }, new ArrayList())) { LazyHostPlugin l = new LazyHostPlugin(ap); - list.add(l); + ret.add(l); } - + return ret; } - private void update() throws MalformedURLException { + private List update() throws MalformedURLException { + List ret = new ArrayList(); ArrayList save = new ArrayList(); for (PluginInfo c : scan(HOSTERPATH)) { - HostPlugin a = c.getClazz().getAnnotation(HostPlugin.class); if (a != null) { - String[] names = a.names(); - String[] patterns = a.urls(); - if (names.length == 0) { - try { + try { + String[] names = a.names(); + String[] patterns = a.urls(); + if (names.length == 0) { + /* create multiple hoster plugins from one source */ patterns = (String[]) c.getClazz().getDeclaredMethod("getAnnotationUrls", new Class[] {}).invoke(null, new Object[] {}); names = (String[]) c.getClazz().getDeclaredMethod("getAnnotationNames", new Class[] {}).invoke(null, new Object[] {}); - - } catch (Throwable e) { - Log.exception(e); } - } - - for (int i = 0; i < names.length; i++) { - try { - AbstractHostPlugin ap = new AbstractHostPlugin(c.getClazz().getSimpleName()); - ap.setDisplayName(names[i]); - ap.setPattern(patterns[i]); - PluginForHost plg; + if (patterns.length != names.length) throw new WTFException("names.length != patterns.length"); + if (names.length == 0) { throw new WTFException("names.length=0"); } + for (int i = 0; i < names.length; i++) { try { - plg = (PluginForHost) c.getClazz().newInstance(); - } catch (java.lang.InstantiationException e) { - plg = (PluginForHost) c.getClazz().getConstructor(new Class[] { PluginWrapper.class }).newInstance(null); + AbstractHostPlugin ap = new AbstractHostPlugin(c.getClazz().getSimpleName()); + ap.setDisplayName(names[i]); + ap.setPattern(patterns[i]); + PluginForHost plg; + try { + plg = (PluginForHost) c.getClazz().newInstance(); + } catch (java.lang.InstantiationException e) { + plg = (PluginForHost) c.getClazz().getConstructor(new Class[] { PluginWrapper.class }).newInstance(null); + } + ap.setPremium(plg.isPremiumEnabled()); + String purl = plg.getBuyPremiumUrl(); + if (purl != null && purl.startsWith(HTTP_JDOWNLOADER_ORG_R_PHP_U)) { + purl = Encoding.urlDecode(purl.substring(HTTP_JDOWNLOADER_ORG_R_PHP_U.length()), false); + } + ap.setPremiumUrl(purl); + LazyHostPlugin l = new LazyHostPlugin(ap, c.getClazz(), plg); + list.add(l); + save.add(ap); + Log.L.severe("@HostPlugin ok:" + c); + } catch (Throwable e) { + Log.L.severe("@HostPlugin failed:" + c + ":" + names[i]); + Log.exception(e); } - ap.setPremium(plg.isPremiumEnabled()); - String purl = plg.getBuyPremiumUrl(); - if (purl != null && purl.startsWith(HTTP_JDOWNLOADER_ORG_R_PHP_U)) { - purl = Encoding.urlDecode(purl.substring(HTTP_JDOWNLOADER_ORG_R_PHP_U.length()), false); - } - ap.setPremiumUrl(purl); - LazyHostPlugin l = new LazyHostPlugin(ap, c.getClazz(), plg); - list.add(l); - save.add(ap); - - } catch (Throwable e) { - e.printStackTrace(); } - + } catch (final Throwable e) { + Log.L.severe("@HostPlugin failed:" + c); + Log.exception(e); } - System.out.println(c); - } else { - Log.L.severe("@HostPlugin missing for " + c); + Log.L.severe("@HostPlugin missing:" + c); } } save(save); - + return ret; } - private void save(ArrayList save) { + private void save(List save) { JSonStorage.saveTo(Application.getResource(TMP_HOSTS_JSON), save); } - public ArrayList list() { + public List list() { + lazyInit(); return list; } - public LazyHostPlugin get(Class class1) { - return classNameMap.get(class1.getName()); - } - - @SuppressWarnings("unchecked") - public T newInstance(Class class1) { - - return (T) get(class1).newInstance(); - } - - public boolean canHandle(String data) { - ArrayList list = this.list; - for (LazyHostPlugin l : list) { - if (l.canHandle(data)) return true; + private void lazyInit() { + if (list != null) return; + synchronized (this) { + if (list != null) return; + init(); } - return false; + } + + public LazyHostPlugin get(String displayName) { + lazyInit(); + return hosterPluginMap.get(displayName); } private static final String HOSTERPATH = "jd/plugins/hoster"; diff --git a/src/org/jdownloader/plugins/controller/host/LazyHostPlugin.java b/src/org/jdownloader/plugins/controller/host/LazyHostPlugin.java index 28428a88f3..00ea4d4b8d 100644 --- a/src/org/jdownloader/plugins/controller/host/LazyHostPlugin.java +++ b/src/org/jdownloader/plugins/controller/host/LazyHostPlugin.java @@ -57,4 +57,11 @@ public class LazyHostPlugin extends LazyPlugin { return DomainInfo.getInstance(getDisplayName()).getFavIcon(); } + @Override + public PluginForHost newInstance() { + PluginForHost ret = super.newInstance(); + ret.setLazyP(this); + return ret; + } + }