# HG changeset patch
# User duane.cawthron@nokia.com
# Date 1250542920 18000
# Node ID 11a6943ebeb2bab5af0823002b9fd634db5f5cde
# Parent b6b7ad8a25a38dfaf9a4594cd447a14e7670287e
add dsdp/tm/tcf_0_3_x
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.classpath
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.classpath Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.project
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.project Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.tm.tcf.core
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.settings/org.eclipse.jdt.core.prefs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.settings/org.eclipse.jdt.core.prefs Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,279 @@
+#Mon Jun 22 11:36:07 PDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=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.maxProblemPerUnit=100
+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=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_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.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=8
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=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=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+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_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.settings/org.eclipse.jdt.ui.prefs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/.settings/org.eclipse.jdt.ui.prefs Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,4 @@
+#Thu May 21 14:51:03 PDT 2009
+eclipse.preferences.version=1
+formatter_profile=_Java STD
+formatter_settings_version=11
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/META-INF/MANIFEST.MF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/META-INF/MANIFEST.MF Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TCF Core Fragment
+Bundle-SymbolicName: org.eclipse.tm.tcf.core;singleton:=true
+Bundle-Version: 0.2.0.qualifier
+Fragment-Host: org.eclipse.tm.tcf;bundle-version="0.2.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.tm.tcf.core;version="0.2.0",
+ org.eclipse.tm.tcf.protocol;version="0.2.0",
+ org.eclipse.tm.tcf.services;version="0.2.0",
+ org.eclipse.tm.tcf.util;version="0.2.0"
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/build.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/build.properties Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/ChannelLoop.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/ChannelLoop.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.core;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+
+import org.eclipse.tm.tcf.core.StreamChannel;
+import org.eclipse.tm.tcf.protocol.IPeer;
+
+
+public class ChannelLoop extends StreamChannel {
+
+ private final byte[] buf = new byte[0x1000];
+ private int buf_inp;
+ private int buf_out;
+ private boolean waiting;
+ private boolean closed;
+
+ ChannelLoop(IPeer peer) {
+ super(peer);
+ start();
+ }
+
+ @Override
+ protected synchronized int get() throws IOException {
+ try {
+ while (buf_inp == buf_out) {
+ if (closed) return -1;
+ waiting = true;
+ wait();
+ }
+ int b = buf[buf_out] & 0xff;
+ buf_out = (buf_out + 1) % buf.length;
+ if (waiting) {
+ waiting = false;
+ notifyAll();
+ }
+ return b;
+ }
+ catch (InterruptedException e) {
+ throw new InterruptedIOException();
+ }
+ }
+
+ @Override
+ protected synchronized void put(int b) throws IOException {
+ assert b >=0 && b <= 0xff;
+ try {
+ for (;;) {
+ int nxt_inp = (buf_inp + 1) % buf.length;
+ if (nxt_inp != buf_out) {
+ buf[buf_inp] = (byte)b;
+ buf_inp = nxt_inp;
+ break;
+ }
+ if (closed) return;
+ waiting = true;
+ wait();
+ }
+ if (waiting) {
+ waiting = false;
+ notifyAll();
+ }
+ }
+ catch (InterruptedException e) {
+ throw new InterruptedIOException();
+ }
+ }
+
+ @Override
+ protected void flush() throws IOException {
+ }
+
+ @Override
+ protected synchronized void stop() throws IOException {
+ closed = true;
+ if (waiting) {
+ waiting = false;
+ notifyAll();
+ }
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/LocalPeer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/LocalPeer.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.tm.tcf.core.AbstractPeer;
+
+public class LocalPeer extends AbstractPeer {
+
+ private static Map createAttributes() {
+ Map attrs = new HashMap();
+ attrs.put(ATTR_ID, "TCFLocal");
+ attrs.put(ATTR_NAME, "Local Peer");
+ attrs.put(ATTR_OS_NAME, System.getProperty("os.name"));
+ attrs.put(ATTR_TRANSPORT_NAME, "Loop");
+ return attrs;
+ }
+
+ public LocalPeer() {
+ super(createAttributes());
+ }
+}
\ No newline at end of file
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/RemotePeer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/RemotePeer.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.core;
+
+import java.util.Map;
+
+import org.eclipse.tm.tcf.core.AbstractPeer;
+
+public class RemotePeer extends AbstractPeer {
+
+ private long last_update_time;
+
+ public RemotePeer(Map attrs) {
+ super(attrs);
+ last_update_time = System.currentTimeMillis();
+ }
+
+ @Override
+ public void updateAttributes(Map attrs) {
+ super.updateAttributes(attrs);
+ last_update_time = System.currentTimeMillis();
+ }
+
+ public long getLastUpdateTime() {
+ return last_update_time;
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/ServiceManager.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/ServiceManager.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Anyware Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.tm.internal.tcf.services.local.DiagnosticsService;
+import org.eclipse.tm.internal.tcf.services.remote.GenericProxy;
+import org.eclipse.tm.internal.tcf.services.remote.LocatorProxy;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IService;
+import org.eclipse.tm.tcf.protocol.IServiceProvider;
+
+public class ServiceManager {
+
+ private static final Collection providers = new ArrayList();
+
+ static {
+ addServiceProvider(new IServiceProvider() {
+
+ private final String package_name = LocatorProxy.class.getPackage().getName();
+
+ public IService[] getLocalService(IChannel channel) {
+ return new IService[]{ new DiagnosticsService(channel) };
+ }
+
+ public IService getServiceProxy(IChannel channel, String service_name) {
+ IService service = null;
+ try {
+ Class> cls = Class.forName(package_name + "." + service_name + "Proxy");
+ service = (IService)cls.getConstructor(IChannel.class).newInstance(channel);
+ assert service_name.equals(service.getName());
+ }
+ catch (Exception x) {
+ }
+ return service;
+ }
+ });
+
+ }
+
+ public static void addServiceProvider(IServiceProvider provider) {
+ providers.add(provider);
+ }
+
+ public static void removeServiceProvider(IServiceProvider provider) {
+ providers.remove(provider);
+ }
+
+ public static void onChannelCreated(IChannel channel, Map services) {
+ IService zero_copy = new IService() {
+ public String getName() {
+ return "ZeroCopy";
+ }
+ };
+ services.put(zero_copy.getName(), zero_copy);
+ for (IServiceProvider provider : providers) {
+ IService[] arr = provider.getLocalService(channel);
+ if (arr == null) continue;
+ for (IService service : arr) {
+ if (services.containsKey(service.getName())) continue;
+ services.put(service.getName(), service);
+ }
+ }
+ }
+
+ public static void onChannelOpened(IChannel channel, Collection service_names, Map services) {
+ for (String name : service_names) {
+ for (IServiceProvider provider : providers) {
+ IService service = provider.getServiceProxy(channel, name);
+ if (service == null) continue;
+ services.put(name, service);
+ break;
+ }
+ if (!services.containsKey(name)) {
+ services.put(name, new GenericProxy(channel, name));
+ }
+ }
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/Token.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/Token.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.core;
+
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IToken;
+
+
+public class Token implements IToken {
+
+ private static int cnt = 0;
+
+ private final String id;
+ private final byte[] bytes;
+ private final IChannel.ICommandListener listener;
+
+ public Token() {
+ id = null;
+ bytes = null;
+ listener = null;
+ }
+
+ public Token(IChannel.ICommandListener listener) {
+ this.listener = listener;
+ id = Integer.toString(cnt++);
+ try {
+ bytes = id.getBytes("ASCII");
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new Error(e);
+ }
+ }
+
+ public Token(byte[] bytes) {
+ this.bytes = bytes;
+ listener = null;
+ try {
+ id = new String(bytes, "ASCII");
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new Error(e);
+ }
+ }
+
+ public boolean cancel() {
+ return false;
+ }
+
+ public String getID() {
+ return id;
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public IChannel.ICommandListener getListener() {
+ return listener;
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/TransportManager.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/core/TransportManager.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.tm.tcf.core.AbstractChannel;
+import org.eclipse.tm.tcf.core.AbstractPeer;
+import org.eclipse.tm.tcf.core.ChannelTCP;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IPeer;
+import org.eclipse.tm.tcf.protocol.IService;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.protocol.ITransportProvider;
+import org.eclipse.tm.tcf.protocol.Protocol;
+import org.eclipse.tm.tcf.services.ILocator;
+
+
+public class TransportManager {
+
+ private static final Collection channels =
+ new LinkedList();
+ private static final Collection listeners =
+ new LinkedList();
+ private static final HashMap transports =
+ new HashMap();
+
+ static {
+ addTransportProvider(new ITransportProvider() {
+
+ public String getName() {
+ return "TCP";
+ }
+
+ public IChannel openChannel(IPeer peer) {
+ assert getName().equals(peer.getTransportName());
+ Map attrs = peer.getAttributes();
+ String host = attrs.get(IPeer.ATTR_IP_HOST);
+ String port = attrs.get(IPeer.ATTR_IP_PORT);
+ if (host == null) throw new Error("No host name");
+ if (port == null) throw new Error("No port number");
+ return new ChannelTCP(peer, host, Integer.parseInt(port), false);
+ }
+ });
+
+ addTransportProvider(new ITransportProvider() {
+
+ public String getName() {
+ return "SSL";
+ }
+
+ public IChannel openChannel(IPeer peer) {
+ assert getName().equals(peer.getTransportName());
+ Map attrs = peer.getAttributes();
+ String host = attrs.get(IPeer.ATTR_IP_HOST);
+ String port = attrs.get(IPeer.ATTR_IP_PORT);
+ if (host == null) throw new Error("No host name");
+ if (port == null) throw new Error("No port number");
+ return new ChannelTCP(peer, host, Integer.parseInt(port), true);
+ }
+ });
+
+ addTransportProvider(new ITransportProvider() {
+
+ public String getName() {
+ return "Loop";
+ }
+
+ public IChannel openChannel(IPeer peer) {
+ assert getName().equals(peer.getTransportName());
+ return new ChannelLoop(peer);
+ }
+ });
+ }
+
+ public static void addTransportProvider(ITransportProvider transport) {
+ String name = transport.getName();
+ assert name != null;
+ if (transports.get(name) != null) throw new Error("Already registered: " + name);
+ transports.put(name, transport);
+ }
+
+ public static void removeTransportProvider(ITransportProvider transport) {
+ String name = transport.getName();
+ assert name != null;
+ if (transports.get(name) == transport) transports.remove(name);
+ }
+
+ public static IChannel openChannel(IPeer peer) {
+ String name = peer.getTransportName();
+ if (name == null) throw new Error("No transport name");
+ ITransportProvider transport = transports.get(name);
+ if (transport == null) throw new Error("Unknown transport name: " + name);
+ return transport.openChannel(peer);
+ }
+
+ public static void channelOpened(final AbstractChannel channel) {
+ assert !channels.contains(channel);
+ channels.add(channel);
+ Protocol.ChannelOpenListener[] array = listeners.toArray(new Protocol.ChannelOpenListener[listeners.size()]);
+ for (Protocol.ChannelOpenListener l : array) {
+ try {
+ l.onChannelOpen(channel);
+ }
+ catch (Throwable x) {
+ Protocol.log("Exception in channel listener", x);
+ }
+ }
+ }
+
+ public static void channelClosed(final AbstractChannel channel, final Throwable x) {
+ assert channels.contains(channel);
+ channels.remove(channel);
+ }
+
+ public static IChannel[] getOpenChannels() {
+ return channels.toArray(new IChannel[channels.size()]);
+ }
+
+ public static void addChanelOpenListener(Protocol.ChannelOpenListener listener) {
+ assert listener != null;
+ listeners.add(listener);
+ }
+
+ public static void removeChanelOpenListener(Protocol.ChannelOpenListener listener) {
+ listeners.remove(listener);
+ }
+
+ public static void peerDisposed(AbstractPeer peer) {
+ Exception error = null;
+ Collection bf = new ArrayList(channels);
+ for (Iterator i = bf.iterator(); i.hasNext();) {
+ AbstractChannel c = i.next();
+ if (c.getRemotePeer() != peer) continue;
+ if (error == null) error = new Exception("Peer is disposed");
+ c.terminate(error);
+ }
+ }
+
+ /**
+ * Transmit TCF event message.
+ * The message is sent to all open communication channels – broadcasted.
+ *
+ * This is internal API, TCF clients should use {@code org.eclipse.tm.tcf.protocol.Protocol}.
+ */
+ public static void sendEvent(String service_name, String event_name, byte[] data) {
+ for (Iterator i = channels.iterator(); i.hasNext();) {
+ AbstractChannel channel = i.next();
+ IService s = channel.getLocalService(service_name);
+ if (s != null) channel.sendEvent(s, event_name, data);
+ }
+ }
+
+ /**
+ * Call back after TCF messages sent by this host up to this moment are delivered
+ * to their intended targets. This method is intended for synchronization of messages
+ * across multiple channels.
+ *
+ * Note: Cross channel synchronization can reduce performance and throughput.
+ * Most clients don't need cross channel synchronization and should not call this method.
+ *
+ * @param done will be executed by dispatch thread after communication
+ * messages are delivered to corresponding targets.
+ *
+ * This is internal API, TCF clients should use {@code org.eclipse.tm.tcf.protocol.Protocol}.
+ */
+ public static void sync(final Runnable done) {
+ final Set set = new HashSet();
+ ILocator.DoneSync done_sync = new ILocator.DoneSync() {
+ public void doneSync(IToken token) {
+ assert set.contains(token);
+ set.remove(token);
+ if (set.isEmpty()) done.run();
+ }
+ };
+ for (Iterator i = channels.iterator(); i.hasNext();) {
+ AbstractChannel channel = i.next();
+ ILocator s = channel.getRemoteService(ILocator.class);
+ if (s != null) set.add(s.sync(done_sync));
+ }
+ if (set.isEmpty()) Protocol.invokeLater(done);
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/ChannelProxy.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/ChannelProxy.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.services.local;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.tm.internal.tcf.core.ChannelLoop;
+import org.eclipse.tm.tcf.core.AbstractChannel;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IService;
+import org.eclipse.tm.tcf.protocol.IToken;
+
+/**
+ * ChannelProxy implements forwarding of TCF messages between two channels.
+ * The class is used to implement Locator service "redirect" command.
+ */
+class ChannelProxy {
+
+ private final AbstractChannel ch_x;
+ private final AbstractChannel ch_y;
+
+ private boolean closed_x;
+ private boolean closed_y;
+
+ private final Map tokens_x = new HashMap();
+ private final Map tokens_y = new HashMap();
+
+ private final AbstractChannel.Proxy proxy_x = new AbstractChannel.Proxy() {
+
+ public void onChannelClosed(Throwable error) {
+ closed_x = true;
+ if (closed_y) return;
+ if (error == null) ch_y.close();
+ else ch_y.terminate(error);
+ }
+
+ public void onCommand(IToken token, String service, String name, byte[] data) {
+ if (closed_y) return;
+ assert ch_y.getState() == IChannel.STATE_OPEN;
+ IService s = ch_y.getRemoteService(service);
+ if (s == null) ch_x.terminate(new IOException("Invalid service name"));
+ else tokens_x.put(ch_y.sendCommand(s, name, data, cmd_listener_x), token);
+ }
+
+ public void onEvent(String service, String name, byte[] data) {
+ IService s = ch_x.getRemoteService(service);
+ if (s == null) ch_x.terminate(new IOException("Invalid service name"));
+ else if (!closed_y) ch_y.sendEvent(s, name, data);
+ }
+ };
+
+ private final AbstractChannel.Proxy proxy_y = new AbstractChannel.Proxy() {
+
+ public void onChannelClosed(Throwable error) {
+ closed_y = true;
+ if (closed_x) return;
+ if (error == null) ch_x.close();
+ else ch_x.terminate(error);
+ }
+
+ public void onCommand(IToken token, String service, String name, byte[] data) {
+ if (closed_x) return;
+ assert ch_x.getState() == IChannel.STATE_OPEN;
+ IService s = ch_x.getRemoteService(service);
+ if (s == null) ch_y.terminate(new IOException("Invalid service name"));
+ else tokens_y.put(ch_x.sendCommand(s, name, data, cmd_listener_y), token);
+ }
+
+ public void onEvent(String service, String name, byte[] data) {
+ IService s = ch_y.getRemoteService(service);
+ if (s == null) ch_y.terminate(new IOException("Invalid service name"));
+ else if (!closed_x) ch_x.sendEvent(s, name, data);
+ }
+ };
+
+ private final IChannel.ICommandListener cmd_listener_x = new IChannel.ICommandListener() {
+
+ public void progress(IToken token, byte[] data) {
+ ch_x.sendProgress(tokens_x.get(token), data);
+ }
+
+ public void result(IToken token, byte[] data) {
+ ch_x.sendResult(tokens_x.get(token), data);
+ tokens_x.remove(token);
+ }
+
+ public void terminated(IToken token, Exception error) {
+ tokens_x.remove(token);
+ }
+ };
+
+ private final IChannel.ICommandListener cmd_listener_y = new IChannel.ICommandListener() {
+
+ public void progress(IToken token, byte[] data) {
+ ch_y.sendProgress(tokens_y.get(token), data);
+ }
+
+ public void result(IToken token, byte[] data) {
+ ch_y.sendResult(tokens_y.get(token), data);
+ tokens_y.remove(token);
+ }
+
+ public void terminated(IToken token, Exception error) {
+ tokens_y.remove(token);
+ }
+ };
+
+ ChannelProxy(IChannel x, IChannel y) {
+ assert !(x instanceof ChannelLoop);
+ assert !(y instanceof ChannelLoop);
+ ch_x = (AbstractChannel)x;
+ ch_y = (AbstractChannel)y;
+ assert ch_x.getState() == IChannel.STATE_OPEN;
+ assert ch_y.getState() == IChannel.STATE_OPENNING;
+ try {
+ ch_y.setProxy(proxy_y, ch_x.getRemoteServices());
+ ch_y.addChannelListener(new IChannel.IChannelListener() {
+
+ public void congestionLevel(int level) {
+ }
+
+ public void onChannelClosed(Throwable error) {
+ ch_y.removeChannelListener(this);
+ if (error == null) error = new Exception("Channel closed");
+ }
+
+ public void onChannelOpened() {
+ ch_y.removeChannelListener(this);
+ try {
+ ch_x.setProxy(proxy_x, ch_y.getRemoteServices());
+ }
+ catch (IOException e) {
+ ch_x.terminate(e);
+ ch_y.terminate(e);
+ }
+ }
+ });
+ }
+ catch (IOException e) {
+ ch_x.terminate(e);
+ ch_y.terminate(e);
+ }
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/DiagnosticsService.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/DiagnosticsService.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.services.local;
+
+import java.math.BigDecimal;
+
+import org.eclipse.tm.internal.tcf.core.Token;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.protocol.JSON;
+import org.eclipse.tm.tcf.protocol.Protocol;
+import org.eclipse.tm.tcf.services.IDiagnostics;
+
+
+public class DiagnosticsService implements IDiagnostics {
+
+ private final IChannel channel;
+
+ private class CommandServer implements IChannel.ICommandServer {
+
+ public void command(IToken token, String name, byte[] data) {
+ try {
+ command(token, name, JSON.parseSequence(data));
+ }
+ catch (Throwable x) {
+ channel.terminate(x);
+ }
+ }
+
+ private void command(IToken token, String name, Object[] args) throws Exception {
+ if (name.equals("echo")) {
+ if (args.length != 1) throw new Exception("Invalid number of arguments");
+ String s = (String)args[0];
+ channel.sendResult(token, JSON.toJSONSequence(new Object[]{ s }));
+ }
+ else if (name.equals("echoFP")) {
+ if (args.length != 1) throw new Exception("Invalid number of arguments");
+ Number n = (Number)args[0];
+ channel.sendResult(token, JSON.toJSONSequence(new Object[]{ n }));
+ }
+ else if (name.equals("getTestList")) {
+ if (args.length != 0) throw new Exception("Invalid number of arguments");
+ channel.sendResult(token, JSON.toJSONSequence(new Object[]{ null, new String[0] }));
+ }
+ else {
+ channel.rejectCommand(token);
+ }
+ }
+ }
+
+ public DiagnosticsService(IChannel channel) {
+ this.channel = channel;
+ channel.addCommandServer(this, new CommandServer());
+ }
+
+ public String getName() {
+ return NAME;
+ }
+
+ public IToken echo(final String s, final DoneEcho done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneEcho(token, null, s);
+ }
+ });
+ return token;
+ }
+
+ public IToken echoFP(final BigDecimal n, final DoneEchoFP done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneEchoFP(token, null, n);
+ }
+ });
+ return token;
+ }
+
+ public IToken getTestList(final DoneGetTestList done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneGetTestList(token, null, new String[0]);
+ }
+ });
+ return token;
+ }
+
+ public IToken runTest(final String s, final DoneRunTest done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneRunTest(token, new Exception("Test suite not found: " + s), null);
+ }
+ });
+ return token;
+ }
+
+ public IToken cancelTest(String context_id, final DoneCancelTest done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneCancelTest(token, null);
+ }
+ });
+ return token;
+ }
+
+ public IToken getSymbol(String context_id, String symbol_name, final DoneGetSymbol done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneGetSymbol(token, new Exception("Invalid context"), null);
+ }
+ });
+ return token;
+ }
+
+ public IToken createTestStreams(int inp_buf_size, int out_buf_size, final DoneCreateTestStreams done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneCreateTestStreams(token, new Exception("Not implemented"), null, null);
+ }
+ });
+ return token;
+ }
+
+ public IToken disposeTestStream(String id, final DoneDisposeTestStream done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneDisposeTestStream(token, new Exception("Invalid context"));
+ }
+ });
+ return token;
+ }
+
+ public IToken not_implemented_command(final DoneNotImplementedCommand done) {
+ final IToken token = new Token();
+ Protocol.invokeLater(new Runnable() {
+ public void run() {
+ done.doneNotImplementedCommand(token, new Exception("Not implemented"));
+ }
+ });
+ return token;
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,785 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.services.local;
+
+import java.lang.reflect.Method;
+import java.net.BindException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.tm.internal.tcf.core.LocalPeer;
+import org.eclipse.tm.internal.tcf.core.RemotePeer;
+import org.eclipse.tm.internal.tcf.core.ServiceManager;
+import org.eclipse.tm.internal.tcf.core.TransportManager;
+import org.eclipse.tm.tcf.core.AbstractChannel;
+import org.eclipse.tm.tcf.core.AbstractPeer;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IErrorReport;
+import org.eclipse.tm.tcf.protocol.IPeer;
+import org.eclipse.tm.tcf.protocol.IService;
+import org.eclipse.tm.tcf.protocol.IServiceProvider;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.protocol.JSON;
+import org.eclipse.tm.tcf.protocol.Protocol;
+import org.eclipse.tm.tcf.services.ILocator;
+
+
+/**
+ * Locator service uses transport layer to search
+ * for peers and to collect and maintain up-to-date
+ * data about peer’s attributes.
+ */
+// TODO: research usage of DNS-SD (DNS Service Discovery) to discover TCF peers
+public class LocatorService implements ILocator {
+
+ private static final int DISCOVEY_PORT = 1534;
+ private static final int MAX_PACKET_SIZE = 9000 - 40 - 8;
+ private static final int PREF_PACKET_SIZE = 1500 - 40 - 8;
+
+ private static LocatorService locator;
+ private static final Map peers = new HashMap();
+ private static final ArrayList listeners = new ArrayList();
+
+ private final HashSet subnets = new HashSet();
+ private final ArrayList slaves = new ArrayList();
+ private final byte[] inp_buf = new byte[MAX_PACKET_SIZE];
+ private final byte[] out_buf = new byte[MAX_PACKET_SIZE];
+
+ private InetAddress loopback_addr;
+
+ private static class SubNet {
+ final int prefix_length;
+ final InetAddress address;
+ final InetAddress broadcast;
+
+ long last_slaves_req_time;
+ boolean send_all_ok;
+
+ SubNet(int prefix_length, InetAddress address, InetAddress broadcast) {
+ this.prefix_length = prefix_length;
+ this.address = address;
+ this.broadcast = broadcast;
+ }
+
+ boolean contains(InetAddress addr) {
+ if (addr == null) return false;
+ byte[] a1 = addr.getAddress();
+ byte[] a2 = broadcast.getAddress();
+ int i = 0;
+ while (i + 8 <= prefix_length) {
+ int n = i / 8;
+ if (a1[n] != a2[n]) return false;
+ i += 8;
+ }
+ while (i < prefix_length) {
+ int n = i / 8;
+ int m = 1 << (7 - i % 8);
+ if ((a1[n] & m) != (a2[n] & m)) return false;
+ i++;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof SubNet)) return false;
+ SubNet x = (SubNet)o;
+ return
+ prefix_length == x.prefix_length &&
+ broadcast.equals(x.broadcast) &&
+ address.equals(x.address);
+ }
+
+ @Override
+ public int hashCode() {
+ return broadcast.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return broadcast.getHostAddress() + "/" + prefix_length;
+ }
+ }
+
+ private static class Slave {
+ final InetAddress address;
+ final int port;
+
+ /* Time of last packet receiver from this slave */
+ long last_packet_time;
+
+ /* Time of last REQ_SLAVES packet received from this slave */
+ long last_req_slaves_time;
+
+ Slave(InetAddress address, int port) {
+ this.address = address;
+ this.port = port;
+ }
+
+ @Override
+ public String toString() {
+ return address.getHostAddress() + ":" + port;
+ }
+ }
+
+ private static LocalPeer local_peer;
+
+ private DatagramSocket socket;
+ private long last_master_packet_time;
+
+ private Thread timer_thread = new Thread() {
+ public void run() {
+ while (true) {
+ try {
+ sleep(DATA_RETENTION_PERIOD / 4);
+ Protocol.invokeAndWait(new Runnable() {
+ public void run() {
+ refresh_timer();
+ }
+ });
+ }
+ catch (IllegalStateException x) {
+ // TCF event dispatch is shut down
+ return;
+ }
+ catch (Throwable x) {
+ Protocol.log("Unhandled exception in TCF discovery listening thread", x);
+ }
+ }
+ }
+ };
+
+ private Thread input_thread = new Thread() {
+ public void run() {
+ for (;;) {
+ DatagramSocket socket = LocatorService.this.socket;
+ try {
+ final DatagramPacket p = new DatagramPacket(inp_buf, inp_buf.length);
+ socket.receive(p);
+ Protocol.invokeAndWait(new Runnable() {
+ public void run() {
+ handleDatagramPacket(p);
+ }
+ });
+ }
+ catch (IllegalStateException x) {
+ // TCF event dispatch is shutdown
+ return;
+ }
+ catch (Exception x) {
+ if (socket != LocatorService.this.socket) continue;
+ Protocol.log("Cannot read from datagram socket", x);
+ }
+ }
+ }
+ };
+
+ static {
+ ServiceManager.addServiceProvider(new IServiceProvider() {
+
+ public IService[] getLocalService(final IChannel channel) {
+ channel.addCommandServer(locator, new IChannel.ICommandServer() {
+ public void command(IToken token, String name, byte[] data) {
+ locator.command((AbstractChannel)channel, token, name, data);
+ }
+ });
+ return new IService[]{ locator };
+ }
+
+ public IService getServiceProxy(IChannel channel, String service_name) {
+ return null;
+ }
+ });
+ }
+
+ public LocatorService() {
+ locator = this;
+ try {
+ loopback_addr = InetAddress.getByName(null);
+ out_buf[0] = 'T';
+ out_buf[1] = 'C';
+ out_buf[2] = 'F';
+ out_buf[3] = CONF_VERSION;
+ out_buf[4] = 0;
+ out_buf[5] = 0;
+ out_buf[6] = 0;
+ out_buf[7] = 0;
+ try {
+ socket = new DatagramSocket(DISCOVEY_PORT);
+ }
+ catch (BindException x) {
+ socket = new DatagramSocket();
+ }
+ socket.setBroadcast(true);
+ input_thread.setName("TCF Locator Receiver");
+ timer_thread.setName("TCF Locator Timer");
+ input_thread.setDaemon(true);
+ timer_thread.setDaemon(true);
+ input_thread.start();
+ timer_thread.start();
+ listeners.add(new LocatorListener() {
+
+ public void peerAdded(IPeer peer) {
+ sendPeerInfo(peer, null, 0);
+ }
+
+ public void peerChanged(IPeer peer) {
+ sendPeerInfo(peer, null, 0);
+ }
+
+ public void peerHeartBeat(String id) {
+ }
+
+ public void peerRemoved(String id) {
+ }
+ });
+ refreshSubNetList();
+ sendPeersRequest(null, 0);
+ sendAll(null, 0, null, System.currentTimeMillis());
+ }
+ catch (Exception x) {
+ Protocol.log("Cannot open UDP socket for TCF discovery protocol", x);
+ }
+ }
+
+ public static LocalPeer getLocalPeer() {
+ return local_peer;
+ }
+
+ public static LocatorListener[] getListeners() {
+ return listeners.toArray(new LocatorListener[listeners.size()]);
+ }
+
+ public static void addPeer(AbstractPeer peer) {
+ assert peers.get(peer.getID()) == null;
+ if (peer instanceof LocalPeer) local_peer = (LocalPeer)peer;
+ peers.put(peer.getID(), peer);
+ peer.sendPeerAddedEvent();
+ }
+
+ public static void removePeer(AbstractPeer peer) {
+ String id = peer.getID();
+ assert peers.get(id) == peer;
+ peers.remove(id);
+ peer.sendPeerRemovedEvent();
+ }
+
+ private Map makeErrorReport(int code, String msg) {
+ Map err = new HashMap();
+ err.put(IErrorReport.ERROR_TIME, new Long(System.currentTimeMillis()));
+ err.put(IErrorReport.ERROR_CODE, new Integer(code));
+ err.put(IErrorReport.ERROR_FORMAT, msg);
+ return err;
+ }
+
+ private void command(final AbstractChannel channel, final IToken token, String name, byte[] data) {
+ try {
+ if (name.equals("redirect")) {
+ String peer_id = (String)JSON.parseSequence(data)[0];
+ IPeer peer = peers.get(peer_id);
+ if (peer == null) {
+ channel.sendResult(token, JSON.toJSONSequence(new Object[]{
+ makeErrorReport(IErrorReport.TCF_ERROR_UNKNOWN_PEER, "Unknown peer ID") }));
+ return;
+ }
+ channel.sendResult(token, JSON.toJSONSequence(new Object[]{ null }));
+ if (peer instanceof LocalPeer) {
+ channel.sendEvent(Protocol.getLocator(), "Hello", JSON.toJSONSequence(
+ new Object[]{ channel.getLocalServices() }));
+ return;
+ }
+ new ChannelProxy(channel, peer.openChannel());
+ }
+ else if (name.equals("sync")) {
+ channel.sendResult(token, null);
+ }
+ else if (name.equals("getPeers")) {
+ int i = 0;
+ Object[] arr = new Object[peers.size()];
+ for (IPeer p : peers.values()) arr[i++] = p.getAttributes();
+ channel.sendResult(token, JSON.toJSONSequence(new Object[]{ null, arr }));
+ }
+ else {
+ channel.rejectCommand(token);
+ }
+ }
+ catch (Throwable x) {
+ channel.terminate(x);
+ }
+ }
+
+ private void refresh_timer() {
+ long time = System.currentTimeMillis();
+ /* Cleanup slave table */
+ if (slaves.size() > 0) {
+ int i = 0;
+ while (i < slaves.size()) {
+ Slave s = slaves.get(i);
+ if (s.last_packet_time + DATA_RETENTION_PERIOD < time) {
+ slaves.remove(i);
+ }
+ else {
+ i++;
+ }
+ }
+ }
+ /* Cleanup peers table */
+ ArrayList stale_peers = null;
+ for (IPeer p : peers.values()) {
+ if (p instanceof RemotePeer) {
+ RemotePeer r = (RemotePeer)p;
+ if (r.getLastUpdateTime() + DATA_RETENTION_PERIOD < time) {
+ if (stale_peers == null) stale_peers = new ArrayList();
+ stale_peers.add(r);
+ }
+ }
+ }
+ if (stale_peers != null) {
+ IChannel[] open_channels = TransportManager.getOpenChannels();
+ HashSet connected_peers = new HashSet();
+ for (IChannel c : open_channels) connected_peers.add(c.getRemotePeer());
+ for (RemotePeer p : stale_peers) {
+ if (!connected_peers.contains(p)) p.dispose();
+ }
+ }
+ /* Try to become a master */
+ if (socket.getLocalPort() != DISCOVEY_PORT && last_master_packet_time + DATA_RETENTION_PERIOD / 2 <= time) {
+ DatagramSocket s0 = socket;
+ DatagramSocket s1 = null;
+ try {
+ s1 = new DatagramSocket(DISCOVEY_PORT);
+ s1.setBroadcast(true);
+ socket = s1;
+ s0.close();
+ }
+ catch (Throwable x) {
+ }
+ }
+ refreshSubNetList();
+ sendAll(null, 0, null, time);
+ }
+
+ private Slave addSlave(InetAddress addr, int port, long timestamp) {
+ for (Slave s : slaves) {
+ if (s.port == port && s.address.equals(addr)) {
+ if (s.last_packet_time < timestamp) s.last_packet_time = timestamp;
+ return s;
+ }
+ }
+ long time = System.currentTimeMillis();
+ Slave s = new Slave(addr, port);
+ s.last_packet_time = timestamp;
+ slaves.add(s);
+ sendPeersRequest(addr, port);
+ sendAll(addr, port, s, time);
+ sendSlaveInfo(s, time);
+ return s;
+ }
+
+ private void refreshSubNetList() {
+ HashSet set = new HashSet();
+ try {
+ for (Enumeration e = NetworkInterface.getNetworkInterfaces(); e.hasMoreElements();) {
+ NetworkInterface f = e.nextElement();
+ /* TODO: Class InterfaceAddress does not exists in Java versions before 1.6.
+ * Fix the code below when support for old Java versions is not needed any more.
+ */
+ try {
+ Method m0 = f.getClass().getMethod("getInterfaceAddresses");
+ for (Object ia : (List>)m0.invoke(f)) {
+ Method m1 = ia.getClass().getMethod("getNetworkPrefixLength");
+ Method m2 = ia.getClass().getMethod("getAddress");
+ Method m3 = ia.getClass().getMethod("getBroadcast");
+ int network_prefix_len = (Short)m1.invoke(ia);
+ InetAddress address = (InetAddress)m2.invoke(ia);
+ InetAddress broadcast = (InetAddress)m3.invoke(ia);
+ if (broadcast == null) broadcast = address;
+ set.add(new SubNet(network_prefix_len, address, broadcast));
+ }
+ }
+ catch (Exception x) {
+ // Java 1.5 or older
+ // TODO: need a better way to get broadcast addresses on Java 1.5 VM
+ Enumeration n = f.getInetAddresses();
+ while (n.hasMoreElements()) {
+ InetAddress addr = n.nextElement();
+ byte[] buf = addr.getAddress();
+ if (buf.length != 4) continue;
+ buf[3] = (byte)255;
+ try {
+ set.add(new SubNet(24, addr, InetAddress.getByAddress(buf)));
+ }
+ catch (UnknownHostException y) {
+ }
+ }
+ }
+ }
+ }
+ catch (SocketException x) {
+ Protocol.log("Cannot get list of network interfaces", x);
+ }
+ for (Iterator i = subnets.iterator(); i.hasNext();) {
+ SubNet s = i.next();
+ if (set.contains(s)) continue;
+ i.remove();
+ }
+ for (Iterator i = set.iterator(); i.hasNext();) {
+ SubNet s = i.next();
+ if (subnets.contains(s)) continue;
+ subnets.add(s);
+ }
+ }
+
+ private void sendPeersRequest(InetAddress addr, int port) {
+ out_buf[4] = CONF_REQ_INFO;
+ for (SubNet n : subnets) {
+ try {
+ if (addr == null) {
+ socket.send(new DatagramPacket(out_buf, 8, n.broadcast, DISCOVEY_PORT));
+ for (Slave slave : slaves) {
+ if (!n.contains(slave.address)) continue;
+ socket.send(new DatagramPacket(out_buf, 8, slave.address, slave.port));
+ }
+ }
+ else if (n.contains(addr)) {
+ socket.send(new DatagramPacket(out_buf, 8, addr, port));
+ }
+ }
+ catch (Exception x) {
+ Protocol.log("Cannot send datagram packet", x);
+ }
+ }
+ }
+
+ private void sendPeerInfo(IPeer peer, InetAddress addr, int port) {
+ Map attrs = peer.getAttributes();
+ if (attrs.get(IPeer.ATTR_IP_HOST) == null) return;
+ if (attrs.get(IPeer.ATTR_IP_PORT) == null) return;
+ try {
+ out_buf[4] = CONF_PEER_INFO;
+ int i = 8;
+ for (String key : attrs.keySet()) {
+ String s = key + "=" + attrs.get(key);
+ byte[] bt = s.getBytes("UTF-8");
+ if (i + bt.length >= out_buf.length) break;
+ System.arraycopy(bt, 0, out_buf, i, bt.length);
+ i += bt.length;
+ out_buf[i++] = 0;
+ }
+
+ InetAddress peer_addr = InetAddress.getByName(attrs.get(IPeer.ATTR_IP_HOST));
+ for (SubNet subnet : subnets) {
+ if (peer instanceof RemotePeer) {
+ if (socket.getLocalPort() != DISCOVEY_PORT) return;
+ if (!subnet.address.equals(loopback_addr) && !subnet.address.equals(peer_addr)) continue;
+ }
+ if (!subnet.address.equals(loopback_addr)) {
+ if (!subnet.contains(peer_addr)) continue;
+ }
+ if (addr == null) {
+ socket.send(new DatagramPacket(out_buf, i, subnet.broadcast, DISCOVEY_PORT));
+ for (Slave slave : slaves) {
+ if (!subnet.contains(slave.address)) continue;
+ socket.send(new DatagramPacket(out_buf, i, slave.address, slave.port));
+ }
+ subnet.send_all_ok = true;
+ }
+ else if (subnet.contains(addr)) {
+ socket.send(new DatagramPacket(out_buf, i, addr, port));
+ subnet.send_all_ok = true;
+ }
+ }
+ }
+ catch (Exception x) {
+ Protocol.log("Cannot send datagram packet", x);
+ }
+ }
+
+ private void sendEmptyPacket(InetAddress addr, int port) {
+ out_buf[4] = CONF_SLAVES_INFO;
+ for (SubNet n : subnets) {
+ if (n.send_all_ok) continue;
+ try {
+ if (addr == null) {
+ socket.send(new DatagramPacket(out_buf, 8, n.broadcast, DISCOVEY_PORT));
+ for (Slave slave : slaves) {
+ if (!n.contains(slave.address)) continue;
+ socket.send(new DatagramPacket(out_buf, 8, slave.address, slave.port));
+ }
+ }
+ else if (n.contains(addr)) {
+ socket.send(new DatagramPacket(out_buf, 8, addr, port));
+ }
+ }
+ catch (Exception x) {
+ Protocol.log("Cannot send datagram packet", x);
+ }
+ }
+ }
+
+ private void sendAll(InetAddress addr, int port, Slave sl, long time) {
+ for (SubNet n : subnets) n.send_all_ok = false;
+ for (IPeer peer : peers.values()) sendPeerInfo(peer, addr, port);
+ if (addr != null && sl != null && sl.last_req_slaves_time + DATA_RETENTION_PERIOD >= time) {
+ sendSlavesInfo(addr, port, time);
+ }
+ sendEmptyPacket(addr, port);
+ }
+
+ private void sendSlavesRequest(InetAddress addr, int port) {
+ try {
+ out_buf[4] = CONF_REQ_SLAVES;
+ socket.send(new DatagramPacket(out_buf, 8, addr, port));
+ }
+ catch (Exception x) {
+ Protocol.log("Cannot send datagram packet", x);
+ }
+ }
+
+ private void sendSlaveInfo(Slave x, long time) {
+ out_buf[4] = CONF_SLAVES_INFO;
+ for (SubNet n : subnets) {
+ if (!n.contains(x.address)) continue;
+ try {
+ int i = 8;
+ String s = x.last_packet_time + ":" + x.port + ":" + x.address.getHostAddress();
+ byte[] bt = s.getBytes("UTF-8");
+ System.arraycopy(bt, 0, out_buf, i, bt.length);
+ i += bt.length;
+ out_buf[i++] = 0;
+ for (Slave y : slaves) {
+ if (!n.contains(y.address)) continue;
+ if (y.last_req_slaves_time + DATA_RETENTION_PERIOD < time) continue;
+ socket.send(new DatagramPacket(out_buf, i, y.address, y.port));
+ }
+ }
+ catch (Exception z) {
+ Protocol.log("Cannot send datagram packet", z);
+ }
+ }
+ }
+
+ private void sendSlavesInfo(InetAddress addr, int port, long time) {
+ out_buf[4] = CONF_SLAVES_INFO;
+ for (SubNet n : subnets) {
+ if (!n.contains(addr)) continue;
+ try {
+ int i = 8;
+ for (Slave x : slaves) {
+ if (x.last_packet_time + DATA_RETENTION_PERIOD < time) continue;
+ if (x.port == port && x.address.equals(addr)) continue;
+ if (!n.address.equals(loopback_addr)) {
+ if (!n.contains(x.address)) continue;
+ }
+ n.send_all_ok = true;
+ String s = x.last_packet_time + ":" + x.port + ":" + x.address.getHostAddress();
+ byte[] bt = s.getBytes("UTF-8");
+ if (i > 8 && i + bt.length >= PREF_PACKET_SIZE) {
+ socket.send(new DatagramPacket(out_buf, i, addr, port));
+ i = 8;
+ }
+ System.arraycopy(bt, 0, out_buf, i, bt.length);
+ i += bt.length;
+ out_buf[i++] = 0;
+ }
+ if (i > 8) socket.send(new DatagramPacket(out_buf, i, addr, port));
+ }
+ catch (Exception x) {
+ Protocol.log("Cannot send datagram packet", x);
+ }
+ }
+ }
+
+ private boolean isRemote(InetAddress address, int port) {
+ if (port != socket.getLocalPort()) return true;
+ for (SubNet s : subnets) {
+ if (s.address.equals(address)) return false;
+ }
+ return true;
+ }
+
+ private void handleDatagramPacket(DatagramPacket p) {
+ try {
+ long time = System.currentTimeMillis();
+ byte[] buf = p.getData();
+ int len = p.getLength();
+ if (len < 8) return;
+ if (buf[0] != 'T') return;
+ if (buf[1] != 'C') return;
+ if (buf[2] != 'F') return;
+ if (buf[3] != CONF_VERSION) return;
+ int remote_port = p.getPort();
+ InetAddress remote_address = p.getAddress();
+ if (isRemote(remote_address, remote_port)) {
+ Slave sl = null;
+ if (p.getPort() != DISCOVEY_PORT) {
+ sl = addSlave(remote_address, remote_port, time);
+ }
+ switch (buf[4]) {
+ case CONF_PEER_INFO:
+ handlePeerInfoPacket(p);
+ break;
+ case CONF_REQ_INFO:
+ handleReqInfoPacket(p, sl, time);
+ break;
+ case CONF_SLAVES_INFO:
+ handleSlavesInfoPacket(p);
+ break;
+ case CONF_REQ_SLAVES:
+ handleReqSlavesPacket(p, sl, time);
+ break;
+ }
+ for (SubNet s : subnets) {
+ if (!s.contains(remote_address)) continue;
+ long delay = DATA_RETENTION_PERIOD / 3;
+ if (remote_port != DISCOVEY_PORT) delay = DATA_RETENTION_PERIOD / 3 * 2;
+ else if (!s.address.equals(remote_address)) delay = DATA_RETENTION_PERIOD / 2;
+ if (s.last_slaves_req_time + delay <= time) {
+ sendSlavesRequest(remote_address, remote_port);
+ s.last_slaves_req_time = time;
+ }
+ if (s.address.equals(remote_address) && remote_port == DISCOVEY_PORT) {
+ last_master_packet_time = time;
+ }
+ }
+ }
+ }
+ catch (Throwable x) {
+ Protocol.log("Invalid datagram packet received", x);
+ }
+ }
+
+ private void handlePeerInfoPacket(DatagramPacket p) {
+ try {
+ Map map = new HashMap();
+ String s = new String(p.getData(), 8, p.getLength() - 8, "UTF-8");
+ int l = s.length();
+ int i = 0;
+ while (i < l) {
+ int i0 = i;
+ while (i < l && s.charAt(i) != '=' && s.charAt(i) != 0) i++;
+ int i1 = i;
+ if (i < l && s.charAt(i) == '=') i++;
+ int i2 = i;
+ while (i < l && s.charAt(i) != 0) i++;
+ int i3 = i;
+ if (i < l && s.charAt(i) == 0) i++;
+ String key = s.substring(i0, i1);
+ String val = s.substring(i2, i3);
+ map.put(key, val);
+ }
+ String id = map.get(IPeer.ATTR_ID);
+ if (id == null) throw new Exception("Invalid peer info: no ID");
+ String peer_host = map.get(IPeer.ATTR_IP_HOST);
+ if (peer_host == null) return;
+ InetAddress peer_addr = InetAddress.getByName(peer_host);
+ for (SubNet subnet : subnets) {
+ if (!subnet.contains(peer_addr)) continue;
+ IPeer peer = peers.get(id);
+ if (peer instanceof RemotePeer) {
+ ((RemotePeer)peer).updateAttributes(map);
+ }
+ else if (peer == null) {
+ new RemotePeer(map);
+ }
+ break;
+ }
+ }
+ catch (Exception x) {
+ Protocol.log("Invalid datagram packet received", x);
+ }
+ }
+
+ private void handleReqInfoPacket(DatagramPacket p, Slave sl, long time) {
+ sendAll(p.getAddress(), p.getPort(), sl, time);
+ }
+
+ private void handleSlavesInfoPacket(DatagramPacket p) {
+ try {
+ String s = new String(p.getData(), 8, p.getLength() - 8, "UTF-8");
+ int l = s.length();
+ int i = 0;
+ while (i < l) {
+ int time0 = i;
+ while (i < l&& s.charAt(i) != ':' && s.charAt(i) != 0) i++;
+ int time1 = i;
+ if (i < l && s.charAt(i) == ':') i++;
+ int port0 = i;
+ while (i < l&& s.charAt(i) != ':' && s.charAt(i) != 0) i++;
+ int port1 = i;
+ if (i < l && s.charAt(i) == ':') i++;
+ int host0 = i;
+ while (i < l && s.charAt(i) != 0) i++;
+ int host1 = i;
+ if (i < l && s.charAt(i) == 0) i++;
+ int port = Integer.parseInt(s.substring(port0, port1));
+ if (port != DISCOVEY_PORT) {
+ String host = s.substring(host0, host1);
+ long time = time0 != time1 ? Long.parseLong(s.substring(time0, time1)) : System.currentTimeMillis();
+ addSlave(InetAddress.getByName(host), port, time);
+ }
+ }
+ }
+ catch (Exception x) {
+ Protocol.log("Invalid datagram packet received", x);
+ }
+ }
+
+ private void handleReqSlavesPacket(DatagramPacket p, Slave sl, long time) {
+ if (sl != null) sl.last_req_slaves_time = time;
+ sendSlavesInfo(p.getAddress(), p.getPort(), time);
+ }
+
+ /*----------------------------------------------------------------------------------*/
+
+ public static LocatorService getLocator() {
+ return locator;
+ }
+
+ public String getName() {
+ return NAME;
+ }
+
+ public Map getPeers() {
+ assert Protocol.isDispatchThread();
+ return peers;
+ }
+
+ public IToken redirect(String peer_id, DoneRedirect done) {
+ throw new Error("Channel redirect cannot be done on local peer");
+ }
+
+ public IToken sync(DoneSync done) {
+ throw new Error("Channel sync cannot be done on local peer");
+ }
+
+ public void addListener(LocatorListener listener) {
+ assert listener != null;
+ assert Protocol.isDispatchThread();
+ listeners.add(listener);
+ }
+
+ public void removeListener(LocatorListener listener) {
+ assert Protocol.isDispatchThread();
+ listeners.remove(listener);
+ }
+}
diff -r b6b7ad8a25a3 -r 11a6943ebeb2 dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/BreakpointsProxy.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/BreakpointsProxy.java Mon Aug 17 16:02:00 2009 -0500
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.services.remote;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.tm.tcf.core.Command;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.protocol.JSON;
+import org.eclipse.tm.tcf.services.IBreakpoints;
+
+
+public class BreakpointsProxy implements IBreakpoints {
+
+ private final IChannel channel;
+ private final Map listeners =
+ new HashMap();
+
+ public BreakpointsProxy(IChannel channel) {
+ this.channel = channel;
+ }
+
+ public IToken set(Map[] properties, final DoneCommand done) {
+ return new Command(channel, this, "set", new Object[]{ properties }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ if (error == null) {
+ assert args.length == 1;
+ error = toError(args[0]);
+ }
+ done.doneCommand(token, error);
+ }
+ }.token;
+ }
+
+ public IToken add(Map properties, final DoneCommand done) {
+ return new Command(channel, this, "add", new Object[]{ properties }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ if (error == null) {
+ assert args.length == 1;
+ error = toError(args[0]);
+ }
+ done.doneCommand(token, error);
+ }
+ }.token;
+ }
+
+ public IToken change(Map properties, final DoneCommand done) {
+ return new Command(channel, this, "change", new Object[]{ properties }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ if (error == null) {
+ assert args.length == 1;
+ error = toError(args[0]);
+ }
+ done.doneCommand(token, error);
+ }
+ }.token;
+ }
+
+ public IToken disable(String[] ids, final DoneCommand done) {
+ return new Command(channel, this, "disable", new Object[]{ ids }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ if (error == null) {
+ assert args.length == 1;
+ error = toError(args[0]);
+ }
+ done.doneCommand(token, error);
+ }
+ }.token;
+ }
+
+ public IToken enable(String[] ids, final DoneCommand done) {
+ return new Command(channel, this, "enable", new Object[]{ ids }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ if (error == null) {
+ assert args.length == 1;
+ error = toError(args[0]);
+ }
+ done.doneCommand(token, error);
+ }
+ }.token;
+ }
+
+ public IToken remove(String[] ids, final DoneCommand done) {
+ return new Command(channel, this, "remove", new Object[]{ ids }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ if (error == null) {
+ assert args.length == 1;
+ error = toError(args[0]);
+ }
+ done.doneCommand(token, error);
+ }
+ }.token;
+ }
+
+ public IToken getIDs(final DoneGetIDs done) {
+ return new Command(channel, this, "getIDs", null) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ String[] arr = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ arr = toStringArray(args[1]);
+ }
+ done.doneGetIDs(token, error, arr);
+ }
+ }.token;
+ }
+
+ public IToken getProperties(String id, final DoneGetProperties done) {
+ return new Command(channel, this, "getProperties", new Object[]{ id }) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void done(Exception error, Object[] args) {
+ Map map = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ map = (Map)args[1];
+ }
+ done.doneGetProperties(token, error, map);
+ }
+ }.token;
+ }
+
+ public IToken getStatus(String id, final DoneGetStatus done) {
+ return new Command(channel, this, "getStatus", new Object[]{ id }) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void done(Exception error, Object[] args) {
+ Map map = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ map = (Map)args[1];
+ }
+ done.doneGetStatus(token, error, map);
+ }
+ }.token;
+ }
+
+ public IToken getCapabilities(String id, final DoneGetCapabilities done) {
+ return new Command(channel, this, "getCapabilities", new Object[]{ id }) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void done(Exception error, Object[] args) {
+ Map map = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ map = (Map)args[1];
+ }
+ done.doneGetCapabilities(token, error, map);
+ }
+ }.token;
+ }
+
+ public String getName() {
+ return NAME;
+ }
+
+ @SuppressWarnings("unchecked")
+ private String[] toStringArray(Object o) {
+ if (o == null) return null;
+ Collection c = (Collection)o;
+ return (String[])c.toArray(new String[c.size()]);
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map[] toBreakpointArray(Object o) {
+ if (o == null) return null;
+ Collection