http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/tools/eclipse-formatter-style.xml ---------------------------------------------------------------------- diff --git a/sortmelatter/tools/eclipse-formatter-style.xml b/sortmelatter/tools/eclipse-formatter-style.xml new file mode 100644 index 0000000..cd698ca --- /dev/null +++ b/sortmelatter/tools/eclipse-formatter-style.xml @@ -0,0 +1,291 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<profiles version="12"> +<profile kind="CodeFormatterProfile" name="WaveStyle" version="12"> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> +<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="100"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/> +<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/> +<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> +<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> +<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/> +<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> +</profile> +</profiles>
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.examples.img.Img_Example-launch ---------------------------------------------------------------------- diff --git a/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.examples.img.Img_Example-launch b/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.examples.img.Img_Example-launch new file mode 100644 index 0000000..473507c --- /dev/null +++ b/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.examples.img.Img_Example-launch @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> + +<launchConfiguration type="com.google.gdt.eclipse.suite.webapp"> +<stringAttribute key="bad_container_name" value="/WPL-wpl1/tool"/> +<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/> +<stringAttribute key="com.google.gwt.eclipse.core.URL" value="http://localhost:8888/org.waveprotocol.wave.client.editor.examples.img.TestModule/?gwt.codesvr=127.0.0.1:9997"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/WPL-wpl1"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-logLevel INFO -port 8888 http://localhost:8888/org.waveprotocol.wave.client.editor.examples.img.TestModule/?gwt.codesvr=127.0.0.1:9997"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="WPL-wpl1"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/> +</launchConfiguration> http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.harness.EditorTest-launch ---------------------------------------------------------------------- diff --git a/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.harness.EditorTest-launch b/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.harness.EditorTest-launch new file mode 100644 index 0000000..5ab0f40 --- /dev/null +++ b/sortmelatter/tools/eclipse-launch/src.org.waveprotocol.wave.client.editor.harness.EditorTest-launch @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> + +<launchConfiguration type="com.google.gdt.eclipse.suite.webapp"> +<stringAttribute key="bad_container_name" value="/WPL-wpl1/tool"/> +<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/> +<stringAttribute key="com.google.gwt.eclipse.core.URL" value="http://localhost:8888/org.waveprotocol.wave.client.editor.harness.EditorTest/EditorTest.html?gwt.codesvr=127.0.0.1:9997"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/WPL-wpl1"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-logLevel INFO -port 8888 http://localhost:8888/org.waveprotocol.wave.client.editor.harness.EditorTest/EditorTest.html?gwt.codesvr=127.0.0.1:9997"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="WPL-wpl1"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/> +</launchConfiguration> http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/tools/eclipse.sh ---------------------------------------------------------------------- diff --git a/sortmelatter/tools/eclipse.sh b/sortmelatter/tools/eclipse.sh new file mode 100755 index 0000000..10065c1 --- /dev/null +++ b/sortmelatter/tools/eclipse.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Simple utility to setup an eclipse project +# Author: [email protected] + +set -e + +if [ ! -d 'src' -o ! -d 'test' ]; then + echo 'Must run from root directory of checkout' + exit 1 +fi + +HERE=`pwd` +NAME=`basename "$HERE"` +echo "Creating .project" +sed -e "s/PROJECT_NAME/WPL-$NAME/" .project_template > .project + +for f in tools/eclipse-launch/*; do + dest=`echo \`basename "$f"\` | sed -e 's|\.|/|g;s|-|.|g'` + echo "Creating $dest" + cp "$f" "$dest" +done http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/war/.gitignore ---------------------------------------------------------------------- diff --git a/sortmelatter/war/.gitignore b/sortmelatter/war/.gitignore new file mode 100755 index 0000000..ae6bc80 --- /dev/null +++ b/sortmelatter/war/.gitignore @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +/webclient http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/war/static/auth.css ---------------------------------------------------------------------- diff --git a/sortmelatter/war/static/auth.css b/sortmelatter/war/static/auth.css new file mode 100644 index 0000000..6159759 --- /dev/null +++ b/sortmelatter/war/static/auth.css @@ -0,0 +1,136 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ +body { + background-color: #ffffff margin-top : 2; +} + +body { + font-family: arial, sans-serif; +} + +#wiab_loginform { + margin: 0; +} + +#wiab_loginbox_td { + padding-right: 10px; +} + +.form-noindent { + border: #0066cc 2px solid; + background-color: white; +} + +.bubble { + background-color: #62c4fb; +} + +.tl { + font-size: 1px; + padding: 0; + width: 4; + text-align: left; + vertical-align: top +} + +.tr { + font-size: 1px; + padding: 0; + width: 2; + text-align: right; + vertical-align: top +} + +.bl { + font-size: 1px; + padding: 0; + width: 4; + text-align: left; + vertical-align: bottom +} + +.br { + font-size: 1px; + padding: 0; + width: 4; + text-align: right; + vertical-align: bottom +} + +.loginBox { + padding: 5px 5px 20px; + margin: 0; + text-align: center; + background-color: #d3d4d6; +} + +.loginBox td { + padding-bottom: 5px; +} + +.loginBox td.smallfont { + font-size: 80%; +} + +.loginBox h2 { + margin: 0; + font-weight: bold; + font-size: 120%; +} + +.loginBox table { + margin: 0; + text-align: left; +} + +.loginBox p { + text-align: left; +} + +.alBox { + padding: 5px 10px; + margin: 0; +} + +.alBox h4 { + margin: 0; + font-size: 80%; +} + +.wiab.le.lbl { + font-family: Arial, Helvetica, sans-serif; + font-size: smaller; +} + +.wiab.le.val { + font-family: Arial, Helvetica, sans-serif; + font-size: smaller; +} + +.wiab.le.button { + font-family: Arial, Helvetica, sans-serif; + font-size: smaller; +} + +.icon { + float: left; + margin-right: 5px; + width: 28px; +} + http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/war/static/favicon.ico ---------------------------------------------------------------------- diff --git a/sortmelatter/war/static/favicon.ico b/sortmelatter/war/static/favicon.ico new file mode 100644 index 0000000..22290ee Binary files /dev/null and b/sortmelatter/war/static/favicon.ico differ http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/war/static/images/unknown.jpg ---------------------------------------------------------------------- diff --git a/sortmelatter/war/static/images/unknown.jpg b/sortmelatter/war/static/images/unknown.jpg new file mode 100644 index 0000000..0f39513 Binary files /dev/null and b/sortmelatter/war/static/images/unknown.jpg differ http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/war/static/logo.png ---------------------------------------------------------------------- diff --git a/sortmelatter/war/static/logo.png b/sortmelatter/war/static/logo.png new file mode 100644 index 0000000..48ac016 Binary files /dev/null and b/sortmelatter/war/static/logo.png differ http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/war/static/wiab_screenshot.jpg ---------------------------------------------------------------------- diff --git a/sortmelatter/war/static/wiab_screenshot.jpg b/sortmelatter/war/static/wiab_screenshot.jpg new file mode 100644 index 0000000..e89518f Binary files /dev/null and b/sortmelatter/war/static/wiab_screenshot.jpg differ http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/war/static/wiab_screenshot_small.jpg ---------------------------------------------------------------------- diff --git a/sortmelatter/war/static/wiab_screenshot_small.jpg b/sortmelatter/war/static/wiab_screenshot_small.jpg new file mode 100644 index 0000000..e36a74d Binary files /dev/null and b/sortmelatter/war/static/wiab_screenshot_small.jpg differ http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/sortmelatter/wiab-logging.conf ---------------------------------------------------------------------- diff --git a/sortmelatter/wiab-logging.conf b/sortmelatter/wiab-logging.conf new file mode 100644 index 0000000..efad66c --- /dev/null +++ b/sortmelatter/wiab-logging.conf @@ -0,0 +1,47 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# This file sets up console and file logging for the wiab server + +handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler + +# Available log levels are: +# ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF + +# Default global logging level. +# Loggers and Handlers may override this level +.level=INFO + +java.util.logging.ConsoleHandler.level = INFO +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter + +java.util.logging.FileHandler.level = ALL +java.util.logging.FileHandler.pattern = wiab-server.log +java.util.logging.FileHandler.count=5 +java.util.logging.FileHandler.append=false +java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter +java.util.logging.FileHandler.limit=5242880 + +# Per-package logging levels. +# Add extra packages here to increase or decrease the log level +# per-package levels affect both console and file output + +org.eclipse.jetty.level = SEVERE +org.eclipse.jetty.websocket.level = SEVERE + +#org.waveprotocol.level=ALL + http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/gwt/build.xml ---------------------------------------------------------------------- diff --git a/src/com/google/gwt/build.xml b/src/com/google/gwt/build.xml deleted file mode 100644 index 552249e..0000000 --- a/src/com/google/gwt/build.xml +++ /dev/null @@ -1,25 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - --> -<project name="gwt-util"> - <import file="${build.common.path}"/> - <property name="libname" value="gwt-util"/> - <patternset id="srcs"> - <include name="com/google/gwt/**"/> - </patternset> -</project> http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/gwt/websockets/WebSockets.gwt.xml ---------------------------------------------------------------------- diff --git a/src/com/google/gwt/websockets/WebSockets.gwt.xml b/src/com/google/gwt/websockets/WebSockets.gwt.xml deleted file mode 100644 index 170190d..0000000 --- a/src/com/google/gwt/websockets/WebSockets.gwt.xml +++ /dev/null @@ -1,21 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - --> -<module> - <inherits name="com.google.gwt.core.CompilerParameters"/> -</module> http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/gwt/websockets/client/WebSocket.java ---------------------------------------------------------------------- diff --git a/src/com/google/gwt/websockets/client/WebSocket.java b/src/com/google/gwt/websockets/client/WebSocket.java deleted file mode 100644 index e326998..0000000 --- a/src/com/google/gwt/websockets/client/WebSocket.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.google.gwt.websockets.client; - -import com.google.gwt.core.client.JavaScriptObject; - -public class WebSocket { - private final static class WebSocketImpl extends JavaScriptObject { - public static native WebSocketImpl create(WebSocket client, String server) - /*-{ - var ws = new WebSocket(server); - ws.onopen = $entry(function() { - [email protected]::onOpen()(); - }); - ws.onmessage = $entry(function(response) { - [email protected]::onMessage(Ljava/lang/String;)(response.data); - }); - ws.onclose = $entry(function() { - [email protected]::onClose()(); - }); - return ws; - }-*/; - - public static native boolean isSupported() /*-{return !!window.WebSocket;}-*/; - - protected WebSocketImpl() { - } - - public native void close() /*-{this.close();}-*/; - - public native void send(String data) /*-{this.send(data);}-*/; - } - - private final WebSocketCallback callback; - private WebSocketImpl webSocket; - - public WebSocket(WebSocketCallback callback) { - this.callback = callback; - } - - public void close() { - if (webSocket == null) { - throw new IllegalStateException("Not connected"); - } - webSocket.close(); - webSocket = null; - } - - public void connect(String server) { - if (!WebSocketImpl.isSupported()) { - throw new RuntimeException("No WebSocket support"); - } - webSocket = WebSocketImpl.create(this, server); - } - - public void send(String data) { - if (webSocket == null) { - throw new IllegalStateException("Not connected"); - } - webSocket.send(data); - } - - @SuppressWarnings("unused") - private void onClose() { - callback.onDisconnect(); - } - - @SuppressWarnings("unused") - private void onMessage(String message) { - callback.onMessage(message); - } - - @SuppressWarnings("unused") - private void onOpen() { - callback.onConnect(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/gwt/websockets/client/WebSocketCallback.java ---------------------------------------------------------------------- diff --git a/src/com/google/gwt/websockets/client/WebSocketCallback.java b/src/com/google/gwt/websockets/client/WebSocketCallback.java deleted file mode 100644 index 595639f..0000000 --- a/src/com/google/gwt/websockets/client/WebSocketCallback.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.google.gwt.websockets.client; - -public interface WebSocketCallback { - void onConnect(); - void onDisconnect(); - void onMessage(String message); -} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/AbstractRobot.java ---------------------------------------------------------------------- diff --git a/src/com/google/wave/api/AbstractRobot.java b/src/com/google/wave/api/AbstractRobot.java deleted file mode 100644 index 435eab1..0000000 --- a/src/com/google/wave/api/AbstractRobot.java +++ /dev/null @@ -1,919 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package com.google.wave.api; - -import com.google.gson.Gson; -import com.google.wave.api.WaveService.ConsumerData; -import com.google.wave.api.event.AnnotatedTextChangedEvent; -import com.google.wave.api.event.BlipContributorsChangedEvent; -import com.google.wave.api.event.BlipSubmittedEvent; -import com.google.wave.api.event.DocumentChangedEvent; -import com.google.wave.api.event.Event; -import com.google.wave.api.event.EventHandler; -import com.google.wave.api.event.EventType; -import com.google.wave.api.event.FormButtonClickedEvent; -import com.google.wave.api.event.GadgetStateChangedEvent; -import com.google.wave.api.event.OperationErrorEvent; -import com.google.wave.api.event.WaveletBlipCreatedEvent; -import com.google.wave.api.event.WaveletBlipRemovedEvent; -import com.google.wave.api.event.WaveletCreatedEvent; -import com.google.wave.api.event.WaveletFetchedEvent; -import com.google.wave.api.event.WaveletParticipantsChangedEvent; -import com.google.wave.api.event.WaveletSelfAddedEvent; -import com.google.wave.api.event.WaveletSelfRemovedEvent; -import com.google.wave.api.event.WaveletTagsChangedEvent; -import com.google.wave.api.event.WaveletTitleChangedEvent; -import com.google.wave.api.impl.EventMessageBundle; -import com.google.wave.api.impl.GsonFactory; - -import net.oauth.OAuthException; - -import org.waveprotocol.wave.model.id.InvalidIdException; -import org.waveprotocol.wave.model.id.WaveId; -import org.waveprotocol.wave.model.id.WaveletId; - -import java.io.BufferedReader; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.HttpURLConnection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.logging.Logger; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * A robot is an automated participant on a wave, that can read the contents - * of a wave in which it participates, modify the wave's contents, add or remove - * participants, and create new blips and new waves. In short, a robot can - * perform many of the actions that any other participant can perform. - * - * This is the abstract base class for a Google Wave Java robot, that supports: - * <ul> - * <li>Automatic events deserialization and operations serialization, - * in the event based model</li> - * <li>OAuth-secured operations submission, in the active model</li> - * <li>Callback for profile request, including proxied/custom profile</li> - * <li>Callback for capabilities.xml support</li> - * <li>Callback for verification token request, that is used during the robot - * registration process, to obtain consumer key and secret</li> - * </ul> - * - * Robot should implements the handlers of the events that it's interested in, - * and specify the context and filter (if applicable) via the - * {@link EventHandler.Capability} annotation. For example, if it is interested - * in a {@link BlipSubmittedEvent}, and would like to get the parent blip with - * the incoming event bundle, then it should implement this method: - * <pre> - * @Capability(contexts = {Context.PARENT, Context.SELF}) - * public void onBlipSubmitted(BlipSubmittedEvent e) { - * ... - * } - * </pre> - * If the robot does not specify the {@link EventHandler.Capability} - * annotation, the default contexts (parent and children), and empty filter will - * be provided by default. - */ -public abstract class AbstractRobot extends HttpServlet implements EventHandler { - - /** Some mime types. */ - public static final String JSON_MIME_TYPE = "application/json; charset=utf-8"; - public static final String TEXT_MIME_TYPE = "text/plain"; - public static final String XML_MIME_TYPE = "application/xml"; - - /** Some constants for encoding. */ - public static final String UTF_8 = "UTF-8"; - - /** The query parameter to specify custom profile request. */ - public static final String NAME_QUERY_PARAMETER_KEY = "name"; - - /** The query parameter for security token. */ - public static final String SECURITY_TOKEN_PARAMETER_KEY = "st"; - - /** Various request path constants that the robot replies to. */ - public static final String RPC_PATH = "/_wave/robot/jsonrpc"; - public static final String PROFILE_PATH = "/_wave/robot/profile"; - public static final String CAPABILITIES_PATH = "/_wave/capabilities.xml"; - public static final String VERIFY_TOKEN_PATH = "/_wave/verify_token"; - public static final String DEFAULT_AVATAR = - "https://wave.google.com/a/wavesandbox.com/static/images/profiles/rusty.png"; - - private static final Logger LOG = Logger.getLogger(AbstractRobot.class.getName()); - - /** Serializer to serialize events and operations in the event-based mode. */ - private static final Gson SERIALIZER = new GsonFactory().create(); - - /** A map of this robot's capabilities. */ - private Map<String, Capability> capabilityMap; - - /** A version number that is computed from this robot's capabilities. */ - private String version; - - /** A utility class to make Wave service calls. */ - private WaveService waveService; - - /** The token used to verify author during the registration process. */ - private String verificationToken; - - /** The token that is checked when handling verification token request. */ - private String securityToken; - - private boolean allowUnsignedRequests = true; - - /** - * Constructor. - */ - protected AbstractRobot() { - initRobot(); - } - - /** - * Initializes the robot. Call it if required to re-compute robot's - * capabilities. Re-invoke {@link #setupOAuth} if needed. - */ - protected void initRobot() { - capabilityMap = computeCapabilityMap(); - version = computeHash(); - waveService = new WaveService(version); - } - - /** - * Submits the pending operations associated with this {@link Wavelet}. - * - * @param wavelet the bundle that contains the operations to be submitted. - * @param rpcServerUrl the active gateway to send the operations to. - * @return a list of {@link JsonRpcResponse} that represents the responses - * from the server for all operations that were submitted. - * - * @throws IllegalStateException if this method is called prior to setting - * the proper consumer key, secret, and handler URL. - * @throws IOException if there is a problem submitting the operations. - */ - public List<JsonRpcResponse> submit(Wavelet wavelet, String rpcServerUrl) throws IOException { - return waveService.submit(wavelet, rpcServerUrl); - } - - /** - * Returns an empty/blind stub of a wavelet with the given wave id and wavelet - * id. - * - * Call this method if you would like to apply wavelet-only operations - * without fetching the wave first. - * - * The returned wavelet has its own {@link OperationQueue}. It is the - * responsibility of the caller to make sure this wavelet gets submitted to - * the server, either by calling {@link AbstractRobot#submit(Wavelet, String)} - * or by calling {@link Wavelet#submitWith(Wavelet)} on the new wavelet, to - * join its queue with another wavelet, for example, the event wavelet. - * - * @param waveId the id of the wave. - * @param waveletId the id of the wavelet. - * @return a stub of a wavelet. - */ - public Wavelet blindWavelet(WaveId waveId, WaveletId waveletId) { - return waveService.blindWavelet(waveId, waveletId); - } - - /** - * @see #blindWavelet(WaveId, WaveletId) - * - * @param proxyForId the proxying information that should be set on the - * operation queue. Please note that this parameter should be properly - * encoded to ensure that the resulting participant id is valid - * (see {@link Util#checkIsValidProxyForId(String)} for more details). - */ - public Wavelet blindWavelet(WaveId waveId, WaveletId waveletId, String proxyForId) { - return waveService.blindWavelet(waveId, waveletId, proxyForId); - } - - /** - * @see #blindWavelet(WaveId, WaveletId, String) - * - * @param blips a collection of blips that belong to this wavelet. - */ - public Wavelet blindWavelet(WaveId waveId, WaveletId waveletId, String proxyForId, - Map<String, Blip> blips) { - return waveService.blindWavelet(waveId, waveletId, proxyForId, blips); - } - - /** - * @see #blindWavelet(WaveId, WaveletId, String, Map) - * - * @param threads a collection of threads that belong to this wavelet. - */ - public Wavelet blindWavelet(WaveId waveId, WaveletId waveletId, String proxyForId, - Map<String, Blip> blips, Map<String, BlipThread> threads) { - return waveService.blindWavelet(waveId, waveletId, proxyForId, blips, threads); - } - - /** - * Creates a new wave with a list of participants on it. - * - * The root wavelet of the new wave is returned with its own - * {@link OperationQueue}. It is the responsibility of the caller to make sure - * this wavelet gets submitted to the server, either by calling - * {@link AbstractRobot#submit(Wavelet, String)} or by calling - * {@link Wavelet#submitWith(Wavelet)} on the new wavelet. - * - * @param domain the domain to create the wavelet on. In general, this should - * correspond to the domain of the incoming event wavelet, except when - * the robot is calling this method outside of an event or when the server - * is handling multiple domains. - * @param participants the initial participants on the wave. The robot, as the - * creator of the wave, will be added by default. The order of the - * participants will be preserved. - */ - public Wavelet newWave(String domain, Set<String> participants) { - return waveService.newWave(domain, participants); - } - - /** - * @see #newWave(String, Set) - * - * @param proxyForId the proxy id that should be used to create the new wave. - * If specified, the creator of the wave would be - * robotid+<proxyForId>@appspot.com. Please note that this parameter - * should be properly encoded to ensure that the resulting participant id - * is valid (see {@link Util#checkIsValidProxyForId(String)} for more - * details). - */ - public Wavelet newWave(String domain, Set<String> participants, String proxyForId) { - return waveService.newWave(domain, participants, proxyForId); - } - - /** - * @see #newWave(String, Set, String) - * - * @param msg the message that will be passed back to the robot when - * WAVELET_CREATED event is fired as a result of this operation. - */ - public Wavelet newWave(String domain, Set<String> participants, String msg, String proxyForId) { - return waveService.newWave(domain, participants, msg, proxyForId); - } - - /** - * @see #newWave(String, Set, String, String) - * - * @param rpcServerUrl if specified, this operation will be submitted - * immediately to this active gateway, that will return immediately the - * actual wave id, the id of the root wavelet, and id of the root blip. - * - * @throws IOException if there is a problem submitting the operation to the - * server, when {@code submit} is {@code true}. - * @throws InvalidIdException - */ - public Wavelet newWave(String domain, Set<String> participants, String msg, String proxyForId, - String rpcServerUrl) throws IOException, InvalidIdException { - return waveService.newWave(domain, participants, msg, proxyForId, rpcServerUrl); - } - - - /** - * Requests SearchResult for a query. - * - * @param query the query to execute. - * @param index the index from which to return results. - * @param numresults the number of results to return. - * @param rpcServerUrl the active gateway. - * - * @throws IOException if remote server returns error. - */ - public SearchResult search(String query, Integer index, Integer numResults, String rpcServerUrl) - throws IOException { - SearchResult searchResult = waveService.search(query, index, numResults, rpcServerUrl); - return searchResult; - } - - /** - * Fetches a wavelet using the active API. - * - * The returned wavelet contains a snapshot of the state of the wavelet at - * that point. It can be used to modify the wavelet, but the wavelet might - * change in between, so treat carefully. - * - * Also, the returned wavelet has its own {@link OperationQueue}. It is the - * responsibility of the caller to make sure this wavelet gets submitted to - * the server, either by calling {@link AbstractRobot#submit(Wavelet, String)} - * or by calling {@link Wavelet#submitWith(Wavelet)} on the new wavelet. - * - * @param waveId the id of the wave to fetch. - * @param waveletId the id of the wavelet to fetch. - * @param rpcServerUrl the active gateway that is used to fetch the wavelet. - * - * @throws IOException if there is a problem fetching the wavelet. - */ - public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId, String rpcServerUrl) - throws IOException { - return waveService.fetchWavelet(waveId, waveletId, rpcServerUrl); - } - - /** - * @see #fetchWavelet(WaveId, WaveletId, String) - * - * @param proxyForId the proxy id that should be used to fetch this wavelet. - * Please note that this parameter should be properly encoded to ensure - * that the resulting participant id is valid (see - * {@link Util#checkIsValidProxyForId(String)} for more details). - */ - public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId, String proxyForId, - String rpcServerUrl) throws IOException { - return waveService.fetchWavelet(waveId, waveletId, proxyForId, rpcServerUrl); - } - - @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) { - if (req.getRequestURI().endsWith(RPC_PATH)) { - processRpc(req, resp); - } else { - resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); - } - } - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) { - String path = req.getRequestURI(); - if (path.endsWith(PROFILE_PATH)) { - processProfile(req, resp); - } else if (path.endsWith(CAPABILITIES_PATH)) { - processCapabilities(req, resp); - } else if (path.endsWith(VERIFY_TOKEN_PATH)) { - processVerifyToken(req, resp); - } else { - resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); - } - } - - /** - * @return a custom profile based on "name" query parameter, or {@code null} - * if this robot doesn't support custom profile. - */ - protected ParticipantProfile getCustomProfile(@SuppressWarnings("unused") String name) { - return null; - } - - /** - * @return the URL of the robot's avatar image. - */ - protected String getRobotAvatarUrl() { - return DEFAULT_AVATAR; - } - - /** - * Sets up the verification token that is used for the owner verification - * step during the robot registration. - * - * @param verificationToken the verification token. - * @param securityToken the security token that should be matched against when - * serving a verification token request. - */ - protected void setupVerificationToken(String verificationToken, String securityToken) { - this.verificationToken = verificationToken; - this.securityToken = securityToken; - } - - /** - * Sets the OAuth related properties, including the consumer key and secret - * that are used to sign the outgoing operations in the active mode. Robot - * developer needs to visit - * {@link "http://wave.google.com/wave/robot/register"} to register and obtain - * the consumer key and secret. - * - * Should you need to make Active API calls to both our public and sandbox - * servers from the same robot, you can call this method multiple times, with - * the same consumer key and secret, but different RPC server URLs. - * - * After calling this method, the robot no longer accepts unsigned requests, - * but you can override that by calling - * {@link #setAllowUnsignedRequests(boolean)}. - * - * @param consumerKey the consumer key. - * @param consumerSecret the consumer secret. - * @param rpcServerUrl the URL of the server that serves the JSON-RPC request. - * <ul> - * <li>https://www-opensocial.googleusercontent.com/api/rpc - for wave - * preview.<li> - * <li>https://www-opensocial-sandbox.googleusercontent.com/api/rpc - - * for wave sandbox.</li> - * </ul> - * - * @throws IllegalArgumentException if any of the arguments are {@code null}. - */ - protected void setupOAuth(String consumerKey, String consumerSecret, String rpcServerUrl) { - waveService.setupOAuth(consumerKey, consumerSecret, rpcServerUrl); - setAllowUnsignedRequests(false); - } - - /** - * Sets the OAuth related properties, including the consumer key and secret - * that are used to sign the outgoing operations in the active mode. This - * method sets the JSON-RPC handler URL to - * https://www-opensocial.googleusercontent.com/api/rpc, that is associated - * with wave preview instance. - * - * @param consumerKey the consumer key. - * @param consumerSecret the consumer secret. - */ - protected void setupOAuth(String consumerKey, String consumerSecret) { - setupOAuth(consumerKey, consumerSecret, WaveService.RPC_URL); - } - - /** - * Sets whether or not unsigned incoming requests from robot proxy are - * allowed. - * - * @param allowUnsignedRequests whether or not unsigned requests from robot - * proxy are allowed. - */ - protected void setAllowUnsignedRequests(boolean allowUnsignedRequests) { - if (!allowUnsignedRequests && waveService.getConsumerDataMap().isEmpty()) { - throw new IllegalArgumentException("Please call AbstractRobot.setupOAuth() first to " + - "setup the consumer key and secret to validate the request."); - } - this.allowUnsignedRequests = allowUnsignedRequests; - } - - /** - * @return {@code true} if unsigned incoming requests from robot proxy are - * allowed. - */ - protected boolean isUnsignedRequestsAllowed() { - return allowUnsignedRequests; - } - - /** - * Processes the incoming HTTP request to obtain the verification token. - * - * @param req the HTTP request. - * @param resp the HTTP response. - */ - private void processVerifyToken(HttpServletRequest req, HttpServletResponse resp) { - if (verificationToken == null || verificationToken.isEmpty()) { - LOG.info("Please register a verification token by calling " + - "AbstractRobot.setVerificationToken()."); - resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); - return; - } - - String incomingSecurityToken = req.getParameter(SECURITY_TOKEN_PARAMETER_KEY); - if (securityToken != null && !securityToken.equals(incomingSecurityToken)) { - LOG.info("The incoming security token " + incomingSecurityToken + " does not match the " + - "expected security token " + securityToken + "."); - resp.setStatus(HttpURLConnection.HTTP_UNAUTHORIZED); - return; - } - - resp.setContentType(TEXT_MIME_TYPE); - resp.setCharacterEncoding(UTF_8); - try { - resp.getWriter().write(verificationToken); - } catch (IOException e) { - resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); - return; - } - resp.setStatus(HttpURLConnection.HTTP_OK); - } - - /** - * Processes the incoming HTTP request to obtain the capabilities.xml file. - * - * @param req the HTTP request. - * @param resp the HTTP response. - */ - private void processCapabilities(HttpServletRequest req, HttpServletResponse resp) { - StringBuilder xml = new StringBuilder(); - xml.append("<?xml version=\"1.0\"?>\n"); - xml.append("<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\n"); - xml.append(" <w:version>"); - xml.append(version); - xml.append("</w:version>\n"); - xml.append(" <w:protocolversion>"); - xml.append(WaveService.PROTOCOL_VERSION.getVersionString()); - xml.append("</w:protocolversion>\n"); - xml.append(" <w:capabilities>\n"); - for (Entry<String, Capability> entry : capabilityMap.entrySet()) { - xml.append(" <w:capability name=\"" + entry.getKey() + "\""); - Capability capability = entry.getValue(); - if (capability != null) { - // Append context. - if (capability.contexts().length != 0) { - xml.append(" context=\""); - boolean first = true; - for (Context context : capability.contexts()) { - if (first) { - first = false; - } else { - xml.append(','); - } - xml.append(context.name()); - } - xml.append("\""); - } - - // Append filter. - if (capability.filter() != null && !capability.filter().isEmpty()) { - xml.append(" filter=\""); - xml.append(capability.filter()); - xml.append("\""); - } - } - xml.append("/>\n"); - } - xml.append(" </w:capabilities>\n"); - if (!waveService.getConsumerDataMap().isEmpty()) { - xml.append(" <w:consumer_keys>\n"); - for (ConsumerData consumerDataObj : waveService.getConsumerDataMap().values()) { - xml.append(" <w:consumer_key for=\"" + consumerDataObj.getRpcServerUrl() + "\">" - + consumerDataObj.getConsumerKey() + "</w:consumer_key>\n"); - } - xml.append(" </w:consumer_keys>\n"); - } - xml.append("</w:robot>\n"); - // Write the result into the output stream. - resp.setContentType(XML_MIME_TYPE); - resp.setCharacterEncoding(UTF_8); - try { - resp.getWriter().write(xml.toString()); - } catch (IOException e) { - resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); - return; - } - resp.setStatus(HttpURLConnection.HTTP_OK); - } - - /** - * Processes the incoming HTTP request to obtain robot's profile. - * - * @param req the HTTP request. - * @param resp the HTTP response. - */ - private void processProfile(HttpServletRequest req, HttpServletResponse resp) { - ParticipantProfile profile = null; - - // Try to get custom profile. - String proxiedName = req.getParameter(NAME_QUERY_PARAMETER_KEY); - if (proxiedName != null) { - profile = getCustomProfile(proxiedName); - } - - // Set the default profile. - if (profile == null) { - profile = new ParticipantProfile(getRobotName(), getRobotAvatarUrl(), - getRobotProfilePageUrl()); - } - - // Write the result into the output stream. - resp.setContentType(JSON_MIME_TYPE); - resp.setCharacterEncoding(UTF_8); - try { - resp.getWriter().write(SERIALIZER.toJson(profile)); - } catch (IOException e) { - resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); - return; - } - resp.setStatus(HttpURLConnection.HTTP_OK); - } - - /** - * Processes the incoming HTTP request that contains the event bundle. - * - * @param req the HTTP request. - * @param resp the HTTP response. - */ - private void processRpc(HttpServletRequest req, HttpServletResponse resp) { - // Deserialize and process the incoming events. - EventMessageBundle events = null; - try { - events = deserializeEvents(req); - } catch (IOException e) { - resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); - return; - } - - // Append robot.notifyCapabilitiesHash operation before processing the - // events. - OperationQueue operationQueue = events.getWavelet().getOperationQueue(); - operationQueue.notifyRobotInformation(WaveService.PROTOCOL_VERSION, version); - - // Call the robot event handlers. - processEvents(events); - - // Serialize the operations. - serializeOperations(operationQueue.getPendingOperations(), resp); - operationQueue.clear(); - } - - /** - * Processes the incoming event bundle. This method iterates over the event - * bundle and dispatch the individual event to its own handler, based on the - * event type. - * - * @param events the incoming event bundle. - */ - protected void processEvents(EventMessageBundle events) { - for (Event event : events.getEvents()) { - switch (event.getType()) { - case ANNOTATED_TEXT_CHANGED: - onAnnotatedTextChanged(AnnotatedTextChangedEvent.as(event)); - break; - case BLIP_CONTRIBUTORS_CHANGED: - onBlipContributorsChanged(BlipContributorsChangedEvent.as(event)); - break; - case BLIP_SUBMITTED: - onBlipSubmitted(BlipSubmittedEvent.as(event)); - break; - case DOCUMENT_CHANGED: - onDocumentChanged(DocumentChangedEvent.as(event)); - break; - case FORM_BUTTON_CLICKED: - onFormButtonClicked(FormButtonClickedEvent.as(event)); - break; - case GADGET_STATE_CHANGED: - onGadgetStateChanged(GadgetStateChangedEvent.as(event)); - break; - case WAVELET_BLIP_CREATED: - onWaveletBlipCreated(WaveletBlipCreatedEvent.as(event)); - break; - case WAVELET_BLIP_REMOVED: - onWaveletBlipRemoved(WaveletBlipRemovedEvent.as(event)); - break; - case WAVELET_CREATED: - onWaveletCreated(WaveletCreatedEvent.as(event)); - break; - case WAVELET_FETCHED: - onWaveletFetched(WaveletFetchedEvent.as(event)); - break; - case WAVELET_PARTICIPANTS_CHANGED: - onWaveletParticipantsChanged(WaveletParticipantsChangedEvent.as(event)); - break; - case WAVELET_SELF_ADDED: - onWaveletSelfAdded(WaveletSelfAddedEvent.as(event)); - break; - case WAVELET_SELF_REMOVED: - onWaveletSelfRemoved(WaveletSelfRemovedEvent.as(event)); - break; - case WAVELET_TAGS_CHANGED: - onWaveletTagsChanged(WaveletTagsChangedEvent.as(event)); - break; - case WAVELET_TITLE_CHANGED: - onWaveletTitleChanged(WaveletTitleChangedEvent.as(event)); - break; - case OPERATION_ERROR: - onOperationError(OperationErrorEvent.as(event)); - break; - } - } - } - - /** - * Computes this robot's capabilities, based on the overriden event handler - * methods, and their {@link EventHandler.Capability} annotations. - * - * The result map does not use {@link EventType} enum as the key for stability - * between JVM runs, since the same enum may have different hashcode between - * JVM runs. This may cause two instances of the same robot that are running - * on different JVMs (for example, when App Engine scale the robot) to have - * different version number and capabilities ordering in - * {@code capabilities.xml}. - * - * @return a map of event type string to capability. - */ - protected Map<String, Capability> computeCapabilityMap() { - Map<String, Capability> map = new HashMap<String, Capability>(); - for (Method baseMethod : EventHandler.class.getDeclaredMethods()) { - Method overridenMethod = null; - try { - overridenMethod = this.getClass().getMethod(baseMethod.getName(), - baseMethod.getParameterTypes()); - } catch (NoSuchMethodException e) { - // Robot does not override this particular event handler. Continue. - continue; - } - - // Skip the method, if it's declared in AbstractRobot. - if (AbstractRobot.class.equals(overridenMethod.getDeclaringClass())) { - continue; - } - - // Get the event type. - EventType eventType = EventType.fromClass(overridenMethod.getParameterTypes()[0]); - - // Get the capability annotation. - Capability capability = overridenMethod.getAnnotation(Capability.class); - - map.put(eventType.toString(), capability); - } - return map; - } - - /** - * Computes this robot's hash, based on the capabilities. - * - * @return a hash of this robot, computed from it's capabilities. - */ - protected String computeHash() { - long version = 0l; - for (Entry<String, Capability> entry : capabilityMap.entrySet()) { - long hash = entry.getKey().hashCode(); - Capability capability = entry.getValue(); - if (capability != null) { - for (Context context : capability.contexts()) { - hash = hash * 31 + context.name().hashCode(); - } - hash = hash * 31 + capability.filter().hashCode(); - } - version = version * 17 + hash; - } - return Long.toHexString(version); - } - - /** - * Deserializes the given HTTP request's JSON body into an event message - * bundle. - * - * @param req the HTTP request to be deserialized. - * @return an event message bundle. - * - * @throws IOException if there is a problem reading the request's body. - * @throws IllegalArgumentException if the request is not signed properly. - */ - private EventMessageBundle deserializeEvents(HttpServletRequest req) throws IOException { - String json = readRequestBody(req); - LOG.info("Incoming events: " + json); - - EventMessageBundle bundle = SERIALIZER.fromJson(json, EventMessageBundle.class); - - if (bundle.getRpcServerUrl() == null) { - throw new IllegalArgumentException("RPC server URL is not set in the event bundle."); - } - - if (!isUnsignedRequestsAllowed()) { - if (!waveService.hasConsumerData(bundle.getRpcServerUrl())) { - throw new IllegalArgumentException("No consumer key is found for the RPC server URL: " + - bundle.getRpcServerUrl()); - } - - // Validates the request. - try { - @SuppressWarnings("unchecked") - Map<String, String[]> parameterMap = req.getParameterMap(); - waveService.validateOAuthRequest(req.getRequestURL().toString(), parameterMap, - json, bundle.getRpcServerUrl()); - } catch (OAuthException e) { - throw new IllegalArgumentException("Error validating OAuth request", e); - } - } - return bundle; - } - /** - * Serializes the given outgoing operations into a JSON string, and put it in - * the given response object. - * - * @param operations the operations to be serialized. - * @param resp the response object to flush the output string into. - */ - private static void serializeOperations(List<OperationRequest> operations, - HttpServletResponse resp) { - try { - String json = SERIALIZER.toJson(operations, GsonFactory.OPERATION_REQUEST_LIST_TYPE); - LOG.info("Outgoing operations: " + json); - - resp.setContentType(JSON_MIME_TYPE); - resp.setCharacterEncoding(UTF_8); - resp.getWriter().write(json); - resp.setStatus(HttpURLConnection.HTTP_OK); - } catch (IOException iox) { - resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); - } - } - - /** - * Reads the given HTTP request's input stream into a string. - * - * @param req the HTTP request to be read. - * @return a string representation of the given HTTP request's body. - * - * @throws IOException if there is a problem reading the body. - */ - private static String readRequestBody(HttpServletRequest req) throws IOException { - StringBuilder json = new StringBuilder(); - BufferedReader reader = req.getReader(); - String line; - while ((line = reader.readLine()) != null) { - json.append(line); - } - return json.toString(); - } - - @Override - public void onAnnotatedTextChanged(AnnotatedTextChangedEvent event) { - // No-op. - } - - @Override - public void onBlipContributorsChanged(BlipContributorsChangedEvent event) { - // No-op. - } - - @Override - public void onBlipSubmitted(BlipSubmittedEvent event) { - // No-op. - } - - @Override - public void onDocumentChanged(DocumentChangedEvent event) { - // No-op. - } - - @Override - public void onFormButtonClicked(FormButtonClickedEvent event) { - // No-op. - } - - @Override - public void onGadgetStateChanged(GadgetStateChangedEvent event) { - // No-op. - } - - @Override - public void onWaveletBlipCreated(WaveletBlipCreatedEvent event) { - // No-op. - } - - - @Override - public void onWaveletBlipRemoved(WaveletBlipRemovedEvent event) { - // No-op. - } - - @Override - public void onWaveletCreated(WaveletCreatedEvent event) { - // No-op. - } - - @Override - public void onWaveletFetched(WaveletFetchedEvent event) { - // No-op. - } - - @Override - public void onWaveletParticipantsChanged(WaveletParticipantsChangedEvent event) { - // No-op. - } - - @Override - public void onWaveletSelfAdded(WaveletSelfAddedEvent event) { - // No-op. - } - - @Override - public void onWaveletSelfRemoved(WaveletSelfRemovedEvent event) { - // No-op. - } - - @Override - public void onWaveletTagsChanged(WaveletTagsChangedEvent event) { - // No-op. - } - - @Override - public void onWaveletTitleChanged(WaveletTitleChangedEvent event) { - // No-op. - } - - @Override - public void onOperationError(OperationErrorEvent event) { - // No-op. - } - - /** - * @return the display name of the robot. - */ - protected abstract String getRobotName(); - - /** - * @return the URL of the robot's profile page. - */ - protected abstract String getRobotProfilePageUrl(); -}
