Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server')
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.classpath7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.cvsignore5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.project28
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.core.prefs256
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.ui.prefs20
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.pde.prefs12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.emf.cdo.server/build.properties9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/epl-v10.html319
-rw-r--r--plugins/org.eclipse.emf.cdo.server/plugin.properties2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/plugin.xml5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoResServerProtocol.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerException.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerPlugin.java103
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerProtocol.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java89
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java150
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java876
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java66
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java85
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java72
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java81
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SqlConstants.java199
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java64
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoResServerProtocolImpl.java79
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoServerProtocolImpl.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java620
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java110
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidateObjectRequest.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRidIndication.java55
46 files changed, 4189 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/.classpath b/plugins/org.eclipse.emf.cdo.server/.classpath
new file mode 100644
index 0000000000..751c8f2e50
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.emf.cdo.server/.cvsignore b/plugins/org.eclipse.emf.cdo.server/.cvsignore
new file mode 100644
index 0000000000..eb65b4b8f2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/.cvsignore
@@ -0,0 +1,5 @@
+tmp
+bin
+dist
+build
+runtime
diff --git a/plugins/org.eclipse.emf.cdo.server/.project b/plugins/org.eclipse.emf.cdo.server/.project
new file mode 100644
index 0000000000..9ea6a8ca9c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.cdo.server</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..a26cfdb179
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,256 @@
+#Tue Mar 21 17:41:42 CET 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.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=2
+org.eclipse.jdt.core.formatter.blank_lines_after_package=2
+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=2
+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_type_declarations=2
+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=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_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=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+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_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=100
+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=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=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=do not 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_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=100
+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=2
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000000..166555c1ac
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,20 @@
+#Mon Mar 13 08:16:17 CET 2006
+comment_clear_blank_lines=false
+comment_format_comments=false
+comment_format_header=false
+comment_format_html=true
+comment_format_source_code=true
+comment_indent_parameter_description=true
+comment_indent_root_tags=true
+comment_line_length=100
+comment_new_line_for_parameter=true
+comment_separate_root_tags=true
+eclipse.preferences.version=1
+formatter_settings_version=10
+internal.default.compliance=default
+org.eclipse.jdt.ui.exception.name=ex
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=org.eclipse.net4j;org.eclipse.emf;org.eclipse;org.apache;org;com;java.lang;java.util;java.io;java.nio;java.net;java;javax;
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
diff --git a/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000000..7aff9bcec7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,12 @@
+#Mon Mar 14 22:44:16 CET 2005
+compilers.p.deprecated=1
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=0
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..7f39047697
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.emf.cdo.server
+Bundle-Version: 1.0.0
+Bundle-ClassPath: net4j.cdo.server.jar
+Bundle-Activator: org.eclipse.emf.cdo.server.CdoServerPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.emf.cdo.core;visibility:=reexport,
+ org.eclipse.emf.dbgen;visibility:=reexport,
+ org.eclipse.emf.jdbc;visibility:=reexport
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.emf.cdo.server,
+ org.eclipse.emf.cdo.server.impl,
+ org.eclipse.emf.cdo.server.protocol
diff --git a/plugins/org.eclipse.emf.cdo.server/build.properties b/plugins/org.eclipse.emf.cdo.server/build.properties
new file mode 100644
index 0000000000..9557100be9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/build.properties
@@ -0,0 +1,9 @@
+src.includes = src/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ net4j.cdo.server.jar,\
+ plugin.properties,\
+ epl-v10.html
+jars.compile.order = net4j.cdo.server.jar
+source.net4j.cdo.server.jar = src/
+output.net4j.cdo.server.jar = bin/
diff --git a/plugins/org.eclipse.emf.cdo.server/epl-v10.html b/plugins/org.eclipse.emf.cdo.server/epl-v10.html
new file mode 100644
index 0000000000..d7b88e9416
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/epl-v10.html
@@ -0,0 +1,319 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<meta name="ProgId" content="Word.Document">
+<meta name="Generator" content="Microsoft Word 9">
+<meta name="Originator" content="Microsoft Word 9">
+<link rel="File-List" href="http://www.eclipse.org/org/documents/Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"><title>Eclipse Public License - Version 1.0</title><!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+
+
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style></head>
+
+<body style="" lang="EN-US">
+
+<div class="Section1">
+
+<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p>
+
+<p><span style="font-size: 10pt;">"Contribution" means:</span> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear="left">
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
+changes to the Program, and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
+additions to the Program;</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style="font-size: 10pt;">"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style="font-size: 10pt;">"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style="font-size: 10pt;">"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style="font-size: 10pt;">"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p>
+
+<p><span style="font-size: 10pt;">A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
+its license agreement:</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style="color: blue;"> </span></span></p>
+
+<p><span style="font-size: 10pt;">When the Program is made available in source
+code form:</span> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+it must be made available under this Agreement; and </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style="font-size: 10pt;">Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style="font-size: 10pt;">Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style="font-size: 10pt;">Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style="font-size: 10pt;">For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p>
+
+<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p>
+
+<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style="font-size: 10pt;">If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
+
+</div>
+
+</body></html> \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/plugin.properties b/plugins/org.eclipse.emf.cdo.server/plugin.properties
new file mode 100644
index 0000000000..e6fd2cbf38
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/plugin.properties
@@ -0,0 +1,2 @@
+pluginName = Net4j CDO Server
+providerName = Eclipse.org
diff --git a/plugins/org.eclipse.emf.cdo.server/plugin.xml b/plugins/org.eclipse.emf.cdo.server/plugin.xml
new file mode 100644
index 0000000000..8e49b52120
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/plugin.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java
new file mode 100644
index 0000000000..195587a374
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+public interface AttributeInfo
+{
+ public String getName();
+
+ public int getFeatureID();
+
+ public int getDataType();
+
+ public String getColumnName();
+
+ public int getColumnType();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoResServerProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoResServerProtocol.java
new file mode 100644
index 0000000000..cf1a9a6116
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoResServerProtocol.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.net4j.spring.Service;
+
+import org.springframework.transaction.support.TransactionTemplate;
+
+
+public interface CdoResServerProtocol extends Service
+{
+ public Mapper getMapper();
+
+ public TransactionTemplate getTransactionTemplate();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerException.java
new file mode 100644
index 0000000000..978061afdb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerException.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.emf.cdo.core.CdoException;
+
+
+public class CdoServerException extends CdoException
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4120854356464777268L;
+
+ /**
+ *
+ */
+ public CdoServerException()
+ {
+ super();
+ }
+
+ /**
+ * @param message
+ */
+ public CdoServerException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public CdoServerException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public CdoServerException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerPlugin.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerPlugin.java
new file mode 100644
index 0000000000..542bb6d4b3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerPlugin.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.net4j.util.eclipse.AbstractPlugin;
+import org.eclipse.net4j.util.eclipse.Element;
+import org.eclipse.net4j.util.eclipse.ListExtensionParser;
+
+import java.util.List;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class CdoServerPlugin extends AbstractPlugin
+{
+ //The shared instance.
+ private static CdoServerPlugin plugin;
+
+ /**
+ * The constructor.
+ */
+ public CdoServerPlugin()
+ {
+ if (plugin == null) plugin = this;
+ }
+
+ protected void doStart() throws Exception
+ {
+ }
+
+ protected void doStop() throws Exception
+ {
+ plugin = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static CdoServerPlugin getDefault()
+ {
+ return plugin;
+ }
+
+
+ public class MappingElement extends Element
+ {
+ protected String uri;
+
+ protected String map;
+
+ public String getMap()
+ {
+ return map;
+ }
+
+ public void setMap(String map)
+ {
+ this.map = map;
+ }
+
+ public String getUri()
+ {
+ return uri;
+ }
+
+ public void setUri(String url)
+ {
+ this.uri = url;
+ }
+
+ public String toString()
+ {
+ return "Mapping(" + uri + ", " + map + ")";
+ }
+ }
+
+
+ public class MappingExtensionParser extends ListExtensionParser
+ {
+ public MappingExtensionParser(List list)
+ {
+ super(list);
+
+ addFactory("mapping", new Element.Factory()
+ {
+ public Element createElementData()
+ {
+ return new MappingElement();
+ }
+ });
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerProtocol.java
new file mode 100644
index 0000000000..1441b7d8d7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CdoServerProtocol.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.net4j.spring.Service;
+
+import org.springframework.transaction.support.TransactionTemplate;
+
+
+public interface CdoServerProtocol extends Service
+{
+ public Mapper getMapper();
+
+ public TransactionTemplate getTransactionTemplate();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java
new file mode 100644
index 0000000000..b94d6ccb7d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+public interface ClassInfo
+{
+ public int getCid();
+
+ public String getName();
+
+ public String getParentName();
+
+ public String getTableName();
+
+ public PackageInfo getPackageInfo();
+
+ public AttributeInfo addAttribute(String name, int featureID, int dataType, String columnName,
+ int columnType);
+
+ public AttributeInfo getAttributeInfo(int feature);
+
+ public AttributeInfo[] getAttributeInfos();
+
+ public ClassInfo getParent();
+
+ public String getColumnNames();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java
new file mode 100644
index 0000000000..e01b155016
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.net4j.core.Channel;
+import org.eclipse.net4j.spring.Service;
+
+
+public interface ColumnConverter extends Service
+{
+ /**
+ * @param channel
+ * @return
+ */
+ public Object fromChannel(Channel channel, int dataType);
+
+ /**
+ *
+ * @param channel
+ * @param value
+ */
+ public void toChannel(Channel channel, int dataType, Object value);
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java
new file mode 100644
index 0000000000..1df76e76e9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+public class DatabaseInconsistencyException extends CdoServerException
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3618700786088031544L;
+
+ /**
+ *
+ */
+ public DatabaseInconsistencyException()
+ {
+ super();
+ }
+
+ /**
+ * @param message
+ */
+ public DatabaseInconsistencyException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public DatabaseInconsistencyException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public DatabaseInconsistencyException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java
new file mode 100644
index 0000000000..60dae9cfbf
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.net4j.core.Channel;
+import org.eclipse.net4j.spring.Service;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.core.OidEncoder;
+
+
+public interface Mapper extends Service, CdoProtocol
+{
+ public int getNextPid();
+
+ public int getNextCid();
+
+ public int getNextRid();
+
+ public long getNextOid(int rid);
+
+ public void sql(String sql);
+
+ public void sql(String sql, Object[] args);
+
+ public int getCollectionCount(long oid, int feature);
+
+ public boolean lock(long oid, int oca);
+
+ public void insertPackage(final PackageInfo packageInfo);
+
+ public void insertClass(final ClassInfo classInfo);
+
+ public void insertAttribute(final AttributeInfo attributeInfo, final int cid);
+
+ public ResourceInfo createResource(String resourcePath);
+
+ public ResourceInfo selectResourceInfo(String path);
+
+ public ResourceInfo selectResourceInfo(int rid);
+
+ public void insertReference(long oid, int feature, int ordinal, long target, boolean content);
+
+ public void removeReference(long oid, int feature, int ordinal);
+
+ public void moveReferenceAbsolute(long oid, int feature, int toIndex, int fromIndex);
+
+ public void moveReferencesRelative(long oid, int feature, int startIndex, int endIndex, int offset);
+
+ public void insertObject(long oid, int cid);
+
+ public void insertContent(long oid);
+
+ public void removeObject(long oid);
+
+ public void removeContent(long oid);
+
+ public void transmitContent(Channel channel, ResourceInfo resourceInfo);
+
+ public void transmitObject(Channel channel, long oid);
+
+ public void transmitAttributes(Channel channel, long oid, ClassInfo classInfo);
+
+ public void transmitReferences(Channel channel, long oid);
+
+ public void transmitAllResources(Channel channel);
+
+ public void createAttributeTables(PackageInfo packageInfo);
+
+ public void insertResource(int rid, String path);
+
+ public OidEncoder getOidEncoder();
+
+ public PackageManager getPackageManager();
+
+ public ResourceManager getResourceManager();
+
+ public ColumnConverter getColumnConverter();
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java
new file mode 100644
index 0000000000..fbbf69b3e8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+public interface PackageInfo
+{
+ public int getPid();
+
+ public String getName();
+
+ public PackageManager getPackageManager();
+
+ public ClassInfo addClass(int cid, String name, String parentName, String tableName);
+
+ public ClassInfo[] getClasses();
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java
new file mode 100644
index 0000000000..ce106fdff4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+public interface PackageListener
+{
+ public void notifyAddedPackage();
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java
new file mode 100644
index 0000000000..d0278e4960
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.net4j.spring.Service;
+
+
+public interface PackageManager extends Service
+{
+ public void addPackageListener(PackageListener listener);
+
+ public void removePackageListener(PackageListener listener);
+
+ public PackageInfo addPackage(int pid, String name);
+
+ public PackageInfo getPackageInfo(String name);
+
+ public void registerClassInfo(ClassInfo classInfo);
+
+ public ClassInfo getClassInfo(int cid);
+
+ public ClassInfo getClassInfo(String name);
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java
new file mode 100644
index 0000000000..7714efd5a8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+public interface ResourceInfo
+{
+ public long getNextOIDFragment();
+
+ public String getPath();
+
+ public int getRid();
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java
new file mode 100644
index 0000000000..073587db70
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+import org.eclipse.net4j.spring.Service;
+
+
+public interface ResourceManager extends Service
+{
+ public void registerResourceInfo(ResourceInfo resourceInfo);
+
+ public ResourceInfo registerResourceInfo(String resourcePath, int rid, long nextOidFragment);
+
+ public ResourceInfo getResourceInfo(int rid, Mapper mapper);
+
+ public ResourceInfo getResourceInfo(String path, Mapper mapper);
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java
new file mode 100644
index 0000000000..4b9e8c22b2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server;
+
+
+public class ResourceNotFoundException extends CdoServerException
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3545239124224062515L;
+
+ public ResourceNotFoundException()
+ {
+ super();
+ }
+
+ public ResourceNotFoundException(String message)
+ {
+ super(message);
+ }
+
+ public ResourceNotFoundException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public ResourceNotFoundException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java
new file mode 100644
index 0000000000..4a942cf5ae
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.emf.cdo.server.AttributeInfo;
+
+
+public class AttributeInfoImpl implements AttributeInfo
+{
+ protected String name;
+
+ protected int featureID;
+
+ protected int dataType;
+
+ protected String columnName;
+
+ protected int columnType;
+
+ public AttributeInfoImpl(String name, int featureID, int dataType, String columnName,
+ int columnType)
+ {
+ this.name = name;
+ this.featureID = featureID;
+ this.dataType = dataType;
+ this.columnName = columnName;
+ this.columnType = columnType;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int getFeatureID()
+ {
+ return featureID;
+ }
+
+ public int getDataType()
+ {
+ return dataType;
+ }
+
+ public String getColumnName()
+ {
+ return columnName;
+ }
+
+ public int getColumnType()
+ {
+ return columnType;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java
new file mode 100644
index 0000000000..2a382d44a0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.emf.cdo.server.AttributeInfo;
+import org.eclipse.emf.cdo.server.ClassInfo;
+import org.eclipse.emf.cdo.server.PackageInfo;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class ClassInfoImpl implements ClassInfo
+{
+ protected int cid;
+
+ protected String name;
+
+ protected String parentName;
+
+ protected String tableName;
+
+ protected PackageInfo packageInfo;
+
+ protected List attributeInfos = new ArrayList();
+
+ private ClassInfo cachedParent;
+
+ private String cachedColumnNames;
+
+ public ClassInfoImpl(int cid, String name, String parentName, String tableName,
+ PackageInfo packageInfo)
+ {
+ this.cid = cid;
+ this.cid = cid;
+ this.name = name;
+ this.parentName = parentName;
+ this.tableName = tableName;
+ this.packageInfo = packageInfo;
+ }
+
+ public int getCid()
+ {
+ return cid;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getParentName()
+ {
+ return parentName;
+ }
+
+ public String getTableName()
+ {
+ return tableName;
+ }
+
+ public PackageInfo getPackageInfo()
+ {
+ return packageInfo;
+ }
+
+ public AttributeInfo addAttribute(String name, int featureID, int dataType, String columnName,
+ int columnType)
+ {
+ AttributeInfo attributeInfo = new AttributeInfoImpl(name, featureID, dataType, columnName,
+ columnType);
+ attributeInfos.add(attributeInfo);
+ return attributeInfo;
+ }
+
+ public AttributeInfo getAttributeInfo(int feature)
+ {
+ for (Iterator iter = attributeInfos.iterator(); iter.hasNext();)
+ {
+ AttributeInfo attributeInfo = (AttributeInfo) iter.next();
+
+ if (attributeInfo.getFeatureID() == feature)
+ {
+ return attributeInfo;
+ }
+ }
+
+ ClassInfo parentInfo = getParent();
+ if (parentInfo != null)
+ {
+ return parentInfo.getAttributeInfo(feature);
+ }
+
+ return null;
+ }
+
+ public AttributeInfo[] getAttributeInfos()
+ {
+ return (AttributeInfo[]) attributeInfos.toArray(new AttributeInfo[attributeInfos.size()]);
+ }
+
+ public ClassInfo getParent()
+ {
+ if (cachedParent == null && parentName != null)
+ {
+ cachedParent = packageInfo.getPackageManager().getClassInfo(parentName);
+ }
+
+ return cachedParent;
+ }
+
+ public String getColumnNames()
+ {
+ if (cachedColumnNames == null)
+ {
+ StringBuffer buffer = new StringBuffer();
+ boolean first = true;
+
+ for (Iterator iter = attributeInfos.iterator(); iter.hasNext();)
+ {
+ AttributeInfo attributeInfo = (AttributeInfo) iter.next();
+
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ buffer.append(", ");
+ }
+
+ buffer.append(attributeInfo.getColumnName());
+ }
+
+ cachedColumnNames = buffer.toString();
+ }
+
+ return cachedColumnNames;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java
new file mode 100644
index 0000000000..1083244e71
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.net4j.core.Channel;
+
+import org.eclipse.emf.cdo.core.impl.AbstractConverter;
+import org.eclipse.emf.cdo.server.ColumnConverter;
+
+
+public class ColumnConverterImpl extends AbstractConverter implements ColumnConverter
+{
+ public Object fromChannel(Channel channel, int dataType)
+ {
+ if (dataType > MIN_PRIMITIVE)
+ {
+ boolean isNull = channel.receiveBoolean();
+
+ if (isNull)
+ {
+ return null;
+ }
+
+ if (dataType < MAX_PRIMITIVE)
+ {
+ dataType = -dataType;
+ }
+ }
+
+ return dispatchFromChannel(channel, dataType);
+ }
+
+ public void toChannel(Channel channel, int dataType, Object value)
+ {
+ if (dataType > MIN_PRIMITIVE)
+ {
+ boolean isNull = value == null;
+ channel.transmitBoolean(isNull);
+
+ if (isNull)
+ {
+ return;
+ }
+
+ if (dataType < MAX_PRIMITIVE)
+ {
+ dataType = -dataType;
+ }
+ }
+
+ dispatchToChannel(channel, dataType, value);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java
new file mode 100644
index 0000000000..64bf45a82e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java
@@ -0,0 +1,876 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.net4j.core.Channel;
+import org.eclipse.net4j.spring.ValidationException;
+import org.eclipse.net4j.spring.impl.ServiceImpl;
+import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.StringHelper;
+
+import org.eclipse.emf.cdo.core.CdoResProtocol;
+import org.eclipse.emf.cdo.core.OidEncoder;
+import org.eclipse.emf.cdo.server.AttributeInfo;
+import org.eclipse.emf.cdo.server.ClassInfo;
+import org.eclipse.emf.cdo.server.ColumnConverter;
+import org.eclipse.emf.cdo.server.DatabaseInconsistencyException;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.PackageInfo;
+import org.eclipse.emf.cdo.server.PackageManager;
+import org.eclipse.emf.cdo.server.ResourceInfo;
+import org.eclipse.emf.cdo.server.ResourceManager;
+import org.eclipse.emf.cdo.server.ResourceNotFoundException;
+import org.eclipse.emf.dbgen.ColumnType;
+import org.eclipse.emf.dbgen.Database;
+import org.eclipse.emf.dbgen.DbgenFactory;
+import org.eclipse.emf.dbgen.IndexType;
+import org.eclipse.emf.dbgen.SqlDialect;
+import org.eclipse.emf.dbgen.Table;
+import org.eclipse.emf.dbgen.internal.DbgenActivator;
+
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowCallbackHandler;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+
+public class MapperImpl extends ServiceImpl implements Mapper, SqlConstants
+{
+ protected static final int OBJECT_NOT_FOUND_IN_DB = 0;
+
+ protected static final long OBJECT_NOT_REFERENCED_IN_DB = 0;
+
+ protected ColumnConverter columnConverter;
+
+ protected PackageManager packageManager;
+
+ protected ResourceManager resourceManager;
+
+ protected DataSource dataSource;
+
+ protected JdbcTemplate jdbcTemplate;
+
+ protected String sqlDialectName;
+
+ protected OidEncoder oidEncoder;
+
+ private int nextPid;
+
+ private int nextRid;
+
+ private int nextCid;
+
+ private transient SqlDialect cachedSqlDialect;
+
+ /**
+ * @return Returns the packageManager.
+ */
+ public PackageManager getPackageManager()
+ {
+ return packageManager;
+ }
+
+ /**
+ * @param packageManager The packageManager to set.
+ */
+ public void setPackageManager(PackageManager packageManager)
+ {
+ doSet("packageManager", packageManager);
+ }
+
+ /**
+ * @return Returns the columnConverter.
+ */
+ public ColumnConverter getColumnConverter()
+ {
+ return columnConverter;
+ }
+
+ /**
+ * @param columnConverter The columnConverter to set.
+ */
+ public void setColumnConverter(ColumnConverter columnConverter)
+ {
+ doSet("columnConverter", columnConverter);
+ }
+
+ public ResourceManager getResourceManager()
+ {
+ return resourceManager;
+ }
+
+ public void setResourceManager(ResourceManager resourceManager)
+ {
+ doSet("resourceManager", resourceManager);
+ }
+
+ /**
+ * @return Returns the dataSource.
+ */
+ public DataSource getDataSource()
+ {
+ return dataSource;
+ }
+
+ /**
+ * @param dataSource The dataSource to set.
+ */
+ public void setDataSource(DataSource dataSource)
+ {
+ doSet("dataSource", dataSource);
+ }
+
+ /**
+ * @return Returns the sqlDialect.
+ */
+ public SqlDialect getSqlDialect()
+ {
+ if (cachedSqlDialect == null)
+ {
+ cachedSqlDialect = DbgenActivator.INSTANCE.createDialect(sqlDialectName);
+ }
+ return cachedSqlDialect;
+ }
+
+ public String getSqlDialectName()
+ {
+ return sqlDialectName;
+ }
+
+ /**
+ * @param sqlDialectName The sqlDialectName to set.
+ */
+ public void setSqlDialectName(String sqlDialectName)
+ {
+ doSet("sqlDialectName", sqlDialectName);
+ }
+
+ /**
+ * @return Returns the oidEncoder.
+ */
+ public OidEncoder getOidEncoder()
+ {
+ return oidEncoder;
+ }
+
+ /**
+ * @param oidEncoder The oidEncoder to set.
+ */
+ public void setOidEncoder(OidEncoder oidEncoder)
+ {
+ doSet("oidEncoder", oidEncoder);
+ }
+
+ /**
+ * @return Returns the jdbcTemplate.
+ */
+ public JdbcTemplate getJdbcTemplate()
+ {
+ return jdbcTemplate;
+ }
+
+ /**
+ * @param jdbcTemplate The jdbcTemplate to set.
+ */
+ public void setJdbcTemplate(JdbcTemplate jdbcTemplate)
+ {
+ doSet("jdbcTemplate", jdbcTemplate);
+ }
+
+ public int getNextPid()
+ {
+ return nextPid++;
+ }
+
+ public int getNextCid()
+ {
+ return nextCid++;
+ }
+
+ public int getNextRid()
+ {
+ return nextRid++;
+ }
+
+ public long getNextOid(int rid)
+ {
+ ResourceInfo resourceInfo = resourceManager.getResourceInfo(rid, this);
+ if (resourceInfo == null) throw new ResourceNotFoundException("Unknown RID: " + rid);
+
+ long nextOidFragment = resourceInfo.getNextOIDFragment();
+ return oidEncoder.getOID(rid, nextOidFragment);
+ }
+
+ protected void validate() throws ValidationException
+ {
+ super.validate();
+ assertNotNull("columnConverter");
+ assertNotNull("packageManager");
+ assertNotNull("resourceManager");
+ assertNotNull("dataSource");
+ assertNotNull("oidEncoder");
+ assertNotNull("jdbcTemplate");
+
+ initTables();
+ initPackages();
+
+ nextPid = selectMaxPid() + 1;
+ nextCid = selectMaxCid() + 1;
+ nextRid = selectMaxRid() + 1;
+ }
+
+ protected void initTables()
+ {
+ Database database = DbgenFactory.eINSTANCE.createDatabase();
+
+ // Table systemTable = database.addTable(SYSTEM_TABLE);
+ // systemTable.addColumn(SYSTEM_SID_COLUMN, ColumnType.VARCHAR_LITERAL, 63);
+ // systemTable.addColumn(SYSTEM_STARTED_COLUMN, ColumnType.BOOLEAN_LITERAL);
+ // systemTable.addSimpleIndex(SYSTEM_SID_COLUMN, IndexType.PRIMARY_LITERAL);
+
+ Table packageTable = database.addTable(PACKAGE_TABLE);
+ packageTable.addColumn(PACKAGE_PID_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ packageTable.addColumn(PACKAGE_NAME_COLUMN, ColumnType.VARCHAR_LITERAL, 255, "NOT NULL");
+ packageTable.addSimpleIndex(PACKAGE_PID_COLUMN, IndexType.PRIMARY_LITERAL);
+ packageTable.addSimpleIndex(PACKAGE_NAME_COLUMN, IndexType.UNIQUE_LITERAL);
+
+ Table classTable = database.addTable(CLASS_TABLE);
+ classTable.addColumn(CLASS_CID_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ classTable.addColumn(CLASS_NAME_COLUMN, ColumnType.VARCHAR_LITERAL, 255, "NOT NULL");
+ classTable.addColumn(CLASS_PARENTNAME_COLUMN, ColumnType.VARCHAR_LITERAL, 255);
+ classTable.addColumn(CLASS_TABLENAME_COLUMN, ColumnType.VARCHAR_LITERAL, 127, "NOT NULL");
+ classTable.addColumn(CLASS_PID_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ classTable.addSimpleIndex(CLASS_CID_COLUMN, IndexType.PRIMARY_LITERAL);
+ classTable.addSimpleIndex(CLASS_NAME_COLUMN, IndexType.UNIQUE_LITERAL);
+ classTable.addSimpleIndex(CLASS_PID_COLUMN, IndexType.NON_UNIQUE_LITERAL);
+
+ Table columnTable = database.addTable(ATTRIBUTE_TABLE);
+ columnTable.addColumn(ATTRIBUTE_NAME_COLUMN, ColumnType.VARCHAR_LITERAL, 127, "NOT NULL");
+ columnTable.addColumn(ATTRIBUTE_FEATUREID_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ columnTable.addColumn(ATTRIBUTE_DATATYPE_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ columnTable.addColumn(ATTRIBUTE_COLUMNNAME_COLUMN, ColumnType.VARCHAR_LITERAL, 127, "NOT NULL");
+ columnTable.addColumn(ATTRIBUTE_COLUMNTYPE_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ columnTable.addColumn(ATTRIBUTE_CID_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ columnTable.addSimpleIndex(ATTRIBUTE_CID_COLUMN, IndexType.NON_UNIQUE_LITERAL);
+
+ Table objectTable = database.addTable(OBJECT_TABLE);
+ objectTable.addColumn(OBJECT_OID_COLUMN, ColumnType.BIGINT_LITERAL, "NOT NULL");
+ objectTable.addColumn(OBJECT_OCA_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ objectTable.addColumn(OBJECT_CID_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ objectTable.addSimpleIndex(OBJECT_OID_COLUMN, IndexType.PRIMARY_LITERAL);
+ objectTable.addSimpleIndex(OBJECT_CID_COLUMN, IndexType.NON_UNIQUE_LITERAL);
+
+ Table resourceTable = database.addTable(RESOURCE_TABLE);
+ resourceTable.addColumn(RESOURCE_RID_COLUMN, ColumnType.INTEGER_LITERAL, "NOT NULL");
+ resourceTable.addColumn(RESOURCE_PATH_COLUMN, ColumnType.VARCHAR_LITERAL, 255, "NOT NULL");
+ resourceTable.addSimpleIndex(RESOURCE_RID_COLUMN, IndexType.PRIMARY_LITERAL);
+ resourceTable.addSimpleIndex(RESOURCE_PATH_COLUMN, IndexType.UNIQUE_LITERAL);
+
+ Table contentTable = database.addTable(CONTENT_TABLE);
+ contentTable.addColumn(CONTENT_OID_COLUMN, ColumnType.BIGINT_LITERAL, "NOT NULL");
+ contentTable.addSimpleIndex(CONTENT_OID_COLUMN, IndexType.PRIMARY_LITERAL);
+
+ Table referenceTable = database.addTable(REFERENCE_TABLE);
+ referenceTable.addColumn(REFERENCE_OID_COLUMN, ColumnType.BIGINT_LITERAL);
+ referenceTable.addColumn(REFERENCE_FEATUREID_COLUMN, ColumnType.INTEGER_LITERAL);
+ referenceTable.addColumn(REFERENCE_ORDINAL_COLUMN, ColumnType.BIGINT_LITERAL);
+ referenceTable.addColumn(REFERENCE_TARGET_COLUMN, ColumnType.BIGINT_LITERAL, 0, "NOT NULL");
+ referenceTable.addColumn(REFERENCE_CONTENT_COLUMN, ColumnType.BOOLEAN_LITERAL);
+ referenceTable.addSimpleIndex(REFERENCE_TARGET_COLUMN, IndexType.NON_UNIQUE_LITERAL);
+
+ // TODO Check if this compound index generally makes preceding simple index superfluous
+ referenceTable.addCompoundIndex(new String[] { REFERENCE_TARGET_COLUMN,
+ REFERENCE_CONTENT_COLUMN,}, IndexType.NON_UNIQUE_LITERAL);
+
+ // This index can not be a real PK (UNIQUE), since during movement of allReferences
+ // it temporarily holds duplicate entries!!!
+ referenceTable.addCompoundIndex(new String[] { REFERENCE_OID_COLUMN,
+ REFERENCE_FEATUREID_COLUMN, REFERENCE_ORDINAL_COLUMN}, IndexType.NON_UNIQUE_LITERAL);
+
+ getSqlDialect().save(dataSource, database, false);
+ }
+
+ protected void initPackages()
+ {
+ if (isDebugEnabled()) debug(SELECT_PACKAGES);
+ jdbcTemplate.query(SELECT_PACKAGES, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ int pid = resultSet.getInt(1);
+ String name = resultSet.getString(2);
+
+ if (isDebugEnabled()) debug("Initializing package: pid=" + pid + ", name=" + name);
+ PackageInfo packageInfo = packageManager.addPackage(pid, name);
+ initClasses(packageInfo);
+ }
+ });
+ }
+
+ protected void initClasses(final PackageInfo packageInfo)
+ {
+ // TODO This is NOT necessary!
+ // Important to create a new template instance to handle nested select
+ JdbcTemplate nestedTemplate = new JdbcTemplate(dataSource);
+
+ Object[] args = { new Integer(packageInfo.getPid())};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_CLASSES, "?", args));
+
+ nestedTemplate.query(SELECT_CLASSES, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ int cid = resultSet.getInt(1);
+ String name = resultSet.getString(2);
+ String parentName = resultSet.getString(3);
+ String tableName = resultSet.getString(4);
+
+ if (isDebugEnabled())
+ debug("Initializing class: cid=" + cid + ", name=" + name + ", parentName=" + parentName
+ + ", tableName=" + tableName);
+ ClassInfo classInfo = packageInfo.addClass(cid, name, parentName, tableName);
+ initAttributes(classInfo);
+
+ if (cid > nextCid)
+ {
+ nextCid = cid;
+ }
+ }
+ });
+
+ ++nextCid;
+ }
+
+ protected void initAttributes(final ClassInfo classInfo)
+ {
+ // Important to create a new template instance to handle nested select
+ JdbcTemplate nestedTemplate = new JdbcTemplate(dataSource);
+
+ Object[] args = { new Integer(classInfo.getCid())};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_ATTRIBUTES, "?", args));
+
+ nestedTemplate.query(SELECT_ATTRIBUTES, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ String name = resultSet.getString(1);
+ int featureId = resultSet.getInt(2);
+ int dataType = resultSet.getInt(3);
+ String columnName = resultSet.getString(4);
+ int columnType = resultSet.getInt(5);
+
+ if (isDebugEnabled())
+ debug("Initializing attribute: name=" + name + ", featureId=" + featureId + ", dataType="
+ + dataType + ", columnName=" + columnName + ", columnType=" + columnType);
+ classInfo.addAttribute(name, featureId, dataType, columnName, columnType);
+ }
+ });
+ }
+
+ public void insertPackage(final PackageInfo packageInfo)
+ {
+ sql(INSERT_PACKAGE, new Object[] { new Integer(packageInfo.getPid()), packageInfo.getName()});
+ }
+
+ public void insertClass(final ClassInfo classInfo)
+ {
+ sql(INSERT_CLASS, new Object[] { new Integer(classInfo.getCid()), classInfo.getName(),
+ classInfo.getParentName(), classInfo.getTableName(),
+ new Integer(classInfo.getPackageInfo().getPid())});
+ }
+
+ public void insertAttribute(final AttributeInfo attributeInfo, final int cid)
+ {
+ sql(INSERT_ATTRIBUTE,
+ new Object[] { attributeInfo.getName(), new Integer(attributeInfo.getFeatureID()),
+ new Integer(attributeInfo.getDataType()), attributeInfo.getColumnName(),
+ new Integer(attributeInfo.getColumnType()), new Integer(cid)});
+ }
+
+ public ResourceInfo selectResourceInfo(String path)
+ {
+ Object[] args = { path};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_RID_OF_RESOURCE, "?", args));
+
+ final int[] rows = new int[1];
+ final ResourceInfoImpl result = new ResourceInfoImpl();
+ result.setPath(path);
+
+ jdbcTemplate.query(SELECT_RID_OF_RESOURCE, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ result.setRid(resultSet.getInt(1));
+ ++rows[0];
+ }
+ });
+
+ if (rows[0] != 1)
+ {
+ return null;
+ }
+
+ long nextOidFragment = selectMaxOidFragment(result.getRid()) + 1;
+ result.setNextOIDFragment(nextOidFragment);
+
+ if (isDebugEnabled()) debug("Selected " + result);
+ return result;
+ }
+
+ public ResourceInfo selectResourceInfo(int rid)
+ {
+ Object[] args = { new Integer(rid)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_PATH_OF_RESOURCE, "?", args));
+
+ final int[] rows = new int[1];
+ final ResourceInfoImpl result = new ResourceInfoImpl();
+ result.setRid(rid);
+
+ jdbcTemplate.query(SELECT_PATH_OF_RESOURCE, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ result.setPath(resultSet.getString(1));
+ ++rows[0];
+ }
+ });
+
+ if (rows[0] != 1)
+ {
+ return null;
+ }
+
+ long nextOidFragment = selectMaxOidFragment(result.getRid()) + 1;
+ result.setNextOIDFragment(nextOidFragment);
+
+ if (isDebugEnabled()) debug("Selected " + result);
+ return result;
+ }
+
+ protected int selectMaxOidFragment(int rid)
+ {
+ Object[] args = ridBounds(rid);
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_MAX_OID_FRAGMENT, "?", args));
+ long oid = jdbcTemplate.queryForLong(SELECT_MAX_OID_FRAGMENT, args);
+ return (int) (oid & 0xFFFFFFFFL); // TODO Without OidEncoder???
+ }
+
+ private Object[] ridBounds(int rid)
+ {
+ long lowerBound = oidEncoder.getOID(rid, 1);
+ long upperBound = oidEncoder.getOID(rid + 1, 1) - 1;
+ return new Object[] { new Long(lowerBound), new Long(upperBound)};
+ }
+
+ private int selectMaxPid()
+ {
+ if (isDebugEnabled()) debug(SELECT_MAX_PID);
+ return jdbcTemplate.queryForInt(SELECT_MAX_PID);
+ }
+
+ private int selectMaxCid()
+ {
+ if (isDebugEnabled()) debug(SELECT_MAX_CID);
+ return jdbcTemplate.queryForInt(SELECT_MAX_CID);
+ }
+
+ private int selectMaxRid()
+ {
+ if (isDebugEnabled()) debug(SELECT_MAX_RID);
+ return jdbcTemplate.queryForInt(SELECT_MAX_RID);
+ }
+
+ public ResourceInfo createResource(String resourcePath)
+ {
+ int rid = getNextRid();
+ sql(INSERT_RESOURCE, new Object[] { new Integer(rid), resourcePath});
+ return resourceManager.registerResourceInfo(resourcePath, rid, 1);
+ }
+
+ public int getCollectionCount(long oid, int feature)
+ {
+ Object[] args = { new Long(oid), new Integer(feature)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_COLLECTION_COUNT, "?", args));
+
+ return jdbcTemplate.queryForInt(SELECT_COLLECTION_COUNT, args);
+ }
+
+ public boolean lock(long oid, int oca)
+ {
+ Object[] args = { new Long(oid), new Integer(oca)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(DO_OPTIMISTIC_CONTROL, "?", args));
+
+ int changed = jdbcTemplate.update(DO_OPTIMISTIC_CONTROL, args);
+ return changed == 1;
+ }
+
+ public void insertResource(int rid, String path)
+ {
+ sql(INSERT_RESOURCE, new Object[] { new Integer(rid), path});
+ }
+
+ public void insertReference(long oid, int feature, int ordinal, long target, boolean content)
+ {
+ sql(INSERT_REFERENCE, new Object[] { new Long(oid), new Integer(feature), new Integer(ordinal),
+ new Long(target), new Boolean(content)});
+ }
+
+ public void removeReference(long oid, int feature, int ordinal)
+ {
+ sql(REMOVE_REFERENCE, new Object[] { new Long(oid), new Integer(feature), new Integer(ordinal)});
+ }
+
+ public void moveReferenceAbsolute(long oid, int feature, int toIndex, int fromIndex)
+ {
+ sql(MOVE_REFERENCE_ABSOLUTE, new Object[] { new Integer(toIndex), new Long(oid),
+ new Integer(feature), new Integer(fromIndex)});
+ }
+
+ public void moveReferencesRelative(long oid, int feature, int startIndex, int endIndex, int offset)
+ {
+ Object[] args = { new Integer(offset), new Long(oid), new Integer(feature),
+ new Integer(startIndex), new Integer(endIndex)};
+ if (isDebugEnabled())
+ debug(StringHelper.replaceWildcards(MOVE_REFERENCES_RELATIVE, "?", args));
+
+ // ignore number of affected rows
+ jdbcTemplate.update(MOVE_REFERENCES_RELATIVE, args);
+ }
+
+ public void insertObject(long oid, int cid)
+ {
+ sql(INSERT_OBJECT, new Object[] { new Long(oid), new Integer(cid)});
+ }
+
+ protected void removeReferences(long oid)
+ {
+ Object[] args = { new Long(oid)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(REMOVE_REFERENCES, "?", args));
+
+ jdbcTemplate.update(REMOVE_REFERENCES, args);
+ }
+
+ public void removeObject(long oid)
+ {
+ removeReferences(oid); // TODO optimize for objects with no refs
+
+ int cid = selectCidOfObject(oid);
+ ClassInfo classInfo = packageManager.getClassInfo(cid);
+
+ while (classInfo != null)
+ {
+ removeSegment(oid, classInfo.getTableName());
+ classInfo = classInfo.getParent();
+ }
+
+ removeSegment(oid, OBJECT_TABLE);
+ }
+
+ protected int selectCidOfObject(long oid)
+ {
+ Object[] args = { new Long(oid)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_CID_OF_OBJECT, "?", args));
+
+ try
+ {
+ return jdbcTemplate.queryForInt(SELECT_CID_OF_OBJECT, args);
+ }
+ catch (IncorrectResultSizeDataAccessException ex)
+ {
+ return OBJECT_NOT_FOUND_IN_DB;
+ }
+ }
+
+ protected void removeSegment(long oid, String tableName)
+ {
+ StringBuffer query = new StringBuffer("DELETE FROM ");
+ query.append(tableName);
+ query.append(" WHERE ");
+ query.append(OBJECT_OID_COLUMN);
+ query.append("=");
+ query.append(oid);
+
+ sql(query.toString());
+ }
+
+ public void insertContent(long oid)
+ {
+ sql(INSERT_CONTENT, new Object[] { new Long(oid)});
+ }
+
+ public void removeContent(long oid)
+ {
+ sql(REMOVE_CONTENT, new Object[] { new Long(oid)});
+ }
+
+ public void sql(String sql)
+ {
+ if (isDebugEnabled()) debug(sql);
+
+ int rows = jdbcTemplate.update(sql);
+
+ if (rows != 1)
+ {
+ throw new DatabaseInconsistencyException(sql);
+ }
+ }
+
+ public void sql(String sql, Object[] args)
+ {
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(sql, "?", args));
+
+ int rows = jdbcTemplate.update(sql, args);
+
+ if (rows != 1)
+ {
+ throw new DatabaseInconsistencyException(sql);
+ }
+ }
+
+ public void transmitContent(final Channel channel, ResourceInfo resourceInfo)
+ {
+ if (resourceInfo != null)
+ {
+ Object[] args = ridBounds(resourceInfo.getRid());
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(TRANSMIT_CONTENT, "?", args));
+
+ jdbcTemplate.query(TRANSMIT_CONTENT, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ long oid = resultSet.getLong(1);
+ int oca = resultSet.getInt(2);
+ int cid = resultSet.getInt(3);
+
+ if (isDebugEnabled())
+ debug("Object: oid=" + oidEncoder.toString(oid) + ", oca=" + oca + ", cid=" + cid);
+
+ channel.transmitLong(oid);
+ channel.transmitInt(oca);
+ channel.transmitInt(cid);
+
+ ClassInfo classInfo = packageManager.getClassInfo(cid);
+ if (classInfo == null) throw new ImplementationError("Unknown cid " + cid);
+
+ transmitAttributes(channel, oid, classInfo);
+ transmitReferences(channel, oid);
+ }
+ });
+ }
+
+ channel.transmitLong(0);
+ }
+
+ public void transmitObject(final Channel channel, final long oid)
+ {
+ Object[] args = { new Long(oid)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(TRANSMIT_OBJECT, "?", args));
+
+ jdbcTemplate.query(TRANSMIT_OBJECT, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ int oca = resultSet.getInt(1);
+ int cid = resultSet.getInt(2);
+
+ if (isDebugEnabled())
+ debug("Object: oid=" + oidEncoder.toString(oid) + ", oca=" + oca + ", cid=" + cid);
+
+ channel.transmitLong(oid);
+ channel.transmitInt(oca);
+ channel.transmitInt(cid);
+
+ ClassInfo classInfo = packageManager.getClassInfo(cid);
+ if (classInfo == null) throw new ImplementationError("Unknown cid " + cid);
+
+ transmitContainers(channel, oid);
+ transmitAttributes(channel, oid, classInfo);
+ transmitReferences(channel, oid);
+ }
+ });
+
+ channel.transmitLong(0);
+ }
+
+ public void transmitContainers(final Channel channel, long oid)
+ {
+ class Container
+ {
+ public long oid;
+
+ public int cid;
+
+ public Container(long oid, int cid)
+ {
+ this.oid = oid;
+ this.cid = cid;
+ }
+ }
+ ;
+
+ final List containers = new LinkedList();
+ final long[] child = { oid};
+
+ while (child[0] != 0)
+ {
+ Object[] args = { new Long(child[0]), Boolean.TRUE};
+ if (isDebugEnabled())
+ debug(StringHelper.replaceWildcards(SELECT_CONTAINER_OF_OBJECT, "?", args));
+
+ child[0] = 0;
+ jdbcTemplate.query(SELECT_CONTAINER_OF_OBJECT, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ long oid = resultSet.getLong(1);
+ int cid = resultSet.getInt(2);
+
+ containers.add(0, new Container(oid, cid));
+ child[0] = oid;
+ }
+ });
+ }
+
+ channel.transmitInt(containers.size());
+ for (Iterator it = containers.iterator(); it.hasNext();)
+ {
+ Container container = (Container) it.next();
+ if (isDebugEnabled())
+ debug("Container: oid=" + oidEncoder.toString(container.oid) + ", cid=" + container.cid);
+
+ channel.transmitLong(container.oid);
+ channel.transmitInt(container.cid);
+ }
+ }
+
+ public void transmitReferences(final Channel channel, long oid)
+ {
+ Object[] args = { new Long(oid)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(TRANSMIT_REFERENCES, "?", args));
+ jdbcTemplate.query(TRANSMIT_REFERENCES, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ int feature = resultSet.getInt(1);
+ long target = resultSet.getLong(2);
+ int cid = resultSet.getInt(3);
+
+ if (isDebugEnabled())
+ debug("Reference: feature=" + feature + ", target=" + oidEncoder.toString(target)
+ + ", cid=" + cid);
+
+ channel.transmitInt(feature);
+ channel.transmitLong(target);
+ channel.transmitInt(cid);
+ }
+ });
+
+ channel.transmitInt(-1);
+ }
+
+ public void transmitAttributes(final Channel channel, long oid, ClassInfo classInfo)
+ {
+ while (classInfo != null)
+ {
+ String columnNames = classInfo.getColumnNames();
+
+ if (columnNames != null && columnNames.length() > 0)
+ {
+ final ClassInfo finalClassInfo = classInfo;
+ String sql = "SELECT " + columnNames + " FROM " + classInfo.getTableName() + " WHERE "
+ + OBJECT_OID_COLUMN + "=?";
+
+ Object[] args = { new Long(oid)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(sql, "?", args));
+
+ jdbcTemplate.query(sql, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ AttributeInfo[] attributeInfos = finalClassInfo.getAttributeInfos();
+ for (int i = 0; i < attributeInfos.length; i++)
+ {
+ AttributeInfo attributeInfo = attributeInfos[i];
+
+ Object value = resultSet.getObject(i + 1);
+ columnConverter.toChannel(channel, attributeInfo.getDataType(), value);
+ }
+ }
+ });
+ }
+
+ classInfo = classInfo.getParent();
+ }
+ }
+
+ public void transmitAllResources(final Channel channel)
+ {
+ if (isDebugEnabled()) debug("Querying all resources");
+ if (isDebugEnabled()) debug(SELECT_ALL_RESOURCES);
+
+ jdbcTemplate.query(SELECT_ALL_RESOURCES, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ int rid = resultSet.getInt(1);
+ String path = resultSet.getString(2);
+
+ channel.transmitInt(rid);
+ channel.transmitString(path);
+ }
+ });
+
+ channel.transmitInt(CdoResProtocol.NO_MORE_RESOURCES);
+ }
+
+ public void createAttributeTables(PackageInfo packageInfo)
+ {
+ if (isDebugEnabled()) debug("Creating attribute tables");
+
+ Database database = DbgenFactory.eINSTANCE.createDatabase();
+ ClassInfo[] classes = packageInfo.getClasses();
+
+ for (int i = 0; i < classes.length; i++)
+ {
+ ClassInfo classInfo = classes[i];
+ createAttributeTable(classInfo, database);
+ }
+
+ getSqlDialect().save(dataSource, database, false);
+ }
+
+ private void createAttributeTable(ClassInfo classInfo, Database database)
+ {
+ Table segmentTable = database.addTable(classInfo.getTableName());
+ segmentTable.addColumn(OBJECT_OID_COLUMN, ColumnType.BIGINT_LITERAL, "NOT NULL");
+
+ AttributeInfo[] attributeInfos = classInfo.getAttributeInfos();
+ for (int i = 0; i < attributeInfos.length; i++)
+ {
+ AttributeInfo attributeInfo = attributeInfos[i];
+
+ String columnName = attributeInfo.getColumnName();
+ ColumnType columnType = ColumnType.get(attributeInfo.getColumnType());
+ segmentTable.addColumn(columnName, columnType);
+ }
+
+ segmentTable.addSimpleIndex(OBJECT_OID_COLUMN, IndexType.PRIMARY_LITERAL);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java
new file mode 100644
index 0000000000..c41019eeb4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.emf.cdo.server.ClassInfo;
+import org.eclipse.emf.cdo.server.PackageInfo;
+import org.eclipse.emf.cdo.server.PackageManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class PackageInfoImpl implements PackageInfo
+{
+ protected int pid;
+
+ protected String name;
+
+ protected PackageManager packageManager;
+
+ protected List classes = new ArrayList();
+
+ public PackageInfoImpl(int pid, String name, PackageManager packageManager)
+ {
+ this.pid = pid;
+ this.name = name;
+ this.packageManager = packageManager;
+ }
+
+ public PackageManager getPackageManager()
+ {
+ return packageManager;
+ }
+
+ public int getPid()
+ {
+ return pid;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public ClassInfo addClass(int cid, String name, String parentName, String tableName)
+ {
+ ClassInfo classInfo = new ClassInfoImpl(cid, name, parentName, tableName, this);
+ classes.add(classInfo);
+ packageManager.registerClassInfo(classInfo);
+ return classInfo;
+ }
+
+ public ClassInfo[] getClasses()
+ {
+ return (ClassInfo[]) classes.toArray(new ClassInfo[classes.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java
new file mode 100644
index 0000000000..04d142254f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.net4j.spring.impl.ServiceImpl;
+
+import org.eclipse.emf.cdo.server.ClassInfo;
+import org.eclipse.emf.cdo.server.PackageInfo;
+import org.eclipse.emf.cdo.server.PackageListener;
+import org.eclipse.emf.cdo.server.PackageManager;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+public class PackageManagerImpl extends ServiceImpl implements PackageManager
+{
+ protected Map cidToClassInfoMap = new HashMap(2111);
+
+ protected Map nameToClassInfoMap = new HashMap(2111);
+
+ protected Map packages = new HashMap();
+
+ protected List listeners = new ArrayList();
+
+ public PackageInfo getPackageInfo(String name)
+ {
+ return (PackageInfo) packages.get(name);
+ }
+
+ public PackageInfo addPackage(int pid, String name)
+ {
+ PackageInfo packageInfo = new PackageInfoImpl(pid, name, this);
+ packages.put(name, packageInfo);
+ notifyPackageListeners();
+ return packageInfo;
+ }
+
+ public void addPackageListener(PackageListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public void removePackageListener(PackageListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ public void registerClassInfo(ClassInfo classInfo)
+ {
+ cidToClassInfoMap.put(new Integer(classInfo.getCid()), classInfo);
+ nameToClassInfoMap.put(classInfo.getName(), classInfo);
+ }
+
+ public ClassInfo getClassInfo(int cid)
+ {
+ return (ClassInfo) cidToClassInfoMap.get(new Integer(cid));
+ }
+
+ public ClassInfo getClassInfo(String name)
+ {
+ return (ClassInfo) nameToClassInfoMap.get(name);
+ }
+
+ protected void notifyPackageListeners()
+ {
+ for (Iterator iter = listeners.iterator(); iter.hasNext();)
+ {
+ PackageListener listener = (PackageListener) iter.next();
+ listener.notifyAddedPackage();
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java
new file mode 100644
index 0000000000..f0ad428269
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.emf.cdo.server.ResourceInfo;
+
+
+public class ResourceInfoImpl implements ResourceInfo
+{
+ private String path;
+
+ private int rid;
+
+ private long nextOIDFragment;
+
+ public ResourceInfoImpl()
+ {
+ }
+
+ public ResourceInfoImpl(String path, int rid, long nextOIDFragment)
+ {
+ this.path = path;
+ this.rid = rid;
+ this.nextOIDFragment = nextOIDFragment;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ public int getRid()
+ {
+ return rid;
+ }
+
+ public void setRid(int rid)
+ {
+ this.rid = rid;
+ }
+
+ public long getNextOIDFragment()
+ {
+ return nextOIDFragment++;
+ }
+
+ public void setNextOIDFragment(long nextOIDFragment)
+ {
+ this.nextOIDFragment = nextOIDFragment;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ResourceInfo(rid=" + rid + ", path=" + path + ", nextOidFragment=" + nextOIDFragment
+ + ")";
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java
new file mode 100644
index 0000000000..6783d56db9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+import org.eclipse.net4j.spring.impl.ServiceImpl;
+
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.ResourceInfo;
+import org.eclipse.emf.cdo.server.ResourceManager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class ResourceManagerImpl extends ServiceImpl implements ResourceManager
+{
+ private Map<Integer, ResourceInfo> ridToResourceMap = new HashMap<Integer, ResourceInfo>();
+
+ private Map<String, ResourceInfo> pathToResourceMap = new HashMap<String, ResourceInfo>();
+
+ public void registerResourceInfo(ResourceInfo resourceInfo)
+ {
+ if (isDebugEnabled()) debug("Registering " + resourceInfo);
+ ridToResourceMap.put(resourceInfo.getRid(), resourceInfo);
+ pathToResourceMap.put(resourceInfo.getPath(), resourceInfo);
+ }
+
+ public ResourceInfo registerResourceInfo(String resourcePath, int rid, long nextOidFragment)
+ {
+ ResourceInfo resourceInfo = new ResourceInfoImpl(resourcePath, rid, nextOidFragment);
+ registerResourceInfo(resourceInfo);
+ return resourceInfo;
+ }
+
+ public ResourceInfo getResourceInfo(String path, Mapper mapper)
+ {
+ ResourceInfo resourceInfo = pathToResourceMap.get(path);
+
+ if (resourceInfo == null)
+ {
+ resourceInfo = mapper.selectResourceInfo(path);
+
+ if (resourceInfo == null)
+ {
+ return null;
+ }
+
+ registerResourceInfo(resourceInfo);
+ }
+
+ return resourceInfo;
+ }
+
+ public ResourceInfo getResourceInfo(int rid, Mapper mapper)
+ {
+ ResourceInfo resourceInfo = ridToResourceMap.get(new Integer(rid));
+
+ if (resourceInfo == null)
+ {
+ resourceInfo = mapper.selectResourceInfo(rid);
+
+ if (resourceInfo == null)
+ {
+ return null;
+ }
+
+ registerResourceInfo(resourceInfo);
+ }
+
+ return resourceInfo;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SqlConstants.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SqlConstants.java
new file mode 100644
index 0000000000..63365efbdc
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SqlConstants.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.impl;
+
+
+public interface SqlConstants
+{
+ //--------------------------------------------------------------------
+ public static final String SYSTEM_TABLE = "CDO_SYSTEM";
+
+ public static final String SYSTEM_SID_COLUMN = "SID";
+
+ public static final String SYSTEM_STARTED_COLUMN = "STARTED";
+
+ //--------------------------------------------------------------------
+ public static final String PACKAGE_TABLE = "CDO_PACKAGE";
+
+ public static final String PACKAGE_PID_COLUMN = "PID";
+
+ public static final String PACKAGE_NAME_COLUMN = "NAME";
+
+ //--------------------------------------------------------------------
+ public static final String CLASS_TABLE = "CDO_CLASS";
+
+ public static final String CLASS_CID_COLUMN = "CID";
+
+ public static final String CLASS_NAME_COLUMN = "NAME";
+
+ public static final String CLASS_PARENTNAME_COLUMN = "PARENT" + CLASS_NAME_COLUMN;
+
+ public static final String CLASS_TABLENAME_COLUMN = "TABLENAME";
+
+ public static final String CLASS_PID_COLUMN = PACKAGE_PID_COLUMN;
+
+ //--------------------------------------------------------------------
+ public static final String ATTRIBUTE_TABLE = "CDO_ATTRIBUTE";
+
+ public static final String ATTRIBUTE_NAME_COLUMN = "NAME";
+
+ public static final String ATTRIBUTE_FEATUREID_COLUMN = "FEATUREID";
+
+ public static final String ATTRIBUTE_DATATYPE_COLUMN = "DATATYPE";
+
+ public static final String ATTRIBUTE_COLUMNNAME_COLUMN = "COLUMNNAME";
+
+ public static final String ATTRIBUTE_COLUMNTYPE_COLUMN = "COLUMNTYPE";
+
+ public static final String ATTRIBUTE_CID_COLUMN = CLASS_CID_COLUMN;
+
+ //--------------------------------------------------------------------
+ public static final String OBJECT_TABLE = "CDO_OBJECT";
+
+ public static final String OBJECT_OID_COLUMN = "OID";
+
+ public static final String OBJECT_OCA_COLUMN = "OCA";
+
+ public static final String OBJECT_CID_COLUMN = CLASS_CID_COLUMN;
+
+ //--------------------------------------------------------------------
+ public static final String RESOURCE_TABLE = "CDO_RESOURCE";
+
+ public static final String RESOURCE_RID_COLUMN = "RID";
+
+ public static final String RESOURCE_PATH_COLUMN = "PATH";
+
+ //--------------------------------------------------------------------
+ public static final String CONTENT_TABLE = "CDO_CONTENT";
+
+ public static final String CONTENT_OID_COLUMN = OBJECT_OID_COLUMN;
+
+ //--------------------------------------------------------------------
+ public static final String REFERENCE_TABLE = "CDO_REFERENCE";
+
+ public static final String REFERENCE_OID_COLUMN = "SOURCE" + OBJECT_OID_COLUMN;
+
+ public static final String REFERENCE_FEATUREID_COLUMN = "FEATUREID";
+
+ public static final String REFERENCE_CONTENT_COLUMN = "CONTENT";
+
+ public static final String REFERENCE_ORDINAL_COLUMN = "ORDINAL";
+
+ public static final String REFERENCE_TARGET_COLUMN = "TARGET" + OBJECT_OID_COLUMN;
+
+ //--------------------------------------------------------------------
+ public static final String SELECT_PACKAGES = "SELECT " + PACKAGE_PID_COLUMN + ", "
+ + PACKAGE_NAME_COLUMN + " FROM " + PACKAGE_TABLE;
+
+ public static final String SELECT_CLASSES = "SELECT " + CLASS_CID_COLUMN + ", "
+ + CLASS_NAME_COLUMN + ", " + CLASS_PARENTNAME_COLUMN + ", " + CLASS_TABLENAME_COLUMN
+ + " FROM " + CLASS_TABLE + " WHERE " + CLASS_PID_COLUMN + "=?";
+
+ public static final String SELECT_ATTRIBUTES = "SELECT " + ATTRIBUTE_NAME_COLUMN + ", "
+ + ATTRIBUTE_FEATUREID_COLUMN + ", " + ATTRIBUTE_DATATYPE_COLUMN + ", "
+ + ATTRIBUTE_COLUMNNAME_COLUMN + ", " + ATTRIBUTE_COLUMNTYPE_COLUMN + " FROM "
+ + ATTRIBUTE_TABLE + " WHERE " + ATTRIBUTE_CID_COLUMN + "=?";
+
+ public static final String INSERT_PACKAGE = "INSERT INTO " + PACKAGE_TABLE + " VALUES (?, ?)";
+
+ public static final String INSERT_CLASS = "INSERT INTO " + CLASS_TABLE
+ + " VALUES (?, ?, ?, ?, ?)";
+
+ public static final String INSERT_ATTRIBUTE = "INSERT INTO " + ATTRIBUTE_TABLE
+ + " VALUES (?, ?, ?, ?, ?, ?)";
+
+ public static final String SELECT_MAX_PID = "SELECT MAX(" + PACKAGE_PID_COLUMN + ") FROM "
+ + PACKAGE_TABLE;
+
+ public static final String SELECT_MAX_CID = "SELECT MAX(" + CLASS_CID_COLUMN + ") FROM "
+ + CLASS_TABLE;
+
+ public static final String SELECT_MAX_RID = "SELECT MAX(" + RESOURCE_RID_COLUMN + ") FROM "
+ + RESOURCE_TABLE;
+
+ public static final String SELECT_MAX_OID_FRAGMENT = "SELECT MAX(" + OBJECT_OID_COLUMN
+ + ") FROM " + OBJECT_TABLE + " WHERE " + OBJECT_OID_COLUMN + " BETWEEN ? AND ?";
+
+ public static final String SELECT_CID_OF_OBJECT = "SELECT " + OBJECT_CID_COLUMN + " FROM "
+ + OBJECT_TABLE + " WHERE " + OBJECT_OID_COLUMN + "=?";
+
+ public static final String SELECT_CONTAINER_OF_OBJECT = "SELECT " + REFERENCE_TABLE + "."
+ + REFERENCE_OID_COLUMN + ", " + OBJECT_TABLE + "." + OBJECT_CID_COLUMN + " FROM "
+ + REFERENCE_TABLE + ", " + OBJECT_TABLE + " WHERE " + REFERENCE_TABLE + "."
+ + REFERENCE_TARGET_COLUMN + "=? AND " + REFERENCE_TABLE + "." + REFERENCE_CONTENT_COLUMN
+ + "=? AND " + REFERENCE_TABLE + "." + REFERENCE_OID_COLUMN + "=" + OBJECT_TABLE + "."
+ + OBJECT_OID_COLUMN;
+
+ public static final String SELECT_ALL_RESOURCES = "SELECT " + RESOURCE_RID_COLUMN + ", "
+ + RESOURCE_PATH_COLUMN + " FROM " + RESOURCE_TABLE;
+
+ public static final String SELECT_RID_OF_RESOURCE = "SELECT " + RESOURCE_RID_COLUMN + " FROM "
+ + RESOURCE_TABLE + " WHERE " + RESOURCE_PATH_COLUMN + "=?";
+
+ public static final String SELECT_PATH_OF_RESOURCE = "SELECT " + RESOURCE_PATH_COLUMN + " FROM "
+ + RESOURCE_TABLE + " WHERE " + RESOURCE_RID_COLUMN + "=?";
+
+ public static final String SELECT_COLLECTION_COUNT = "SELECT COUNT(" + REFERENCE_OID_COLUMN
+ + ") FROM " + REFERENCE_TABLE + " WHERE " + REFERENCE_OID_COLUMN + "=? AND "
+ + REFERENCE_FEATUREID_COLUMN + "=?";
+
+ public static final String INSERT_RESOURCE = "INSERT INTO " + RESOURCE_TABLE + " VALUES (?, ?)";
+
+ public static final String INSERT_REFERENCE = "INSERT INTO " + REFERENCE_TABLE
+ + " VALUES (?, ?, ?, ?, ?)";
+
+ public static final String REMOVE_REFERENCES = "DELETE FROM " + REFERENCE_TABLE + " WHERE "
+ + REFERENCE_OID_COLUMN + "=?";
+
+ public static final String REMOVE_REFERENCE = "DELETE FROM " + REFERENCE_TABLE + " WHERE "
+ + REFERENCE_OID_COLUMN + "=? AND " + REFERENCE_FEATUREID_COLUMN + "=? AND "
+ + REFERENCE_ORDINAL_COLUMN + "=?";
+
+ public static final String MOVE_REFERENCE_ABSOLUTE = "UPDATE " + REFERENCE_TABLE + " SET "
+ + REFERENCE_ORDINAL_COLUMN + "=? WHERE " + REFERENCE_OID_COLUMN + "=? AND "
+ + REFERENCE_FEATUREID_COLUMN + "=? AND " + REFERENCE_ORDINAL_COLUMN + "=?";
+
+ public static final String MOVE_REFERENCES_RELATIVE = "UPDATE " + REFERENCE_TABLE + " SET "
+ + REFERENCE_ORDINAL_COLUMN + "=" + REFERENCE_ORDINAL_COLUMN + "+? WHERE "
+ + REFERENCE_OID_COLUMN + "=? AND " + REFERENCE_FEATUREID_COLUMN + "=? AND "
+ + REFERENCE_ORDINAL_COLUMN + " BETWEEN ? AND ?";
+
+ public static final String TRANSMIT_REFERENCES = "SELECT "
+ + (REFERENCE_TABLE + "." + REFERENCE_FEATUREID_COLUMN) + ", "
+ + (REFERENCE_TABLE + "." + REFERENCE_TARGET_COLUMN) + ", "
+ + (OBJECT_TABLE + "." + OBJECT_CID_COLUMN) + " FROM " + REFERENCE_TABLE + ", " + OBJECT_TABLE
+ + " WHERE " + (REFERENCE_TABLE + "." + REFERENCE_OID_COLUMN) + "=? AND "
+ + (REFERENCE_TABLE + "." + REFERENCE_TARGET_COLUMN) + "="
+ + (OBJECT_TABLE + "." + OBJECT_OID_COLUMN) + " ORDER BY "
+ + (REFERENCE_TABLE + "." + REFERENCE_FEATUREID_COLUMN) + ", "
+ + (REFERENCE_TABLE + "." + REFERENCE_ORDINAL_COLUMN);
+
+ public static final String INSERT_OBJECT = "INSERT INTO " + OBJECT_TABLE + " VALUES (?, 1, ?)";
+
+ public static final String INSERT_CONTENT = "INSERT INTO " + CONTENT_TABLE + " VALUES (?)";
+
+ public static final String REMOVE_CONTENT = "DELETE FROM " + CONTENT_TABLE + " WHERE "
+ + CONTENT_OID_COLUMN + "=?";
+
+ public static final String TRANSMIT_CONTENT = "SELECT "
+ + (OBJECT_TABLE + "." + OBJECT_OID_COLUMN) + ", " + (OBJECT_TABLE + "." + OBJECT_OCA_COLUMN)
+ + ", " + (OBJECT_TABLE + "." + OBJECT_CID_COLUMN) + " FROM " + CONTENT_TABLE + ", "
+ + OBJECT_TABLE + " WHERE " + (OBJECT_TABLE + "." + OBJECT_OID_COLUMN) + "="
+ + (CONTENT_TABLE + "." + CONTENT_OID_COLUMN) + " AND "
+ + (OBJECT_TABLE + "." + OBJECT_OID_COLUMN) + " BETWEEN ? AND ?";
+
+ public static final String TRANSMIT_OBJECT = "SELECT " + OBJECT_OCA_COLUMN + ", "
+ + OBJECT_CID_COLUMN + " FROM " + OBJECT_TABLE + " WHERE " + OBJECT_OID_COLUMN + "=?";
+
+ public static final String DO_OPTIMISTIC_CONTROL = "UPDATE " + OBJECT_TABLE + " SET "
+ + OBJECT_OCA_COLUMN + "=" + OBJECT_OCA_COLUMN + "+1 WHERE " + OBJECT_OID_COLUMN + "=?"
+ + " AND " + OBJECT_OCA_COLUMN + "=?";
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java
new file mode 100644
index 0000000000..bdd4225fe7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.ClassInfo;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.PackageInfo;
+
+
+public class AnnouncePackageIndication extends AbstractIndicationWithResponse
+{
+ private String packageName;
+
+ public short getSignalId()
+ {
+ return CdoProtocol.ANNOUNCE_PACKAGE;
+ }
+
+ public void indicate()
+ {
+ packageName = receiveString();
+ if (isDebugEnabled()) debug("Announced package " + packageName);
+ }
+
+ public void respond()
+ {
+ Mapper mapper = ((CdoServerProtocol) getProtocol()).getMapper();
+ PackageInfo packageInfo = mapper.getPackageManager().getPackageInfo(packageName);
+
+ if (packageInfo == null)
+ {
+ if (isDebugEnabled()) debug("Unknown package " + packageName);
+ transmitInt(-1);
+ }
+ else
+ {
+ ClassInfo[] classInfos = packageInfo.getClasses();
+ transmitInt(classInfos.length);
+
+ for (int i = 0; i < classInfos.length; i++)
+ {
+ ClassInfo classInfo = classInfos[i];
+ if (isDebugEnabled())
+ debug("Responding class " + classInfo.getName() + " = " + classInfo.getCid());
+
+ transmitInt(classInfo.getCid());
+ transmitString(classInfo.getName());
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoResServerProtocolImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoResServerProtocolImpl.java
new file mode 100644
index 0000000000..25431f8696
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoResServerProtocolImpl.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.Indication;
+import org.eclipse.net4j.spring.ValidationException;
+import org.eclipse.net4j.util.ImplementationError;
+
+import org.eclipse.emf.cdo.core.protocol.AbstractCdoResProtocol;
+import org.eclipse.emf.cdo.server.CdoResServerProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+
+import org.springframework.transaction.support.TransactionTemplate;
+
+
+public class CdoResServerProtocolImpl extends AbstractCdoResProtocol implements
+ CdoResServerProtocol
+{
+ protected Mapper mapper;
+
+ protected TransactionTemplate transactionTemplate;
+
+ public CdoResServerProtocolImpl()
+ {
+ }
+
+ public int getType()
+ {
+ return SERVER;
+ }
+
+ public Indication createIndication(short signalId)
+ {
+ switch (signalId)
+ {
+ case QUERY_ALL_RESOURCES:
+ return new QueryAllResourcesIndication();
+
+ default:
+ throw new ImplementationError("Invalid " + PROTOCOL_NAME + " signalId: " + signalId);
+ }
+ }
+
+ public Mapper getMapper()
+ {
+ return mapper;
+ }
+
+ public void setMapper(Mapper mapper)
+ {
+ doSet("mapper", mapper);
+ }
+
+ public TransactionTemplate getTransactionTemplate()
+ {
+ return transactionTemplate;
+ }
+
+ public void setTransactionTemplate(TransactionTemplate transactionTemplate)
+ {
+ doSet("transactionTemplate", transactionTemplate);
+ }
+
+ protected void validate() throws ValidationException
+ {
+ super.validate();
+ assertNotNull("mapper");
+ assertNotNull("transactionTemplate");
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoServerProtocolImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoServerProtocolImpl.java
new file mode 100644
index 0000000000..e5260954d9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CdoServerProtocolImpl.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.Indication;
+import org.eclipse.net4j.spring.ValidationException;
+import org.eclipse.net4j.util.ImplementationError;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.core.protocol.AbstractCdoProtocol;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+
+import org.springframework.transaction.support.TransactionTemplate;
+
+
+public class CdoServerProtocolImpl extends AbstractCdoProtocol implements CdoServerProtocol
+{
+ protected Mapper mapper;
+
+ protected TransactionTemplate transactionTemplate;
+
+ public CdoServerProtocolImpl()
+ {
+ }
+
+ public int getType()
+ {
+ return SERVER;
+ }
+
+ public Indication createIndication(short signalId)
+ {
+ switch (signalId)
+ {
+ case ANNOUNCE_PACKAGE:
+ return new AnnouncePackageIndication();
+
+ case DESCRIBE_PACKAGE:
+ return new DescribePackageIndication();
+
+ case RESOURCE_RID:
+ return new ResourceRidIndication();
+
+ case RESOURCE_PATH:
+ return new ResourcePathIndication();
+
+ case LOAD_RESOURCE:
+ return new LoadResourceIndication();
+
+ case LOAD_OBJECT:
+ return new LoadObjectIndication();
+
+ case COMMIT_TRANSACTION:
+ return new CommitTransactionIndication();
+
+ default:
+ throw new ImplementationError("Invalid " + CdoProtocol.PROTOCOL_NAME + " signalId: "
+ + signalId);
+ }
+ }
+
+ public Mapper getMapper()
+ {
+ return mapper;
+ }
+
+ public void setMapper(Mapper mapper)
+ {
+ doSet("mapper", mapper);
+ }
+
+ public TransactionTemplate getTransactionTemplate()
+ {
+ return transactionTemplate;
+ }
+
+ public void setTransactionTemplate(TransactionTemplate transactionTemplate)
+ {
+ doSet("transactionTemplate", transactionTemplate);
+ }
+
+ protected void validate() throws ValidationException
+ {
+ super.validate();
+ assertNotNull("mapper");
+ assertNotNull("transactionTemplate");
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java
new file mode 100644
index 0000000000..3531ff99a2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java
@@ -0,0 +1,620 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.Channel;
+import org.eclipse.net4j.core.Protocol;
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.util.ImplementationError;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.core.OidEncoder;
+import org.eclipse.emf.cdo.server.AttributeInfo;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.ClassInfo;
+import org.eclipse.emf.cdo.server.ColumnConverter;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.ResourceInfo;
+import org.eclipse.emf.cdo.server.impl.SqlConstants;
+
+import org.springframework.transaction.TransactionException;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallbackWithoutResult;
+import org.springframework.transaction.support.TransactionTemplate;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+public class CommitTransactionIndication extends AbstractIndicationWithResponse
+{
+ public static final int CAPACITY_tempIdtoPersistentIdMap = 499;
+
+ private Map tempOIDs = new HashMap(CAPACITY_tempIdtoPersistentIdMap);
+
+ private List changedObjectIds = new ArrayList();
+
+ private Map changedObjectOidOca = new HashMap();
+
+ private List oidList = new ArrayList();
+
+ private boolean optimisticControlException = false;
+
+ private Mapper mapper;
+
+ public short getSignalId()
+ {
+ return CdoProtocol.COMMIT_TRANSACTION;
+ }
+
+ public void indicate()
+ {
+ try
+ {
+ TransactionTemplate transactionTemplate = ((CdoServerProtocol) getProtocol())
+ .getTransactionTemplate();
+ transactionTemplate.execute(new TransactionCallbackWithoutResult()
+ {
+ public void doInTransactionWithoutResult(TransactionStatus status)
+ {
+ receiveObjectsToDetach();
+ receiveObjectsToAttach();
+ receiveObjectChanges();
+
+ announcedNewResources();
+ }
+ });
+ }
+ catch (TransactionException ex)
+ {
+ error("Error while committing transaction to database", ex);
+ }
+
+ transmitInvalidations();
+ }
+
+ public void respond()
+ {
+ if (optimisticControlException)
+ {
+ transmitBoolean(false);
+ return;
+ }
+ else
+ {
+ transmitBoolean(true);
+ }
+
+ transmitInt(oidList.size());
+
+ for (Iterator iter = oidList.iterator(); iter.hasNext();)
+ {
+ Long id = (Long) iter.next();
+ transmitLong(id.longValue());
+ }
+
+ transmitInt(changedObjectIds.size());
+
+ for (Iterator iter = changedObjectIds.iterator(); iter.hasNext();)
+ {
+ Long id = (Long) iter.next();
+ transmitLong(id.longValue());
+
+ Integer oca = (Integer) changedObjectOidOca.get(id);
+ transmitInt(oca.intValue());
+ }
+ }
+
+ private void announcedNewResources()
+ {
+ int rid;
+ while ((rid = receiveInt()) != 0)
+ {
+ String path = receiveString();
+ getMapper().insertResource(rid, path);
+ }
+ }
+
+ private void receiveObjectsToDetach()
+ {
+ if (isDebugEnabled()) debug("receiveObjectsToDetach()");
+
+ for (;;)
+ {
+ long oid = receiveLong();
+
+ if (oid == 0)
+ {
+ break;
+ }
+
+ getMapper().removeObject(oid);
+ }
+ }
+
+ private void receiveObjectsToAttach()
+ {
+ if (isDebugEnabled()) debug("receiveObjectsToAttach()");
+ int count = receiveInt();
+
+ for (int i = 0; i < count; i++)
+ {
+ long oid = receiveLong();
+
+ if (oid < 0)
+ {
+ oid = registerTempOID(oid);
+ }
+
+ ClassInfo info = receiveClassInfo();
+ getMapper().insertObject(oid, info.getCid());
+
+ boolean isContent = receiveBoolean();
+ if (isContent)
+ {
+ getMapper().insertContent(oid);
+ }
+
+ receiveObjectsToAttachAttributes(info, oid);
+ }
+
+ receiveObjectsToAttachReferences();
+ }
+
+ private void receiveObjectsToAttachReferences()
+ {
+ if (isDebugEnabled()) debug("receiveObjectsToAttachReferences()");
+ int count = receiveInt();
+
+ for (int i = 0; i < count; i++)
+ {
+ long oid = receiveLong();
+ int feature = receiveInt();
+ int ordinal = receiveInt();
+ long target = receiveLong();
+ boolean content = receiveBoolean();
+
+ if (oid < 0)
+ {
+ oid = resolveTempOID(oid);
+ }
+
+ if (target < 0)
+ {
+ target = resolveTempOID(target);
+ }
+
+ getMapper().insertReference(oid, feature, ordinal, target, content);
+ }
+ }
+
+ /**
+ * @return
+ */
+ private ClassInfo receiveClassInfo()
+ {
+ int cid = receiveInt();
+ ClassInfo classInfo = getMapper().getPackageManager().getClassInfo(cid);
+ if (classInfo == null) throw new ImplementationError("Unknown cid " + cid);
+
+ return classInfo;
+ }
+
+ /**
+ * @param tempOID
+ * @return
+ */
+ private long registerTempOID(long tempOID)
+ {
+ OidEncoder oidEncoder = getMapper().getOidEncoder();
+ int rid = oidEncoder.getRID(-tempOID);
+ ResourceInfo resourceInfo = getMapper().getResourceManager().getResourceInfo(rid, getMapper());
+ long oidFragment = resourceInfo.getNextOIDFragment();
+
+ Long key = new Long(tempOID);
+ long oid = oidEncoder.getOID(rid, oidFragment);
+ Long val = new Long(oid);
+
+ tempOIDs.put(key, val);
+ oidList.add(val);
+
+ if (isDebugEnabled())
+ debug("Mapping oid " + oidEncoder.toString(key) + " --> " + oidEncoder.toString(val));
+ return oid;
+ }
+
+ /**
+ * @param tempOID
+ * @return
+ */
+ private long resolveTempOID(long tempOID)
+ {
+ Long sourceVal = (Long) tempOIDs.get(new Long(tempOID));
+
+ if (sourceVal == null)
+ {
+ OidEncoder oidEncoder = getMapper().getOidEncoder();
+ throw new ImplementationError("no mapping for temporary oid " + oidEncoder.toString(tempOID));
+ }
+
+ return sourceVal.longValue();
+ }
+
+ private void receiveObjectChanges()
+ {
+ if (isDebugEnabled()) debug("receiveObjectChanges()");
+
+ for (;;)
+ {
+ long oid = receiveLong();
+ if (oid == CdoProtocol.NO_MORE_OBJECT_CHANGES)
+ {
+ break;
+ }
+
+ int oca = receiveInt();
+ int newOCA = lock(oid, oca);
+
+ receiveReferenceChanges();
+ receiveAttributeChanges(oid);
+ rememberChangedObject(oid, newOCA);
+ }
+ }
+
+ private void receiveReferenceChanges()
+ {
+ for (;;)
+ {
+ byte changeKind = receiveByte();
+ if (changeKind == CdoProtocol.NO_MORE_REFERENCE_CHANGES)
+ {
+ break;
+ }
+
+ switch (changeKind)
+ {
+ case CdoProtocol.FEATURE_SET:
+ receiveReferenceSet();
+ break;
+
+ case CdoProtocol.FEATURE_UNSET:
+ receiveReferenceUnset();
+ break;
+
+ case CdoProtocol.LIST_ADD:
+ receiveReferenceAdd();
+ break;
+
+ case CdoProtocol.LIST_REMOVE:
+ receiveReferenceRemove();
+ break;
+
+ case CdoProtocol.LIST_MOVE:
+ receiveReferenceMove();
+ break;
+
+ default:
+ throw new ImplementationError("invalid changeKind: " + changeKind);
+ }
+ }
+ }
+
+ /**
+ * @param oid
+ * @param feature
+ */
+ private void receiveReferenceSet()
+ {
+ // oid is not mapped for changes!
+ long oid = receiveLong();
+ int feature = receiveInt();
+ long target = receiveLong();
+ boolean content = receiveBoolean();
+
+ if (target < 0)
+ {
+ target = resolveTempOID(target);
+ }
+
+ if (isDebugEnabled())
+ {
+ OidEncoder oidEncoder = getMapper().getOidEncoder();
+ debug("received reference set: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
+ + ", target=" + oidEncoder.toString(target) + ", content=" + content);
+ }
+
+ getMapper().insertReference(oid, feature, 0, target, content);
+ }
+
+ /**
+ *
+ */
+ private void receiveReferenceUnset()
+ {
+ // oid is not mapped for changes!
+ long oid = receiveLong();
+ int feature = receiveInt();
+
+ if (isDebugEnabled())
+ {
+ OidEncoder oidEncoder = getMapper().getOidEncoder();
+ debug("received reference unset: oid=" + oidEncoder.toString(oid) + ", feature=" + feature);
+ }
+
+ getMapper().removeReference(oid, feature, 0);
+ }
+
+ /**
+ *
+ */
+ private void receiveReferenceAdd()
+ {
+ // oid is not mapped for changes!
+ long oid = receiveLong();
+ int feature = receiveInt();
+ int ordinal = receiveInt() + 1;
+ long target = receiveLong();
+ boolean content = receiveBoolean();
+
+ if (target < 0)
+ {
+ target = resolveTempOID(target);
+ }
+
+ if (isDebugEnabled())
+ {
+ OidEncoder oidEncoder = getMapper().getOidEncoder();
+ debug("received reference add: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
+ + ", ordinal=" + ordinal + ", target=" + oidEncoder.toString(target) + ", content="
+ + content);
+ }
+
+ if (ordinal == 0)
+ {
+ ordinal = getMapper().getCollectionCount(oid, feature);
+ }
+
+ getMapper().moveReferencesRelative(oid, feature, ordinal, Integer.MAX_VALUE, 1);
+ getMapper().insertReference(oid, feature, ordinal, target, content);
+ }
+
+ /**
+ *
+ */
+ private void receiveReferenceRemove()
+ {
+ // oid is not mapped for changes!
+ long oid = receiveLong();
+ int feature = receiveInt();
+ int ordinal = receiveInt() + 1;
+
+ if (isDebugEnabled())
+ {
+ OidEncoder oidEncoder = getMapper().getOidEncoder();
+ debug("receiveObjectChangesReferences(REMOVE, sourceId=" + oidEncoder.toString(oid)
+ + ", featureId=" + feature + ", sourceOrdinal=" + ordinal + ")");
+ }
+
+ getMapper().removeReference(oid, feature, ordinal);
+ getMapper().moveReferencesRelative(oid, feature, ordinal, Integer.MAX_VALUE, -1);
+ }
+
+ /**
+ *
+ */
+ private void receiveReferenceMove()
+ {
+ // oid is not mapped for changes!
+ long oid = receiveLong();
+ int feature = receiveInt();
+ int ordinal = receiveInt();
+ int moveToIndex = receiveInt();
+
+ if (isDebugEnabled())
+ {
+ OidEncoder oidEncoder = getMapper().getOidEncoder();
+ debug("received reference move: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
+ + ", ordinal=" + ordinal + ", moveToIndex=" + moveToIndex);
+ }
+
+ ordinal++;
+ moveToIndex++;
+
+ getMapper().moveReferenceAbsolute(oid, feature, -1, ordinal);
+
+ if (moveToIndex > ordinal)
+ {
+ getMapper().moveReferencesRelative(oid, feature, ordinal + 1, moveToIndex, -1);
+ }
+ else if (moveToIndex < ordinal)
+ {
+ getMapper().moveReferencesRelative(oid, feature, moveToIndex, ordinal - 1, 1);
+ }
+
+ getMapper().moveReferenceAbsolute(oid, feature, moveToIndex, -1);
+ }
+
+ /**
+ *
+ * @param oid
+ * @param oca
+ */
+ private int lock(long oid, int oca)
+ {
+ boolean ok = getMapper().lock(oid, oca);
+
+ if (!ok)
+ {
+ optimisticControlException = true;
+
+ if (isDebugEnabled())
+ {
+ debug("");
+ debug("============================");
+ debug("OPTIMISTIC CONTROL EXCEPTION");
+ debug("============================");
+ debug("");
+ }
+
+ return oca;
+ }
+
+ return oca + 1;
+ }
+
+ /**
+ * @param oid
+ */
+ private void rememberChangedObject(long oid, int oca)
+ {
+ Long key = new Long(oid);
+ changedObjectIds.add(key);
+ changedObjectOidOca.put(key, new Integer(oca));
+ }
+
+ /**
+ * @param info
+ * @param oid
+ * @throws InterruptedException
+ */
+ private void receiveAttributeChanges(long oid)
+ {
+ ClassInfo classInfo = null;
+
+ for (;;)
+ {
+ int cid = receiveInt();
+ if (cid == CdoProtocol.NO_MORE_SEGMENTS)
+ {
+ break;
+ }
+
+ classInfo = getMapper().getPackageManager().getClassInfo(cid);
+ receiveAttributeChangeSegment(oid, classInfo);
+ }
+ }
+
+ /**
+ *
+ */
+ private void receiveAttributeChangeSegment(long oid, ClassInfo classInfo)
+ {
+ int count = receiveInt();
+ Object[] args = new Object[count + 1]; // last element is the oid
+ args[count] = new Long(oid);
+
+ StringBuffer sql = new StringBuffer("UPDATE ");
+ sql.append(classInfo.getTableName());
+ sql.append(" SET ");
+
+ for (int i = 0; i < count; i++)
+ {
+ int feature = receiveInt();
+ AttributeInfo attributeInfo = classInfo.getAttributeInfo(feature);
+ ColumnConverter converter = getMapper().getColumnConverter();
+ args[i] = converter.fromChannel(getChannel(), attributeInfo.getDataType());
+
+ if (i > 0) sql.append(", ");
+ sql.append(attributeInfo.getColumnName());
+ sql.append("=?");
+ }
+
+ sql.append(" WHERE ");
+ sql.append(SqlConstants.OBJECT_OID_COLUMN);
+ sql.append("=?");
+
+ getMapper().sql(sql.toString(), args);
+
+ }
+
+ private void receiveObjectsToAttachAttributes(ClassInfo classInfo, long oid)
+ {
+ if (isDebugEnabled()) debug("receiveObjectsToAttachAttributes()");
+
+ while (classInfo != null)
+ {
+ AttributeInfo[] attributeInfos = classInfo.getAttributeInfos();
+
+ Object[] args = new Object[attributeInfos.length + 1]; // the first element is the oid
+ args[0] = new Long(oid);
+
+ StringBuffer sql = new StringBuffer("INSERT INTO ");
+ sql.append(classInfo.getTableName());
+ sql.append(" VALUES(?");
+
+ for (int i = 0; i < attributeInfos.length; i++)
+ {
+ AttributeInfo attributeInfo = attributeInfos[i];
+ if (isDebugEnabled()) debug("Receiving attribute " + attributeInfo.getName());
+
+ ColumnConverter converter = getMapper().getColumnConverter();
+ args[i + 1] = converter.fromChannel(getChannel(), attributeInfo.getDataType());
+
+ sql.append(", ?");
+ }
+
+ sql.append(")");
+ getMapper().sql(sql.toString(), args);
+
+ classInfo = classInfo.getParent();
+ }
+ }
+
+ /**
+ *
+ */
+ private void transmitInvalidations()
+ {
+ if (!changedObjectIds.isEmpty())
+ {
+ Channel me = getChannel();
+ int myType = me.getConnector().getType();
+ Protocol cdo = me.getProtocol();
+
+ Channel[] channels = cdo.getChannels();
+ for (int i = 0; i < channels.length; i++)
+ {
+ Channel channel = channels[i];
+ if (channel != me)
+ {
+ int type = channel.getConnector().getType();
+ if (type == myType) // Important to exclude embedded peers (clients)
+ {
+ InvalidateObjectRequest signal = new InvalidateObjectRequest(changedObjectIds);
+
+ try
+ {
+ channel.transmit(signal);
+ }
+ catch (Exception ex)
+ {
+ error("Error while requesting signal " + signal, ex);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private Mapper getMapper()
+ {
+ if (mapper == null)
+ {
+ mapper = ((CdoServerProtocol) getProtocol()).getMapper();
+ }
+
+ return mapper;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java
new file mode 100644
index 0000000000..7764255db4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.server.AttributeInfo;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.ClassInfo;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.PackageInfo;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class DescribePackageIndication extends AbstractIndicationWithResponse
+{
+ private List infos;
+
+ public short getSignalId()
+ {
+ return CdoProtocol.DESCRIBE_PACKAGE;
+ }
+
+ public void indicate()
+ {
+ int pid = getMapper().getNextPid();
+ String packageName = receiveString();
+ if (isDebugEnabled()) debug("Described package " + packageName);
+
+ PackageInfo packageInfo = getMapper().getPackageManager().addPackage(pid, packageName);
+ getMapper().insertPackage(packageInfo);
+
+ infos = receiveClasses(packageInfo);
+ getMapper().createAttributeTables(packageInfo);
+ }
+
+ public void respond()
+ {
+ transmitInt(infos.size());
+
+ for (Iterator iter = infos.iterator(); iter.hasNext();)
+ {
+ ClassInfo classInfo = (ClassInfo) iter.next();
+ if (isDebugEnabled())
+ debug("Responding class " + classInfo.getName() + " = " + classInfo.getCid());
+
+ transmitInt(classInfo.getCid());
+ transmitString(classInfo.getName());
+ }
+ }
+
+ private List receiveClasses(PackageInfo packageInfo)
+ {
+ List result = new ArrayList();
+ int count = receiveInt();
+
+ for (int i = 0; i < count; i++)
+ {
+ int cid = getMapper().getNextCid();
+ String name = receiveString();
+ String parentName = receiveString();
+ String tableName = receiveString();
+ if (isDebugEnabled()) debug("Described class " + name);
+
+ ClassInfo classInfo = packageInfo.addClass(cid, name, parentName, tableName);
+ getMapper().insertClass(classInfo);
+ receiveAttributes(classInfo);
+
+ result.add(classInfo);
+ }
+
+ return result;
+ }
+
+ private void receiveAttributes(ClassInfo classInfo)
+ {
+ int count = receiveInt();
+ for (int i = 0; i < count; i++)
+ {
+ String name = receiveString();
+ int featureId = receiveInt();
+ int dataType = receiveInt();
+ String columnName = receiveString();
+ int columnType = receiveInt();
+ if (isDebugEnabled()) debug("Described attribute " + name);
+
+ AttributeInfo attributeInfo = classInfo.addAttribute(name, featureId, dataType, columnName,
+ columnType);
+ getMapper().insertAttribute(attributeInfo, classInfo.getCid());
+ }
+ }
+
+ private Mapper getMapper()
+ {
+ return ((CdoServerProtocol) getProtocol()).getMapper();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidateObjectRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidateObjectRequest.java
new file mode 100644
index 0000000000..77da72598c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidateObjectRequest.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractRequest;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+
+import java.util.Iterator;
+import java.util.List;
+
+
+public class InvalidateObjectRequest extends AbstractRequest
+{
+ private List changedObjectIds;
+
+ public InvalidateObjectRequest(List changedObjectIds)
+ {
+ this.changedObjectIds = changedObjectIds;
+ }
+
+ public short getSignalId()
+ {
+ return CdoProtocol.INVALIDATE_OBJECT;
+ }
+
+ public void request()
+ {
+ transmitInt(changedObjectIds.size());
+
+ for (Iterator iter = changedObjectIds.iterator(); iter.hasNext();)
+ {
+ Long id = (Long) iter.next();
+ transmitLong(id.longValue());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java
new file mode 100644
index 0000000000..e9e8a21d0f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+
+
+public class LoadObjectIndication extends AbstractIndicationWithResponse
+{
+ private long oid;
+
+ public short getSignalId()
+ {
+ return CdoProtocol.LOAD_OBJECT;
+ }
+
+ public void indicate()
+ {
+ oid = receiveLong();
+ }
+
+ public void respond()
+ {
+ Mapper mapper = ((CdoServerProtocol) getProtocol()).getMapper();
+ mapper.transmitObject(getChannel(), oid);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java
new file mode 100644
index 0000000000..9bb7e54d1e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.Channel;
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.ResourceInfo;
+import org.eclipse.emf.cdo.server.ResourceManager;
+
+
+public class LoadResourceIndication extends AbstractIndicationWithResponse
+{
+ private int rid;
+
+ public short getSignalId()
+ {
+ return CdoProtocol.LOAD_RESOURCE;
+ }
+
+ public void indicate()
+ {
+ rid = receiveInt();
+ }
+
+ public void respond()
+ {
+ Mapper mapper = ((CdoServerProtocol) getProtocol()).getMapper();
+ ResourceManager resourceManager = mapper.getResourceManager();
+ ResourceInfo resourceInfo = resourceManager.getResourceInfo(rid, mapper);
+
+ Channel channel = getChannel();
+ // CdoServerProtocolImpl.setResourceInfo(channel, resourceInfo);
+ mapper.transmitContent(channel, resourceInfo);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java
new file mode 100644
index 0000000000..28f7cacfde
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java
@@ -0,0 +1,34 @@
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.Protocol;
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CdoResSignals;
+import org.eclipse.emf.cdo.server.CdoResServerProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+
+
+public class QueryAllResourcesIndication extends AbstractIndicationWithResponse implements
+ CdoResSignals
+{
+ public QueryAllResourcesIndication()
+ {
+ }
+
+ public short getSignalId()
+ {
+ return QUERY_ALL_RESOURCES;
+ }
+
+ public void indicate()
+ {
+ }
+
+ public void respond()
+ {
+ Protocol protocol = getProtocol();
+ Mapper mapper = ((CdoResServerProtocol) protocol).getMapper();
+ mapper.transmitAllResources(channel);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java
new file mode 100644
index 0000000000..3c99c98d12
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.ResourceInfo;
+import org.eclipse.emf.cdo.server.ResourceManager;
+
+
+public class ResourcePathIndication extends AbstractIndicationWithResponse
+{
+ private String path;
+
+ public short getSignalId()
+ {
+ return CdoProtocol.RESOURCE_PATH;
+ }
+
+ public void indicate()
+ {
+ path = receiveString();
+ if (isDebugEnabled()) debug("Requested path " + path);
+ }
+
+ public void respond()
+ {
+ Mapper mapper = ((CdoServerProtocol) getProtocol()).getMapper();
+ ResourceManager resourceManager = mapper.getResourceManager();
+ ResourceInfo info = resourceManager.getResourceInfo(path, mapper);
+
+ if (info == null)
+ {
+ int rid = mapper.getNextRid();
+ resourceManager.registerResourceInfo(path, rid, 1);
+
+ if (isDebugEnabled()) debug("No resource with path " + path);
+ if (isDebugEnabled()) debug("Reserving rid " + rid);
+ transmitInt(-rid);
+ }
+ else
+ {
+ if (isDebugEnabled()) debug("Responding rid " + info.getRid());
+ transmitInt(info.getRid());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRidIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRidIndication.java
new file mode 100644
index 0000000000..70de2f99d9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRidIndication.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Sympedia Methods and Tools.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CdoProtocol;
+import org.eclipse.emf.cdo.server.CdoServerProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.ResourceInfo;
+import org.eclipse.emf.cdo.server.ResourceManager;
+
+
+public class ResourceRidIndication extends AbstractIndicationWithResponse
+{
+ private int rid;
+
+ public short getSignalId()
+ {
+ return CdoProtocol.RESOURCE_RID;
+ }
+
+ public void indicate()
+ {
+ rid = receiveInt();
+ if (isDebugEnabled()) debug("Requested rid " + rid);
+ }
+
+ public void respond()
+ {
+ Mapper mapper = ((CdoServerProtocol) getProtocol()).getMapper();
+ ResourceManager resourceManager = mapper.getResourceManager();
+ ResourceInfo info = resourceManager.getResourceInfo(rid, mapper);
+
+ if (info == null)
+ {
+ if (isDebugEnabled()) debug("No resource with rid " + rid);
+ transmitString(null);
+ }
+ else
+ {
+ if (isDebugEnabled()) debug("Responding path " + info.getPath());
+ transmitString(info.getPath());
+ }
+ }
+}

Back to the top