Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-01-14 05:27:01 -0500
committerEike Stepper2012-01-14 05:27:01 -0500
commit0266166cb9ff9535c150250073ea1e57b42d2693 (patch)
treec006a3bc0ba1f6e1d8a2bc032eedc346f71eab0d /plugins/org.eclipse.emf.cdo.workspace.efs
parent7416443692cdda72d1f704ea4fc5ececcc669df7 (diff)
downloadcdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.gz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.xz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.zip
Adjusted copyrights to 2012
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.workspace.efs')
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/.settings/org.eclipse.jdt.ui.prefs240
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/build.properties44
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/copyright.txt14
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/plugin.properties22
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/plugin.xml48
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java386
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractFileStore.java208
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java392
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOProjectDescriptionStore.java288
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java384
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceFileSystem.java384
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java1238
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/bundle/OM.java88
13 files changed, 1868 insertions, 1868 deletions
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.workspace.efs/.settings/org.eclipse.jdt.ui.prefs
index aaef0ccba1..6726e7034a 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/.settings/org.eclipse.jdt.ui.prefs
@@ -1,120 +1,120 @@
-#Thu Feb 04 09:44:24 CET 2010
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=true
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=true
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=false
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=true
-cleanup.use_this_for_non_static_field_access=true
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=true
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_EMFT
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_EMFT
-formatter_settings_version=11
-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.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java;
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"/><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Eike Stepper - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Eike Stepper\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=false
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=true
-sp_cleanup.use_this_for_non_static_field_access=true
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=true
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+#Thu Feb 04 09:44:24 CET 2010
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_EMFT
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMFT
+formatter_settings_version=11
+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.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"/><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Eike Stepper - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Eike Stepper\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=true
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/build.properties b/plugins/org.eclipse.emf.cdo.workspace.efs/build.properties
index 7aaa05eb68..b9909b26f5 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/build.properties
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/build.properties
@@ -1,22 +1,22 @@
-# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Eike Stepper - initial API and implementation
-
-# NLS_MESSAGEFORMAT_VAR
-
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- .options,\
- about.html,\
- copyright.txt,\
- plugin.properties,\
- plugin.xml
-src.includes = about.html,\
- copyright.txt
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ .options,\
+ about.html,\
+ copyright.txt,\
+ plugin.properties,\
+ plugin.xml
+src.includes = about.html,\
+ copyright.txt
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/copyright.txt b/plugins/org.eclipse.emf.cdo.workspace.efs/copyright.txt
index e921242cf0..8f6328980e 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/copyright.txt
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/copyright.txt
@@ -1,8 +1,8 @@
-Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Eclipse Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/epl-v10.html
-
-Contributors:
+Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
Eike Stepper - initial API and implementation \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.properties b/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.properties
index 996618c568..cc43fd9137 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.properties
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.properties
@@ -1,11 +1,11 @@
-# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Eike Stepper - initial API and implementation
-
-pluginName = CDO Model Repository Client Workspace EFS
-providerName = Eclipse Modeling Project
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+pluginName = CDO Model Repository Client Workspace EFS
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.xml b/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.xml
index 36bdb91bb2..7a6fdeba25 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/plugin.xml
@@ -1,24 +1,24 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<!--
- Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Eike Stepper - initial API and implementation
--->
-
-<plugin>
-
- <extension
- id="org.eclipse.core.filesystem.cdo.workspace"
- point="org.eclipse.core.filesystem.filesystems">
- <filesystem scheme="cdo.workspace">
- <run class="org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceFileSystem"/>
- </filesystem>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Eike Stepper - initial API and implementation
+-->
+
+<plugin>
+
+ <extension
+ id="org.eclipse.core.filesystem.cdo.workspace"
+ point="org.eclipse.core.filesystem.filesystems">
+ <filesystem scheme="cdo.workspace">
+ <run class="org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceFileSystem"/>
+ </filesystem>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java
index 3e269cafe8..c52a845761 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/efs/CDOFS.java
@@ -1,193 +1,193 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.efs;
-
-import org.eclipse.emf.cdo.location.ICheckoutSource;
-import org.eclipse.emf.cdo.location.IRepositoryLocation;
-import org.eclipse.emf.cdo.location.IRepositoryLocationManager;
-import org.eclipse.emf.cdo.server.db.CDODBUtil;
-import org.eclipse.emf.cdo.server.db.IDBStore;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
-import org.eclipse.emf.cdo.workspace.CDOWorkspace;
-import org.eclipse.emf.cdo.workspace.CDOWorkspaceBase;
-import org.eclipse.emf.cdo.workspace.CDOWorkspaceConfiguration;
-import org.eclipse.emf.cdo.workspace.CDOWorkspaceUtil;
-import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceFileSystem;
-import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceStore;
-
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.IDBConnectionProvider;
-import org.eclipse.net4j.db.h2.H2Adapter;
-import org.eclipse.net4j.util.io.IOUtil;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-
-import org.h2.jdbcx.JdbcDataSource;
-
-import javax.sql.DataSource;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URI;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOFS
-{
- private CDOFS()
- {
- }
-
- public static CDOWorkspace open(String projectName, File projectFolder) throws Exception
- {
- IDBStore local = creatLocalStore(projectFolder);
- CDOWorkspaceBase base = createWorkspaceBase(new File(projectFolder, "base"));
- IRepositoryLocation remote = readRepositoryLocation(projectFolder);
-
- CDOWorkspaceConfiguration config = CDOWorkspaceUtil.createWorkspaceConfiguration();
- config.setStore(local);
- config.setBase(base);
- config.setRemote(remote);
-
- CDOWorkspace workspace = config.open();
- return workspace;
- }
-
- public static void checkout(ICheckoutSource checkoutSource, String projectName, IProgressMonitor monitor)
- throws Exception
- {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IProject project = root.getProject(projectName);
- if (project.exists())
- {
- throw new IOException("Project " + projectName + " already exists");
- }
-
- File projectFolder = root.getLocation().append(projectName).toFile();
- URI uri = checkout(checkoutSource, projectName, projectFolder);
-
- IProjectDescription description = workspace.newProjectDescription(projectName);
- description.setLocationURI(uri);
-
- project.create(description, new NullProgressMonitor());
- if (!project.isOpen())
- {
- project.open(new NullProgressMonitor());
- }
- }
-
- private static URI checkout(ICheckoutSource checkoutSource, String projectName, File projectFolder) throws Exception
- {
- IDBStore local = creatLocalStore(projectFolder);
- CDOWorkspaceBase base = createWorkspaceBase(new File(projectFolder, "base"));
-
- IRepositoryLocation remote = checkoutSource.getRepositoryLocation();
- writeRepositoryLocation(projectFolder, remote);
-
- String branchPath = checkoutSource.getBranchPath();
- long timeStamp = checkoutSource.getTimeStamp();
-
- CDOWorkspaceConfiguration config = CDOWorkspaceUtil.createWorkspaceConfiguration();
- config.setStore(local);
- config.setBase(base);
- config.setRemote(remote);
- config.setBranchPath(branchPath);
- config.setTimeStamp(timeStamp);
-
- CDOWorkspace workspace = config.checkout();
- CDOWorkspaceStore store = getFileSystem().addWorkspaceStore(projectName, workspace);
- return store.toURI();
- }
-
- private static CDOWorkspaceFileSystem getFileSystem() throws CoreException
- {
- return (CDOWorkspaceFileSystem)EFS.getFileSystem(CDOWorkspaceFileSystem.SCHEME);
- }
-
- private static IDBStore creatLocalStore(File projectFolder)
- {
- IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(false);
- IDBAdapter dbAdapter = createLocalAdapter();
- IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(createLocalDataSource(new File(
- projectFolder, "local")));
- IDBStore local = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
- return local;
- }
-
- private static IDBAdapter createLocalAdapter()
- {
- return new H2Adapter();
- }
-
- private static DataSource createLocalDataSource(File folder)
- {
- folder.mkdirs();
- String path = folder.getAbsolutePath().replace('\\', '/');
-
- JdbcDataSource dataSource = new JdbcDataSource();
- dataSource.setURL("jdbc:h2:" + path + "/db");
- return dataSource;
- }
-
- private static CDOWorkspaceBase createWorkspaceBase(File folder)
- {
- folder.mkdirs();
- return CDOWorkspaceUtil.createFolderWorkspaceBase(folder);
- }
-
- private static File getRemotePropertiesFile(File projectFolder)
- {
- return new File(projectFolder, "remote.properties");
- }
-
- private static void writeRepositoryLocation(File projectFolder, IRepositoryLocation remote) throws IOException
- {
- FileOutputStream out = null;
-
- try
- {
- out = new FileOutputStream(getRemotePropertiesFile(projectFolder));
- remote.write(out);
- }
- finally
- {
- IOUtil.close(out);
- }
- }
-
- private static IRepositoryLocation readRepositoryLocation(File projectFolder) throws IOException
- {
- FileInputStream in = null;
-
- try
- {
- in = new FileInputStream(getRemotePropertiesFile(projectFolder));
- return IRepositoryLocationManager.INSTANCE.addRepositoryLocation(in);
- }
- finally
- {
- IOUtil.close(in);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.efs;
+
+import org.eclipse.emf.cdo.location.ICheckoutSource;
+import org.eclipse.emf.cdo.location.IRepositoryLocation;
+import org.eclipse.emf.cdo.location.IRepositoryLocationManager;
+import org.eclipse.emf.cdo.server.db.CDODBUtil;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.workspace.CDOWorkspace;
+import org.eclipse.emf.cdo.workspace.CDOWorkspaceBase;
+import org.eclipse.emf.cdo.workspace.CDOWorkspaceConfiguration;
+import org.eclipse.emf.cdo.workspace.CDOWorkspaceUtil;
+import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceFileSystem;
+import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceStore;
+
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.IDBConnectionProvider;
+import org.eclipse.net4j.db.h2.H2Adapter;
+import org.eclipse.net4j.util.io.IOUtil;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+import org.h2.jdbcx.JdbcDataSource;
+
+import javax.sql.DataSource;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URI;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOFS
+{
+ private CDOFS()
+ {
+ }
+
+ public static CDOWorkspace open(String projectName, File projectFolder) throws Exception
+ {
+ IDBStore local = creatLocalStore(projectFolder);
+ CDOWorkspaceBase base = createWorkspaceBase(new File(projectFolder, "base"));
+ IRepositoryLocation remote = readRepositoryLocation(projectFolder);
+
+ CDOWorkspaceConfiguration config = CDOWorkspaceUtil.createWorkspaceConfiguration();
+ config.setStore(local);
+ config.setBase(base);
+ config.setRemote(remote);
+
+ CDOWorkspace workspace = config.open();
+ return workspace;
+ }
+
+ public static void checkout(ICheckoutSource checkoutSource, String projectName, IProgressMonitor monitor)
+ throws Exception
+ {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IProject project = root.getProject(projectName);
+ if (project.exists())
+ {
+ throw new IOException("Project " + projectName + " already exists");
+ }
+
+ File projectFolder = root.getLocation().append(projectName).toFile();
+ URI uri = checkout(checkoutSource, projectName, projectFolder);
+
+ IProjectDescription description = workspace.newProjectDescription(projectName);
+ description.setLocationURI(uri);
+
+ project.create(description, new NullProgressMonitor());
+ if (!project.isOpen())
+ {
+ project.open(new NullProgressMonitor());
+ }
+ }
+
+ private static URI checkout(ICheckoutSource checkoutSource, String projectName, File projectFolder) throws Exception
+ {
+ IDBStore local = creatLocalStore(projectFolder);
+ CDOWorkspaceBase base = createWorkspaceBase(new File(projectFolder, "base"));
+
+ IRepositoryLocation remote = checkoutSource.getRepositoryLocation();
+ writeRepositoryLocation(projectFolder, remote);
+
+ String branchPath = checkoutSource.getBranchPath();
+ long timeStamp = checkoutSource.getTimeStamp();
+
+ CDOWorkspaceConfiguration config = CDOWorkspaceUtil.createWorkspaceConfiguration();
+ config.setStore(local);
+ config.setBase(base);
+ config.setRemote(remote);
+ config.setBranchPath(branchPath);
+ config.setTimeStamp(timeStamp);
+
+ CDOWorkspace workspace = config.checkout();
+ CDOWorkspaceStore store = getFileSystem().addWorkspaceStore(projectName, workspace);
+ return store.toURI();
+ }
+
+ private static CDOWorkspaceFileSystem getFileSystem() throws CoreException
+ {
+ return (CDOWorkspaceFileSystem)EFS.getFileSystem(CDOWorkspaceFileSystem.SCHEME);
+ }
+
+ private static IDBStore creatLocalStore(File projectFolder)
+ {
+ IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(false);
+ IDBAdapter dbAdapter = createLocalAdapter();
+ IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(createLocalDataSource(new File(
+ projectFolder, "local")));
+ IDBStore local = CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
+ return local;
+ }
+
+ private static IDBAdapter createLocalAdapter()
+ {
+ return new H2Adapter();
+ }
+
+ private static DataSource createLocalDataSource(File folder)
+ {
+ folder.mkdirs();
+ String path = folder.getAbsolutePath().replace('\\', '/');
+
+ JdbcDataSource dataSource = new JdbcDataSource();
+ dataSource.setURL("jdbc:h2:" + path + "/db");
+ return dataSource;
+ }
+
+ private static CDOWorkspaceBase createWorkspaceBase(File folder)
+ {
+ folder.mkdirs();
+ return CDOWorkspaceUtil.createFolderWorkspaceBase(folder);
+ }
+
+ private static File getRemotePropertiesFile(File projectFolder)
+ {
+ return new File(projectFolder, "remote.properties");
+ }
+
+ private static void writeRepositoryLocation(File projectFolder, IRepositoryLocation remote) throws IOException
+ {
+ FileOutputStream out = null;
+
+ try
+ {
+ out = new FileOutputStream(getRemotePropertiesFile(projectFolder));
+ remote.write(out);
+ }
+ finally
+ {
+ IOUtil.close(out);
+ }
+ }
+
+ private static IRepositoryLocation readRepositoryLocation(File projectFolder) throws IOException
+ {
+ FileInputStream in = null;
+
+ try
+ {
+ in = new FileInputStream(getRemotePropertiesFile(projectFolder));
+ return IRepositoryLocationManager.INSTANCE.addRepositoryLocation(in);
+ }
+ finally
+ {
+ IOUtil.close(in);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractFileStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractFileStore.java
index 90a7fcd19d..43315abc4a 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractFileStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractFileStore.java
@@ -1,104 +1,104 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.internal.efs;
-
-import org.eclipse.net4j.util.WrappedException;
-
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractFileStore extends FileStore
-{
- public AbstractFileStore()
- {
- }
-
- @Override
- public CDOWorkspaceFileSystem getFileSystem()
- {
- return CDOWorkspaceFileSystem.getInstance();
- }
-
- @Override
- public URI toURI()
- {
- try
- {
- return new URI(getParent().toURI().toString() + "/" + getName());
- }
- catch (URISyntaxException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class Invalid extends AbstractFileStore
- {
- private IFileStore parent;
-
- private String name;
-
- public Invalid(IFileStore parent, String name)
- {
- this.parent = parent;
- this.name = name;
- }
-
- @Override
- public IFileStore getParent()
- {
- return parent;
- }
-
- @Override
- public String getName()
- {
- return name;
- }
-
- @Override
- public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
- {
- return CDOWorkspaceFileSystem.NO_CHILD_NAMES;
- }
-
- @Override
- public IFileStore getChild(String name)
- {
- return new Invalid(this, name);
- }
-
- @Override
- public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
- {
- throw new UnsupportedOperationException();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.internal.efs;
+
+import org.eclipse.net4j.util.WrappedException;
+
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractFileStore extends FileStore
+{
+ public AbstractFileStore()
+ {
+ }
+
+ @Override
+ public CDOWorkspaceFileSystem getFileSystem()
+ {
+ return CDOWorkspaceFileSystem.getInstance();
+ }
+
+ @Override
+ public URI toURI()
+ {
+ try
+ {
+ return new URI(getParent().toURI().toString() + "/" + getName());
+ }
+ catch (URISyntaxException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Invalid extends AbstractFileStore
+ {
+ private IFileStore parent;
+
+ private String name;
+
+ public Invalid(IFileStore parent, String name)
+ {
+ this.parent = parent;
+ this.name = name;
+ }
+
+ @Override
+ public IFileStore getParent()
+ {
+ return parent;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return CDOWorkspaceFileSystem.NO_CHILD_NAMES;
+ }
+
+ @Override
+ public IFileStore getChild(String name)
+ {
+ return new Invalid(this, name);
+ }
+
+ @Override
+ public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
index c7c4a6884c..0fc4348eb2 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
@@ -1,196 +1,196 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.internal.efs;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CommitException;
-import org.eclipse.emf.cdo.view.CDOView;
-import org.eclipse.emf.cdo.workspace.CDOWorkspace;
-
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.io.IOUtil;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileInfo;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractResourceNodeStore extends AbstractFileStore
-{
- private CDOID resourceNodeID;
-
- public AbstractResourceNodeStore()
- {
- }
-
- @Override
- public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
- {
- return new ResourceNodeRunnable<String[]>()
- {
- @Override
- protected String[] run(CDOResourceNode node)
- {
- List<String> childNames = new ArrayList<String>();
- collectChildNames(node, childNames);
- return childNames.toArray(new String[childNames.size()]);
- }
- }.run();
- }
-
- @Override
- public IFileStore getChild(String name)
- {
- return new CDOResourceNodeStore(getWorkspaceStore(), this, name);
- }
-
- @Override
- public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
- {
- return new ResourceNodeRunnable<IFileInfo>()
- {
- @Override
- protected IFileInfo run(CDOResourceNode node)
- {
- long lastModified = EFS.NONE;
- boolean exists = node != null;
- boolean directory = exists && isDirectory(node);
- if (!directory)
- {
- lastModified = getWorkspaceStore().getLastModified(getPath());
- }
-
- FileInfo info = new FileInfo(getName());
- info.setLastModified(lastModified);
- info.setExists(exists);
- info.setDirectory(directory);
- info.setLength(EFS.NONE);
- info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
- info.setAttribute(EFS.ATTRIBUTE_HIDDEN, false);
- return info;
- }
- }.run();
- }
-
- public abstract CDOWorkspaceStore getWorkspaceStore();
-
- @Override
- public abstract AbstractResourceNodeStore getParent();
-
- public abstract String getPath();
-
- protected CDOView getView()
- {
- return getWorkspaceStore().getView();
- }
-
- protected abstract CDOResourceNode getResourceNode(CDOView view);
-
- protected abstract boolean isDirectory(CDOResourceNode node);
-
- protected abstract void collectChildNames(CDOResourceNode node, List<String> childNames);
-
- /**
- * @author Eike Stepper
- */
- protected abstract class ResourceNodeRunnable<RESULT>
- {
- public ResourceNodeRunnable()
- {
- }
-
- public RESULT run()
- {
- return run(false);
- }
-
- public RESULT run(boolean transactional)
- {
- CDOView view = null;
-
- try
- {
- view = openView(transactional);
- RESULT result = run(view);
- if (transactional)
- {
- CDOTransaction transaction = (CDOTransaction)view;
- transaction.commit();
- }
-
- return result;
- }
- catch (CommitException ex)
- {
- throw WrappedException.wrap(ex);
- }
- finally
- {
- if (transactional)
- {
- IOUtil.close(view);
- }
- }
- }
-
- protected RESULT run(CDOView view)
- {
- CDOResourceNode node = getResourceNode(view);
- RESULT result = run(node);
- return result;
- }
-
- protected RESULT run(CDOResourceNode node)
- {
- return null;
- }
-
- private CDOView openView(boolean transactional)
- {
- CDOWorkspace workspace = getWorkspaceStore().getWorkspace();
- return transactional ? workspace.openTransaction() : getView();
- }
-
- private CDOResourceNode getResourceNode(CDOView view)
- {
- CDOResourceNode node = null;
-
- try
- {
- if (resourceNodeID == null)
- {
- node = AbstractResourceNodeStore.this.getResourceNode(view);
- resourceNodeID = node.cdoID();
- }
- else
- {
- node = (CDOResourceNode)view.getObject(resourceNodeID);
- }
- }
- catch (Exception ex)
- {
- //$FALL-THROUGH$
- }
-
- return node;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.internal.efs;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.workspace.CDOWorkspace;
+
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.io.IOUtil;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractResourceNodeStore extends AbstractFileStore
+{
+ private CDOID resourceNodeID;
+
+ public AbstractResourceNodeStore()
+ {
+ }
+
+ @Override
+ public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return new ResourceNodeRunnable<String[]>()
+ {
+ @Override
+ protected String[] run(CDOResourceNode node)
+ {
+ List<String> childNames = new ArrayList<String>();
+ collectChildNames(node, childNames);
+ return childNames.toArray(new String[childNames.size()]);
+ }
+ }.run();
+ }
+
+ @Override
+ public IFileStore getChild(String name)
+ {
+ return new CDOResourceNodeStore(getWorkspaceStore(), this, name);
+ }
+
+ @Override
+ public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return new ResourceNodeRunnable<IFileInfo>()
+ {
+ @Override
+ protected IFileInfo run(CDOResourceNode node)
+ {
+ long lastModified = EFS.NONE;
+ boolean exists = node != null;
+ boolean directory = exists && isDirectory(node);
+ if (!directory)
+ {
+ lastModified = getWorkspaceStore().getLastModified(getPath());
+ }
+
+ FileInfo info = new FileInfo(getName());
+ info.setLastModified(lastModified);
+ info.setExists(exists);
+ info.setDirectory(directory);
+ info.setLength(EFS.NONE);
+ info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
+ info.setAttribute(EFS.ATTRIBUTE_HIDDEN, false);
+ return info;
+ }
+ }.run();
+ }
+
+ public abstract CDOWorkspaceStore getWorkspaceStore();
+
+ @Override
+ public abstract AbstractResourceNodeStore getParent();
+
+ public abstract String getPath();
+
+ protected CDOView getView()
+ {
+ return getWorkspaceStore().getView();
+ }
+
+ protected abstract CDOResourceNode getResourceNode(CDOView view);
+
+ protected abstract boolean isDirectory(CDOResourceNode node);
+
+ protected abstract void collectChildNames(CDOResourceNode node, List<String> childNames);
+
+ /**
+ * @author Eike Stepper
+ */
+ protected abstract class ResourceNodeRunnable<RESULT>
+ {
+ public ResourceNodeRunnable()
+ {
+ }
+
+ public RESULT run()
+ {
+ return run(false);
+ }
+
+ public RESULT run(boolean transactional)
+ {
+ CDOView view = null;
+
+ try
+ {
+ view = openView(transactional);
+ RESULT result = run(view);
+ if (transactional)
+ {
+ CDOTransaction transaction = (CDOTransaction)view;
+ transaction.commit();
+ }
+
+ return result;
+ }
+ catch (CommitException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ finally
+ {
+ if (transactional)
+ {
+ IOUtil.close(view);
+ }
+ }
+ }
+
+ protected RESULT run(CDOView view)
+ {
+ CDOResourceNode node = getResourceNode(view);
+ RESULT result = run(node);
+ return result;
+ }
+
+ protected RESULT run(CDOResourceNode node)
+ {
+ return null;
+ }
+
+ private CDOView openView(boolean transactional)
+ {
+ CDOWorkspace workspace = getWorkspaceStore().getWorkspace();
+ return transactional ? workspace.openTransaction() : getView();
+ }
+
+ private CDOResourceNode getResourceNode(CDOView view)
+ {
+ CDOResourceNode node = null;
+
+ try
+ {
+ if (resourceNodeID == null)
+ {
+ node = AbstractResourceNodeStore.this.getResourceNode(view);
+ resourceNodeID = node.cdoID();
+ }
+ else
+ {
+ node = (CDOResourceNode)view.getObject(resourceNodeID);
+ }
+ }
+ catch (Exception ex)
+ {
+ //$FALL-THROUGH$
+ }
+
+ return node;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOProjectDescriptionStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOProjectDescriptionStore.java
index 749a179c69..44531dc5a8 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOProjectDescriptionStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOProjectDescriptionStore.java
@@ -1,144 +1,144 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.internal.efs;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOProjectDescriptionStore extends AbstractFileStore
-{
- public static final String DESCRIPTION_FILE_NAME = ".project";
-
- private CDOWorkspaceStore workspaceStore;
-
- public CDOProjectDescriptionStore(CDOWorkspaceStore workspaceStore)
- {
- this.workspaceStore = workspaceStore;
- }
-
- public CDOWorkspaceStore getWorkspaceStore()
- {
- return workspaceStore;
- }
-
- @Override
- public IFileStore getParent()
- {
- return workspaceStore;
- }
-
- @Override
- public String getName()
- {
- return DESCRIPTION_FILE_NAME;
- }
-
- @Override
- public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
- {
- return CDOWorkspaceFileSystem.NO_CHILD_NAMES;
- }
-
- @Override
- public IFileStore getChild(String name)
- {
- return new AbstractFileStore.Invalid(this, name);
- }
-
- @Override
- public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException
- {
- getLocalFile().copy(destination, options, monitor);
- }
-
- @Override
- public void delete(int options, IProgressMonitor monitor) throws CoreException
- {
- getLocalFile().delete(options, monitor);
- }
-
- @Override
- public IFileInfo fetchInfo()
- {
- return getLocalFile().fetchInfo();
- }
-
- @Override
- public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
- {
- return getLocalFile().fetchInfo(options, monitor);
- }
-
- @Override
- public IFileStore getFileStore(IPath path)
- {
- return getLocalFile().getFileStore(path);
- }
-
- @Override
- public boolean isParentOf(IFileStore other)
- {
- return getLocalFile().isParentOf(other);
- }
-
- @Override
- public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
- {
- return getLocalFile().mkdir(options, monitor);
- }
-
- @Override
- public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException
- {
- getLocalFile().move(destination, options, monitor);
- }
-
- @Override
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
- {
- return getLocalFile().openInputStream(options, monitor);
- }
-
- @Override
- public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException
- {
- return getLocalFile().openOutputStream(options, monitor);
- }
-
- @Override
- public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException
- {
- getLocalFile().putInfo(info, options, monitor);
- }
-
- @Override
- public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException
- {
- return getLocalFile().toLocalFile(options, monitor);
- }
-
- private IFileStore getLocalFile()
- {
- File file = new File(workspaceStore.getLocation(), DESCRIPTION_FILE_NAME);
- return EFS.getLocalFileSystem().fromLocalFile(file);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.internal.efs;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOProjectDescriptionStore extends AbstractFileStore
+{
+ public static final String DESCRIPTION_FILE_NAME = ".project";
+
+ private CDOWorkspaceStore workspaceStore;
+
+ public CDOProjectDescriptionStore(CDOWorkspaceStore workspaceStore)
+ {
+ this.workspaceStore = workspaceStore;
+ }
+
+ public CDOWorkspaceStore getWorkspaceStore()
+ {
+ return workspaceStore;
+ }
+
+ @Override
+ public IFileStore getParent()
+ {
+ return workspaceStore;
+ }
+
+ @Override
+ public String getName()
+ {
+ return DESCRIPTION_FILE_NAME;
+ }
+
+ @Override
+ public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return CDOWorkspaceFileSystem.NO_CHILD_NAMES;
+ }
+
+ @Override
+ public IFileStore getChild(String name)
+ {
+ return new AbstractFileStore.Invalid(this, name);
+ }
+
+ @Override
+ public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException
+ {
+ getLocalFile().copy(destination, options, monitor);
+ }
+
+ @Override
+ public void delete(int options, IProgressMonitor monitor) throws CoreException
+ {
+ getLocalFile().delete(options, monitor);
+ }
+
+ @Override
+ public IFileInfo fetchInfo()
+ {
+ return getLocalFile().fetchInfo();
+ }
+
+ @Override
+ public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return getLocalFile().fetchInfo(options, monitor);
+ }
+
+ @Override
+ public IFileStore getFileStore(IPath path)
+ {
+ return getLocalFile().getFileStore(path);
+ }
+
+ @Override
+ public boolean isParentOf(IFileStore other)
+ {
+ return getLocalFile().isParentOf(other);
+ }
+
+ @Override
+ public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return getLocalFile().mkdir(options, monitor);
+ }
+
+ @Override
+ public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException
+ {
+ getLocalFile().move(destination, options, monitor);
+ }
+
+ @Override
+ public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return getLocalFile().openInputStream(options, monitor);
+ }
+
+ @Override
+ public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return getLocalFile().openOutputStream(options, monitor);
+ }
+
+ @Override
+ public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException
+ {
+ getLocalFile().putInfo(info, options, monitor);
+ }
+
+ @Override
+ public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return getLocalFile().toLocalFile(options, monitor);
+ }
+
+ private IFileStore getLocalFile()
+ {
+ File file = new File(workspaceStore.getLocation(), DESCRIPTION_FILE_NAME);
+ return EFS.getLocalFileSystem().fromLocalFile(file);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
index 3e4afc709b..b815635cf7 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
@@ -1,192 +1,192 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.internal.efs;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.view.CDOView;
-import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceStore.SaveContext;
-import org.eclipse.emf.cdo.workspace.internal.efs.bundle.OM;
-
-import org.eclipse.net4j.util.WrappedException;
-
-import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOResourceNodeStore extends AbstractResourceNodeStore
-{
- private CDOWorkspaceStore workspaceStore;
-
- private AbstractResourceNodeStore parent;
-
- private String name;
-
- public CDOResourceNodeStore(CDOWorkspaceStore workspaceStore, AbstractResourceNodeStore parent, String name)
- {
- this.workspaceStore = workspaceStore;
- this.parent = parent;
- this.name = name;
- }
-
- @Override
- public AbstractResourceNodeStore getParent()
- {
- return parent;
- }
-
- @Override
- public String getName()
- {
- return name;
- }
-
- @Override
- public String getPath()
- {
- return parent.getPath() + "/" + name;
- }
-
- @Override
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
- {
- return new ResourceNodeRunnable<InputStream>()
- {
- @Override
- protected InputStream run(CDOResourceNode node)
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- CDOResource resource = (CDOResource)node;
-
- try
- {
- resource.save(baos, null);
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- throw WrappedException.wrap(ex);
- }
-
- return new ByteArrayInputStream(baos.toByteArray());
- }
- }.run();
- }
-
- @Override
- public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException
- {
- return new ByteArrayOutputStream()
- {
- @Override
- public void close() throws IOException
- {
- byte[] bytes = toByteArray();
- InputStream in = new ByteArrayInputStream(bytes);
-
- XMIResource xmiResource = new XMIResourceImpl();
- xmiResource.load(in, null);
-
- String path = getPath();
- getWorkspaceStore().setLastModified(path, System.currentTimeMillis());
-
- SaveContext saveContext = getWorkspaceStore().getSaveContext();
- saveContext.save(xmiResource, path);
- }
- };
- }
-
- @Override
- public void delete(int options, IProgressMonitor monitor) throws CoreException
- {
- // Options can only contain EFS.NONE
- new ResourceNodeRunnable<Boolean>()
- {
- @Override
- protected Boolean run(CDOResourceNode node)
- {
- try
- {
- node.delete(null);
- return true;
- }
- catch (IOException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
- }.run(true);
- }
-
- @Override
- public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
- {
- // TODO Respect the SHALLOW option
- new ResourceNodeRunnable<CDOResourceFolder>()
- {
- @Override
- protected CDOResourceFolder run(CDOView view)
- {
- String path = getPath();
- return ((CDOTransaction)view).getOrCreateResourceFolder(path);
- }
- }.run(true);
-
- return this;
- }
-
- @Override
- public CDOWorkspaceStore getWorkspaceStore()
- {
- return workspaceStore;
- }
-
- @Override
- protected CDOResourceNode getResourceNode(CDOView view)
- {
- return view.getResourceNode(getPath());
- }
-
- @Override
- protected boolean isDirectory(CDOResourceNode node)
- {
- return node instanceof CDOResourceFolder;
- }
-
- @Override
- protected void collectChildNames(CDOResourceNode node, List<String> childNames)
- {
- if (node instanceof CDOResourceFolder)
- {
- CDOResourceFolder folder = (CDOResourceFolder)node;
-
- for (CDOResourceNode child : folder.getNodes())
- {
- childNames.add(child.getName());
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.internal.efs;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.workspace.internal.efs.CDOWorkspaceStore.SaveContext;
+import org.eclipse.emf.cdo.workspace.internal.efs.bundle.OM;
+
+import org.eclipse.net4j.util.WrappedException;
+
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOResourceNodeStore extends AbstractResourceNodeStore
+{
+ private CDOWorkspaceStore workspaceStore;
+
+ private AbstractResourceNodeStore parent;
+
+ private String name;
+
+ public CDOResourceNodeStore(CDOWorkspaceStore workspaceStore, AbstractResourceNodeStore parent, String name)
+ {
+ this.workspaceStore = workspaceStore;
+ this.parent = parent;
+ this.name = name;
+ }
+
+ @Override
+ public AbstractResourceNodeStore getParent()
+ {
+ return parent;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public String getPath()
+ {
+ return parent.getPath() + "/" + name;
+ }
+
+ @Override
+ public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return new ResourceNodeRunnable<InputStream>()
+ {
+ @Override
+ protected InputStream run(CDOResourceNode node)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ CDOResource resource = (CDOResource)node;
+
+ try
+ {
+ resource.save(baos, null);
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ throw WrappedException.wrap(ex);
+ }
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+ }.run();
+ }
+
+ @Override
+ public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return new ByteArrayOutputStream()
+ {
+ @Override
+ public void close() throws IOException
+ {
+ byte[] bytes = toByteArray();
+ InputStream in = new ByteArrayInputStream(bytes);
+
+ XMIResource xmiResource = new XMIResourceImpl();
+ xmiResource.load(in, null);
+
+ String path = getPath();
+ getWorkspaceStore().setLastModified(path, System.currentTimeMillis());
+
+ SaveContext saveContext = getWorkspaceStore().getSaveContext();
+ saveContext.save(xmiResource, path);
+ }
+ };
+ }
+
+ @Override
+ public void delete(int options, IProgressMonitor monitor) throws CoreException
+ {
+ // Options can only contain EFS.NONE
+ new ResourceNodeRunnable<Boolean>()
+ {
+ @Override
+ protected Boolean run(CDOResourceNode node)
+ {
+ try
+ {
+ node.delete(null);
+ return true;
+ }
+ catch (IOException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+ }.run(true);
+ }
+
+ @Override
+ public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
+ {
+ // TODO Respect the SHALLOW option
+ new ResourceNodeRunnable<CDOResourceFolder>()
+ {
+ @Override
+ protected CDOResourceFolder run(CDOView view)
+ {
+ String path = getPath();
+ return ((CDOTransaction)view).getOrCreateResourceFolder(path);
+ }
+ }.run(true);
+
+ return this;
+ }
+
+ @Override
+ public CDOWorkspaceStore getWorkspaceStore()
+ {
+ return workspaceStore;
+ }
+
+ @Override
+ protected CDOResourceNode getResourceNode(CDOView view)
+ {
+ return view.getResourceNode(getPath());
+ }
+
+ @Override
+ protected boolean isDirectory(CDOResourceNode node)
+ {
+ return node instanceof CDOResourceFolder;
+ }
+
+ @Override
+ protected void collectChildNames(CDOResourceNode node, List<String> childNames)
+ {
+ if (node instanceof CDOResourceFolder)
+ {
+ CDOResourceFolder folder = (CDOResourceFolder)node;
+
+ for (CDOResourceNode child : folder.getNodes())
+ {
+ childNames.add(child.getName());
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceFileSystem.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceFileSystem.java
index 3af712492b..3e98e2fc28 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceFileSystem.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceFileSystem.java
@@ -1,192 +1,192 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.internal.efs;
-
-import org.eclipse.emf.cdo.workspace.CDOWorkspace;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileSystem;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IPath;
-
-import java.io.File;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * @author Eike Stepper
- */
-public class CDOWorkspaceFileSystem extends FileSystem implements IResourceChangeListener
-{
- public static final String SCHEME = "cdo.workspace";
-
- public static final String[] NO_CHILD_NAMES = {};
-
- private static CDOWorkspaceFileSystem instance;
-
- /**
- * Maps {@link IProject} name to {@link IFileStore}.
- */
- private Map<String, CDOWorkspaceStore> workspaceStores = new HashMap<String, CDOWorkspaceStore>();
-
- /**
- * <code>true</code> if this {@link CDOWorkspaceFileSystem} is registered as an {@link IResourceChangeListener} with
- * the {@link IWorkspace}, <code>false</code> otherwise.
- */
- private boolean workspaceListenerRegistered;
-
- /**
- * Called once by the {@link IExtensionRegistry}.
- */
- public CDOWorkspaceFileSystem()
- {
- instance = this;
- }
-
- public static CDOWorkspaceFileSystem getInstance()
- {
- return instance;
- }
-
- @Override
- public int attributes()
- {
- return EFS.ATTRIBUTE_OTHER_READ | EFS.ATTRIBUTE_OTHER_WRITE;
- }
-
- @Override
- public boolean isCaseSensitive()
- {
- return true;
- }
-
- @Override
- public IFileStore getStore(URI uri)
- {
- String path = uri.getSchemeSpecificPart();
- StringTokenizer tokenizer = new StringTokenizer(path, "/");
- String name = tokenizer.nextToken();
-
- IFileStore store = getWorkspaceStore(name);
-
- while (tokenizer.hasMoreTokens())
- {
- name = tokenizer.nextToken();
- store = store.getChild(name);
- }
-
- return store;
- }
-
- public void resourceChanged(IResourceChangeEvent event)
- {
- IResourceDelta delta = event.getDelta();
- if (delta != null)
- {
- IResourceDelta[] deltas = delta.getAffectedChildren();
- projectsChanged(deltas);
- }
- }
-
- private void projectsChanged(IResourceDelta[] deltas)
- {
- for (IResourceDelta delta : deltas)
- {
- int kind = delta.getKind();
- boolean removed = kind == IResourceDelta.REMOVED;
- if (!removed)
- {
- int flags = delta.getFlags();
- if ((flags & IResourceDelta.OPEN) != 0)
- {
- IProject project = (IProject)delta.getResource();
- removed = !project.isOpen();
- }
- }
-
- if (removed)
- {
- String name = delta.getFullPath().segment(0);
-
- CDOWorkspaceStore store;
- synchronized (workspaceStores)
- {
- store = workspaceStores.remove(name);
-
- if (workspaceStores.isEmpty())
- {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- workspaceListenerRegistered = false;
- }
- }
-
- if (store != null)
- {
- store.dispose();
- }
- }
- }
- }
-
- public CDOWorkspaceStore addWorkspaceStore(String name, CDOWorkspace workspace)
- {
- synchronized (workspaceStores)
- {
- CDOWorkspaceStore store = createWorkspaceStore(name);
- store.setWorkspace(workspace);
- addWorkspaceStore(store);
- return store;
- }
- }
-
- private void addWorkspaceStore(IFileStore store)
- {
- workspaceStores.put(store.getName(), (CDOWorkspaceStore)store);
-
- if (!workspaceListenerRegistered)
- {
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- workspaceListenerRegistered = true;
- }
- }
-
- private IFileStore getWorkspaceStore(String name)
- {
- synchronized (workspaceStores)
- {
- IFileStore store = workspaceStores.get(name);
- if (store == null)
- {
- store = createWorkspaceStore(name);
- addWorkspaceStore(store);
- }
-
- return store;
- }
- }
-
- private CDOWorkspaceStore createWorkspaceStore(String name)
- {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IPath location = root.getLocation().append(name);
- return new CDOWorkspaceStore(name, new File(location.toOSString()));
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.internal.efs;
+
+import org.eclipse.emf.cdo.workspace.CDOWorkspace;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileSystem;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IPath;
+
+import java.io.File;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOWorkspaceFileSystem extends FileSystem implements IResourceChangeListener
+{
+ public static final String SCHEME = "cdo.workspace";
+
+ public static final String[] NO_CHILD_NAMES = {};
+
+ private static CDOWorkspaceFileSystem instance;
+
+ /**
+ * Maps {@link IProject} name to {@link IFileStore}.
+ */
+ private Map<String, CDOWorkspaceStore> workspaceStores = new HashMap<String, CDOWorkspaceStore>();
+
+ /**
+ * <code>true</code> if this {@link CDOWorkspaceFileSystem} is registered as an {@link IResourceChangeListener} with
+ * the {@link IWorkspace}, <code>false</code> otherwise.
+ */
+ private boolean workspaceListenerRegistered;
+
+ /**
+ * Called once by the {@link IExtensionRegistry}.
+ */
+ public CDOWorkspaceFileSystem()
+ {
+ instance = this;
+ }
+
+ public static CDOWorkspaceFileSystem getInstance()
+ {
+ return instance;
+ }
+
+ @Override
+ public int attributes()
+ {
+ return EFS.ATTRIBUTE_OTHER_READ | EFS.ATTRIBUTE_OTHER_WRITE;
+ }
+
+ @Override
+ public boolean isCaseSensitive()
+ {
+ return true;
+ }
+
+ @Override
+ public IFileStore getStore(URI uri)
+ {
+ String path = uri.getSchemeSpecificPart();
+ StringTokenizer tokenizer = new StringTokenizer(path, "/");
+ String name = tokenizer.nextToken();
+
+ IFileStore store = getWorkspaceStore(name);
+
+ while (tokenizer.hasMoreTokens())
+ {
+ name = tokenizer.nextToken();
+ store = store.getChild(name);
+ }
+
+ return store;
+ }
+
+ public void resourceChanged(IResourceChangeEvent event)
+ {
+ IResourceDelta delta = event.getDelta();
+ if (delta != null)
+ {
+ IResourceDelta[] deltas = delta.getAffectedChildren();
+ projectsChanged(deltas);
+ }
+ }
+
+ private void projectsChanged(IResourceDelta[] deltas)
+ {
+ for (IResourceDelta delta : deltas)
+ {
+ int kind = delta.getKind();
+ boolean removed = kind == IResourceDelta.REMOVED;
+ if (!removed)
+ {
+ int flags = delta.getFlags();
+ if ((flags & IResourceDelta.OPEN) != 0)
+ {
+ IProject project = (IProject)delta.getResource();
+ removed = !project.isOpen();
+ }
+ }
+
+ if (removed)
+ {
+ String name = delta.getFullPath().segment(0);
+
+ CDOWorkspaceStore store;
+ synchronized (workspaceStores)
+ {
+ store = workspaceStores.remove(name);
+
+ if (workspaceStores.isEmpty())
+ {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ workspaceListenerRegistered = false;
+ }
+ }
+
+ if (store != null)
+ {
+ store.dispose();
+ }
+ }
+ }
+ }
+
+ public CDOWorkspaceStore addWorkspaceStore(String name, CDOWorkspace workspace)
+ {
+ synchronized (workspaceStores)
+ {
+ CDOWorkspaceStore store = createWorkspaceStore(name);
+ store.setWorkspace(workspace);
+ addWorkspaceStore(store);
+ return store;
+ }
+ }
+
+ private void addWorkspaceStore(IFileStore store)
+ {
+ workspaceStores.put(store.getName(), (CDOWorkspaceStore)store);
+
+ if (!workspaceListenerRegistered)
+ {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ workspaceListenerRegistered = true;
+ }
+ }
+
+ private IFileStore getWorkspaceStore(String name)
+ {
+ synchronized (workspaceStores)
+ {
+ IFileStore store = workspaceStores.get(name);
+ if (store == null)
+ {
+ store = createWorkspaceStore(name);
+ addWorkspaceStore(store);
+ }
+
+ return store;
+ }
+ }
+
+ private CDOWorkspaceStore createWorkspaceStore(String name)
+ {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IPath location = root.getLocation().append(name);
+ return new CDOWorkspaceStore(name, new File(location.toOSString()));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
index c4804b71bc..ba4a22df73 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
@@ -1,619 +1,619 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.internal.efs;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.util.CommitException;
-import org.eclipse.emf.cdo.view.CDOView;
-import org.eclipse.emf.cdo.workspace.CDOWorkspace;
-import org.eclipse.emf.cdo.workspace.efs.CDOFS;
-
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.io.IOUtil;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOWorkspaceStore extends AbstractResourceNodeStore
-{
- private static final AbstractResourceNodeStore NO_PARENT = null;
-
- private String name;
-
- private File location;
-
- private CDOWorkspace workspace;
-
- private Map<String, Long> lastModifiedTimes = new HashMap<String, Long>();
-
- private CDOView view;
-
- private SaveContext saveContext;
-
- public CDOWorkspaceStore(String name, File location)
- {
- this.name = name;
- this.location = location;
- }
-
- public File getLocation()
- {
- return location;
- }
-
- public synchronized CDOWorkspace getWorkspace()
- {
- if (workspace == null)
- {
- workspace = openWorkspace();
- }
-
- return workspace;
- }
-
- public synchronized void setWorkspace(CDOWorkspace workspace)
- {
- this.workspace = workspace;
- }
-
- private CDOWorkspace openWorkspace()
- {
- try
- {
- return CDOFS.open(name, location);
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- @Override
- public AbstractResourceNodeStore getParent()
- {
- return NO_PARENT;
- }
-
- @Override
- public String getName()
- {
- return name;
- }
-
- @Override
- public URI toURI()
- {
- try
- {
- return new URI(CDOWorkspaceFileSystem.SCHEME + "://" + name);
- }
- catch (URISyntaxException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- @Override
- public IFileStore getChild(String name)
- {
- if (CDOProjectDescriptionStore.DESCRIPTION_FILE_NAME.equals(name))
- {
- return new CDOProjectDescriptionStore(this);
- }
-
- return super.getChild(name);
- }
-
- @Override
- public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
- {
- return this;
- }
-
- @Override
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
- {
- throw new UnsupportedOperationException();
- }
-
- public void dispose()
- {
- if (view != null)
- {
- IOUtil.close(view);
- view = null;
- }
- }
-
- @Override
- public CDOWorkspaceStore getWorkspaceStore()
- {
- return this;
- }
-
- public long getLastModified(String path)
- {
- Long time = lastModifiedTimes.get(path);
- return time == null ? EFS.NONE : time;
- }
-
- public void setLastModified(String path, long time)
- {
- lastModifiedTimes.put(path, time);
- // TODO Save lastModifiedTimes
- }
-
- public SaveContext getSaveContext()
- {
- if (saveContext == null)
- {
- saveContext = new SaveContext();
- }
-
- return saveContext;
- }
-
- @Override
- public String getPath()
- {
- return "";
- }
-
- @Override
- protected synchronized CDOView getView()
- {
- if (view == null)
- {
- view = workspace.openView();
- }
-
- return view;
- }
-
- @Override
- protected CDOResourceNode getResourceNode(CDOView view)
- {
- return view.getRootResource();
- }
-
- @Override
- protected boolean isDirectory(CDOResourceNode node)
- {
- return true;
- }
-
- @Override
- protected void collectChildNames(CDOResourceNode node, List<String> childNames)
- {
- childNames.add(CDOProjectDescriptionStore.DESCRIPTION_FILE_NAME);
-
- CDOResource rootResource = (CDOResource)node;
- for (EObject content : rootResource.getContents())
- {
- if (content instanceof CDOResourceNode)
- {
- CDOResourceNode child = (CDOResourceNode)content;
- childNames.add(child.getName());
- }
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public final class SaveContext
- {
- private CDOTransaction transaction = workspace.openTransaction();
-
- private Map<String, InternalCDOObject> newObjects = new HashMap<String, InternalCDOObject>();
-
- private Map<String, List<ForwardReference>> forwardReferences = new HashMap<String, List<ForwardReference>>();
-
- private XMIResource xmiResource;
-
- public SaveContext()
- {
- }
-
- public void save(XMIResource xmiResource, String cdoPath)
- {
- this.xmiResource = xmiResource;
-
- try
- {
- CDOResource cdoResource = transaction.getOrCreateResource(cdoPath);
- saveContents(xmiResource.getContents(), cdoResource.getContents());
- }
- finally
- {
- this.xmiResource = null;
- done();
- }
- }
-
- private void saveContents(EList<EObject> xmiContents, EList<EObject> cdoContents)
- {
- int size = xmiContents.size();
- for (int i = 0; i < size; i++)
- {
- EObject xmiObject = xmiContents.get(i);
- CDOObject cdoObject = getCDOObjectByXMIID(xmiObject);
- if (cdoObject == null)
- {
- cdoObject = createNewCDOObject(xmiObject);
- cdoContents.add(i, cdoObject);
- }
- else
- {
- int index = cdoContents.indexOf(cdoObject);
- if (index != -1)
- {
- if (index != i)
- {
- cdoContents.move(i, index);
- }
- }
- else
- {
- cdoContents.add(i, cdoObject);
- }
- }
-
- saveObject((InternalEObject)xmiObject, (InternalCDOObject)cdoObject);
- }
-
- shortenList(cdoContents, size);
- }
-
- private void saveObject(InternalEObject xmiObject, InternalCDOObject cdoObject)
- {
- // CDOClassInfo classInfo = cdoObject.cdoRevision().getClassInfo();
- for (EStructuralFeature feature : xmiObject.eClass().getEAllStructuralFeatures())
- {
- Object xmiValue = xmiObject.eGet(feature);
- if (feature instanceof EReference)
- {
- EReference reference = (EReference)feature;
- if (reference.isContainment())
- {
- if (reference.isMany())
- {
- // Many-valued containment reference
- @SuppressWarnings("unchecked")
- EList<EObject> xmiContents = (EList<EObject>)xmiValue;
-
- @SuppressWarnings("unchecked")
- EList<EObject> cdoContents = (EList<EObject>)cdoObject.eGet(reference);
-
- saveContents(xmiContents, cdoContents);
- }
- else
- {
- // Single-valued containment reference
- if (xmiValue != null)
- {
- InternalCDOObject cdoValue = getCDOObjectByXMIID((EObject)xmiValue);
- if (cdoValue == null)
- {
- cdoValue = createNewCDOObject((EObject)xmiValue);
- }
-
- cdoObject.eSet(reference, cdoValue);
- saveObject((InternalEObject)xmiValue, cdoValue);
- }
- else
- {
- cdoObject.eSet(reference, null);
- }
- }
- }
- else
- {
- if (reference.isMany())
- {
- // Many-valued cross reference
- @SuppressWarnings("unchecked")
- EList<EObject> xmiElements = (EList<EObject>)xmiValue;
-
- @SuppressWarnings("unchecked")
- EList<EObject> cdoElements = (EList<EObject>)cdoObject.eGet(reference);
-
- int size = xmiElements.size();
- for (int i = 0; i < size; i++)
- {
- InternalEObject xmiElement = (InternalEObject)xmiElements.get(i);
- InternalCDOObject cdoElement;
-
- org.eclipse.emf.common.util.URI eProxyURI = xmiElement.eProxyURI();
- if (eProxyURI != null)
- {
- String href = eProxyURI.fragment();
- cdoElement = getCDOObjectByHREF(href);
- if (cdoElement == null)
- {
- registerForwardReference(cdoObject, reference, i, href);
-
- InternalCDOObject dummy = createNewCDOObject(xmiElement);
- cdoElements.add(i, dummy);
- continue;
- }
- }
- else
- {
- cdoElement = getCDOObjectByXMIID(xmiElement);
- }
-
- int index = cdoElements.indexOf(cdoElement);
- if (index != -1)
- {
- cdoElements.move(i, index);
- }
- else
- {
- cdoElements.add(i, cdoElement);
- }
- }
-
- shortenList(cdoElements, size);
- }
- else
- {
- // Single-valued cross reference
- CDOObject cdoValue = null;
- if (xmiValue != null)
- {
- org.eclipse.emf.common.util.URI eProxyURI = ((InternalEObject)xmiValue).eProxyURI();
- if (eProxyURI != null)
- {
- String href = eProxyURI.fragment();
- cdoValue = getCDOObjectByHREF(href);
- if (cdoValue == null)
- {
- registerForwardReference(cdoObject, reference, -1, href);
- }
- }
- else
- {
- cdoValue = getCDOObjectByXMIID((EObject)xmiValue);
- }
- }
-
- cdoObject.eSet(reference, cdoValue);
- }
- }
- }
- else
- {
- EAttribute attribute = (EAttribute)feature;
- if (attribute.isMany())
- {
- // Many-valued attribute
- @SuppressWarnings("unchecked")
- EList<Object> xmiElements = (EList<Object>)xmiValue;
-
- @SuppressWarnings("unchecked")
- EList<Object> cdoElements = (EList<Object>)cdoObject.eGet(attribute);
- cdoElements.clear();
-
- int size = xmiElements.size();
- for (int i = 0; i < size; i++)
- {
- Object xmiElement = xmiElements.get(i);
- cdoElements.add(xmiElement);
- }
- }
- else
- {
- // Single-valued attribute
- cdoObject.eSet(attribute, xmiValue);
- }
- }
- }
- }
-
- private InternalCDOObject getCDOObjectByXMIID(EObject xmiObject)
- {
- String xmiID = xmiResource.getID(xmiObject);
- if (xmiID != null)
- {
- try
- {
- CDOID id = CDOIDUtil.read(xmiID);
- if (!CDOIDUtil.isNull(id))
- {
- return (InternalCDOObject)transaction.getObject(id);
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- //$FALL-THROUGH$
- }
- }
-
- return null;
- }
-
- private InternalCDOObject createNewCDOObject(EObject xmiObject)
- {
- // Create new object
- EObject newInstance = EcoreUtil.create(xmiObject.eClass());
- InternalCDOObject cdoObject = (InternalCDOObject)CDOUtil.getCDOObject(newInstance);
-
- // Remember new object
- String fragment = xmiResource.getURIFragment(xmiObject);
- newObjects.put(fragment, cdoObject);
-
- return cdoObject;
- }
-
- private void shortenList(EList<EObject> list, int size)
- {
- int remove = list.size() - size;
- while (remove-- != 0)
- {
- list.remove(list.size() - 1);
- }
- }
-
- private InternalCDOObject getCDOObjectByHREF(String href)
- {
- InternalCDOObject cdoObject = null;
-
- try
- {
- CDOID id = CDOIDUtil.read(href);
- cdoObject = (InternalCDOObject)transaction.getObject(id);
- }
- catch (Exception ex)
- {
- //$FALL-THROUGH$
- }
-
- if (cdoObject == null)
- {
- cdoObject = newObjects.get(href);
- }
-
- return cdoObject;
- }
-
- private void done()
- {
- if (resolveForwardReferences())
- {
- commit();
- }
- }
-
- private void registerForwardReference(InternalCDOObject cdoObject, EReference reference, int index, String href)
- {
- List<ForwardReference> list = forwardReferences.get(href);
- if (list == null)
- {
- list = new ArrayList<ForwardReference>();
- forwardReferences.put(href, list);
- }
-
- list.add(new ForwardReference(cdoObject, reference, index));
- }
-
- private boolean resolveForwardReferences()
- {
- Set<Entry<String, List<ForwardReference>>> entrySet = forwardReferences.entrySet();
- for (Iterator<Entry<String, List<ForwardReference>>> it = entrySet.iterator(); it.hasNext();)
- {
- Entry<String, List<ForwardReference>> entry = it.next();
- String href = entry.getKey();
-
- InternalCDOObject target = getCDOObjectByHREF(href);
- if (target != null)
- {
- List<ForwardReference> list = entry.getValue();
- for (ForwardReference forwardReference : list)
- {
- forwardReference.resolve(target);
- }
-
- it.remove();
- }
- }
-
- return forwardReferences.isEmpty();
- }
-
- private void commit()
- {
- try
- {
- transaction.commit();
- }
- catch (CommitException ex)
- {
- throw WrappedException.wrap(ex);
- }
- finally
- {
- IOUtil.closeSilent(transaction);
- transaction = null;
- forwardReferences = null;
- newObjects = null;
- saveContext = null;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class ForwardReference
- {
- private InternalCDOObject source;
-
- private EReference reference;
-
- private int index;
-
- public ForwardReference(InternalCDOObject source, EReference reference, int index)
- {
- this.source = source;
- this.reference = reference;
- this.index = index;
- }
-
- public void resolve(InternalCDOObject target)
- {
- if (reference.isMany())
- {
- @SuppressWarnings("unchecked")
- EList<EObject> list = (EList<EObject>)source.eGet(reference);
- list.set(index, target);
- }
- else
- {
- source.eSet(reference, target);
- }
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.internal.efs;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.util.CommitException;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.workspace.CDOWorkspace;
+import org.eclipse.emf.cdo.workspace.efs.CDOFS;
+
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.io.IOUtil;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOWorkspaceStore extends AbstractResourceNodeStore
+{
+ private static final AbstractResourceNodeStore NO_PARENT = null;
+
+ private String name;
+
+ private File location;
+
+ private CDOWorkspace workspace;
+
+ private Map<String, Long> lastModifiedTimes = new HashMap<String, Long>();
+
+ private CDOView view;
+
+ private SaveContext saveContext;
+
+ public CDOWorkspaceStore(String name, File location)
+ {
+ this.name = name;
+ this.location = location;
+ }
+
+ public File getLocation()
+ {
+ return location;
+ }
+
+ public synchronized CDOWorkspace getWorkspace()
+ {
+ if (workspace == null)
+ {
+ workspace = openWorkspace();
+ }
+
+ return workspace;
+ }
+
+ public synchronized void setWorkspace(CDOWorkspace workspace)
+ {
+ this.workspace = workspace;
+ }
+
+ private CDOWorkspace openWorkspace()
+ {
+ try
+ {
+ return CDOFS.open(name, location);
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ @Override
+ public AbstractResourceNodeStore getParent()
+ {
+ return NO_PARENT;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public URI toURI()
+ {
+ try
+ {
+ return new URI(CDOWorkspaceFileSystem.SCHEME + "://" + name);
+ }
+ catch (URISyntaxException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ @Override
+ public IFileStore getChild(String name)
+ {
+ if (CDOProjectDescriptionStore.DESCRIPTION_FILE_NAME.equals(name))
+ {
+ return new CDOProjectDescriptionStore(this);
+ }
+
+ return super.getChild(name);
+ }
+
+ @Override
+ public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
+ {
+ return this;
+ }
+
+ @Override
+ public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void dispose()
+ {
+ if (view != null)
+ {
+ IOUtil.close(view);
+ view = null;
+ }
+ }
+
+ @Override
+ public CDOWorkspaceStore getWorkspaceStore()
+ {
+ return this;
+ }
+
+ public long getLastModified(String path)
+ {
+ Long time = lastModifiedTimes.get(path);
+ return time == null ? EFS.NONE : time;
+ }
+
+ public void setLastModified(String path, long time)
+ {
+ lastModifiedTimes.put(path, time);
+ // TODO Save lastModifiedTimes
+ }
+
+ public SaveContext getSaveContext()
+ {
+ if (saveContext == null)
+ {
+ saveContext = new SaveContext();
+ }
+
+ return saveContext;
+ }
+
+ @Override
+ public String getPath()
+ {
+ return "";
+ }
+
+ @Override
+ protected synchronized CDOView getView()
+ {
+ if (view == null)
+ {
+ view = workspace.openView();
+ }
+
+ return view;
+ }
+
+ @Override
+ protected CDOResourceNode getResourceNode(CDOView view)
+ {
+ return view.getRootResource();
+ }
+
+ @Override
+ protected boolean isDirectory(CDOResourceNode node)
+ {
+ return true;
+ }
+
+ @Override
+ protected void collectChildNames(CDOResourceNode node, List<String> childNames)
+ {
+ childNames.add(CDOProjectDescriptionStore.DESCRIPTION_FILE_NAME);
+
+ CDOResource rootResource = (CDOResource)node;
+ for (EObject content : rootResource.getContents())
+ {
+ if (content instanceof CDOResourceNode)
+ {
+ CDOResourceNode child = (CDOResourceNode)content;
+ childNames.add(child.getName());
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public final class SaveContext
+ {
+ private CDOTransaction transaction = workspace.openTransaction();
+
+ private Map<String, InternalCDOObject> newObjects = new HashMap<String, InternalCDOObject>();
+
+ private Map<String, List<ForwardReference>> forwardReferences = new HashMap<String, List<ForwardReference>>();
+
+ private XMIResource xmiResource;
+
+ public SaveContext()
+ {
+ }
+
+ public void save(XMIResource xmiResource, String cdoPath)
+ {
+ this.xmiResource = xmiResource;
+
+ try
+ {
+ CDOResource cdoResource = transaction.getOrCreateResource(cdoPath);
+ saveContents(xmiResource.getContents(), cdoResource.getContents());
+ }
+ finally
+ {
+ this.xmiResource = null;
+ done();
+ }
+ }
+
+ private void saveContents(EList<EObject> xmiContents, EList<EObject> cdoContents)
+ {
+ int size = xmiContents.size();
+ for (int i = 0; i < size; i++)
+ {
+ EObject xmiObject = xmiContents.get(i);
+ CDOObject cdoObject = getCDOObjectByXMIID(xmiObject);
+ if (cdoObject == null)
+ {
+ cdoObject = createNewCDOObject(xmiObject);
+ cdoContents.add(i, cdoObject);
+ }
+ else
+ {
+ int index = cdoContents.indexOf(cdoObject);
+ if (index != -1)
+ {
+ if (index != i)
+ {
+ cdoContents.move(i, index);
+ }
+ }
+ else
+ {
+ cdoContents.add(i, cdoObject);
+ }
+ }
+
+ saveObject((InternalEObject)xmiObject, (InternalCDOObject)cdoObject);
+ }
+
+ shortenList(cdoContents, size);
+ }
+
+ private void saveObject(InternalEObject xmiObject, InternalCDOObject cdoObject)
+ {
+ // CDOClassInfo classInfo = cdoObject.cdoRevision().getClassInfo();
+ for (EStructuralFeature feature : xmiObject.eClass().getEAllStructuralFeatures())
+ {
+ Object xmiValue = xmiObject.eGet(feature);
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ if (reference.isContainment())
+ {
+ if (reference.isMany())
+ {
+ // Many-valued containment reference
+ @SuppressWarnings("unchecked")
+ EList<EObject> xmiContents = (EList<EObject>)xmiValue;
+
+ @SuppressWarnings("unchecked")
+ EList<EObject> cdoContents = (EList<EObject>)cdoObject.eGet(reference);
+
+ saveContents(xmiContents, cdoContents);
+ }
+ else
+ {
+ // Single-valued containment reference
+ if (xmiValue != null)
+ {
+ InternalCDOObject cdoValue = getCDOObjectByXMIID((EObject)xmiValue);
+ if (cdoValue == null)
+ {
+ cdoValue = createNewCDOObject((EObject)xmiValue);
+ }
+
+ cdoObject.eSet(reference, cdoValue);
+ saveObject((InternalEObject)xmiValue, cdoValue);
+ }
+ else
+ {
+ cdoObject.eSet(reference, null);
+ }
+ }
+ }
+ else
+ {
+ if (reference.isMany())
+ {
+ // Many-valued cross reference
+ @SuppressWarnings("unchecked")
+ EList<EObject> xmiElements = (EList<EObject>)xmiValue;
+
+ @SuppressWarnings("unchecked")
+ EList<EObject> cdoElements = (EList<EObject>)cdoObject.eGet(reference);
+
+ int size = xmiElements.size();
+ for (int i = 0; i < size; i++)
+ {
+ InternalEObject xmiElement = (InternalEObject)xmiElements.get(i);
+ InternalCDOObject cdoElement;
+
+ org.eclipse.emf.common.util.URI eProxyURI = xmiElement.eProxyURI();
+ if (eProxyURI != null)
+ {
+ String href = eProxyURI.fragment();
+ cdoElement = getCDOObjectByHREF(href);
+ if (cdoElement == null)
+ {
+ registerForwardReference(cdoObject, reference, i, href);
+
+ InternalCDOObject dummy = createNewCDOObject(xmiElement);
+ cdoElements.add(i, dummy);
+ continue;
+ }
+ }
+ else
+ {
+ cdoElement = getCDOObjectByXMIID(xmiElement);
+ }
+
+ int index = cdoElements.indexOf(cdoElement);
+ if (index != -1)
+ {
+ cdoElements.move(i, index);
+ }
+ else
+ {
+ cdoElements.add(i, cdoElement);
+ }
+ }
+
+ shortenList(cdoElements, size);
+ }
+ else
+ {
+ // Single-valued cross reference
+ CDOObject cdoValue = null;
+ if (xmiValue != null)
+ {
+ org.eclipse.emf.common.util.URI eProxyURI = ((InternalEObject)xmiValue).eProxyURI();
+ if (eProxyURI != null)
+ {
+ String href = eProxyURI.fragment();
+ cdoValue = getCDOObjectByHREF(href);
+ if (cdoValue == null)
+ {
+ registerForwardReference(cdoObject, reference, -1, href);
+ }
+ }
+ else
+ {
+ cdoValue = getCDOObjectByXMIID((EObject)xmiValue);
+ }
+ }
+
+ cdoObject.eSet(reference, cdoValue);
+ }
+ }
+ }
+ else
+ {
+ EAttribute attribute = (EAttribute)feature;
+ if (attribute.isMany())
+ {
+ // Many-valued attribute
+ @SuppressWarnings("unchecked")
+ EList<Object> xmiElements = (EList<Object>)xmiValue;
+
+ @SuppressWarnings("unchecked")
+ EList<Object> cdoElements = (EList<Object>)cdoObject.eGet(attribute);
+ cdoElements.clear();
+
+ int size = xmiElements.size();
+ for (int i = 0; i < size; i++)
+ {
+ Object xmiElement = xmiElements.get(i);
+ cdoElements.add(xmiElement);
+ }
+ }
+ else
+ {
+ // Single-valued attribute
+ cdoObject.eSet(attribute, xmiValue);
+ }
+ }
+ }
+ }
+
+ private InternalCDOObject getCDOObjectByXMIID(EObject xmiObject)
+ {
+ String xmiID = xmiResource.getID(xmiObject);
+ if (xmiID != null)
+ {
+ try
+ {
+ CDOID id = CDOIDUtil.read(xmiID);
+ if (!CDOIDUtil.isNull(id))
+ {
+ return (InternalCDOObject)transaction.getObject(id);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ //$FALL-THROUGH$
+ }
+ }
+
+ return null;
+ }
+
+ private InternalCDOObject createNewCDOObject(EObject xmiObject)
+ {
+ // Create new object
+ EObject newInstance = EcoreUtil.create(xmiObject.eClass());
+ InternalCDOObject cdoObject = (InternalCDOObject)CDOUtil.getCDOObject(newInstance);
+
+ // Remember new object
+ String fragment = xmiResource.getURIFragment(xmiObject);
+ newObjects.put(fragment, cdoObject);
+
+ return cdoObject;
+ }
+
+ private void shortenList(EList<EObject> list, int size)
+ {
+ int remove = list.size() - size;
+ while (remove-- != 0)
+ {
+ list.remove(list.size() - 1);
+ }
+ }
+
+ private InternalCDOObject getCDOObjectByHREF(String href)
+ {
+ InternalCDOObject cdoObject = null;
+
+ try
+ {
+ CDOID id = CDOIDUtil.read(href);
+ cdoObject = (InternalCDOObject)transaction.getObject(id);
+ }
+ catch (Exception ex)
+ {
+ //$FALL-THROUGH$
+ }
+
+ if (cdoObject == null)
+ {
+ cdoObject = newObjects.get(href);
+ }
+
+ return cdoObject;
+ }
+
+ private void done()
+ {
+ if (resolveForwardReferences())
+ {
+ commit();
+ }
+ }
+
+ private void registerForwardReference(InternalCDOObject cdoObject, EReference reference, int index, String href)
+ {
+ List<ForwardReference> list = forwardReferences.get(href);
+ if (list == null)
+ {
+ list = new ArrayList<ForwardReference>();
+ forwardReferences.put(href, list);
+ }
+
+ list.add(new ForwardReference(cdoObject, reference, index));
+ }
+
+ private boolean resolveForwardReferences()
+ {
+ Set<Entry<String, List<ForwardReference>>> entrySet = forwardReferences.entrySet();
+ for (Iterator<Entry<String, List<ForwardReference>>> it = entrySet.iterator(); it.hasNext();)
+ {
+ Entry<String, List<ForwardReference>> entry = it.next();
+ String href = entry.getKey();
+
+ InternalCDOObject target = getCDOObjectByHREF(href);
+ if (target != null)
+ {
+ List<ForwardReference> list = entry.getValue();
+ for (ForwardReference forwardReference : list)
+ {
+ forwardReference.resolve(target);
+ }
+
+ it.remove();
+ }
+ }
+
+ return forwardReferences.isEmpty();
+ }
+
+ private void commit()
+ {
+ try
+ {
+ transaction.commit();
+ }
+ catch (CommitException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ finally
+ {
+ IOUtil.closeSilent(transaction);
+ transaction = null;
+ forwardReferences = null;
+ newObjects = null;
+ saveContext = null;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class ForwardReference
+ {
+ private InternalCDOObject source;
+
+ private EReference reference;
+
+ private int index;
+
+ public ForwardReference(InternalCDOObject source, EReference reference, int index)
+ {
+ this.source = source;
+ this.reference = reference;
+ this.index = index;
+ }
+
+ public void resolve(InternalCDOObject target)
+ {
+ if (reference.isMany())
+ {
+ @SuppressWarnings("unchecked")
+ EList<EObject> list = (EList<EObject>)source.eGet(reference);
+ list.set(index, target);
+ }
+ else
+ {
+ source.eSet(reference, target);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/bundle/OM.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/bundle/OM.java
index cd07b6b0d9..087eb5b0fa 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/bundle/OM.java
@@ -1,44 +1,44 @@
-/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.workspace.internal.efs.bundle;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.emf.cdo.workspace.efs"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.workspace.internal.efs.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.workspace.efs"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}

Back to the top