diff options
author | Eike Stepper | 2012-01-14 10:27:01 +0000 |
---|---|---|
committer | Eike Stepper | 2012-01-14 10:27:01 +0000 |
commit | 0266166cb9ff9535c150250073ea1e57b42d2693 (patch) | |
tree | c006a3bc0ba1f6e1d8a2bc032eedc346f71eab0d /plugins/org.eclipse.emf.cdo.examples | |
parent | 7416443692cdda72d1f704ea4fc5ececcc669df7 (diff) | |
download | cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.gz cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.xz cdo-0266166cb9ff9535c150250073ea1e57b42d2693.zip |
Adjusted copyrights to 2012
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.examples')
20 files changed, 1426 insertions, 1426 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.examples/.settings/org.eclipse.jdt.ui.prefs index aaef0ccba1..6726e7034a 100644 --- a/plugins/org.eclipse.emf.cdo.examples/.settings/org.eclipse.jdt.ui.prefs +++ b/plugins/org.eclipse.emf.cdo.examples/.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.examples/about.properties b/plugins/org.eclipse.emf.cdo.examples/about.properties index df0ebcb785..48672211ca 100644 --- a/plugins/org.eclipse.emf.cdo.examples/about.properties +++ b/plugins/org.eclipse.emf.cdo.examples/about.properties @@ -1,31 +1,31 @@ -# 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 - -# ============================================================================== -# Do not change the properties between this line and the last line containing: -# %%% END OF TRANSLATED PROPERTIES %%% -# Instead, either redefine an existing property, or create a new property, -# append it to the end of the file, and change the code to use the new name. -# ============================================================================== - -featureName = CDO Model Repository Examples -featureText = CDO Model Repository Examples\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. All rights reserved.\n\ -\n\ -Visit http://www.eclipse.org/cdo - -# ============================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# The above properties have been shipped for translation. -# ============================================================================== +# 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
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+featureName = CDO Model Repository Examples
+featureText = CDO Model Repository Examples\n\
+Version: {featureVersion}\n\
+Build id: {0}\n\
+\n\
+Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. All rights reserved.\n\
+\n\
+Visit http://www.eclipse.org/cdo
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.examples/build.properties b/plugins/org.eclipse.emf.cdo.examples/build.properties index c508fc2e99..c4eccff7b9 100644 --- a/plugins/org.eclipse.emf.cdo.examples/build.properties +++ b/plugins/org.eclipse.emf.cdo.examples/build.properties @@ -1,26 +1,26 @@ -# 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 - -output.. = bin/ -bin.includes = META-INF/,\ - plugin.properties,\ - .options,\ - about.html,\ - copyright.txt,\ - about.ini,\ - about.mappings,\ - about.properties,\ - modeling32.png,\ - . -source.. = src/ -jars.compile.order = examples.jar -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
+
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.properties,\
+ .options,\
+ about.html,\
+ copyright.txt,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ modeling32.png,\
+ .
+source.. = src/
+jars.compile.order = examples.jar
+src.includes = about.html,\
+ copyright.txt
diff --git a/plugins/org.eclipse.emf.cdo.examples/copyright.txt b/plugins/org.eclipse.emf.cdo.examples/copyright.txt index e921242cf0..8f6328980e 100644 --- a/plugins/org.eclipse.emf.cdo.examples/copyright.txt +++ b/plugins/org.eclipse.emf.cdo.examples/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.examples/plugin.properties b/plugins/org.eclipse.emf.cdo.examples/plugin.properties index 0354d2fcca..262488c712 100644 --- a/plugins/org.eclipse.emf.cdo.examples/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.examples/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 Examples -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 Examples
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java index f621da74a6..9b21aff15b 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/ImportXML.java @@ -1,118 +1,118 @@ -/* - * 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.examples; - -import org.eclipse.emf.cdo.examples.company.Category; -import org.eclipse.emf.cdo.examples.company.CompanyFactory; -import org.eclipse.emf.cdo.examples.company.Product; -import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; -import org.eclipse.emf.cdo.server.CDOServerUtil; -import org.eclipse.emf.cdo.server.IRepository; -import org.eclipse.emf.cdo.server.IStore; -import org.eclipse.emf.cdo.server.mem.MEMStoreUtil; -import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CommitException; - -import org.eclipse.net4j.Net4jUtil; -import org.eclipse.net4j.connector.IConnector; -import org.eclipse.net4j.jvm.JVMUtil; -import org.eclipse.net4j.util.container.ContainerUtil; -import org.eclipse.net4j.util.container.IManagedContainer; -import org.eclipse.net4j.util.om.OMPlatform; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Eike Stepper - * @since 4.0 - */ -public class ImportXML -{ - private static final String REPOSITORY_NAME = "repo1"; - - public static void main(String[] args) throws CommitException - { - // Turn on tracing - OMPlatform.INSTANCE.setDebugging(true); - - // Prepare the standalone infra structure (not needed when running inside Eclipse) - IManagedContainer container = ContainerUtil.createContainer(); // Create a wiring container - Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel - JVMUtil.prepareContainer(container); // Prepare the JVM transport - CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server - CDONet4jUtil.prepareContainer(container); // Prepare the CDO client - container.activate(); - - // Start the transport and create a repository - JVMUtil.getAcceptor(container, "default"); // Start the JVM transport - CDOServerUtil.addRepository(container, createRepository()); // Start a CDO repository - - // Establish a communications connection and open a session with the repository - IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection - CDOSession session = openSession(connector);// Open a CDO session - - CDOTransaction transaction = session.openTransaction();// Open a CDO transaction - Resource resource = transaction.createResource("/my/big/resource");// Create a new EMF resource - - // Work normally with the EMF resource - EObject inputModel = getInputModel(); - resource.getContents().add(inputModel); - transaction.commit(); - session.close(); - connector.close(); - } - - private static IRepository createRepository() - { - Map<String, String> props = new HashMap<String, String>(); - return CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props); - } - - private static IStore createStore() - { - // You might want to create an IDBStore here instead if memory is an issue! - return MEMStoreUtil.createMEMStore(); - } - - private static EObject getInputModel() - { - Category cat1 = CompanyFactory.eINSTANCE.createCategory(); - cat1.setName("CAT1"); - Category cat2 = CompanyFactory.eINSTANCE.createCategory(); - cat2.setName("CAT2"); - cat1.getCategories().add(cat2); - Product p1 = CompanyFactory.eINSTANCE.createProduct(); - p1.setName("P1"); - cat1.getProducts().add(p1); - Product p2 = CompanyFactory.eINSTANCE.createProduct(); - p2.setName("P2"); - cat1.getProducts().add(p2); - Product p3 = CompanyFactory.eINSTANCE.createProduct(); - p3.setName("P3"); - cat2.getProducts().add(p3); - return cat1; - } - - protected static CDOSession openSession(IConnector connector) - { - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); - configuration.setConnector(connector); - configuration.setRepositoryName(REPOSITORY_NAME); - return configuration.openNet4jSession(); - } -} +/*
+ * 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.examples;
+
+import org.eclipse.emf.cdo.examples.company.Category;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.Product;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.server.CDOServerUtil;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.mem.MEMStoreUtil;
+import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.jvm.JVMUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class ImportXML
+{
+ private static final String REPOSITORY_NAME = "repo1";
+
+ public static void main(String[] args) throws CommitException
+ {
+ // Turn on tracing
+ OMPlatform.INSTANCE.setDebugging(true);
+
+ // Prepare the standalone infra structure (not needed when running inside Eclipse)
+ IManagedContainer container = ContainerUtil.createContainer(); // Create a wiring container
+ Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
+ JVMUtil.prepareContainer(container); // Prepare the JVM transport
+ CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server
+ CDONet4jUtil.prepareContainer(container); // Prepare the CDO client
+ container.activate();
+
+ // Start the transport and create a repository
+ JVMUtil.getAcceptor(container, "default"); // Start the JVM transport
+ CDOServerUtil.addRepository(container, createRepository()); // Start a CDO repository
+
+ // Establish a communications connection and open a session with the repository
+ IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection
+ CDOSession session = openSession(connector);// Open a CDO session
+
+ CDOTransaction transaction = session.openTransaction();// Open a CDO transaction
+ Resource resource = transaction.createResource("/my/big/resource");// Create a new EMF resource
+
+ // Work normally with the EMF resource
+ EObject inputModel = getInputModel();
+ resource.getContents().add(inputModel);
+ transaction.commit();
+ session.close();
+ connector.close();
+ }
+
+ private static IRepository createRepository()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ return CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props);
+ }
+
+ private static IStore createStore()
+ {
+ // You might want to create an IDBStore here instead if memory is an issue!
+ return MEMStoreUtil.createMEMStore();
+ }
+
+ private static EObject getInputModel()
+ {
+ Category cat1 = CompanyFactory.eINSTANCE.createCategory();
+ cat1.setName("CAT1");
+ Category cat2 = CompanyFactory.eINSTANCE.createCategory();
+ cat2.setName("CAT2");
+ cat1.getCategories().add(cat2);
+ Product p1 = CompanyFactory.eINSTANCE.createProduct();
+ p1.setName("P1");
+ cat1.getProducts().add(p1);
+ Product p2 = CompanyFactory.eINSTANCE.createProduct();
+ p2.setName("P2");
+ cat1.getProducts().add(p2);
+ Product p3 = CompanyFactory.eINSTANCE.createProduct();
+ p3.setName("P3");
+ cat2.getProducts().add(p3);
+ return cat1;
+ }
+
+ protected static CDOSession openSession(IConnector connector)
+ {
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName(REPOSITORY_NAME);
+ return configuration.openNet4jSession();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java index 7d26442c5c..612ec5a4a6 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java @@ -1,80 +1,80 @@ -/* - * 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.examples; - -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.examples.company.CompanyFactory; -import org.eclipse.emf.cdo.examples.company.CompanyPackage; -import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CommitException; - -import org.eclipse.net4j.Net4jUtil; -import org.eclipse.net4j.connector.IConnector; -import org.eclipse.net4j.tcp.TCPUtil; -import org.eclipse.net4j.util.container.ContainerUtil; -import org.eclipse.net4j.util.container.IManagedContainer; -import org.eclipse.net4j.util.om.OMPlatform; -import org.eclipse.net4j.util.om.log.PrintLogHandler; -import org.eclipse.net4j.util.om.trace.PrintTraceHandler; - -import org.eclipse.emf.ecore.EObject; - -/** - * @author Eike Stepper - */ -public class StandaloneContainerExample -{ - public static void main(String[] args) throws CommitException - { - // Enable logging and tracing - OMPlatform.INSTANCE.setDebugging(true); - OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE); - OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE); - - // Prepare container - IManagedContainer container = ContainerUtil.createContainer(); - Net4jUtil.prepareContainer(container); // Register Net4j factories - TCPUtil.prepareContainer(container); // Register TCP factories - CDONet4jUtil.prepareContainer(container); // Register CDO factories - container.activate(); - - // Create connector - IConnector connector = TCPUtil.getConnector(container, "localhost:2036"); //$NON-NLS-1$ - - // Create configuration - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); - configuration.setConnector(connector); - configuration.setRepositoryName("repo1"); //$NON-NLS-1$ - - // Open session - CDOSession session = configuration.openNet4jSession(); - session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE); - - // Open transaction - CDOTransaction transaction = session.openTransaction(); - - // Get or create resource - CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$ - - // Work with the resource and commit the transaction - EObject object = CompanyFactory.eINSTANCE.createCompany(); - resource.getContents().add(object); - transaction.commit(); - - // Cleanup - session.close(); - connector.close(); - container.deactivate(); - } -} +/*
+ * 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.examples;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @author Eike Stepper
+ */
+public class StandaloneContainerExample
+{
+ public static void main(String[] args) throws CommitException
+ {
+ // Enable logging and tracing
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+
+ // Prepare container
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ TCPUtil.prepareContainer(container); // Register TCP factories
+ CDONet4jUtil.prepareContainer(container); // Register CDO factories
+ container.activate();
+
+ // Create connector
+ IConnector connector = TCPUtil.getConnector(container, "localhost:2036"); //$NON-NLS-1$
+
+ // Create configuration
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("repo1"); //$NON-NLS-1$
+
+ // Open session
+ CDOSession session = configuration.openNet4jSession();
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ // Open transaction
+ CDOTransaction transaction = session.openTransaction();
+
+ // Get or create resource
+ CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
+
+ // Work with the resource and commit the transaction
+ EObject object = CompanyFactory.eINSTANCE.createCompany();
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Cleanup
+ session.close();
+ connector.close();
+ container.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java index e9a11634b7..e84e5a4559 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExampleSSL.java @@ -1,91 +1,91 @@ -/* - * 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.examples; - -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.examples.company.CompanyFactory; -import org.eclipse.emf.cdo.examples.company.CompanyPackage; -import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CommitException; - -import org.eclipse.net4j.Net4jUtil; -import org.eclipse.net4j.connector.IConnector; -import org.eclipse.net4j.tcp.ssl.SSLUtil; -import org.eclipse.net4j.util.container.ContainerUtil; -import org.eclipse.net4j.util.container.IManagedContainer; -import org.eclipse.net4j.util.om.OMPlatform; -import org.eclipse.net4j.util.om.log.PrintLogHandler; -import org.eclipse.net4j.util.om.trace.PrintTraceHandler; - -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; - -/** - * @author Eike Stepper - * @since 4.0 - */ -public class StandaloneContainerExampleSSL -{ - public static void main(String[] args) throws CommitException - { - // Enable logging and tracing - OMPlatform.INSTANCE.setDebugging(true); - OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE); - OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE); - - // Prepare container - IManagedContainer container = ContainerUtil.createContainer(); - Net4jUtil.prepareContainer(container); // Register Net4j factories - SSLUtil.prepareContainer(container); - CDONet4jUtil.prepareContainer(container); // Register CDO factories - container.activate(); - - // Create connector - IConnector connector = SSLUtil.getConnector(container, "localhost:2036"); - - // Create configuration - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); - configuration.setConnector(connector); - configuration.setRepositoryName("repo1"); //$NON-NLS-1$ - - // Open session - CDOSession session = configuration.openNet4jSession(); - session.options().setGeneratedPackageEmulationEnabled(true); - - session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE); - - // Open transaction - CDOTransaction transaction = session.openTransaction(); - - // Read whatetever is there - TreeIterator<EObject> iter = transaction.getRootResource().getAllContents(); - while (iter.hasNext()) - { - System.out.println("---> It's a " + iter.next().eClass().getName()); - } - - // Get or create resource - CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$ - - // Work with the resource and commit the transaction - EObject object = CompanyFactory.eINSTANCE.createCompany(); - resource.getContents().add(object); - transaction.commit(); - - // Cleanup - session.close(); - connector.close(); - container.deactivate(); - } -} +/*
+ * 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.examples;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.ssl.SSLUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class StandaloneContainerExampleSSL
+{
+ public static void main(String[] args) throws CommitException
+ {
+ // Enable logging and tracing
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+
+ // Prepare container
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ SSLUtil.prepareContainer(container);
+ CDONet4jUtil.prepareContainer(container); // Register CDO factories
+ container.activate();
+
+ // Create connector
+ IConnector connector = SSLUtil.getConnector(container, "localhost:2036");
+
+ // Create configuration
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("repo1"); //$NON-NLS-1$
+
+ // Open session
+ CDOSession session = configuration.openNet4jSession();
+ session.options().setGeneratedPackageEmulationEnabled(true);
+
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ // Open transaction
+ CDOTransaction transaction = session.openTransaction();
+
+ // Read whatetever is there
+ TreeIterator<EObject> iter = transaction.getRootResource().getAllContents();
+ while (iter.hasNext())
+ {
+ System.out.println("---> It's a " + iter.next().eClass().getName());
+ }
+
+ // Get or create resource
+ CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
+
+ // Work with the resource and commit the transaction
+ EObject object = CompanyFactory.eINSTANCE.createCompany();
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Cleanup
+ session.close();
+ connector.close();
+ container.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java index 1a8476648c..7b3b983a8d 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java @@ -1,107 +1,107 @@ -/* - * 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.examples; - -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.examples.company.CompanyFactory; -import org.eclipse.emf.cdo.examples.company.CompanyPackage; -import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CommitException; - -import org.eclipse.net4j.FactoriesProtocolProvider; -import org.eclipse.net4j.Net4jUtil; -import org.eclipse.net4j.buffer.IBufferProvider; -import org.eclipse.net4j.protocol.IProtocolProvider; -import org.eclipse.net4j.util.lifecycle.LifecycleUtil; -import org.eclipse.net4j.util.om.OMPlatform; -import org.eclipse.net4j.util.om.log.PrintLogHandler; -import org.eclipse.net4j.util.om.trace.PrintTraceHandler; - -import org.eclipse.emf.ecore.EObject; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; - -/** - * @author Eike Stepper - */ -public class StandaloneManualExample -{ - public static void main(String[] args) throws CommitException - { - // Enable logging and tracing - OMPlatform.INSTANCE.setDebugging(true); - OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE); - OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE); - - // Prepare receiveExecutor - final ThreadGroup threadGroup = new ThreadGroup("net4j"); //$NON-NLS-1$ - ExecutorService receiveExecutor = Executors.newCachedThreadPool(new ThreadFactory() - { - public Thread newThread(Runnable r) - { - Thread thread = new Thread(threadGroup, r); - thread.setDaemon(true); - return thread; - } - }); - - // Prepare bufferProvider - IBufferProvider bufferProvider = Net4jUtil.createBufferPool(); - LifecycleUtil.activate(bufferProvider); - - IProtocolProvider protocolProvider = new FactoriesProtocolProvider( - new org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocolFactory()); - - // Prepare selector - org.eclipse.net4j.internal.tcp.TCPSelector selector = new org.eclipse.net4j.internal.tcp.TCPSelector(); - selector.activate(); - - // Prepare connector - org.eclipse.net4j.internal.tcp.TCPClientConnector connector = new org.eclipse.net4j.internal.tcp.TCPClientConnector(); - connector.getConfig().setBufferProvider(bufferProvider); - connector.getConfig().setReceiveExecutor(receiveExecutor); - connector.getConfig().setProtocolProvider(protocolProvider); - connector.getConfig().setNegotiator(null); - connector.setSelector(selector); - connector.setHost("localhost"); //$NON-NLS-1$ - connector.setPort(2036); - connector.activate(); - - // Create configuration - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); - configuration.setConnector(connector); - configuration.setRepositoryName("repo1"); //$NON-NLS-1$ - - // Open session - CDOSession session = configuration.openNet4jSession(); - session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE); - - // Open transaction - CDOTransaction transaction = session.openTransaction(); - - // Get or create resource - CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$ - - // Work with the resource and commit the transaction - EObject object = CompanyFactory.eINSTANCE.createCompany(); - resource.getContents().add(object); - transaction.commit(); - - // Cleanup - session.close(); - connector.deactivate(); - } -} +/*
+ * 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.examples;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.FactoriesProtocolProvider;
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.buffer.IBufferProvider;
+import org.eclipse.net4j.protocol.IProtocolProvider;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class StandaloneManualExample
+{
+ public static void main(String[] args) throws CommitException
+ {
+ // Enable logging and tracing
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+
+ // Prepare receiveExecutor
+ final ThreadGroup threadGroup = new ThreadGroup("net4j"); //$NON-NLS-1$
+ ExecutorService receiveExecutor = Executors.newCachedThreadPool(new ThreadFactory()
+ {
+ public Thread newThread(Runnable r)
+ {
+ Thread thread = new Thread(threadGroup, r);
+ thread.setDaemon(true);
+ return thread;
+ }
+ });
+
+ // Prepare bufferProvider
+ IBufferProvider bufferProvider = Net4jUtil.createBufferPool();
+ LifecycleUtil.activate(bufferProvider);
+
+ IProtocolProvider protocolProvider = new FactoriesProtocolProvider(
+ new org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocolFactory());
+
+ // Prepare selector
+ org.eclipse.net4j.internal.tcp.TCPSelector selector = new org.eclipse.net4j.internal.tcp.TCPSelector();
+ selector.activate();
+
+ // Prepare connector
+ org.eclipse.net4j.internal.tcp.TCPClientConnector connector = new org.eclipse.net4j.internal.tcp.TCPClientConnector();
+ connector.getConfig().setBufferProvider(bufferProvider);
+ connector.getConfig().setReceiveExecutor(receiveExecutor);
+ connector.getConfig().setProtocolProvider(protocolProvider);
+ connector.getConfig().setNegotiator(null);
+ connector.setSelector(selector);
+ connector.setHost("localhost"); //$NON-NLS-1$
+ connector.setPort(2036);
+ connector.activate();
+
+ // Create configuration
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("repo1"); //$NON-NLS-1$
+
+ // Open session
+ CDOSession session = configuration.openNet4jSession();
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ // Open transaction
+ CDOTransaction transaction = session.openTransaction();
+
+ // Get or create resource
+ CDOResource resource = transaction.getOrCreateResource("/path/to/my/resource"); //$NON-NLS-1$
+
+ // Work with the resource and commit the transaction
+ EObject object = CompanyFactory.eINSTANCE.createCompany();
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Cleanup
+ session.close();
+ connector.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java index 7c94f97dda..532f6232dd 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/TransactionMonitoring.java @@ -1,68 +1,68 @@ -/* - * 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.examples; - -import org.eclipse.emf.cdo.examples.company.CompanyFactory; -import org.eclipse.emf.cdo.examples.company.CompanyPackage; -import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CommitException; - -import org.eclipse.net4j.Net4jUtil; -import org.eclipse.net4j.tcp.TCPUtil; -import org.eclipse.net4j.util.container.ContainerUtil; -import org.eclipse.net4j.util.container.IManagedContainer; -import org.eclipse.net4j.util.om.OMPlatform; -import org.eclipse.net4j.util.om.log.PrintLogHandler; -import org.eclipse.net4j.util.om.trace.PrintTraceHandler; - -import org.eclipse.emf.ecore.resource.Resource; - -/** - * @author Eike Stepper - * @since 4.0 - */ -public class TransactionMonitoring -{ - public static void main(String[] args) throws CommitException - { - OMPlatform.INSTANCE.setDebugging(true); - OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE); - OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE); - - IManagedContainer container = ContainerUtil.createContainer(); - Net4jUtil.prepareContainer(container); - TCPUtil.prepareContainer(container); - CDONet4jUtil.prepareContainer(container); - container.activate(); - - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); - configuration.setConnector(TCPUtil.getConnector(container, "localhost")); - configuration.setRepositoryName("repo1"); - - CDOSession session = configuration.openNet4jSession(); - session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE); - - CDOTransaction transaction = session.openTransaction(); - Resource resource = transaction.createResource("/my/big/resource"); - resource.getContents().add(CompanyFactory.eINSTANCE.createCompany()); - transaction.commit(); - - System.out.println(); - System.out.println("FINISHED"); - System.out.println(); - - session.close(); - container.deactivate(); - } -} +/*
+ * 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.examples;
+
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class TransactionMonitoring
+{
+ public static void main(String[] args) throws CommitException
+ {
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container);
+ TCPUtil.prepareContainer(container);
+ CDONet4jUtil.prepareContainer(container);
+ container.activate();
+
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(TCPUtil.getConnector(container, "localhost"));
+ configuration.setRepositoryName("repo1");
+
+ CDOSession session = configuration.openNet4jSession();
+ session.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);
+
+ CDOTransaction transaction = session.openTransaction();
+ Resource resource = transaction.createResource("/my/big/resource");
+ resource.getContents().add(CompanyFactory.eINSTANCE.createCompany());
+ transaction.commit();
+
+ System.out.println();
+ System.out.println("FINISHED");
+ System.out.println();
+
+ session.close();
+ container.deactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java index eb9f02d074..dc5d4d52a3 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/VariousExamples.java @@ -1,57 +1,57 @@ -/* - * 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.examples; - -import org.eclipse.emf.cdo.net4j.CDONet4jSession; -import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CommitException; - -import org.eclipse.net4j.Net4jUtil; -import org.eclipse.net4j.connector.IConnector; -import org.eclipse.net4j.util.container.IPluginContainer; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; - -/** - * @author Eike Stepper - * @since 3.0 - */ -public class VariousExamples -{ - public static void openSessionAndUseTransaction() throws CommitException - { - ResourceSet resourceSet = new ResourceSetImpl(); - IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", "repos.foo.org:2036"); - - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); - configuration.setConnector(connector); - configuration.setRepositoryName("MyRepo"); - - CDONet4jSession session = configuration.openNet4jSession(); - CDOTransaction transaction = session.openTransaction(resourceSet); - - // Work with the resource set.... - transaction.commit(); - session.close(); - } - - public static void registerSessionWithPluginContainer() throws CommitException - { - CDONet4jSession session = (CDONet4jSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions", - "cdo", "tcp://repos.foo.org:2036/MyRepo"); - CDOTransaction transaction = session.openTransaction(); - // ... - transaction.commit(); - } -} +/*
+ * 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.examples;
+
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.util.container.IPluginContainer;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public class VariousExamples
+{
+ public static void openSessionAndUseTransaction() throws CommitException
+ {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", "repos.foo.org:2036");
+
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName("MyRepo");
+
+ CDONet4jSession session = configuration.openNet4jSession();
+ CDOTransaction transaction = session.openTransaction(resourceSet);
+
+ // Work with the resource set....
+ transaction.commit();
+ session.close();
+ }
+
+ public static void registerSessionWithPluginContainer() throws CommitException
+ {
+ CDONet4jSession session = (CDONet4jSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions",
+ "cdo", "tcp://repos.foo.org:2036/MyRepo");
+ CDOTransaction transaction = session.openTransaction();
+ // ...
+ transaction.commit();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java index 3cacc5c365..526cf8831c 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/Webinar20090129.java @@ -1,56 +1,56 @@ -/* - * 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.examples; - -import org.eclipse.emf.cdo.examples.company.Company; -import org.eclipse.emf.cdo.examples.company.CompanyPackage; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; - -import java.io.IOException; - -/** - * @author Eike Stepper - * @since 2.0 - */ -public class Webinar20090129 -{ - private static final EPackage MODEL = CompanyPackage.eINSTANCE; - - public static void xmlSetup() throws IOException - { - ResourceSet rs = new ResourceSetImpl(); - rs.getResourceFactoryRegistry().getExtensionToFactoryMap() // - .put("xml", new XMLResourceFactoryImpl()); //$NON-NLS-1$ - rs.getPackageRegistry().put(MODEL.getNsURI(), MODEL); - - URI uri = URI.createFileURI("C:/business/company.xml"); //$NON-NLS-1$ - Resource resource = rs.getResource(uri, true); - resource.setTrackingModification(true); - - Company company = (Company)resource.getContents().get(0); - executeBusinessLogic(company); - - if (resource.isModified()) - { - resource.save(null); - } - } - - private static void executeBusinessLogic(Company company) - { - } -} +/*
+ * 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.examples;
+
+import org.eclipse.emf.cdo.examples.company.Company;
+import org.eclipse.emf.cdo.examples.company.CompanyPackage;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public class Webinar20090129
+{
+ private static final EPackage MODEL = CompanyPackage.eINSTANCE;
+
+ public static void xmlSetup() throws IOException
+ {
+ ResourceSet rs = new ResourceSetImpl();
+ rs.getResourceFactoryRegistry().getExtensionToFactoryMap() //
+ .put("xml", new XMLResourceFactoryImpl()); //$NON-NLS-1$
+ rs.getPackageRegistry().put(MODEL.getNsURI(), MODEL);
+
+ URI uri = URI.createFileURI("C:/business/company.xml"); //$NON-NLS-1$
+ Resource resource = rs.getResource(uri, true);
+ resource.setTrackingModification(true);
+
+ Company company = (Company)resource.getContents().get(0);
+ executeBusinessLogic(company);
+
+ if (resource.isModified())
+ {
+ resource.save(null);
+ }
+ }
+
+ private static void executeBusinessLogic(Company company)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java index b3c844049f..a92b0981f0 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/FailoverExample.java @@ -1,604 +1,604 @@ -/* - * 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.examples.server; - -import org.eclipse.emf.cdo.common.CDOCommonRepository.Type; -import org.eclipse.emf.cdo.common.revision.CDORevisionCache; -import org.eclipse.emf.cdo.common.revision.CDORevisionUtil; -import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent; -import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent; -import org.eclipse.emf.cdo.examples.company.CompanyFactory; -import org.eclipse.emf.cdo.examples.company.Customer; -import org.eclipse.emf.cdo.net4j.CDONet4jSession; -import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; -import org.eclipse.emf.cdo.net4j.CDOSessionRecoveryEvent; -import org.eclipse.emf.cdo.server.CDOServerUtil; -import org.eclipse.emf.cdo.server.IRepository; -import org.eclipse.emf.cdo.server.IRepositorySynchronizer; -import org.eclipse.emf.cdo.server.IStore; -import org.eclipse.emf.cdo.server.ISynchronizableRepository; -import org.eclipse.emf.cdo.server.db.CDODBUtil; -import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy; -import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil; -import org.eclipse.emf.cdo.server.net4j.FailoverAgent; -import org.eclipse.emf.cdo.server.net4j.FailoverMonitor; -import org.eclipse.emf.cdo.server.net4j.FailoverMonitor.AgentProtocol; -import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory; -import org.eclipse.emf.cdo.spi.server.InternalFailoverParticipant; -import org.eclipse.emf.cdo.spi.server.InternalRepository; -import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CommitException; - -import org.eclipse.net4j.Net4jUtil; -import org.eclipse.net4j.acceptor.IAcceptor; -import org.eclipse.net4j.connector.IConnector; -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.tcp.TCPUtil; -import org.eclipse.net4j.util.container.ContainerEventAdapter; -import org.eclipse.net4j.util.container.ContainerUtil; -import org.eclipse.net4j.util.container.IContainer; -import org.eclipse.net4j.util.container.IManagedContainer; -import org.eclipse.net4j.util.event.IEvent; -import org.eclipse.net4j.util.event.IListener; -import org.eclipse.net4j.util.lifecycle.LifecycleUtil; -import org.eclipse.net4j.util.om.OMPlatform; -import org.eclipse.net4j.util.om.log.PrintLogHandler; - -import org.h2.jdbcx.JdbcDataSource; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; - -/** - * @author Eike Stepper - * @since 4.0 - */ -public abstract class FailoverExample -{ - public static final String TRANSPORT_TYPE = "tcp"; - - protected int port; - - protected String name; - - protected transient IManagedContainer container; - - protected transient IRepository repository; - - protected transient IAcceptor acceptor; - - static - { - // OMPlatform.INSTANCE.setDebugging(true); - // OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE); - OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE); - } - - public FailoverExample() - { - container = createContainer(); - } - - public static IManagedContainer createContainer() - { - IManagedContainer container = ContainerUtil.createContainer(); - Net4jUtil.prepareContainer(container); // Register Net4j factories - TCPUtil.prepareContainer(container); // Register TCP factories - CDONet4jUtil.prepareContainer(container); // Register CDO client factories - CDONet4jServerUtil.prepareContainer(container); // Register CDO server factories - container.activate(); - return container; - } - - public void init() - { - IStore store = createStore(); - Map<String, String> props = createProperties(); - - repository = createRepository(store, props); - CDOServerUtil.addRepository(container, repository); - - repository.addListener(new IListener() - { - public void notifyEvent(IEvent event) - { - if (event instanceof RepositoryTypeChangedEvent) - { - RepositoryTypeChangedEvent e = (RepositoryTypeChangedEvent)event; - System.out.println("Type changed to " + e.getNewType()); - } - else if (event instanceof RepositoryStateChangedEvent) - { - RepositoryStateChangedEvent e = (RepositoryStateChangedEvent)event; - System.out.println("State changed to " + e.getNewState()); - } - } - }); - - connect(); - } - - public void run() throws Exception - { - for (;;) - { - System.out.println(); - System.out.println("Enter a command:"); - showMenu(); - System.out.println(); - - String command = new BufferedReader(new InputStreamReader(System.in)).readLine(); - if (handleCommand(command)) - { - break; - } - } - } - - public void done() - { - LifecycleUtil.deactivate(acceptor); - LifecycleUtil.deactivate(repository); - container.deactivate(); - } - - protected void showMenu() - { - System.out.println("0 - exit"); - System.out.println("1 - connect repository to network"); - System.out.println("2 - disconnect repository from network"); - System.out.println("3 - dump repository infos"); - } - - protected boolean handleCommand(String command) - { - if ("1".equals(command)) - { - if (acceptor == null) - { - connect(); - } - else - { - System.out.println("Already connected"); - } - } - else if ("2".equals(command)) - { - if (acceptor != null) - { - disconnect(); - } - else - { - System.out.println("Already disconnected"); - } - } - else if ("3".equals(command)) - { - System.out.println(); - System.out.println(repository.getName() + ": " + repository.getType() - + (repository.getType() == Type.BACKUP ? "|" + repository.getState() : "")); - } - else if ("0".equals(command)) - { - System.out.println("Exiting..."); - return true; - } - else - { - System.out.println("Unknown command"); - } - - return false; - } - - protected void connect() - { - System.out.println("Connecting to network..."); - acceptor = createAcceptor(); - System.out.println("Connected"); - } - - protected void disconnect() - { - System.out.println("Disconnecting from network..."); - LifecycleUtil.deactivate(acceptor); - acceptor = null; - System.out.println("Disconnected"); - } - - protected IStore createStore() - { - JdbcDataSource dataSource = new JdbcDataSource(); - dataSource.setURL("jdbc:h2:_database/" + name); - - IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true); - IDBAdapter dbAdapter = new H2Adapter(); - IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource); - return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider); - } - - protected Map<String, String> createProperties() - { - Map<String, String> props = new HashMap<String, String>(); - props.put(IRepository.Props.OVERRIDE_UUID, name); - props.put(IRepository.Props.SUPPORTING_AUDITS, "true"); - props.put(IRepository.Props.SUPPORTING_BRANCHES, "true"); - return props; - } - - protected abstract IRepository createRepository(IStore store, Map<String, String> props); - - protected IAcceptor createAcceptor() - { - return (IAcceptor)container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + port); - } - - protected IConnector createConnector(String description) - { - return Net4jUtil.getConnector(container, TRANSPORT_TYPE, description); - } - - protected IRepositorySynchronizer createRepositorySynchronizer(IConnector connector, String repositoryName) - { - CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(connector, repositoryName); - - IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory); - synchronizer.setRetryInterval(2); - synchronizer.setRawReplication(true); - synchronizer.setMaxRecommits(10); - synchronizer.setRecommitInterval(2); - return synchronizer; - } - - protected CDOSessionConfigurationFactory createSessionConfigurationFactory(final IConnector connector, - final String repositoryName) - { - return new CDOSessionConfigurationFactory() - { - public CDONet4jSessionConfiguration createSessionConfiguration() - { - return FailoverExample.this.createSessionConfiguration(connector, repositoryName); - } - }; - } - - protected CDONet4jSessionConfiguration createSessionConfiguration(IConnector connector, String repositoryName) - { - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); - configuration.setConnector(connector); - configuration.setRepositoryName(repositoryName); - configuration.setRevisionManager(CDORevisionUtil.createRevisionManager(CDORevisionCache.NOOP)); - return configuration; - } - - /** - * @author Eike Stepper - */ - public static class Unmonitored extends FailoverExample - { - protected boolean master; - - protected String peerHost; - - protected int peerPort; - - protected String peerRepository; - - public Unmonitored(int port, String name, boolean master, String peerHost, int peerPort, String peerRepository) - { - this.port = port; - this.name = name; - this.master = master; - this.peerHost = peerHost; - this.peerPort = peerPort; - this.peerRepository = peerRepository; - } - - @Override - protected IRepository createRepository(IStore store, Map<String, String> props) - { - IConnector connector = createConnector(peerHost + ":" + peerPort); - IRepositorySynchronizer synchronizer = createRepositorySynchronizer(connector, peerRepository); - return CDOServerUtil.createFailoverParticipant(name, store, props, synchronizer, master); - } - - @Override - protected void showMenu() - { - super.showMenu(); - System.out.println("4 - set repository type MASTER"); - System.out.println("5 - set repository type BACKUP"); - } - - @Override - protected boolean handleCommand(String command) - { - if ("4".equals(command)) - { - if (repository.getType() == Type.BACKUP) - { - System.out.println("Setting repository type MASTER..."); - ((InternalRepository)repository).setType(Type.MASTER); - System.out.println("Type is " + repository.getType()); - } - else - { - System.out.println("Already MASTER"); - } - } - else if ("5".equals(command)) - { - if (repository.getType() == Type.MASTER) - { - System.out.println("Setting repository type BACKUP..."); - ((InternalRepository)repository).setType(Type.BACKUP); - System.out.println("Type is " + repository.getType()); - } - else - { - System.out.println("Already BACKUP"); - } - } - else - { - return super.handleCommand(command); - } - - return false; - } - - /** - * @author Eike Stepper - */ - public static final class InitialMaster extends Unmonitored - { - public InitialMaster() - { - super(2036, "repo1", true, "localhost", 2037, "repo2"); - } - - public static void main(String[] args) throws Exception - { - FailoverExample example = new InitialMaster(); - example.init(); - example.run(); - example.done(); - } - } - - /** - * @author Eike Stepper - */ - public static final class InitialBackup extends Unmonitored - { - public InitialBackup() - { - super(2037, "repo2", false, "localhost", 2036, "repo1"); - } - - public static void main(String[] args) throws Exception - { - FailoverExample example = new InitialBackup(); - example.init(); - example.run(); - example.done(); - } - } - } - - /** - * @author Eike Stepper - */ - public static class Monitored extends FailoverExample - { - public static final String REPOSITORY_GROUP = "ExampleGroup"; - - // public static final String REPOSITORY_MONITOR_HOST = "92.231.107.180"; - - public static final String REPOSITORY_MONITOR_HOST = "localhost"; - - public static final int REPOSITORY_MONITOR_PORT = 2038; - - protected String host; - - public Monitored(String host, int port, String name) - { - this.host = host; - this.port = port; - this.name = name; - } - - @Override - protected IRepository createRepository(IStore store, Map<String, String> props) - { - ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(name, store, props); - ((InternalFailoverParticipant)repository).setAllowBackupCommits(true); // Load balancing! - - FailoverAgent agent = new FailoverAgent() - { - @Override - protected org.eclipse.emf.cdo.session.CDOSessionConfiguration createSessionConfiguration( - String connectorDescription, String repositoryName) - { - IConnector connector = createConnector(connectorDescription); - return Monitored.this.createSessionConfiguration(connector, repositoryName); - } - - @Override - protected IManagedContainer getContainer() - { - return container; - } - }; - - agent.setMonitorConnector(createConnector(REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT)); - agent.setConnectorDescription(host + ":" + port); - agent.setRepository(repository); - agent.setGroup(REPOSITORY_GROUP); - agent.setRate(1000L); - agent.setTimeout(4000L); - agent.activate(); - - return repository; - } - - /** - * @author Eike Stepper - */ - public static final class Monitor - { - public static void main(String[] args) throws Exception - { - IManagedContainer container = createContainer(); - FailoverMonitor monitor = (FailoverMonitor)container.getElement(FailoverMonitor.PRODUCT_GROUP, "net4j", - REPOSITORY_GROUP); - - monitor.addListener(new ContainerEventAdapter<AgentProtocol>() - { - @Override - protected void onAdded(IContainer<AgentProtocol> monitor, AgentProtocol agent) - { - dump((FailoverMonitor)monitor, "Registered", agent); - } - - @Override - protected void onRemoved(IContainer<AgentProtocol> monitor, AgentProtocol agent) - { - dump((FailoverMonitor)monitor, "Deregistered", agent); - } - - private void dump(FailoverMonitor monitor, String event, AgentProtocol agent) - { - System.out.println(event + " agent " + agent); - for (AgentProtocol element : monitor.getElements()) - { - String type = element == monitor.getMasterAgent() ? "MASTER: " : "BACKUP: "; - System.out.println(" " + type + element); - } - } - }); - - container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + REPOSITORY_MONITOR_PORT); - System.out.println("Monitoring..."); - - for (;;) - { - Thread.sleep(100); - } - } - } - - /** - * @author Eike Stepper - */ - public static final class Agent1 extends Monitored - { - public Agent1() - { - super("localhost", 2036, "repo1"); - } - - public static void main(String[] args) throws Exception - { - FailoverExample example = new Agent1(); - example.init(); - example.run(); - example.done(); - } - } - - /** - * @author Eike Stepper - */ - public static final class Agent2 extends Monitored - { - public Agent2() - { - super("localhost", 2037, "repo2"); - } - - public static void main(String[] args) throws Exception - { - FailoverExample example = new Agent2(); - example.init(); - example.run(); - example.done(); - } - } - - /** - * @author Eike Stepper - */ - public static final class Client - { - public static void main(String[] args) throws Exception - { - IManagedContainer container = createContainer(); - CDONet4jSessionConfiguration configuration = CDONet4jUtil.createFailoverSessionConfiguration( - REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT, REPOSITORY_GROUP, container); - - final CDONet4jSession session = configuration.openNet4jSession(); - System.out.println("Connected"); - - final CDOTransaction tx = session.openTransaction(); - addObject(tx); - System.out.println("Succesfully committed an object to the original tx/session"); - - session.addListener(new IListener() - { - public void notifyEvent(IEvent event) - { - if (event instanceof CDOSessionRecoveryEvent) - { - CDOSessionRecoveryEvent e = (CDOSessionRecoveryEvent)event; - System.out.println("Failover " + e.getType() + ": " + e.getSource().getRepositoryInfo()); - - if (e.getType() == CDOSessionRecoveryEvent.Type.FINISHED) - { - // Let's see if the TX in the failed-over session is usable: - // - addObject(tx); - System.out.println("Succesfully committed an object to the failed-over tx/session"); - } - } - } - }); - - while (!session.isClosed()) - { - Thread.sleep(100); - } - } - - private static void addObject(CDOTransaction tx) - { - try - { - Customer customer = CompanyFactory.eINSTANCE.createCustomer(); - tx.getOrCreateResource("/r1").getContents().add(customer); - tx.commit(); - } - catch (CommitException x) - { - throw new RuntimeException(x); - } - } - } - } -} +/*
+ * 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.examples.server;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository.Type;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
+import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
+import org.eclipse.emf.cdo.examples.company.CompanyFactory;
+import org.eclipse.emf.cdo.examples.company.Customer;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.net4j.CDOSessionRecoveryEvent;
+import org.eclipse.emf.cdo.server.CDOServerUtil;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IRepositorySynchronizer;
+import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.ISynchronizableRepository;
+import org.eclipse.emf.cdo.server.db.CDODBUtil;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
+import org.eclipse.emf.cdo.server.net4j.FailoverAgent;
+import org.eclipse.emf.cdo.server.net4j.FailoverMonitor;
+import org.eclipse.emf.cdo.server.net4j.FailoverMonitor.AgentProtocol;
+import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+import org.eclipse.emf.cdo.spi.server.InternalFailoverParticipant;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.acceptor.IAcceptor;
+import org.eclipse.net4j.connector.IConnector;
+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.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerEventAdapter;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+
+import org.h2.jdbcx.JdbcDataSource;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public abstract class FailoverExample
+{
+ public static final String TRANSPORT_TYPE = "tcp";
+
+ protected int port;
+
+ protected String name;
+
+ protected transient IManagedContainer container;
+
+ protected transient IRepository repository;
+
+ protected transient IAcceptor acceptor;
+
+ static
+ {
+ // OMPlatform.INSTANCE.setDebugging(true);
+ // OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ }
+
+ public FailoverExample()
+ {
+ container = createContainer();
+ }
+
+ public static IManagedContainer createContainer()
+ {
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ TCPUtil.prepareContainer(container); // Register TCP factories
+ CDONet4jUtil.prepareContainer(container); // Register CDO client factories
+ CDONet4jServerUtil.prepareContainer(container); // Register CDO server factories
+ container.activate();
+ return container;
+ }
+
+ public void init()
+ {
+ IStore store = createStore();
+ Map<String, String> props = createProperties();
+
+ repository = createRepository(store, props);
+ CDOServerUtil.addRepository(container, repository);
+
+ repository.addListener(new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof RepositoryTypeChangedEvent)
+ {
+ RepositoryTypeChangedEvent e = (RepositoryTypeChangedEvent)event;
+ System.out.println("Type changed to " + e.getNewType());
+ }
+ else if (event instanceof RepositoryStateChangedEvent)
+ {
+ RepositoryStateChangedEvent e = (RepositoryStateChangedEvent)event;
+ System.out.println("State changed to " + e.getNewState());
+ }
+ }
+ });
+
+ connect();
+ }
+
+ public void run() throws Exception
+ {
+ for (;;)
+ {
+ System.out.println();
+ System.out.println("Enter a command:");
+ showMenu();
+ System.out.println();
+
+ String command = new BufferedReader(new InputStreamReader(System.in)).readLine();
+ if (handleCommand(command))
+ {
+ break;
+ }
+ }
+ }
+
+ public void done()
+ {
+ LifecycleUtil.deactivate(acceptor);
+ LifecycleUtil.deactivate(repository);
+ container.deactivate();
+ }
+
+ protected void showMenu()
+ {
+ System.out.println("0 - exit");
+ System.out.println("1 - connect repository to network");
+ System.out.println("2 - disconnect repository from network");
+ System.out.println("3 - dump repository infos");
+ }
+
+ protected boolean handleCommand(String command)
+ {
+ if ("1".equals(command))
+ {
+ if (acceptor == null)
+ {
+ connect();
+ }
+ else
+ {
+ System.out.println("Already connected");
+ }
+ }
+ else if ("2".equals(command))
+ {
+ if (acceptor != null)
+ {
+ disconnect();
+ }
+ else
+ {
+ System.out.println("Already disconnected");
+ }
+ }
+ else if ("3".equals(command))
+ {
+ System.out.println();
+ System.out.println(repository.getName() + ": " + repository.getType()
+ + (repository.getType() == Type.BACKUP ? "|" + repository.getState() : ""));
+ }
+ else if ("0".equals(command))
+ {
+ System.out.println("Exiting...");
+ return true;
+ }
+ else
+ {
+ System.out.println("Unknown command");
+ }
+
+ return false;
+ }
+
+ protected void connect()
+ {
+ System.out.println("Connecting to network...");
+ acceptor = createAcceptor();
+ System.out.println("Connected");
+ }
+
+ protected void disconnect()
+ {
+ System.out.println("Disconnecting from network...");
+ LifecycleUtil.deactivate(acceptor);
+ acceptor = null;
+ System.out.println("Disconnected");
+ }
+
+ protected IStore createStore()
+ {
+ JdbcDataSource dataSource = new JdbcDataSource();
+ dataSource.setURL("jdbc:h2:_database/" + name);
+
+ IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(true, true);
+ IDBAdapter dbAdapter = new H2Adapter();
+ IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
+ }
+
+ protected Map<String, String> createProperties()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(IRepository.Props.OVERRIDE_UUID, name);
+ props.put(IRepository.Props.SUPPORTING_AUDITS, "true");
+ props.put(IRepository.Props.SUPPORTING_BRANCHES, "true");
+ return props;
+ }
+
+ protected abstract IRepository createRepository(IStore store, Map<String, String> props);
+
+ protected IAcceptor createAcceptor()
+ {
+ return (IAcceptor)container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + port);
+ }
+
+ protected IConnector createConnector(String description)
+ {
+ return Net4jUtil.getConnector(container, TRANSPORT_TYPE, description);
+ }
+
+ protected IRepositorySynchronizer createRepositorySynchronizer(IConnector connector, String repositoryName)
+ {
+ CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(connector, repositoryName);
+
+ IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory);
+ synchronizer.setRetryInterval(2);
+ synchronizer.setRawReplication(true);
+ synchronizer.setMaxRecommits(10);
+ synchronizer.setRecommitInterval(2);
+ return synchronizer;
+ }
+
+ protected CDOSessionConfigurationFactory createSessionConfigurationFactory(final IConnector connector,
+ final String repositoryName)
+ {
+ return new CDOSessionConfigurationFactory()
+ {
+ public CDONet4jSessionConfiguration createSessionConfiguration()
+ {
+ return FailoverExample.this.createSessionConfiguration(connector, repositoryName);
+ }
+ };
+ }
+
+ protected CDONet4jSessionConfiguration createSessionConfiguration(IConnector connector, String repositoryName)
+ {
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName(repositoryName);
+ configuration.setRevisionManager(CDORevisionUtil.createRevisionManager(CDORevisionCache.NOOP));
+ return configuration;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Unmonitored extends FailoverExample
+ {
+ protected boolean master;
+
+ protected String peerHost;
+
+ protected int peerPort;
+
+ protected String peerRepository;
+
+ public Unmonitored(int port, String name, boolean master, String peerHost, int peerPort, String peerRepository)
+ {
+ this.port = port;
+ this.name = name;
+ this.master = master;
+ this.peerHost = peerHost;
+ this.peerPort = peerPort;
+ this.peerRepository = peerRepository;
+ }
+
+ @Override
+ protected IRepository createRepository(IStore store, Map<String, String> props)
+ {
+ IConnector connector = createConnector(peerHost + ":" + peerPort);
+ IRepositorySynchronizer synchronizer = createRepositorySynchronizer(connector, peerRepository);
+ return CDOServerUtil.createFailoverParticipant(name, store, props, synchronizer, master);
+ }
+
+ @Override
+ protected void showMenu()
+ {
+ super.showMenu();
+ System.out.println("4 - set repository type MASTER");
+ System.out.println("5 - set repository type BACKUP");
+ }
+
+ @Override
+ protected boolean handleCommand(String command)
+ {
+ if ("4".equals(command))
+ {
+ if (repository.getType() == Type.BACKUP)
+ {
+ System.out.println("Setting repository type MASTER...");
+ ((InternalRepository)repository).setType(Type.MASTER);
+ System.out.println("Type is " + repository.getType());
+ }
+ else
+ {
+ System.out.println("Already MASTER");
+ }
+ }
+ else if ("5".equals(command))
+ {
+ if (repository.getType() == Type.MASTER)
+ {
+ System.out.println("Setting repository type BACKUP...");
+ ((InternalRepository)repository).setType(Type.BACKUP);
+ System.out.println("Type is " + repository.getType());
+ }
+ else
+ {
+ System.out.println("Already BACKUP");
+ }
+ }
+ else
+ {
+ return super.handleCommand(command);
+ }
+
+ return false;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class InitialMaster extends Unmonitored
+ {
+ public InitialMaster()
+ {
+ super(2036, "repo1", true, "localhost", 2037, "repo2");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new InitialMaster();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class InitialBackup extends Unmonitored
+ {
+ public InitialBackup()
+ {
+ super(2037, "repo2", false, "localhost", 2036, "repo1");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new InitialBackup();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Monitored extends FailoverExample
+ {
+ public static final String REPOSITORY_GROUP = "ExampleGroup";
+
+ // public static final String REPOSITORY_MONITOR_HOST = "92.231.107.180";
+
+ public static final String REPOSITORY_MONITOR_HOST = "localhost";
+
+ public static final int REPOSITORY_MONITOR_PORT = 2038;
+
+ protected String host;
+
+ public Monitored(String host, int port, String name)
+ {
+ this.host = host;
+ this.port = port;
+ this.name = name;
+ }
+
+ @Override
+ protected IRepository createRepository(IStore store, Map<String, String> props)
+ {
+ ISynchronizableRepository repository = CDOServerUtil.createFailoverParticipant(name, store, props);
+ ((InternalFailoverParticipant)repository).setAllowBackupCommits(true); // Load balancing!
+
+ FailoverAgent agent = new FailoverAgent()
+ {
+ @Override
+ protected org.eclipse.emf.cdo.session.CDOSessionConfiguration createSessionConfiguration(
+ String connectorDescription, String repositoryName)
+ {
+ IConnector connector = createConnector(connectorDescription);
+ return Monitored.this.createSessionConfiguration(connector, repositoryName);
+ }
+
+ @Override
+ protected IManagedContainer getContainer()
+ {
+ return container;
+ }
+ };
+
+ agent.setMonitorConnector(createConnector(REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT));
+ agent.setConnectorDescription(host + ":" + port);
+ agent.setRepository(repository);
+ agent.setGroup(REPOSITORY_GROUP);
+ agent.setRate(1000L);
+ agent.setTimeout(4000L);
+ agent.activate();
+
+ return repository;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Monitor
+ {
+ public static void main(String[] args) throws Exception
+ {
+ IManagedContainer container = createContainer();
+ FailoverMonitor monitor = (FailoverMonitor)container.getElement(FailoverMonitor.PRODUCT_GROUP, "net4j",
+ REPOSITORY_GROUP);
+
+ monitor.addListener(new ContainerEventAdapter<AgentProtocol>()
+ {
+ @Override
+ protected void onAdded(IContainer<AgentProtocol> monitor, AgentProtocol agent)
+ {
+ dump((FailoverMonitor)monitor, "Registered", agent);
+ }
+
+ @Override
+ protected void onRemoved(IContainer<AgentProtocol> monitor, AgentProtocol agent)
+ {
+ dump((FailoverMonitor)monitor, "Deregistered", agent);
+ }
+
+ private void dump(FailoverMonitor monitor, String event, AgentProtocol agent)
+ {
+ System.out.println(event + " agent " + agent);
+ for (AgentProtocol element : monitor.getElements())
+ {
+ String type = element == monitor.getMasterAgent() ? "MASTER: " : "BACKUP: ";
+ System.out.println(" " + type + element);
+ }
+ }
+ });
+
+ container.getElement("org.eclipse.net4j.acceptors", TRANSPORT_TYPE, "0.0.0.0:" + REPOSITORY_MONITOR_PORT);
+ System.out.println("Monitoring...");
+
+ for (;;)
+ {
+ Thread.sleep(100);
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Agent1 extends Monitored
+ {
+ public Agent1()
+ {
+ super("localhost", 2036, "repo1");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new Agent1();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Agent2 extends Monitored
+ {
+ public Agent2()
+ {
+ super("localhost", 2037, "repo2");
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ FailoverExample example = new Agent2();
+ example.init();
+ example.run();
+ example.done();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Client
+ {
+ public static void main(String[] args) throws Exception
+ {
+ IManagedContainer container = createContainer();
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createFailoverSessionConfiguration(
+ REPOSITORY_MONITOR_HOST + ":" + REPOSITORY_MONITOR_PORT, REPOSITORY_GROUP, container);
+
+ final CDONet4jSession session = configuration.openNet4jSession();
+ System.out.println("Connected");
+
+ final CDOTransaction tx = session.openTransaction();
+ addObject(tx);
+ System.out.println("Succesfully committed an object to the original tx/session");
+
+ session.addListener(new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof CDOSessionRecoveryEvent)
+ {
+ CDOSessionRecoveryEvent e = (CDOSessionRecoveryEvent)event;
+ System.out.println("Failover " + e.getType() + ": " + e.getSource().getRepositoryInfo());
+
+ if (e.getType() == CDOSessionRecoveryEvent.Type.FINISHED)
+ {
+ // Let's see if the TX in the failed-over session is usable:
+ //
+ addObject(tx);
+ System.out.println("Succesfully committed an object to the failed-over tx/session");
+ }
+ }
+ }
+ });
+
+ while (!session.isClosed())
+ {
+ Thread.sleep(100);
+ }
+ }
+
+ private static void addObject(CDOTransaction tx)
+ {
+ try
+ {
+ Customer customer = CompanyFactory.eINSTANCE.createCustomer();
+ tx.getOrCreateResource("/r1").getContents().add(customer);
+ tx.commit();
+ }
+ catch (CommitException x)
+ {
+ throw new RuntimeException(x);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java index b275c340e4..a6afa863d5 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/Server.java @@ -1,5 +1,5 @@ /*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java index e7a1cc0f9a..d65cfc583d 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/AbstractOfflineExampleServer.java @@ -1,5 +1,5 @@ /*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java index 631babaea1..24b0b8f2d0 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClient.java @@ -1,5 +1,5 @@ /*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java index f192cdf973..fa61815194 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleClone.java @@ -1,5 +1,5 @@ /*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java index 3aaea82d0e..64ec8b94a5 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleMaster.java @@ -1,5 +1,5 @@ /*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java index 66b18d29c6..5aaaaa917f 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/server/offline/OfflineExampleUtil.java @@ -1,5 +1,5 @@ /*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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
diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java index fe1cc6eddc..734f6913bf 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/bundle/OM.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/internal/examples/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.internal.examples.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.examples"; //$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.internal.examples.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.examples"; //$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);
+ }
+ }
+}
|