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.net4j.http.common | |
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.net4j.http.common')
11 files changed, 922 insertions, 922 deletions
diff --git a/plugins/org.eclipse.net4j.http.common/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.net4j.http.common/.settings/org.eclipse.jdt.ui.prefs index aaef0ccba1..6726e7034a 100644 --- a/plugins/org.eclipse.net4j.http.common/.settings/org.eclipse.jdt.ui.prefs +++ b/plugins/org.eclipse.net4j.http.common/.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.net4j.http.common/build.properties b/plugins/org.eclipse.net4j.http.common/build.properties index 1ad469f62d..98a69263a1 100644 --- a/plugins/org.eclipse.net4j.http.common/build.properties +++ b/plugins/org.eclipse.net4j.http.common/build.properties @@ -1,23 +1,23 @@ -# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Eike Stepper - initial API and implementation - -# NLS_MESSAGEFORMAT_VAR - -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - .options,\ - plugin.properties,\ - about.html,\ - copyright.txt -src.includes = about.html,\ - copyright.txt - -doc.project = org.eclipse.net4j.doc +# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ .options,\
+ plugin.properties,\
+ about.html,\
+ copyright.txt
+src.includes = about.html,\
+ copyright.txt
+
+doc.project = org.eclipse.net4j.doc
diff --git a/plugins/org.eclipse.net4j.http.common/copyright.txt b/plugins/org.eclipse.net4j.http.common/copyright.txt index e921242cf0..8f6328980e 100644 --- a/plugins/org.eclipse.net4j.http.common/copyright.txt +++ b/plugins/org.eclipse.net4j.http.common/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.net4j.http.common/plugin.properties b/plugins/org.eclipse.net4j.http.common/plugin.properties index 7ec7eb181f..14ddce49fe 100644 --- a/plugins/org.eclipse.net4j.http.common/plugin.properties +++ b/plugins/org.eclipse.net4j.http.common/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 = Net4j Signalling Platform Transport HTTP Common -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 = Net4j Signalling Platform Transport HTTP Common
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/IHTTPConnector.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/IHTTPConnector.java index 0042dc7400..dc329a1363 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/IHTTPConnector.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/IHTTPConnector.java @@ -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 - */ -package org.eclipse.net4j.http.common; - -import org.eclipse.net4j.connector.IConnector; - -/** - * A {@link IConnector connector} that implements polling HTTP transport. - * - * @author Eike Stepper - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IHTTPConnector extends IConnector -{ - public static final int DEFAULT_POLL_INTERVAL = 5 * 1000;// 5 seconds - - public static final int UNKNOWN_MAX_IDLE_TIME = -1; - - public String getConnectorID(); - - public int getMaxIdleTime(); -} +/*
+ * 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.net4j.http.common;
+
+import org.eclipse.net4j.connector.IConnector;
+
+/**
+ * A {@link IConnector connector} that implements polling HTTP transport.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IHTTPConnector extends IConnector
+{
+ public static final int DEFAULT_POLL_INTERVAL = 5 * 1000;// 5 seconds
+
+ public static final int UNKNOWN_MAX_IDLE_TIME = -1;
+
+ public String getConnectorID();
+
+ public int getMaxIdleTime();
+}
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.java index 6a22dd4422..97150a2513 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.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.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPChannel.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPChannel.java index 56c65067dd..5bab40030f 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPChannel.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPChannel.java @@ -1,110 +1,110 @@ -/* - * 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.net4j.http.internal.common; - -import org.eclipse.net4j.http.internal.common.HTTPConnector.ChannelOperation; -import org.eclipse.net4j.util.WrappedException; - -import org.eclipse.spi.net4j.Channel; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -/** - * @author Eike Stepper - */ -public class HTTPChannel extends Channel -{ - private long outputOperationCount = 1;// Open channel was 0 implicitely - - private long inputOperationCount; - - private Map<Long, ChannelOperation> inputOperationQuarantine = new ConcurrentHashMap<Long, ChannelOperation>(); - - private CountDownLatch openAck = new CountDownLatch(1); - - private boolean inverseRemoved; - - public HTTPChannel() - { - } - - public long getOutputOperationCount() - { - return outputOperationCount; - } - - public void increaseOutputOperationCount() - { - ++outputOperationCount; - } - - public long getInputOperationCount() - { - return inputOperationCount; - } - - public void increaseInputOperationCount() - { - ++inputOperationCount; - } - - public void quarantineInputOperation(long count, ChannelOperation operation) - { - inputOperationQuarantine.put(count, operation); - } - - public ChannelOperation getQuarantinedInputOperation(long count) - { - return inputOperationQuarantine.remove(count); - } - - public void openAck() - { - openAck.countDown(); - } - - public void waitForOpenAck(long timeout) - { - try - { - openAck.await(timeout, TimeUnit.MILLISECONDS); - } - catch (InterruptedException ex) - { - throw WrappedException.wrap(ex); - } - } - - public boolean isInverseRemoved() - { - return inverseRemoved; - } - - public void setInverseRemoved() - { - inverseRemoved = true; - } - - @Override - protected void doDeactivate() throws Exception - { - for (ChannelOperation operation : inputOperationQuarantine.values()) - { - operation.dispose(); - } - - inputOperationQuarantine.clear(); - super.doDeactivate(); - } -} +/*
+ * 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.net4j.http.internal.common;
+
+import org.eclipse.net4j.http.internal.common.HTTPConnector.ChannelOperation;
+import org.eclipse.net4j.util.WrappedException;
+
+import org.eclipse.spi.net4j.Channel;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author Eike Stepper
+ */
+public class HTTPChannel extends Channel
+{
+ private long outputOperationCount = 1;// Open channel was 0 implicitely
+
+ private long inputOperationCount;
+
+ private Map<Long, ChannelOperation> inputOperationQuarantine = new ConcurrentHashMap<Long, ChannelOperation>();
+
+ private CountDownLatch openAck = new CountDownLatch(1);
+
+ private boolean inverseRemoved;
+
+ public HTTPChannel()
+ {
+ }
+
+ public long getOutputOperationCount()
+ {
+ return outputOperationCount;
+ }
+
+ public void increaseOutputOperationCount()
+ {
+ ++outputOperationCount;
+ }
+
+ public long getInputOperationCount()
+ {
+ return inputOperationCount;
+ }
+
+ public void increaseInputOperationCount()
+ {
+ ++inputOperationCount;
+ }
+
+ public void quarantineInputOperation(long count, ChannelOperation operation)
+ {
+ inputOperationQuarantine.put(count, operation);
+ }
+
+ public ChannelOperation getQuarantinedInputOperation(long count)
+ {
+ return inputOperationQuarantine.remove(count);
+ }
+
+ public void openAck()
+ {
+ openAck.countDown();
+ }
+
+ public void waitForOpenAck(long timeout)
+ {
+ try
+ {
+ openAck.await(timeout, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ public boolean isInverseRemoved()
+ {
+ return inverseRemoved;
+ }
+
+ public void setInverseRemoved()
+ {
+ inverseRemoved = true;
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (ChannelOperation operation : inputOperationQuarantine.values())
+ {
+ operation.dispose();
+ }
+
+ inputOperationQuarantine.clear();
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java index d84d7ac182..8e81b804bc 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java @@ -1,523 +1,523 @@ -/* - * 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.net4j.http.internal.common; - -import org.eclipse.net4j.buffer.IBuffer; -import org.eclipse.net4j.channel.ChannelException; -import org.eclipse.net4j.connector.ConnectorException; -import org.eclipse.net4j.http.common.IHTTPConnector; -import org.eclipse.net4j.http.internal.common.bundle.OM; -import org.eclipse.net4j.http.internal.common.messages.Messages; -import org.eclipse.net4j.protocol.IProtocol; -import org.eclipse.net4j.util.io.ExtendedDataInputStream; -import org.eclipse.net4j.util.io.ExtendedDataOutputStream; -import org.eclipse.net4j.util.om.trace.ContextTracer; -import org.eclipse.net4j.util.security.INegotiationContext; - -import org.eclipse.spi.net4j.Connector; -import org.eclipse.spi.net4j.InternalChannel; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; - -/** - * @author Eike Stepper - */ -public abstract class HTTPConnector extends Connector implements IHTTPConnector -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HTTPConnector.class); - - private static final byte OPERATION_NONE = 0; - - private static final byte OPERATION_OPEN = 1; - - private static final byte OPERATION_OPEN_ACK = 2; - - private static final byte OPERATION_CLOSE = 3; - - private static final byte OPERATION_BUFFER = 4; - - private String connectorID; - - private transient Queue<ChannelOperation> outputOperations = new ConcurrentLinkedQueue<ChannelOperation>(); - - private transient long lastTraffic; - - public static final int OPCODE_CONNECT = 1; - - public static final int OPCODE_DISCONNECT = 2; - - public static final int OPCODE_OPERATIONS = 3; - - public HTTPConnector() - { - markLastTraffic(); - } - - public String getConnectorID() - { - return connectorID; - } - - public void setConnectorID(String connectorID) - { - this.connectorID = connectorID; - } - - public Queue<ChannelOperation> getOutputQueue() - { - return outputOperations; - } - - public long getLastTraffic() - { - return lastTraffic; - } - - private void markLastTraffic() - { - lastTraffic = System.currentTimeMillis(); - } - - public void multiplexChannel(InternalChannel channel) - { - IBuffer buffer; - long outputOperationCount; - - HTTPChannel httpChannel = (HTTPChannel)channel; - synchronized (httpChannel) - { - Queue<IBuffer> channelQueue = httpChannel.getSendQueue(); - buffer = channelQueue.poll(); - outputOperationCount = httpChannel.getOutputOperationCount(); - httpChannel.increaseOutputOperationCount(); - } - - if (TRACER.isEnabled()) - { - TRACER.format("Multiplexing {0} (count={1})", buffer.formatContent(true), outputOperationCount); //$NON-NLS-1$ - } - - outputOperations.add(new BufferChannelOperation(httpChannel.getID(), outputOperationCount, buffer)); - } - - /** - * Writes operations from the {@link #outputOperations} to the passed stream. After each written operation - * {@link #writeMoreOperations()} is asked whether to send more operations. - * - * @return <code>true</code> if more operations are in the {@link #outputOperations}, <code>false</code> otherwise. - */ - public boolean writeOutputOperations(ExtendedDataOutputStream out) throws IOException - { - do - { - ChannelOperation operation = outputOperations.poll(); - if (operation == null && pollAgain()) - { - operation = outputOperations.poll(); - } - - if (operation == null) - { - break; - } - - operation.write(out); - markLastTraffic(); - } while (writeMoreOperations()); - - out.writeByte(OPERATION_NONE); - return !outputOperations.isEmpty(); - } - - public void readInputOperations(ExtendedDataInputStream in) throws IOException - { - for (;;) - { - ChannelOperation operation; - byte code = in.readByte(); - switch (code) - { - case OPERATION_OPEN: - operation = new OpenChannelOperation(in); - break; - - case OPERATION_OPEN_ACK: - operation = new OpenAckChannelOperation(in); - break; - - case OPERATION_CLOSE: - operation = new CloseChannelOperation(in); - break; - - case OPERATION_BUFFER: - operation = new BufferChannelOperation(in); - break; - - case OPERATION_NONE: - return; - - default: - throw new IOException("Invalid operation code: " + code); //$NON-NLS-1$ - } - - markLastTraffic(); - operation.execute(); - } - } - - @Override - protected INegotiationContext createNegotiationContext() - { - throw new UnsupportedOperationException(); - } - - @Override - protected InternalChannel createChannel() - { - return new HTTPChannel(); - } - - @Override - protected void registerChannelWithPeer(short channelID, long timeout, IProtocol<?> protocol) throws ChannelException - { - ChannelOperation operation = new OpenChannelOperation(channelID, protocol.getType()); - outputOperations.add(operation); - - HTTPChannel channel = (HTTPChannel)getChannel(channelID); - channel.waitForOpenAck(timeout); - } - - @Override - protected void deregisterChannelFromPeer(InternalChannel channel) throws ChannelException - { - HTTPChannel httpChannel = (HTTPChannel)channel; - if (!httpChannel.isInverseRemoved()) - { - ChannelOperation operation = new CloseChannelOperation(httpChannel); - outputOperations.add(operation); - } - } - - protected boolean pollAgain() - { - return false; - } - - protected boolean writeMoreOperations() - { - return true; - } - - /** - * @author Eike Stepper - */ - public abstract class ChannelOperation - { - private short channelID; - - private long operationCount; - - public ChannelOperation(short channelID, long operationCount) - { - this.channelID = channelID; - this.operationCount = operationCount; - } - - public ChannelOperation(ExtendedDataInputStream in) throws IOException - { - channelID = in.readShort(); - operationCount = in.readLong(); - } - - public void write(ExtendedDataOutputStream out) throws IOException - { - out.writeByte(getOperation()); - out.writeShort(channelID); - out.writeLong(operationCount); - } - - public abstract byte getOperation(); - - public short getChannelID() - { - return channelID; - } - - public long getOperationCount() - { - return operationCount; - } - - public void execute() - { - HTTPChannel channel = (HTTPChannel)getChannel(getChannelID()); - long operationCount = getOperationCount(); - synchronized (channel) - { - // Execute preceding operations if necessary - while (operationCount < channel.getInputOperationCount()) - { - ChannelOperation operation = channel.getQuarantinedInputOperation(channel.getInputOperationCount()); - if (operation != null) - { - operation.doExecute(channel); - channel.increaseInputOperationCount(); - } - else - { - break; - } - } - - if (operationCount == channel.getInputOperationCount()) - { - // Execute operation if possible - doExecute(channel); - channel.increaseInputOperationCount(); - - // Execute following operations if possible - for (;;) - { - ChannelOperation operation = channel.getQuarantinedInputOperation(++operationCount); - if (operation != null) - { - operation.doExecute(channel); - channel.increaseInputOperationCount(); - } - else - { - break; - } - } - } - else - { - channel.quarantineInputOperation(operationCount, this); - } - } - } - - public abstract void doExecute(HTTPChannel channel); - - public void dispose() - { - } - } - - /** - * @author Eike Stepper - */ - private final class OpenChannelOperation extends ChannelOperation - { - private String protocolID; - - public OpenChannelOperation(short channelID, String protocolID) - { - super(channelID, 0); - this.protocolID = protocolID; - } - - public OpenChannelOperation(ExtendedDataInputStream in) throws IOException - { - super(in); - protocolID = in.readString(); - } - - @Override - public void write(ExtendedDataOutputStream out) throws IOException - { - super.write(out); - out.writeString(protocolID); - } - - @Override - public byte getOperation() - { - return OPERATION_OPEN; - } - - @Override - public void execute() - { - HTTPChannel channel = (HTTPChannel)inverseOpenChannel(getChannelID(), protocolID); - if (channel == null) - { - throw new ConnectorException(Messages.getString("HTTPConnector.0")); //$NON-NLS-1$ - } - - channel.increaseInputOperationCount(); - doExecute(channel); - } - - @Override - public void doExecute(HTTPChannel channel) - { - ChannelOperation operation = new OpenAckChannelOperation(getChannelID(), true); - outputOperations.add(operation); - } - } - - /** - * @author Eike Stepper - */ - private final class OpenAckChannelOperation extends ChannelOperation - { - private boolean success; - - public OpenAckChannelOperation(short channelID, boolean success) - { - super(channelID, 0); - this.success = success; - } - - public OpenAckChannelOperation(ExtendedDataInputStream in) throws IOException - { - super(in); - success = in.readBoolean(); - } - - @Override - public void write(ExtendedDataOutputStream out) throws IOException - { - super.write(out); - out.writeBoolean(success); - } - - @Override - public byte getOperation() - { - return OPERATION_OPEN_ACK; - } - - @Override - public void doExecute(HTTPChannel channel) - { - channel.openAck(); - } - } - - /** - * @author Eike Stepper - */ - private final class CloseChannelOperation extends ChannelOperation - { - public CloseChannelOperation(HTTPChannel channel) - { - super(channel.getID(), channel.getOutputOperationCount()); - channel.increaseOutputOperationCount(); - } - - public CloseChannelOperation(ExtendedDataInputStream in) throws IOException - { - super(in); - } - - @Override - public byte getOperation() - { - return OPERATION_CLOSE; - } - - @Override - public void doExecute(HTTPChannel channel) - { - channel.setInverseRemoved(); - inverseCloseChannel(channel.getID()); - } - } - - /** - * @author Eike Stepper - */ - private final class BufferChannelOperation extends ChannelOperation - { - private IBuffer buffer; - - public BufferChannelOperation(short channelID, long operationCount, IBuffer buffer) - { - super(channelID, operationCount); - this.buffer = buffer; - } - - public BufferChannelOperation(ExtendedDataInputStream in) throws IOException - { - super(in); - int length = in.readShort(); - if (TRACER.isEnabled()) - { - TRACER.format("Receiving Buffer operation: operationID={0}, length={1}", getOperationCount(), length); //$NON-NLS-1$ - } - - buffer = getConfig().getBufferProvider().provideBuffer(); - ByteBuffer byteBuffer = buffer.startPutting(getChannelID()); - for (int i = 0; i < length; i++) - { - byte b = in.readByte(); - byteBuffer.put(b); - } - - buffer.flip(); - } - - @Override - public void write(ExtendedDataOutputStream out) throws IOException - { - super.write(out); - - buffer.flip(); - ByteBuffer byteBuffer = buffer.getByteBuffer(); - byteBuffer.position(IBuffer.HEADER_SIZE); - - int length = byteBuffer.limit() - byteBuffer.position(); - out.writeShort(length); - if (TRACER.isEnabled()) - { - TRACER.format("Transmitting Buffer operation: operationID={0}, length={1}", getOperationCount(), length); //$NON-NLS-1$ - } - - for (int i = 0; i < length; i++) - { - byte b = byteBuffer.get(); - out.writeByte(b); - } - - buffer.release(); - } - - @Override - public byte getOperation() - { - return OPERATION_BUFFER; - } - - @Override - public void doExecute(HTTPChannel channel) - { - channel.handleBufferFromMultiplexer(buffer); - buffer = null; - } - - @Override - public void dispose() - { - if (buffer != null) - { - buffer.release(); - buffer = null; - } - - super.dispose(); - } - } -} +/*
+ * 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.net4j.http.internal.common;
+
+import org.eclipse.net4j.buffer.IBuffer;
+import org.eclipse.net4j.channel.ChannelException;
+import org.eclipse.net4j.connector.ConnectorException;
+import org.eclipse.net4j.http.common.IHTTPConnector;
+import org.eclipse.net4j.http.internal.common.bundle.OM;
+import org.eclipse.net4j.http.internal.common.messages.Messages;
+import org.eclipse.net4j.protocol.IProtocol;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.security.INegotiationContext;
+
+import org.eclipse.spi.net4j.Connector;
+import org.eclipse.spi.net4j.InternalChannel;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class HTTPConnector extends Connector implements IHTTPConnector
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HTTPConnector.class);
+
+ private static final byte OPERATION_NONE = 0;
+
+ private static final byte OPERATION_OPEN = 1;
+
+ private static final byte OPERATION_OPEN_ACK = 2;
+
+ private static final byte OPERATION_CLOSE = 3;
+
+ private static final byte OPERATION_BUFFER = 4;
+
+ private String connectorID;
+
+ private transient Queue<ChannelOperation> outputOperations = new ConcurrentLinkedQueue<ChannelOperation>();
+
+ private transient long lastTraffic;
+
+ public static final int OPCODE_CONNECT = 1;
+
+ public static final int OPCODE_DISCONNECT = 2;
+
+ public static final int OPCODE_OPERATIONS = 3;
+
+ public HTTPConnector()
+ {
+ markLastTraffic();
+ }
+
+ public String getConnectorID()
+ {
+ return connectorID;
+ }
+
+ public void setConnectorID(String connectorID)
+ {
+ this.connectorID = connectorID;
+ }
+
+ public Queue<ChannelOperation> getOutputQueue()
+ {
+ return outputOperations;
+ }
+
+ public long getLastTraffic()
+ {
+ return lastTraffic;
+ }
+
+ private void markLastTraffic()
+ {
+ lastTraffic = System.currentTimeMillis();
+ }
+
+ public void multiplexChannel(InternalChannel channel)
+ {
+ IBuffer buffer;
+ long outputOperationCount;
+
+ HTTPChannel httpChannel = (HTTPChannel)channel;
+ synchronized (httpChannel)
+ {
+ Queue<IBuffer> channelQueue = httpChannel.getSendQueue();
+ buffer = channelQueue.poll();
+ outputOperationCount = httpChannel.getOutputOperationCount();
+ httpChannel.increaseOutputOperationCount();
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Multiplexing {0} (count={1})", buffer.formatContent(true), outputOperationCount); //$NON-NLS-1$
+ }
+
+ outputOperations.add(new BufferChannelOperation(httpChannel.getID(), outputOperationCount, buffer));
+ }
+
+ /**
+ * Writes operations from the {@link #outputOperations} to the passed stream. After each written operation
+ * {@link #writeMoreOperations()} is asked whether to send more operations.
+ *
+ * @return <code>true</code> if more operations are in the {@link #outputOperations}, <code>false</code> otherwise.
+ */
+ public boolean writeOutputOperations(ExtendedDataOutputStream out) throws IOException
+ {
+ do
+ {
+ ChannelOperation operation = outputOperations.poll();
+ if (operation == null && pollAgain())
+ {
+ operation = outputOperations.poll();
+ }
+
+ if (operation == null)
+ {
+ break;
+ }
+
+ operation.write(out);
+ markLastTraffic();
+ } while (writeMoreOperations());
+
+ out.writeByte(OPERATION_NONE);
+ return !outputOperations.isEmpty();
+ }
+
+ public void readInputOperations(ExtendedDataInputStream in) throws IOException
+ {
+ for (;;)
+ {
+ ChannelOperation operation;
+ byte code = in.readByte();
+ switch (code)
+ {
+ case OPERATION_OPEN:
+ operation = new OpenChannelOperation(in);
+ break;
+
+ case OPERATION_OPEN_ACK:
+ operation = new OpenAckChannelOperation(in);
+ break;
+
+ case OPERATION_CLOSE:
+ operation = new CloseChannelOperation(in);
+ break;
+
+ case OPERATION_BUFFER:
+ operation = new BufferChannelOperation(in);
+ break;
+
+ case OPERATION_NONE:
+ return;
+
+ default:
+ throw new IOException("Invalid operation code: " + code); //$NON-NLS-1$
+ }
+
+ markLastTraffic();
+ operation.execute();
+ }
+ }
+
+ @Override
+ protected INegotiationContext createNegotiationContext()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected InternalChannel createChannel()
+ {
+ return new HTTPChannel();
+ }
+
+ @Override
+ protected void registerChannelWithPeer(short channelID, long timeout, IProtocol<?> protocol) throws ChannelException
+ {
+ ChannelOperation operation = new OpenChannelOperation(channelID, protocol.getType());
+ outputOperations.add(operation);
+
+ HTTPChannel channel = (HTTPChannel)getChannel(channelID);
+ channel.waitForOpenAck(timeout);
+ }
+
+ @Override
+ protected void deregisterChannelFromPeer(InternalChannel channel) throws ChannelException
+ {
+ HTTPChannel httpChannel = (HTTPChannel)channel;
+ if (!httpChannel.isInverseRemoved())
+ {
+ ChannelOperation operation = new CloseChannelOperation(httpChannel);
+ outputOperations.add(operation);
+ }
+ }
+
+ protected boolean pollAgain()
+ {
+ return false;
+ }
+
+ protected boolean writeMoreOperations()
+ {
+ return true;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public abstract class ChannelOperation
+ {
+ private short channelID;
+
+ private long operationCount;
+
+ public ChannelOperation(short channelID, long operationCount)
+ {
+ this.channelID = channelID;
+ this.operationCount = operationCount;
+ }
+
+ public ChannelOperation(ExtendedDataInputStream in) throws IOException
+ {
+ channelID = in.readShort();
+ operationCount = in.readLong();
+ }
+
+ public void write(ExtendedDataOutputStream out) throws IOException
+ {
+ out.writeByte(getOperation());
+ out.writeShort(channelID);
+ out.writeLong(operationCount);
+ }
+
+ public abstract byte getOperation();
+
+ public short getChannelID()
+ {
+ return channelID;
+ }
+
+ public long getOperationCount()
+ {
+ return operationCount;
+ }
+
+ public void execute()
+ {
+ HTTPChannel channel = (HTTPChannel)getChannel(getChannelID());
+ long operationCount = getOperationCount();
+ synchronized (channel)
+ {
+ // Execute preceding operations if necessary
+ while (operationCount < channel.getInputOperationCount())
+ {
+ ChannelOperation operation = channel.getQuarantinedInputOperation(channel.getInputOperationCount());
+ if (operation != null)
+ {
+ operation.doExecute(channel);
+ channel.increaseInputOperationCount();
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (operationCount == channel.getInputOperationCount())
+ {
+ // Execute operation if possible
+ doExecute(channel);
+ channel.increaseInputOperationCount();
+
+ // Execute following operations if possible
+ for (;;)
+ {
+ ChannelOperation operation = channel.getQuarantinedInputOperation(++operationCount);
+ if (operation != null)
+ {
+ operation.doExecute(channel);
+ channel.increaseInputOperationCount();
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ channel.quarantineInputOperation(operationCount, this);
+ }
+ }
+ }
+
+ public abstract void doExecute(HTTPChannel channel);
+
+ public void dispose()
+ {
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class OpenChannelOperation extends ChannelOperation
+ {
+ private String protocolID;
+
+ public OpenChannelOperation(short channelID, String protocolID)
+ {
+ super(channelID, 0);
+ this.protocolID = protocolID;
+ }
+
+ public OpenChannelOperation(ExtendedDataInputStream in) throws IOException
+ {
+ super(in);
+ protocolID = in.readString();
+ }
+
+ @Override
+ public void write(ExtendedDataOutputStream out) throws IOException
+ {
+ super.write(out);
+ out.writeString(protocolID);
+ }
+
+ @Override
+ public byte getOperation()
+ {
+ return OPERATION_OPEN;
+ }
+
+ @Override
+ public void execute()
+ {
+ HTTPChannel channel = (HTTPChannel)inverseOpenChannel(getChannelID(), protocolID);
+ if (channel == null)
+ {
+ throw new ConnectorException(Messages.getString("HTTPConnector.0")); //$NON-NLS-1$
+ }
+
+ channel.increaseInputOperationCount();
+ doExecute(channel);
+ }
+
+ @Override
+ public void doExecute(HTTPChannel channel)
+ {
+ ChannelOperation operation = new OpenAckChannelOperation(getChannelID(), true);
+ outputOperations.add(operation);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class OpenAckChannelOperation extends ChannelOperation
+ {
+ private boolean success;
+
+ public OpenAckChannelOperation(short channelID, boolean success)
+ {
+ super(channelID, 0);
+ this.success = success;
+ }
+
+ public OpenAckChannelOperation(ExtendedDataInputStream in) throws IOException
+ {
+ super(in);
+ success = in.readBoolean();
+ }
+
+ @Override
+ public void write(ExtendedDataOutputStream out) throws IOException
+ {
+ super.write(out);
+ out.writeBoolean(success);
+ }
+
+ @Override
+ public byte getOperation()
+ {
+ return OPERATION_OPEN_ACK;
+ }
+
+ @Override
+ public void doExecute(HTTPChannel channel)
+ {
+ channel.openAck();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class CloseChannelOperation extends ChannelOperation
+ {
+ public CloseChannelOperation(HTTPChannel channel)
+ {
+ super(channel.getID(), channel.getOutputOperationCount());
+ channel.increaseOutputOperationCount();
+ }
+
+ public CloseChannelOperation(ExtendedDataInputStream in) throws IOException
+ {
+ super(in);
+ }
+
+ @Override
+ public byte getOperation()
+ {
+ return OPERATION_CLOSE;
+ }
+
+ @Override
+ public void doExecute(HTTPChannel channel)
+ {
+ channel.setInverseRemoved();
+ inverseCloseChannel(channel.getID());
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class BufferChannelOperation extends ChannelOperation
+ {
+ private IBuffer buffer;
+
+ public BufferChannelOperation(short channelID, long operationCount, IBuffer buffer)
+ {
+ super(channelID, operationCount);
+ this.buffer = buffer;
+ }
+
+ public BufferChannelOperation(ExtendedDataInputStream in) throws IOException
+ {
+ super(in);
+ int length = in.readShort();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Receiving Buffer operation: operationID={0}, length={1}", getOperationCount(), length); //$NON-NLS-1$
+ }
+
+ buffer = getConfig().getBufferProvider().provideBuffer();
+ ByteBuffer byteBuffer = buffer.startPutting(getChannelID());
+ for (int i = 0; i < length; i++)
+ {
+ byte b = in.readByte();
+ byteBuffer.put(b);
+ }
+
+ buffer.flip();
+ }
+
+ @Override
+ public void write(ExtendedDataOutputStream out) throws IOException
+ {
+ super.write(out);
+
+ buffer.flip();
+ ByteBuffer byteBuffer = buffer.getByteBuffer();
+ byteBuffer.position(IBuffer.HEADER_SIZE);
+
+ int length = byteBuffer.limit() - byteBuffer.position();
+ out.writeShort(length);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Transmitting Buffer operation: operationID={0}, length={1}", getOperationCount(), length); //$NON-NLS-1$
+ }
+
+ for (int i = 0; i < length; i++)
+ {
+ byte b = byteBuffer.get();
+ out.writeByte(b);
+ }
+
+ buffer.release();
+ }
+
+ @Override
+ public byte getOperation()
+ {
+ return OPERATION_BUFFER;
+ }
+
+ @Override
+ public void doExecute(HTTPChannel channel)
+ {
+ channel.handleBufferFromMultiplexer(buffer);
+ buffer = null;
+ }
+
+ @Override
+ public void dispose()
+ {
+ if (buffer != null)
+ {
+ buffer.release();
+ buffer = null;
+ }
+
+ super.dispose();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/bundle/OM.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/bundle/OM.java index 7cc474ae3d..d3712e4e0a 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/bundle/OM.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/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.net4j.http.internal.common.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.net4j.http.common"; //$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.net4j.http.internal.common.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.net4j.http.common"; //$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);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/Messages.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/Messages.java index 9ff21d6466..c90a8c519c 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/Messages.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/Messages.java @@ -1,41 +1,41 @@ -/* - * 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: - * Victor Roldan Betancort - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.net4j.http.internal.common.messages; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * @author Victor Roldan Betancort - */ -public class Messages -{ - private static final String BUNDLE_NAME = "org.eclipse.net4j.http.internal.common.messages.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private Messages() - { - } - - public static String getString(String key) - { - try - { - return RESOURCE_BUNDLE.getString(key); - } - catch (MissingResourceException e) - { - return '!' + key + '!'; - } - } -} +/*
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.net4j.http.internal.common.messages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.eclipse.net4j.http.internal.common.messages.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages()
+ {
+ }
+
+ public static String getString(String key)
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/messages.properties b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/messages.properties index 388b66a2a0..bd1165bb5f 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/messages.properties +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/messages/messages.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: -# Victor Roldan Betancort - initial API and implementation -# Eike Stepper - maintenance - -HTTPConnector.0=Could not open channel +# 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:
+# Victor Roldan Betancort - initial API and implementation
+# Eike Stepper - maintenance
+
+HTTPConnector.0=Could not open channel
|