From: <wu...@us...> - 2008-02-04 20:53:23
|
Revision: 33 http://davinspector.svn.sourceforge.net/davinspector/?rev=33&view=rev Author: wuest Date: 2008-02-04 12:53:16 -0800 (Mon, 04 Feb 2008) Log Message: ----------- Initial import. Added Paths: ----------- trunk/DAVInspector/.classpath trunk/DAVInspector/.project trunk/DAVInspector/.settings/ trunk/DAVInspector/.settings/org.eclipse.jdt.core.prefs trunk/DAVInspector/.settings/org.eclipse.jdt.ui.prefs trunk/DAVInspector/DAVInspector.bat trunk/DAVInspector/bin/ trunk/DAVInspector/build-user.xml trunk/DAVInspector/build.xml trunk/DAVInspector/config.properties trunk/DAVInspector/src/ trunk/DAVInspector/src/.externalToolBuilders/ trunk/DAVInspector/src/.externalToolBuilders/AUTO.launch trunk/DAVInspector/src/.externalToolBuilders/DAVI.launch trunk/DAVInspector/src/.settings/ trunk/DAVInspector/src/.settings/org.eclipse.jdt.core.prefs trunk/DAVInspector/src/.settings/org.eclipse.jdt.ui.prefs trunk/DAVInspector/src/.settings/org.eclipse.wst.validation.prefs trunk/DAVInspector/src/de/ trunk/DAVInspector/src/de/dlr/ trunk/DAVInspector/src/de/dlr/DAVInspector/ trunk/DAVInspector/src/de/dlr/DAVInspector/Common/ trunk/DAVInspector/src/de/dlr/DAVInspector/Common/Util.java trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/ trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Configuration.java trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Constant.java trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/DAVInspector.java trunk/DAVInspector/src/de/dlr/DAVInspector/HTTP/ trunk/DAVInspector/src/de/dlr/DAVInspector/HTTP/HTTPMessage.java trunk/DAVInspector/src/de/dlr/DAVInspector/HTTP/HTTPMethod.java trunk/DAVInspector/src/de/dlr/DAVInspector/HTTP/HTTPStatusCode.java trunk/DAVInspector/src/de/dlr/DAVInspector/HTTP/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/History/ trunk/DAVInspector/src/de/dlr/DAVInspector/History/HistoryTableCellRenderer.java trunk/DAVInspector/src/de/dlr/DAVInspector/History/HistoryTableModel.java trunk/DAVInspector/src/de/dlr/DAVInspector/History/Message.java trunk/DAVInspector/src/de/dlr/DAVInspector/History/MessageHistory.java trunk/DAVInspector/src/de/dlr/DAVInspector/History/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/Plugin/ trunk/DAVInspector/src/de/dlr/DAVInspector/Plugin/EditPlugin.java trunk/DAVInspector/src/de/dlr/DAVInspector/Plugin/LocalJarHelperClassLoader.java trunk/DAVInspector/src/de/dlr/DAVInspector/Plugin/Plugin.java trunk/DAVInspector/src/de/dlr/DAVInspector/Plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/DAVInspector/Plugin/ViewPlugin.java trunk/DAVInspector/src/de/dlr/DAVInspector/Plugin/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/Relay/ trunk/DAVInspector/src/de/dlr/DAVInspector/Relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/DAVInspector/Relay/ClientListener.java trunk/DAVInspector/src/de/dlr/DAVInspector/Relay/RelayModel.java trunk/DAVInspector/src/de/dlr/DAVInspector/Relay/RelayModelInterface.java trunk/DAVInspector/src/de/dlr/DAVInspector/Relay/ServerListener.java trunk/DAVInspector/src/de/dlr/DAVInspector/Relay/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/UI/ trunk/DAVInspector/src/de/dlr/DAVInspector/UI/AboutDialog.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/ConfigurationDialog.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/MainController.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/MainControllerInterface.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/MainView.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/PluginConfigurationDialog.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/PluginConfigurationTableModel.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/UIResource.java trunk/DAVInspector/src/de/dlr/DAVInspector/UI/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/icons/ trunk/DAVInspector/src/de/dlr/DAVInspector/icons/configure.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/connect_no.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/control_play.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/control_stop.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/delete.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/deleteleft.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/deleteright.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/documentinfo.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/exit.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/help.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/inspector16.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/inspector32.ico trunk/DAVInspector/src/de/dlr/DAVInspector/icons/totheleft.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/totheright.png trunk/DAVInspector/src/de/dlr/DAVInspector/icons/wizard.png trunk/DAVInspector/src/de/dlr/DAVInspector/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/ trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/HeaderPlugin/ trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/HeaderPlugin/HeaderPlugin.java trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/HeaderPlugin/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLPlugin/ trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLPlugin/JTextPaneContentHandler.java trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLPlugin/XMLPlugin.java trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLPlugin/XMLTextPane.java trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLPlugin/package.html trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLTreePlugin/ trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLTreePlugin/JTreeContentHandler.java trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLTreePlugin/XMLTreePlugin.java trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLTreePlugin/XMLTreeView.java trunk/DAVInspector/src/de/dlr/DAVInspector/plugins/XMLTreePlugin/package.html trunk/DAVInspector/src/src-style/ trunk/DAVInspector/src/src-style/checks.xml trunk/DAVInspector/src/src-style/eclipse-codetemplates.xml trunk/DAVInspector/src/src-style/eclipse-formatter.xml Added: trunk/DAVInspector/.classpath =================================================================== --- trunk/DAVInspector/.classpath (rev 0) +++ trunk/DAVInspector/.classpath 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/DAVInspector/.project =================================================================== --- trunk/DAVInspector/.project (rev 0) +++ trunk/DAVInspector/.project 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>DAVInspector</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/DAVInspector/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/DAVInspector/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/DAVInspector/.settings/org.eclipse.jdt.core.prefs 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,12 @@ +#Mon Feb 04 14:52:05 CET 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 Added: trunk/DAVInspector/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/DAVInspector/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ trunk/DAVInspector/.settings/org.eclipse.jdt.ui.prefs 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,3 @@ +#Mon Feb 04 14:52:05 CET 2008 +eclipse.preferences.version=1 +internal.default.compliance=default Added: trunk/DAVInspector/DAVInspector.bat =================================================================== --- trunk/DAVInspector/DAVInspector.bat (rev 0) +++ trunk/DAVInspector/DAVInspector.bat 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,3 @@ +@echo off + +C:\Programme\Java\jdk1.6.0\bin\java -jar DAVInspector.jar Added: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml (rev 0) +++ trunk/DAVInspector/build-user.xml 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse.ant.import?> +<project> + + <target name="dist" description="Generates distribution in subdirectory dist"> + + <!-- Change to desired location --> + <property name="dist" location="C:/Programme/DAVInspector" /> + + <!-- Create necessary directories --> + <delete dir="${dist}" /> + + <mkdir dir="${dist}" /> + <mkdir dir="${dist}/plugins" /> + <mkdir dir="${dist}/lib" /> + <mkdir dir="${dist}/doc" /> + + <!-- Create plugin jar files --> + <jar jarfile="${dist}/plugins/HeaderPlugin.jar" + basedir="bin" + includes="de/dlr/DAVInspector/plugins/HeaderPlugin/**"> + </jar> + <jar jarfile="${dist}/plugins/XMLPlugin.jar" + basedir="bin" + includes="de/dlr/DAVInspector/plugins/XMLPlugin/**"> + </jar> + <jar jarfile="${dist}/plugins/XMLTreePlugin.jar" + basedir="bin" + includes="de/dlr/DAVInspector/plugins/XMLTreePlugin/**"> + </jar> + + <!-- Create DAVInspector jar file --> + <jar jarfile="${dist}/DAVInspector.jar" + basedir="bin" + includes="de/dlr/DAVInspector/**" + excludes="de/dlr/DAVInspector/plugins/**, de/dlr/DAVInspector/src-style/**"> + <manifest> + <attribute name="Main-Class" value="de/dlr/DAVInspector.DAVInspector"/> + <attribute name="Built-By" value="${user.name}"/> + <section name="DAVInspector"> + <attribute name="Specification-Title" value="DAVInspector"/> + <attribute name="Specification-Version" value="${java.specification.version}"/> + <attribute name="Specification-Vendor" value="DLR"/> + <attribute name="Implementation-Title" value="DAVInspector"/> + <attribute name="Implementation-Version" value="${java.version}"/> + <attribute name="Implementation-Vendor" value="DLR"/> + </section> + </manifest> + </jar> + + <!-- Copy script files --> + <copy todir="${dist}"> + <fileset dir="." includes="*.bat, config.properties" /> + <fileset dir="bin/de/dlr/DAVInspector/icons/" includes="*.ico" /> + </copy> + + </target> +</project> \ No newline at end of file Added: trunk/DAVInspector/build.xml =================================================================== --- trunk/DAVInspector/build.xml (rev 0) +++ trunk/DAVInspector/build.xml 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- WARNING: Eclipse auto-generated file. + Any modifications will be overwritten. + To include a user specific buildfile here, simply create one in the same + directory with the processing instruction <?eclipse.ant.import?> + as the first entry and export the buildfile again. --> +<project basedir="." default="build" name="DAVInspector-Prototyp2"> + <property environment="env"/> + <property name="ECLIPSE_HOME" value="../../../../Programme/eclipse"/> + <property name="debuglevel" value="source,lines,vars"/> + <property name="target" value="1.6"/> + <property name="source" value="1.6"/> + <import file="build-user.xml" /> + <path id="DAVInspector-Prototyp2.classpath"> + <pathelement location="bin"/> + </path> + <target name="init"> + <mkdir dir="bin"/> + <copy includeemptydirs="false" todir="bin"> + <fileset dir="src" excludes="**/*.uad, **/*.ucd, **/*.uld, **/*.upd, **/*.udd, **/*.uod, **/*.usd, **/*.utd, **/*.uud, **/*.odd, **/*.ead, **/*.ecd, **/*.eld, **/*.epd, **/*.edd, **/*.eod, **/*.esd, **/*.etd, **/*.eud, **/*.urd*.uml, **/*.ecore, **/*.launch, **/*.java"/> + </copy> + </target> + <target name="clean"> + <delete dir="bin"/> + </target> + <target depends="clean" name="cleanall"/> + <target depends="build-subprojects,build-project" name="build"/> + <target name="build-subprojects"/> + <target depends="init" name="build-project"> + <echo message="${ant.project.name}: ${ant.file}"/> + <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}"> + <src path="src"/> + <classpath refid="DAVInspector-Prototyp2.classpath"/> + </javac> + </target> + <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> + <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler"> + <copy todir="${ant.library.dir}"> + <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> + </copy> + <unzip dest="${ant.library.dir}"> + <patternset includes="jdtCompilerAdapter.jar"/> + <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> + </unzip> + </target> + <target description="compile project with Eclipse compiler" name="build-eclipse-compiler"> + <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> + <antcall target="build"/> + </target> + <target name="New_configuration (2)"> + <java classname="" failonerror="true" fork="yes"> + <classpath refid="DAVInspector-Prototyp2.classpath"/> + </java> + </target> + <target name="DAVInspector"> + <java classname="de.dlr.DAVInspector.DAVInspector" failonerror="true" fork="yes"> + <classpath refid="DAVInspector-Prototyp2.classpath"/> + </java> + </target> +</project> Added: trunk/DAVInspector/config.properties =================================================================== --- trunk/DAVInspector/config.properties (rev 0) +++ trunk/DAVInspector/config.properties 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,5 @@ +#Mon Feb 04 20:56:00 CET 2008 +ClientPort=9999 +ServerPort=8080 +ServerAddress=localhost +ClientAddress= Added: trunk/DAVInspector/src/.externalToolBuilders/AUTO.launch =================================================================== --- trunk/DAVInspector/src/.externalToolBuilders/AUTO.launch (rev 0) +++ trunk/DAVInspector/src/.externalToolBuilders/AUTO.launch 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> +<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="build,dist,"/> +<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/DAVInspector-Prototyp1/build.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DAVInspector-Prototyp1"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/DAVInspector-Prototyp1/build.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +</launchConfiguration> Added: trunk/DAVInspector/src/.externalToolBuilders/DAVI.launch =================================================================== --- trunk/DAVInspector/src/.externalToolBuilders/DAVI.launch (rev 0) +++ trunk/DAVInspector/src/.externalToolBuilders/DAVI.launch 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> +<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="build,dist,"/> +<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="build,dist,"/> +<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/DAVInspector-Prototyp1"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DAVInspector-Prototyp1"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/DAVInspector-Prototyp2/build.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +</launchConfiguration> Added: trunk/DAVInspector/src/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/DAVInspector/src/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/DAVInspector/src/.settings/org.eclipse.jdt.core.prefs 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,256 @@ +#Thu Oct 11 16:36:52 CEST 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=140 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true Added: trunk/DAVInspector/src/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/DAVInspector/src/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ trunk/DAVInspector/src/.settings/org.eclipse.jdt.ui.prefs 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,5 @@ +#Wed Jan 23 14:50:48 CET 2008 +eclipse.preferences.version=1 +formatter_profile=_DLR +formatter_settings_version=11 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * ${todo}\: ${user}\: Comment\!\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * ${todo}\: ${user}\: Comment\!\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${todo}\: ${user}\: enter comment\!\r\n * \r\n * ${tags}\r\n */</template><template autoinsert\="true" 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 * \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 * ${todo}\: ${user}\: Enter comment\!\r\n *\r\n * @version $$LastChangedRevision$$\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${todo}\: ${user}\: Enter comment\!\r\n * \r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * {@inheritDoc}\r\n *\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="New classes and interfaces" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*\r\n * ${file_name}\r\n * \r\n * ${todo}\: ${user} Enter comment\!\r\n * \r\n * Created\: ${date} ${user} <email>\r\n * Changed\:\r\n * \r\n * $$Id$$\r\n * \r\n * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR)\r\n * \r\n * Licensed under the Apache License, Version 2.0 (the 'License');\r\n * you may not use this file except in compliance with the License. \r\n * You may obtain a copy of the License at \r\n * \r\n * http\://www.apache.org/licenses/LICENSE-2.0 \r\n * \r\n * Unless required by applicable law or agreed to in writing, software \r\n * distributed under the License is distributed on an 'AS IS' BASIS, \r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n \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\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\nlogger.error(${exception_var}.getStackTrace());</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" 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}\r\n// ${todo} Auto-generated constructor stub</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> Added: trunk/DAVInspector/src/.settings/org.eclipse.wst.validation.prefs =================================================================== --- trunk/DAVInspector/src/.settings/org.eclipse.wst.validation.prefs (rev 0) +++ trunk/DAVInspector/src/.settings/org.eclipse.wst.validation.prefs 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,6 @@ +#Thu Oct 11 16:32:55 CEST 2007 +DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator; +USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator; +USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator; +USER_PREFERENCE=overrideGlobalPreferencesfalse +eclipse.preferences.version=1 Added: trunk/DAVInspector/src/de/dlr/DAVInspector/Common/Util.java =================================================================== --- trunk/DAVInspector/src/de/dlr/DAVInspector/Common/Util.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/DAVInspector/Common/Util.java 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,70 @@ +/* + * Util.java + * + * TODO: HJW Enter comment! + * + * Created: 04.02.2008 HJW <email> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.DAVInspector.Common; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.Window; + +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + + +/** + * TODO: HJW: Enter comment! + * + * @version $LastChangedRevision$ + * @author HJW + */ +public class Util { + + public static void setUIDesign() { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (UnsupportedLookAndFeelException lfe) { + System.err.println(lfe); + } catch (IllegalAccessException iae) { + System.err.println(iae); + } catch (InstantiationException ie) { + System.err.println(ie); + } catch (ClassNotFoundException cnfe) { + System.err.println(cnfe); + } + } + + public static void centerWindow(Window window) { + // Center the window + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension windowSize = window.getSize(); + if (windowSize.height > screenSize.height) { + windowSize.height = screenSize.height; + } + if (windowSize.width > screenSize.width) { + windowSize.width = screenSize.width; + } + window.setLocation((screenSize.width - windowSize.width) / 2, (screenSize.height - windowSize.height) / 2); + } +} Added: trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Configuration.java =================================================================== --- trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Configuration.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Configuration.java 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,280 @@ +/* + * Configuration.java + * + * This Class stores the configuration of the DAVInspector. + * + * Created: 21.12.2007 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.DAVInspector.Configuration; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.Properties; +import java.util.Vector; + +import de.dlr.DAVInspector.Plugin.Plugin; + + +/** + * TODO: wues_ha: Enter comment! + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public class Configuration { + + /** + * + */ + private Properties properties; + + /** + * Port number of the server connection. + */ + private int serverPort; + + /** + * Port number of the client connection. + */ + private int clientPort; + + /** + * Address of the server. + */ + private String serverAddress; + + /** + * Address of the client. + */ + private String clientAddress; + + /** + * This list contains all available plugins that let you edit the traffic. + */ + private List<Plugin> availableEditPlugins; + + /** + * This list contains all available plugins that let you view the traffic. + */ + private List<Plugin> availableViewPlugins; + + /** + * This list contains all plugins to view the traffic to the server. + */ + private List<Plugin> activeViewPluginsToServer; + + /** + * This list contains all plugins to view the traffic to the client. + */ + private List<Plugin> activeViewPluginsToClient; + + /** + * This list contains all plugins to edit the traffic to the server. + */ + private List<Plugin> activeEditPluginsToServer; + + /** + * This list contains all plugins to edit the traffic to the server. + */ + private List<Plugin> activeEditPluginsToClient; + + /** + * TODO: wues_ha: enter comment! + * + */ + public Configuration() { + loadConfiguration(); + + availableEditPlugins = new Vector<Plugin>(); + availableViewPlugins = new Vector<Plugin>(); + // TODO: Load available plugins + + activeViewPluginsToServer = new Vector<Plugin>(); + activeViewPluginsToClient = new Vector<Plugin>(); + activeEditPluginsToServer = new Vector<Plugin>(); + activeEditPluginsToClient = new Vector<Plugin>(); + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Vector + */ + public List<Plugin> getAvailableEditPlugins() { + return availableEditPlugins; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Vector + */ + public List<Plugin> getAvailableViewPlugins() { + return availableViewPlugins; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Vector + */ + public List<Plugin> getActiveViewPluginsToServer() { + return activeViewPluginsToServer; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Vector + */ + public List<Plugin> getActiveViewPluginsToClient() { + return activeViewPluginsToClient; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Vector + */ + public List<Plugin> getActiveEditPluginsToServer() { + return activeEditPluginsToServer; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Vector + */ + public List<Plugin> getActiveEditPluginsToClient() { + return activeEditPluginsToClient; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return String with address of the server + */ + public String getServerAddress() { + return serverAddress; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Integer Server port + */ + public int getServerPort() { + return serverPort; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return String with address of the server + */ + public String getClientAddress() { + return clientAddress; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Integer Server port + */ + public int getClientPort() { + return clientPort; + } + + /** + * TODO: wues_ha: Enter comment! + * + */ + public void loadConfiguration() { + properties = new Properties(); + try { + properties.load(new FileInputStream(Constant.CONFIGURATION_FILENAME)); + // assign properties to variables + serverAddress = properties.getProperty("ServerAddress", Constant.PROXY_SERVERADDRESS); + serverPort = Integer.parseInt(properties.getProperty("ServerPort", String.valueOf(Constant.PROXY_SERVERPORT))); + clientAddress = properties.getProperty("ClientAddress", Constant.PROXY_CLIENTADDRESS); + clientPort = Integer.parseInt(properties.getProperty("ClientPort", String.valueOf(Constant.PROXY_CLIENTPORT))); + + } catch (IOException ioe) { + System.err.println(ioe); + } + } + + /** + * TODO: wues_ha: Enter comment! + * + */ + public void storeConfiguration() { + // save variables in properties + properties.setProperty("ServerAddress", serverAddress); + properties.setProperty("ServerPort", String.valueOf(serverPort)); + properties.setProperty("ClientAddress", clientAddress); + properties.setProperty("ClientPort", String.valueOf(clientPort)); + + try { + properties.store(new FileOutputStream(Constant.CONFIGURATION_FILENAME), null); + } catch (IOException ioe) { + System.err.println(ioe); + } + } + + /** + * TODO: wues_ha: Enter comment! + * + * @param serverAddressC server address + */ + public void setServerAddress(String serverAddressC) { + this.serverAddress = serverAddressC; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @param clientAddressC client address + */ + public void setClientAddress(String clientAddressC) { + this.clientAddress = clientAddressC; + } + + /** + * TODO: wues_ha: Enter comment! + * + * @param serverPortC server port + */ + public void setServerPort(String serverPortC) { + this.serverPort = Integer.parseInt(serverPortC); + } + + /** + * TODO: wues_ha: Enter comment! + * + * @param clientPortC client port + */ + public void setClientPort(String clientPortC) { + this.clientPort = Integer.parseInt(clientPortC); + } +} Added: trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Constant.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/DAVInspector/Configuration/Constant.java 2008-02-04 20:53:16 UTC (rev 33) @@ -0,0 +1,194 @@ +/* + * Constants.java + * + * Definition aller ben\xF6tigten Konstanten. + * + * Created: 11.10.2007 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eit... [truncated message content] |
From: <wu...@us...> - 2008-02-07 15:59:29
|
Revision: 37 http://davinspector.svn.sourceforge.net/davinspector/?rev=37&view=rev Author: wuest Date: 2008-02-07 07:59:03 -0800 (Thu, 07 Feb 2008) Log Message: ----------- Reorganisation of files and folders. Modified Paths: -------------- trunk/DAVInspector/DAVInspector.bat trunk/DAVInspector/build-user.xml Added Paths: ----------- trunk/DAVInspector/resource/ trunk/DAVInspector/resource/configure.png trunk/DAVInspector/resource/connect_no.png trunk/DAVInspector/resource/control_play.png trunk/DAVInspector/resource/control_stop.png trunk/DAVInspector/resource/delete.png trunk/DAVInspector/resource/deleteleft.png trunk/DAVInspector/resource/deleteright.png trunk/DAVInspector/resource/documentinfo.png trunk/DAVInspector/resource/exit.png trunk/DAVInspector/resource/help.png trunk/DAVInspector/resource/inspector16.png trunk/DAVInspector/resource/inspector32.ico trunk/DAVInspector/resource/inspector32.png trunk/DAVInspector/resource/totheleft.png trunk/DAVInspector/resource/totheright.png trunk/DAVInspector/resource/wizard.png trunk/DAVInspector/src-style/ trunk/DAVInspector/src-style/checks.xml trunk/DAVInspector/src-style/eclipse-codetemplates.xml trunk/DAVInspector/src-style/eclipse-formatter.xml Removed Paths: ------------- trunk/DAVInspector/src/src-style/ Modified: trunk/DAVInspector/DAVInspector.bat =================================================================== --- trunk/DAVInspector/DAVInspector.bat 2008-02-06 10:47:44 UTC (rev 36) +++ trunk/DAVInspector/DAVInspector.bat 2008-02-07 15:59:03 UTC (rev 37) @@ -1,3 +1,3 @@ @echo off -C:\Programme\Java\jdk1.6.0\bin\java -jar DAVInspector.jar +java -jar DAVInspector.jar Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-02-06 10:47:44 UTC (rev 36) +++ trunk/DAVInspector/build-user.xml 2008-02-07 15:59:03 UTC (rev 37) @@ -18,24 +18,29 @@ <!-- Create plugin jar files --> <jar jarfile="${dist}/plugins/HeaderPlugin.jar" basedir="bin" - includes="de/dlr/DAVInspector/plugins/HeaderPlugin/**"> + includes="de/dlr/davinspector/plugins/headerplugin/**"> </jar> <jar jarfile="${dist}/plugins/XMLPlugin.jar" basedir="bin" - includes="de/dlr/DAVInspector/plugins/XMLPlugin/**"> + includes="de/dlr/davinspector/plugins/xmlplugin/**"> </jar> <jar jarfile="${dist}/plugins/XMLTreePlugin.jar" basedir="bin" - includes="de/dlr/DAVInspector/plugins/XMLTreePlugin/**"> + includes="de/dlr/davinspector/plugins/xmltreeplugin/**"> </jar> + <!-- Copy DAVInspector resource files --> + <copy todir="bin/de/dlr/davinspector/resource"> + <fileset dir="resource" includes="*.png" /> + </copy> + <!-- Create DAVInspector jar file --> <jar jarfile="${dist}/DAVInspector.jar" basedir="bin" - includes="de/dlr/DAVInspector/**" - excludes="de/dlr/DAVInspector/plugins/**, de/dlr/DAVInspector/src-style/**"> + includes="de/dlr/davinspector/**" + excludes="de/dlr/davinspector/plugins/**"> <manifest> - <attribute name="Main-Class" value="de/dlr/DAVInspector.DAVInspector"/> + <attribute name="Main-Class" value="de/dlr/davinspector.DAVInspector"/> <attribute name="Built-By" value="${user.name}"/> <section name="DAVInspector"> <attribute name="Specification-Title" value="DAVInspector"/> @@ -48,10 +53,10 @@ </manifest> </jar> - <!-- Copy script files --> + <!-- Copy script files and icon --> <copy todir="${dist}"> - <fileset dir="." includes="*.bat, config.properties" /> - <fileset dir="bin/de/dlr/DAVInspector/icons/" includes="*.ico" /> + <fileset dir="." includes="*.bat, config.properties" /> + <fileset dir="resource" includes="*.ico" /> </copy> </target> Copied: trunk/DAVInspector/resource/configure.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/configure.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/connect_no.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/connect_no.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/control_play.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/control_play.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/control_stop.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/control_stop.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/delete.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/delete.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/deleteleft.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/deleteleft.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/deleteright.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/deleteright.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/documentinfo.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/documentinfo.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/exit.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/exit.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/help.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/help.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/inspector16.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/inspector16.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/inspector32.ico (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/inspector32.ico) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/inspector32.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/inspector32.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/totheleft.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/totheleft.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/totheright.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/totheright.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/resource/wizard.png (from rev 35, trunk/DAVInspector/src/de/dlr/DAVInspector/icons/wizard.png) =================================================================== (Binary files differ) Copied: trunk/DAVInspector/src-style/checks.xml (from rev 35, trunk/DAVInspector/src/src-style/checks.xml) =================================================================== --- trunk/DAVInspector/src-style/checks.xml (rev 0) +++ trunk/DAVInspector/src-style/checks.xml 2008-02-07 15:59:03 UTC (rev 37) @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + This configuration file was written by the eclipse-cs plugin configuration editor +--> +<!-- + Checkstyle-Configuration: DAVInspector + Description: none +--> +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> +<module name="Checker"> + <property name="severity" value="warning"/> + <module name="TreeWalker"> + <property name="tabWidth" value="4"/> + <module name="FileContentsHolder"/> + <module name="JavadocVariable"/> + <module name="JavadocStyle"/> + <module name="JavadocType"> + <property name="scope" value="anoninner"/> + <property name="authorFormat" value="[A-Z][\-\p{L}]*\s+[\p{L}\.\s]*[A-Z][\-\p{L}]*"/> + <property name="versionFormat" value="\$LastChangedRevision.*\$"/> + </module> + <module name="JavadocMethod"/> + <module name="ConstantName"/> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"/> + <module name="MethodName"/> + <module name="PackageName"/> + <module name="ParameterName"/> + <module name="StaticVariableName"/> + <module name="TypeName"/> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> + <module name="RedundantImport"/> + <module name="UnusedImports"/> + <module name="ImportOrder"> + <property name="groups" value="java,java.beans,java.awt,javax,junit,org.omg,org.apache,org.globus,org,com,COM,de.rcenvironment,de"/> + <property name="separated" value="true"/> + </module> + <module name="FileLength"/> + <module name="LineLength"> + <property name="max" value="140"/> + </module> + <module name="MethodLength"> + <property name="tokens" value="METHOD_DEF"/> + </module> + <module name="ParameterNumber"> + <property name="tokens" value="METHOD_DEF"/> + </module> + <module name="EmptyForIteratorPad"/> + <module name="MethodParamPad"/> + <module name="OperatorWrap"/> + <module name="ParenPad"/> + <module name="TypecastParenPad"/> + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"> + <property name="tokens" value="ASSIGN,MINUS,PLUS,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,QUESTION,LOR,LAND,NOT_EQUAL,EQUAL,LT,GT,LE,GE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE"/> + </module> + <module name="TabCharacter"/> + <module name="ModifierOrder"/> + <module name="RedundantModifier"/> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"/> + <module name="LeftCurly"/> + <module name="NeedBraces"/> + <module name="RightCurly"/> + <module name="AvoidInlineConditionals"/> + <module name="DoubleCheckedLocking"/> + <module name="EmptyStatement"/> + <module name="EqualsHashCode"/> + <module name="HiddenField"/> + <module name="InnerAssignment"/> + <module name="IllegalInstantiation"> + <property name="classes" value="java.lang.Boolean"/> + </module> + <module name="MagicNumber"> + <property name="ignoreNumbers" value="0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10"/> + </module> + <module name="MissingSwitchDefault"/> + <module name="ModifiedControlVariable"/> + <module name="RedundantThrows"/> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + <module name="StringLiteralEquality"/> + <module name="NestedIfDepth"> + <property name="max" value="3"/> + </module> + <module name="NestedTryDepth"> + <property name="max" value="3"/> + </module> + <module name="IllegalCatch"> + <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable"/> + </module> + <module name="ReturnCount"> + <property name="max" value="3"/> + </module> + <module name="IllegalType"/> + <module name="DeclarationOrder"/> + <module name="DefaultComesLast"/> + <module name="MultipleStringLiterals"> + <property name="allowedDuplicates" value="2"/> + <property name="ignoreStringsRegexp" value="^(("")|(", ")|(" ")|("\\n")||("\)")|("\(")|("Dialog"))$"/> + </module> + <module name="MultipleVariableDeclarations"/> + <module name="FinalClass"/> + <module name="HideUtilityClassConstructor"/> + <module name="MutableException"/> + <module name="InterfaceIsType"/> + <module name="VisibilityModifier"> + <property name="protectedAllowed" value="true"/> + </module> + <module name="GenericIllegalRegexp"> + <property name="format" value="e\.printStackTrace"/> + <property name="message" value="Provide a useful error message (instead of e.printStackTrace())."/> + </module> + <module name="UpperEll"/> + <module name="ArrayTypeStyle"/> + <module name="Indentation"> + <property name="caseIndent" value="0"/> + </module> + <module name="GenericIllegalRegexp"> + <property name="format" value="System[.]out[.]print"/> + <property name="message" value="Usage of print and println is not allowed."/> + </module> + <module name="Regexp"> + <property name="format" value="\A/\*\n \* [A-Z][a-zA-Z0-9]*\.java\n \*\s*\n"/> + <property name="message" value="Correct file header not found (1)! Add file header from template. (Filename)"/> + </module> + <module name="Regexp"> + <property name="format" value=" \* Copyright [\d]+ Deutsches Zentrum fuer Luft- und Raumfahrt e\.V\. \(DLR\)\n"/> + <property name="message" value="Correct file header not found (2)! Add file header from template. (Copyright)"/> + </module> + <module name="Regexp"> + <property name="format" value=" \* \$Id"/> + <property name="message" value="Correct file header not found (3)! Add file header from template. (ID)"/> + </module> + <module name="Regexp"> + <property name="format" value=" \* Licensed under the Apache License, Version 2\.0 \(the 'License'\);\n"/> + <property name="message" value="Correct file header not found (4)! Add file header from template. (License)"/> + </module> + <module name="LineLength"> + <property name="max" value="140"/> + </module> + </module> + <module name="PackageHtml"/> + <module name="NewlineAtEndOfFile"/> + <module name="Translation"/> + <module name="SuppressionCommentFilter"> + <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="SuppressionCommentFilter"/> + </module> +</module> Copied: trunk/DAVInspector/src-style/eclipse-codetemplates.xml (from rev 35, trunk/DAVInspector/src/src-style/eclipse-codetemplates.xml) =================================================================== --- trunk/DAVInspector/src-style/eclipse-codetemplates.xml (rev 0) +++ trunk/DAVInspector/src-style/eclipse-codetemplates.xml 2008-02-07 15:59:03 UTC (rev 37) @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?><templates><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/** + * ${todo}: ${user}: Comment! + * @return Returns the ${bare_field_name}. + */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/** + * ${todo}: ${user}: Comment! + * @param ${param} The ${bare_field_name} to set. + */</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/** + * ${todo}: ${user}: enter comment! + * + * ${tags} + */</template><template autoinsert="true" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/** + * + */</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">/** + * ${todo}: ${user}: Enter comment! + * + * @version $$LastChangedRevision$$ + * @author ${user} + */</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/** + * + */</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/** + * ${todo}: ${user}: Enter comment! + * + * ${tags} + */</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/** + * {@inheritDoc} + * + * ${see_to_overridden} + */</template><template autoinsert="false" context="newtype_context" deleted="false" description="New classes and interfaces" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">/* + * ${file_name} + * + * ${todo}: ${user} Enter comment! + * + * Created: ${date} ${user} <email> + * Changed: + * + * $$Id$$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +${package_declaration} + +${typecomment} +${type_declaration}</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block +logger.error(${exception_var}.getStackTrace());</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub +${body_statement}</template><template autoinsert="true" 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} +// ${todo} Auto-generated constructor stub</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> \ No newline at end of file Copied: trunk/DAVInspector/src-style/eclipse-formatter.xml (from rev 35, trunk/DAVInspector/src/src-style/eclipse-formatter.xml) =================================================================== --- trunk/DAVInspector/src-style/eclipse-formatter.xml (rev 0) +++ trunk/DAVInspector/src-style/eclipse-formatter.xml 2008-02-07 15:59:03 UTC (rev 37) @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="UTF-8"?> +<profiles version="8"> +<profile name="DAVInspector Conventions" version="8"> +<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="18"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="18"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="18"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="18"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="82"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="18"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="140"/> +<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="140"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> +<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> +</profile> +</profiles> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-02-08 14:55:39
|
Revision: 41 http://davinspector.svn.sourceforge.net/davinspector/?rev=41&view=rev Author: wuest Date: 2008-02-08 06:55:32 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Deleted "@override" declarations. Removed test prints from PluginManager. Added multiple connection management to Relay. Deleted 16px application icon. Modified Paths: -------------- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java Removed Paths: ------------- trunk/DAVInspector/resource/inspector16.png Deleted: trunk/DAVInspector/resource/inspector16.png =================================================================== (Binary files differ) Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-02-08 14:55:32 UTC (rev 41) @@ -123,22 +123,22 @@ /** * Timeout waiting for a StreamCopyThread to finish in ms. */ - public static final int PROXY_THREADTIMEOUT = 100; + public static final int PROXY_THREADTIMEOUT = 1; /** * Linger time in seconds for socket. */ - public static final int PROXY_LINGERTIME = 5; + public static final int PROXY_LINGERTIME = 1; /** * Size of the receive buffer. */ - public static final int PROXY_RECVBUFFERSIZE = 1024; + public static final int PROXY_RECVBUFFERSIZE = 2048; /** * Backlog parameter used when creating the ServerSocket. */ - public static final int PROXY_BACKLOG = 100; + public static final int PROXY_BACKLOG = 1; /** * Address of the Server. IP address or domain name. Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-02-08 14:55:32 UTC (rev 41) @@ -55,7 +55,6 @@ * * @see javax.swing.table.TableModel#getColumnCount() */ - @Override public int getColumnCount() { return columnNames.length; } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-02-08 14:55:32 UTC (rev 41) @@ -82,7 +82,6 @@ public void loadAllPlugins() { //\xFCber jar-dateien im plugin-verzeichnis iterieren // TODO: filter f\xFCr jar dateien - System.err.println("loading plugins ..."); File pluginVZ = new File("plugins"); if (pluginVZ.isDirectory()) { String[] fils = pluginVZ.list(); @@ -105,15 +104,15 @@ IPlugin plugin = null; String name = jarfile.getName().substring(0, jarfile.getName().lastIndexOf(".")); try { - URLClassLoader jcl = new URLClassLoader(new URL[] { jarfile.toURI().toURL() }); - Class<?> c = jcl.loadClass(Constant.PLUGIN_CLASSPATH + name.toLowerCase() + "." + name); + URLClassLoader jClassLoader = new URLClassLoader(new URL[] { jarfile.toURI().toURL() }); + Class<?> c = jClassLoader.loadClass(Constant.PLUGIN_CLASSPATH + name.toLowerCase() + "." + name); // lets try to load plugin... plugin = (IPlugin) c.newInstance(); plugin.init(); // ok, the plugin is initialized if (plugin != null) { pluginVector.add(plugin); - loaderHashmap.put(name, jcl); + loaderHashmap.put(name, jClassLoader); } } catch (ClassNotFoundException cnfe) { System.err.println(cnfe); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java 2008-02-08 14:55:32 UTC (rev 41) @@ -147,7 +147,6 @@ * * @see org.xml.sax.ContentHandler#characters(char[], int, int) */ - @Override public void characters(char[] ch, int start, int length) throws SAXException { String s = new String(ch, start, length).trim(); if (s.length() > 0) { @@ -161,7 +160,6 @@ * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, * java.lang.String, org.xml.sax.Attributes) */ - @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { // if there is a buffered start tag, write to the output if (!bufferStartTag.trim().isEmpty()) { @@ -199,7 +197,6 @@ * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, * java.lang.String) */ - @Override public void endElement(String namespaceURI, String localName, String qName) throws SAXException { bufferEndTag = "</" + qName + ">"; level--; @@ -222,7 +219,6 @@ * * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) */ - @Override public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException { // empty } @@ -232,7 +228,6 @@ * * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) */ - @Override public void processingInstruction(String arg0, String arg1) throws SAXException { // empty } @@ -242,7 +237,6 @@ * * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) */ - @Override public void setDocumentLocator(Locator locator) { // empty } @@ -252,7 +246,6 @@ * * @see org.xml.sax.ContentHandler#endDocument() */ - @Override public void endDocument() throws SAXException { // empty } @@ -262,7 +255,6 @@ * * @see org.xml.sax.ContentHandler#startDocument() */ - @Override public void startDocument() throws SAXException { // empty } @@ -272,7 +264,6 @@ * * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String) */ - @Override public void skippedEntity(String name) throws SAXException { // empty } @@ -287,7 +278,6 @@ * * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String) */ - @Override public void startPrefixMapping(String prefix, String uri) throws SAXException { namespaceMappings.put(uri, prefix); } @@ -300,7 +290,6 @@ * * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String) */ - @Override public void endPrefixMapping(String prefix) throws SAXException { for (Iterator<String> i = namespaceMappings.keySet().iterator(); i.hasNext();) { Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-02-08 14:55:32 UTC (rev 41) @@ -31,11 +31,13 @@ import java.io.PrintStream; import java.net.Socket; import java.net.SocketException; +import java.util.List; import de.dlr.davinspector.common.Constant; /** * TODO: wues_ha: Enter comment! + * TODO: Buffer in ChannelThread for in / outhoing messages * * @version $LastChangedRevision$ * @author Jochen Wuest @@ -49,11 +51,11 @@ /** * */ - private Socket inSock; + private Socket inputSocket; /** * */ - private Socket outSock; + private Socket outputSocket; /** * */ @@ -70,7 +72,7 @@ /** * */ - private PrintStream err; + private PrintStream errorPrintStream; /** * */ @@ -79,12 +81,12 @@ /** * */ - private String header; + private IRelayModel lock = null; /** - * + * */ - private IRelayModel lock = null; + private List<ChannelThread> connections; /** * TODO: wues_ha: enter comment! @@ -93,14 +95,15 @@ * @param outputSock Socket output socket * @param lockRef lock object * @param psErr Printstream for error messages - * @param bufferLockRef Object + * @param con List */ public ChannelThread(Socket inputSock, Socket outputSock, IRelayModel lockRef, - PrintStream psErr, Object bufferLockRef) { - this.inSock = inputSock; - this.outSock = outputSock; + PrintStream psErr, List<ChannelThread> con) { + this.inputSocket = inputSock; + this.outputSocket = outputSock; this.lock = lockRef; - this.err = psErr; + this.errorPrintStream = psErr; + this.connections = con; } /** @@ -108,33 +111,33 @@ * * @see java.lang.Thread#run() */ - @Override public void run() { byte[] buffer = new byte[Constant.PROXY_RECVBUFFERSIZE]; int count = Constant.EOF; try { - InputStream in = inSock.getInputStream(); + InputStream in = inputSocket.getInputStream(); +//# OutputStream out = outSock.getOutputStream(); try { count = in.read(buffer); while ((count != Constant.EOF) && !isInterrupted()) { +//# out.write(buf, 0, count); synchronized (lock) { lock.updateData(new String(buffer, 0, count, "utf-8"), toClient); lock.notifyListeners(toClient); } count = in.read(buffer); } -// synchronized (lock) { -// lock.notifyListeners(toClient); -// } } catch (IOException ioe) { - err.println(ioe); + errorPrintStream.println(tname + ioe); } finally { // The input and output streams will be closed when the sockets themselves are closed. +//# out.flush(); + errorPrintStream.println(tname + "flushing"); flushOut(); } } catch (IOException ioe) { - err.println(ioe); + errorPrintStream.println(tname + ioe); } synchronized (lock) { @@ -142,15 +145,20 @@ try { if ((peer == null) || peer.isDone()) { // Cleanup if there is only one peer OR if _both_ peers are done - inSock.close(); - outSock.close(); + inputSocket.close(); + outputSocket.close(); + errorPrintStream.println(tname + "closing"); } else { // Signal the peer (if any) that we're done on this side of the connection - flushOut(); +// flushOut(); + errorPrintStream.println(tname + "interrupting peer"); peer.interrupt(); } } catch (IOException ioe) { - err.println(header + COLON + ioe); + errorPrintStream.println(tname + COLON + ioe); + } finally { + errorPrintStream.println(tname + "removing connection"); + connections.remove(this); } } } @@ -176,10 +184,10 @@ /** * TODO: wues_ha: Enter comment! * - * @param peerSTC StreamCopyThread to peer to. + * @param peerChannelThread ChannelThread to peer to. */ - public void setPeer(ChannelThread peerSTC) { - this.peer = peerSTC; + public void setPeer(ChannelThread peerChannelThread) { + peer = peerChannelThread; } /** @@ -188,7 +196,7 @@ * @param threadName String thread name. */ public void setTName(String threadName) { - this.tname = threadName; + tname = threadName + ": "; } /** @@ -198,11 +206,11 @@ */ public void writeOut(String data) { try { - OutputStream out = outSock.getOutputStream(); + OutputStream out = outputSocket.getOutputStream(); out.write(data.getBytes()); out.flush(); } catch (IOException ioe) { - err.println(header + COLON + ioe); + errorPrintStream.println(tname + COLON + ioe); } } @@ -212,11 +220,11 @@ */ private void flushOut() { try { - outSock.getOutputStream().flush(); + outputSocket.getOutputStream().flush(); } catch (SocketException se) { - err.println(header + COLON + se); + errorPrintStream.println(tname + COLON + se); } catch (IOException ioe) { - err.println(header + COLON + ioe); + errorPrintStream.println(tname + COLON + ioe); } } @@ -228,4 +236,13 @@ public String getTName() { return tname; } + + /** + * TODO: wues_ha: Enter comment! + * + * @return Boolean + */ + public Boolean getDirection() { + return toClient; + } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-02-08 14:55:32 UTC (rev 41) @@ -34,6 +34,7 @@ import java.net.Socket; import java.net.SocketException; import java.net.UnknownHostException; +import java.util.Iterator; import java.util.List; import java.util.Vector; @@ -60,60 +61,35 @@ /** * Address to forward connections to. */ - private InetAddress dstAddr; + private InetAddress destinationAddress; /** * Port to forward connections to. */ - private int dstPort; + private int destinationPort; /** * This proxy's server socket. */ - private ServerSocket srvSock; + private ServerSocket serverSocket; /** * Log stream for output messages. * TODO: to be deleted. */ - private PrintStream out; + private PrintStream outPrintStream; /** * Log stream for error messages. */ - private PrintStream err; + private PrintStream errorPrintStream; /** - * Lock object. + * Used for synchronizing ChannelThreads. */ - private Object clientLock = new Object(); + private Object lock = new Object(); /** - * Lock object. - */ - private Object serverLock = new Object(); - - /** - * Client to Server ChannelThread. - */ - private ChannelThread clientToServerChannel = null; - - /** - * Server to Client ChannelThread. - */ - private ChannelThread serverToClientChannel = null; - - /** - * Client socket. - */ - private Socket clientSocket; - - /** - * Server socket. - */ - private Socket serverSocket; - - /** * */ private String clientBuffer; @@ -124,6 +100,12 @@ private String serverBuffer; /** + * Contains all current connections (ChannelThreads). + */ + private List<ChannelThread> connections = new Vector<ChannelThread>(); + + + /** * TODO: wues_ha: enter comment! * */ @@ -208,19 +190,19 @@ InetAddress serverAddress = InetAddress.getByName(configuration.getClientAddress()); InetAddress clientAddress = InetAddress.getByName(configuration.getServerAddress()); - this.out = outStream; - this.err = errStream; + this.outPrintStream = outStream; + this.errorPrintStream = errStream; if (clientAddress == null) { - this.srvSock = new ServerSocket(configuration.getClientPort(), Constant.PROXY_BACKLOG); + this.serverSocket = new ServerSocket(configuration.getClientPort(), Constant.PROXY_BACKLOG); } else { - this.srvSock = new ServerSocket(configuration.getClientPort(), Constant.PROXY_BACKLOG, clientAddress); + this.serverSocket = new ServerSocket(configuration.getClientPort(), Constant.PROXY_BACKLOG, clientAddress); } - this.dstAddr = serverAddress; - this.dstPort = configuration.getServerPort(); + this.destinationAddress = serverAddress; + this.destinationPort = configuration.getServerPort(); } catch (UnknownHostException uhe) { - err.println(uhe); + errorPrintStream.println(uhe); } catch (IOException ioe) { - err.println(ioe); + errorPrintStream.println(ioe); } start(); } @@ -231,60 +213,71 @@ * @see java.lang.Thread#run() */ public void run() { - out.println("starting"); + outPrintStream.println("starting"); try { while (!isInterrupted()) { - serverSocket = srvSock.accept(); + Socket serverSideSocket = serverSocket.accept(); try { clientBuffer = ""; serverBuffer = ""; - serverSocket.setSoLinger(true, Constant.PROXY_LINGERTIME); - clientSocket = new Socket(dstAddr, dstPort); - clientSocket.setSoLinger(true, Constant.PROXY_LINGERTIME); - serverToClientChannel = new ChannelThread(serverSocket, clientSocket, (IRelayModel) this, err, clientLock); - clientToServerChannel = new ChannelThread(clientSocket, serverSocket, (IRelayModel) this, err, serverLock); + serverSideSocket.setSoLinger(true, Constant.PROXY_LINGERTIME); + Socket clientSideSocket = new Socket(destinationAddress, destinationPort); + clientSideSocket.setSoLinger(true, Constant.PROXY_LINGERTIME); + ChannelThread serverToClientChannel = new ChannelThread(serverSideSocket, clientSideSocket, + (IRelayModel) this, errorPrintStream, connections); + ChannelThread clientToServerChannel = new ChannelThread(clientSideSocket, serverSideSocket, + (IRelayModel) this, errorPrintStream, connections); serverToClientChannel.setPeer(clientToServerChannel); - serverToClientChannel.setTName("sToC"); - serverToClientChannel.setToClient(true); clientToServerChannel.setPeer(serverToClientChannel); - clientToServerChannel.setTName("cToS"); + serverToClientChannel.setToClient(true); clientToServerChannel.setToClient(false); - serverToClientChannel.start(); - clientToServerChannel.start(); + serverToClientChannel.setTName("ServerToClientThread"); + clientToServerChannel.setTName("ClientToServerThread"); + synchronized (lock) { + connections.add(clientToServerChannel); + connections.add(serverToClientChannel); + serverToClientChannel.start(); + clientToServerChannel.start(); + } } catch (SocketException se) { - err.println(se); + errorPrintStream.println(se); } } - srvSock.close(); + serverSocket.close(); } catch (IOException ioe) { - err.println(ioe); + errorPrintStream.println(ioe); } finally { cleanup(); - out.println("stopped"); + outPrintStream.println("stopped"); } } + /** * TODO: wues_ha: Enter comment! * FIXME: stopping */ public void stopRelay() { - this.interrupt(); - out.println("stopping ..."); + interrupt(); + + outPrintStream.println("stopping ..."); } /** * All StreamCopyThreads are interrupted and joined. */ private void cleanup() { - out.println("stopping .."); - try { - clientToServerChannel.interrupt(); - serverToClientChannel.interrupt(); - clientToServerChannel.join(Constant.PROXY_THREADTIMEOUT); - serverToClientChannel.join(Constant.PROXY_THREADTIMEOUT); - } catch (InterruptedException ie) { - err.println(ie); + synchronized (lock) { + outPrintStream.println("stopping .."); + try { + while (connections.size() > 0) { + ChannelThread channelThread = (ChannelThread) connections.get(0); + channelThread.interrupt(); + channelThread.join(Constant.PROXY_THREADTIMEOUT); + } + } catch (InterruptedException ie) { + errorPrintStream.println(ie); + } } } @@ -337,49 +330,41 @@ outStream.write(buffer.getBytes()); outStream.flush(); } catch (IOException ioe) { - err.println(ioe); + errorPrintStream.println(ioe); } } } /** + * TODO: wues_ha: Enter comment! + * + * @param data String + * @param toClient Boolean + */ + private void write(String data, Boolean toClient) { + for (ChannelThread connection : connections) { + if (connection.getDirection() != toClient) { + connection.writeOut(data); + } + } + } + + /** * Writes data to the Client. * * @param data String data to write to the client. */ public void writeToClient(String data) { - try { - if (serverSocket != null) { - OutputStream outStream = serverSocket.getOutputStream(); - if (isChunked(data)) { - sendChunkedData(outStream, data); - } else { - outStream.write(data.getBytes()); - } - } - } catch (IOException ioe) { - err.println(ioe); - } + write(data, true); } - + /** * Writes Data to the Server. * * @param data String data to write to the server. */ public void writeToServer(String data) { - try { - if (clientSocket != null) { - OutputStream outStream = clientSocket.getOutputStream(); - if (isChunked(data)) { - sendChunkedData(outStream, data); - } else { - outStream.write(data.getBytes()); - } - } - } catch (IOException ioe) { - err.println(ioe); - } + write(data, false); } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-02-08 14:55:32 UTC (rev 41) @@ -547,7 +547,7 @@ jFrame.setContentPane(getJContentPane()); jFrame.setJMenuBar(getJJMenuBar()); jFrame.setTitle(Constant.APP_TITLE + " " + Constant.APP_VERSION); - jFrame.setIconImage(UIResource.getIcon(UIResource.ICON_APP16).getImage()); + jFrame.setIconImage(UIResource.getIcon(UIResource.ICON_APP32).getImage()); jFrame.addWindowListener(new java.awt.event.WindowAdapter() { Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java 2008-02-08 14:55:32 UTC (rev 41) @@ -58,7 +58,6 @@ * * @see javax.swing.table.TableModel#getColumnCount() */ - @Override public int getColumnCount() { return columnNames.length; } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-02-07 16:37:25 UTC (rev 40) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-02-08 14:55:32 UTC (rev 41) @@ -103,11 +103,6 @@ /** * */ - public static final String ICON_APP16 = "inspector16.png"; - - /** - * - */ public static final String ICON_APP32 = "inspector32.png"; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-02-08 15:08:55
|
Revision: 42 http://davinspector.svn.sourceforge.net/davinspector/?rev=42&view=rev Author: wuest Date: 2008-02-08 07:08:46 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Deleted unnecessary files. Removed Paths: ------------- trunk/DAVInspector/.classpath trunk/DAVInspector/.project trunk/DAVInspector/.settings/ Deleted: trunk/DAVInspector/.classpath =================================================================== --- trunk/DAVInspector/.classpath 2008-02-08 14:55:32 UTC (rev 41) +++ trunk/DAVInspector/.classpath 2008-02-08 15:08:46 UTC (rev 42) @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path="bin"/> -</classpath> Deleted: trunk/DAVInspector/.project =================================================================== --- trunk/DAVInspector/.project 2008-02-08 14:55:32 UTC (rev 41) +++ trunk/DAVInspector/.project 2008-02-08 15:08:46 UTC (rev 42) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>DAVInspector</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-02-08 15:20:50
|
Revision: 43 http://davinspector.svn.sourceforge.net/davinspector/?rev=43&view=rev Author: wuest Date: 2008-02-08 07:20:43 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Deleted unnecessary files. Removed Paths: ------------- trunk/DAVInspector/src/.externalToolBuilders/ trunk/DAVInspector/src/.settings/ Property Changed: ---------------- trunk/DAVInspector/bin/ trunk/DAVInspector/src/de/ trunk/DAVInspector/src/de/dlr/ Property changes on: trunk/DAVInspector/bin ___________________________________________________________________ Name: svn:ignore + .* Property changes on: trunk/DAVInspector/src/de ___________________________________________________________________ Name: svn:ignore + .* Property changes on: trunk/DAVInspector/src/de/dlr ___________________________________________________________________ Name: svn:ignore + .* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-02-09 18:08:55
|
Revision: 45 http://davinspector.svn.sourceforge.net/davinspector/?rev=45&view=rev Author: wuest Date: 2008-02-09 10:08:49 -0800 (Sat, 09 Feb 2008) Log Message: ----------- Cleaned build.xml and added separated os-specific stuff in build-user.xml. Modified Paths: -------------- trunk/DAVInspector/build-user.xml trunk/DAVInspector/build.xml Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-02-09 15:51:33 UTC (rev 44) +++ trunk/DAVInspector/build-user.xml 2008-02-09 18:08:49 UTC (rev 45) @@ -1,12 +1,30 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <?eclipse.ant.import?> <project> + <target name="dist" description="Generates distribution in subdirectory dist"> + <!-- Handle OS-specific properties --> + <condition property="isWindows"> + <os family="windows" /> + </condition> + <condition property="isUnix"> + <os family="unix" /> + </condition> + <antcall target="os-independent"/> + </target> - <target name="dist" description="Generates distribution in subdirectory dist"> + <target name="linux" if="isUnix"> + <!-- Change to desired location --> + <property name="dist" location="/usr/local/DAVInspector" /> + </target> - <!-- Change to desired location --> + <target name="win32" if="isWindows"> + <!-- Change to desired location --> <property name="dist" location="C:/Programme/DAVInspector" /> - + </target> + + <target name="os-independent" depends="linux,win32"> + <echo>Distribution directory ${dist}</echo> + <!-- Create necessary directories --> <delete dir="${dist}" /> Modified: trunk/DAVInspector/build.xml =================================================================== --- trunk/DAVInspector/build.xml 2008-02-09 15:51:33 UTC (rev 44) +++ trunk/DAVInspector/build.xml 2008-02-09 18:08:49 UTC (rev 45) @@ -4,20 +4,20 @@ To include a user specific buildfile here, simply create one in the same directory with the processing instruction <?eclipse.ant.import?> as the first entry and export the buildfile again. --> -<project basedir="." default="build" name="DAVInspector-Prototyp2"> +<project basedir="." default="build" name="DAVInspector"> <property environment="env"/> - <property name="ECLIPSE_HOME" value="../../../../Programme/eclipse"/> + <property name="ECLIPSE_HOME" value="${eclipse.home}"/> <property name="debuglevel" value="source,lines,vars"/> - <property name="target" value="1.6"/> - <property name="source" value="1.6"/> + <property name="target" value="1.5"/> + <property name="source" value="1.5"/> <import file="build-user.xml" /> - <path id="DAVInspector-Prototyp2.classpath"> + <path id="DAVInspector.classpath"> <pathelement location="bin"/> </path> <target name="init"> <mkdir dir="bin"/> <copy includeemptydirs="false" todir="bin"> - <fileset dir="src" excludes="**/*.uad, **/*.ucd, **/*.uld, **/*.upd, **/*.udd, **/*.uod, **/*.usd, **/*.utd, **/*.uud, **/*.odd, **/*.ead, **/*.ecd, **/*.eld, **/*.epd, **/*.edd, **/*.eod, **/*.esd, **/*.etd, **/*.eud, **/*.urd*.uml, **/*.ecore, **/*.launch, **/*.java"/> + <fileset dir="src" excludes="**/*.launch, **/*.java"/> </copy> </target> <target name="clean"> @@ -30,7 +30,7 @@ <echo message="${ant.project.name}: ${ant.file}"/> <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}"> <src path="src"/> - <classpath refid="DAVInspector-Prototyp2.classpath"/> + <classpath refid="DAVInspector.classpath"/> </javac> </target> <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> @@ -47,14 +47,4 @@ <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> <antcall target="build"/> </target> - <target name="New_configuration (2)"> - <java classname="" failonerror="true" fork="yes"> - <classpath refid="DAVInspector-Prototyp2.classpath"/> - </java> - </target> - <target name="DAVInspector"> - <java classname="de.dlr.DAVInspector.DAVInspector" failonerror="true" fork="yes"> - <classpath refid="DAVInspector-Prototyp2.classpath"/> - </java> - </target> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kil...@us...> - 2008-02-26 18:39:07
|
Revision: 61 http://davinspector.svn.sourceforge.net/davinspector/?rev=61&view=rev Author: killerjoe Date: 2008-02-26 10:38:33 -0800 (Tue, 26 Feb 2008) Log Message: ----------- Added linux .sh script. Modified Paths: -------------- trunk/DAVInspector/build-user.xml Added Paths: ----------- trunk/DAVInspector/DAVInspector.sh Added: trunk/DAVInspector/DAVInspector.sh =================================================================== --- trunk/DAVInspector/DAVInspector.sh (rev 0) +++ trunk/DAVInspector/DAVInspector.sh 2008-02-26 18:38:33 UTC (rev 61) @@ -0,0 +1,3 @@ +#!/bin/sh + +java -jar DAVInspector.jar Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-02-26 16:52:42 UTC (rev 60) +++ trunk/DAVInspector/build-user.xml 2008-02-26 18:38:33 UTC (rev 61) @@ -14,7 +14,7 @@ <target name="linux" if="isUnix"> <!-- Change to desired location --> - <property name="dist" location="/usr/local/DAVInspector" /> + <property name="dist" location="/tmp/DAVInspector" /> </target> <target name="win32" if="isWindows"> @@ -73,7 +73,7 @@ <!-- Copy script files and icon --> <copy todir="${dist}"> - <fileset dir="." includes="*.bat, config.properties" /> + <fileset dir="." includes="*.bat, *.sh, config.properties" /> <fileset dir="resource" includes="*.ico" /> </copy> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-02-29 16:16:03
|
Revision: 64 http://davinspector.svn.sourceforge.net/davinspector/?rev=64&view=rev Author: wuest Date: 2008-02-29 08:15:31 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Added Apache Commons Logging. Restructured message processing. Modified Paths: -------------- trunk/DAVInspector/DAVInspector.bat trunk/DAVInspector/build-user.xml trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/history/Message.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java Added Paths: ----------- trunk/DAVInspector/lib/ trunk/DAVInspector/lib/commons-logging.jar trunk/DAVInspector/logging.properties trunk/DAVInspector/plugin-config.properties trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java Removed Paths: ------------- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessage.java Modified: trunk/DAVInspector/DAVInspector.bat =================================================================== --- trunk/DAVInspector/DAVInspector.bat 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/DAVInspector.bat 2008-02-29 16:15:31 UTC (rev 64) @@ -1,3 +1,3 @@ @echo off -java -jar DAVInspector.jar +java -jar DAVInspector.jar -D java.util.logging.config.file=C:/Programme/DAVInspector/logging.properties Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/build-user.xml 2008-02-29 16:15:31 UTC (rev 64) @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <?eclipse.ant.import?> <project> + <property name="project.name" value="DAVInspector"/> + <property name="project.version" value="0.1"/> + <target name="dist" description="Generates distribution in subdirectory dist"> <!-- Handle OS-specific properties --> <condition property="isWindows"> @@ -14,12 +17,12 @@ <target name="linux" if="isUnix"> <!-- Change to desired location --> - <property name="dist" location="/tmp/DAVInspector" /> + <property name="dist" location="/tmp/${project.name}" /> </target> <target name="win32" if="isWindows"> <!-- Change to desired location --> - <property name="dist" location="C:/Programme/DAVInspector" /> + <property name="dist" location="C:/Programme/${project.name}" /> </target> <target name="os-independent" depends="linux,win32"> @@ -31,7 +34,7 @@ <mkdir dir="${dist}" /> <mkdir dir="${dist}/plugins" /> <mkdir dir="${dist}/lib" /> - <mkdir dir="${dist}/doc" /> + <mkdir dir="${dist}/log" /> <!-- Create plugin jar files --> <jar jarfile="${dist}/plugins/HeaderPlugin.jar" @@ -60,22 +63,28 @@ <manifest> <attribute name="Main-Class" value="de/dlr/davinspector.DAVInspector"/> <attribute name="Built-By" value="${user.name}"/> + <attribute name="Class-Path" value=". lib/commons-logging.jar logging.properties"/> + <section name="DAVInspector"> - <attribute name="Specification-Title" value="DAVInspector"/> + <attribute name="Specification-Title" value="${project.name}"/> <attribute name="Specification-Version" value="${java.specification.version}"/> <attribute name="Specification-Vendor" value="DLR"/> - <attribute name="Implementation-Title" value="DAVInspector"/> + <attribute name="Implementation-Title" value="${project.name}"/> <attribute name="Implementation-Version" value="${java.version}"/> - <attribute name="Implementation-Vendor" value="DLR"/> + <attribute name="Implementation-Vendor" value="DLR"/> </section> </manifest> </jar> <!-- Copy script files and icon --> <copy todir="${dist}"> - <fileset dir="." includes="*.bat, *.sh, config.properties" /> + <fileset dir="." includes="*.bat, *.sh, *.properties" /> <fileset dir="resource" includes="*.ico" /> </copy> + <!-- Copy libs --> + <copy todir="${dist}/lib"> + <fileset dir="lib" includes="*.jar" /> + </copy> </target> </project> \ No newline at end of file Added: trunk/DAVInspector/lib/commons-logging.jar =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/lib/commons-logging.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/DAVInspector/logging.properties =================================================================== --- trunk/DAVInspector/logging.properties (rev 0) +++ trunk/DAVInspector/logging.properties 2008-02-29 16:15:31 UTC (rev 64) @@ -0,0 +1,8 @@ +# Add a FileHandler +handlers=java.util.logging.FileHandler +# Default global logging level. +.level = ALL +# Describes specific configuration info for the Handlers. +java.util.logging.FileHandler.pattern = log/relay.log +java.util.logging.FileHandler.limit = 50000 +java.util.logging.FileHandler.count = 1 Added: trunk/DAVInspector/plugin-config.properties =================================================================== --- trunk/DAVInspector/plugin-config.properties (rev 0) +++ trunk/DAVInspector/plugin-config.properties 2008-02-29 16:15:31 UTC (rev 64) @@ -0,0 +1,3 @@ +#Fri Feb 29 14:08:56 CET 2008 +PluginsServer= +PluginsClient= Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-02-29 16:15:31 UTC (rev 64) @@ -74,7 +74,7 @@ /** * About dialog height. */ - public static final int UI_ABOUT_DIALOG_HEIGTH = 235; + public static final int UI_ABOUT_DIALOG_HEIGTH = 275; /** * Backgroundcolor of replies. Modified: trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java 2008-02-29 16:15:31 UTC (rev 64) @@ -46,7 +46,7 @@ /** * Symbol used for separating the plugin names. */ - private final static String DELIMITER = ","; + private static final String DELIMITER = ","; /** * Added: trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-02-29 16:15:31 UTC (rev 64) @@ -0,0 +1,217 @@ +/* + * AMessage.java + * + * TODO: wues_ha Enter comment! + * + * Created: 29.02.2008 wues_ha <email> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.history; + +import java.util.Date; + + +/** + * TODO: wues_ha: Enter comment! + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public abstract class AMessage { + + /** + * + */ + protected static int idCounter; + + /** + * Message type indicates the direction of the message: + * <ul> + * <li>Message from client to server: Request.</li> + * <li>Message from server to client: Response.</li> + * </ul> + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ + public enum MessageDirection { + /** + * + */ + Request, + /** + * + */ + Response + } + + /** + * Unique ID of a message. + */ + private int myID; + + /** + * Timestamp of the current message. + */ + private Date myTimestamp; + + /** + * myDirection indicates the direction of the message. + * @see MessageDirection + */ + private MessageDirection myDirection; + + /** + * This string contains the raw data of the message. + */ + private String myRawData; + + /** + * + */ + private String myMessageHeader; + + /** + * + */ + private String myMessageBody; + + /** + * The size in bytes of the current message. + */ + private int mySize; + + /** + * This method returns the ID of the message. + * + * @return id + */ + public int getId() { + return myID; + } + + /** + * This method returns the timestamp of the message. + * + * @return timestamp + */ + public Date getTimestamp() { + return myTimestamp; + } + + /** + * This method sets the timestamp of the current message. + * + * @param timestamp Date/Timestamp + */ + public void setTimestamp(Date timestamp) { + myTimestamp = timestamp; + } + + /** + * Returns the direction (request/reply) of the message. + * @see MessageDirection + * + * @return MessageDirection + */ + public MessageDirection getMessageDirection() { + return myDirection; + } + + /** + * This method sets the direction (request/reply) of the message. + * @see MessageDirection + * + * @param direction MessageDirection + */ + public void setMessageType(MessageDirection direction) { + myDirection = direction; + } + + /** + * This method sets the message direction. + * @see MessageDirection + * + * @param toClient Boolean + */ + public void setMessageDirection(Boolean toClient) { + if (toClient) { + myDirection = MessageDirection.Response; + } else { + myDirection = MessageDirection.Request; + } + } + + /** + * Returns the size of the message in bytes. + * + * @return size int + */ + public int getSize() { + return mySize; + } + + /** + * TODO: wues_ha: Enter comment! + * + */ + public void parseMessage() { + + } + + /** + * Returns the raw data of the message. + * + * @return data String + */ + public String getRawData() { + return myRawData; + } + + /** + * Sets the raw data of the current message. + * Message size, ID, body and header are automatically added. + * + * @param msg String + */ + public void setRawData(String msg) { + myRawData = msg; + mySize = msg.length(); + myID = idCounter; + } + + /** + * Returns the head of the message. + * + * @return String + */ + public String getMessageHeader() { + return myMessageHeader; + } + + /** + * Returns the body of the message. + * + * @return String + */ + public String getMessageBody() { + return myMessageBody; + } +} Added: trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java 2008-02-29 16:15:31 UTC (rev 64) @@ -0,0 +1,58 @@ +/* + * AMessageParser.java + * + * TODO: wues_ha Enter comment! + * + * Created: 29.02.2008 wues_ha <email> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.history; + + +/** + * TODO: wues_ha: Enter comment! + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public abstract class AMessageParser extends AMessage { + + /** + * Parsing state of the message. + */ + protected Boolean isComplete; + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.history.AMessage#parseMessage() + */ + public abstract void parseMessage(); + + /** + * Returns the parsing state of the message. + * + * @return Boolean + */ + public Boolean isComplete() { + return isComplete; + } + +} Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-02-29 16:15:31 UTC (rev 64) @@ -64,8 +64,8 @@ super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - if (value instanceof Message.MessageType){ - if (value.equals(Message.MessageType.Request)) { + if (value instanceof AMessage.MessageDirection){ + if (value.equals(AMessage.MessageDirection.Request)) { setText("Request"); isRequest = true; } else { Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-02-29 16:15:31 UTC (rev 64) @@ -84,8 +84,8 @@ */ public void newMessage(MessageEvent newMessageEvent) { // update history table - Message msg = newMessageEvent.getMessage(); - addRow(new Object[]{msg.getMessageType(), msg.getId(), msg.getTimestamp(), msg.getSize()}); + AMessage msg = newMessageEvent.getMessage(); + addRow(new Object[]{msg.getMessageDirection(), msg.getId(), msg.getTimestamp(), msg.getSize()}); fireTableDataChanged(); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/Message.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/Message.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/Message.java 2008-02-29 16:15:31 UTC (rev 64) @@ -22,243 +22,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package de.dlr.davinspector.history; -import java.util.Date; - /** * This class represents a single message. - * + * * @version $LastChangedRevision$ * @author Jochen Wuest */ -public class Message { +public class Message extends AMessage { /** - * - */ - private static int idCounter; - - /** - * Message type indicates the direction of the message: - * <ul> - * <li>Message from client to server: Request.</li> - * <li>Message from server to client: Response.</li> - * </ul> - * - * @version $LastChangedRevision$ - * @author Jochen Wuest - */ - public enum MessageType { - /** - * - */ - Request, - /** - * - */ - Response - } - - /** - * Unique ID of a message. - */ - private int myID; - - /** - * Timestamp of the current message. - */ - private Date myTimestamp; - - /** - * Type indicates the direction of the message. - * @see MessageType - */ - private MessageType myType; - - /** - * This string contains the raw data of the message. - */ - private String myData; - - /** - * This string contains the body of the message. - */ - private String myMessageBody; - - /** - * This string contains the head of the message. - */ - private String myMessageHeader; - - /** - * The size in bytes of the current message. - */ - private int mySize; - - /** * Constructor, every new message increases <code>idCounter</code>. */ public Message() { ++idCounter; } - - /** - * This method returns the ID of the message. - * - * @return id - */ - public int getId() { - return myID; - } - - /** - * This method returns the timestamp of the message. - * - * @return timestamp - */ - public Date getTimestamp() { - return myTimestamp; - } - - /** - * This method sets the timestamp of the current message. - * - * @param timestamp Date/Timestamp - */ - public void setTimestamp(Date timestamp) { - myTimestamp = timestamp; - } - - /** - * Returns the message type (request/reply) of the message. - * @see MessageType - * - * @return MessageType - */ - public MessageType getMessageType() { - return myType; - } - - /** - * This method sets the message type (request/reply) of the message. - * @see MessageType - * - * @param type MessageType - */ - public void setMessageType(MessageType type) { - myType = type; - } - - /** - * This method sets the message type. - * @see MessageType - * - * @param toClient Boolean - */ - public void setMessageType(Boolean toClient) { - if (toClient) { - myType = MessageType.Response; - } else { - myType = MessageType.Request; - } - } - - /** - * Returns the raw data of the message. - * - * @return data String - */ - public String getData() { - return myData; - } - - /** - * Sets the raw data of the current message. - * Message size, ID, body and header are automatically added. - * - * @param msg String - */ - public void setData(String msg) { - myData = msg; - mySize = msg.length(); - myID = idCounter; - - myMessageBody = extractMessageBody(msg); - myMessageHeader = extractMessageHeader(msg); - } - - /** - * Returns the head of the message. - * - * @return String - */ - public String getMessageHeader() { - return myMessageHeader; - } - - /** - * Returns the body of the message. - * - * @return String - */ - public String getMessageBody() { - return myMessageBody; - } - - /** - * Returns the size of the message in bytes. - * - * @return size int - */ - public int getSize() { - return mySize; - } - - /** - * Extracts the body of the message from the raw data. - * - * @param input String containig http packet - * @return String with body - */ - private String extractMessageBody(String input) { - String result = ""; - - // HTTP/1.1 HTTP/1.0 HTTP/0.9 - // TODO: split input into different HTTP messages - //String[] httpMessages = input.split("HTTP/[1.1|1.0|0.9]{1}"); - - // TODO: nur die erste Nachricht wird angezeigt - //input = httpMessages[0]; - - String[] s = input.split("\r\n\r\n"); - for (int i = 1; i < s.length; i++) { - result = s[i]; - } - - - // detect and process chunked data - // split the input in the different chunks. - // each chunk starts with the length of the chunk in hex. - String[] lines = result.split("(\r\n[0-9a-fA-F]+\r\n)"); - result = ""; - for (int i = 0; i < lines.length; i++) { - result += lines[i]; - } - - return result; - } - - /** - * Extracts the header of the message from the raw data. - * - * @param input String containing http packet - * @return String with headers - */ - private String extractMessageHeader(String input) { - String[] s = input.split("\r\n\r\n"); - return s[0]; - } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java 2008-02-29 16:15:31 UTC (rev 64) @@ -44,7 +44,7 @@ /** * The message. */ - private Message myMessage; + private AMessage myMessage; /** * Constructor for a new message event. @@ -52,7 +52,7 @@ * @param source Object * @param msg {@link Message} */ - public MessageEvent(Object source, Message msg) { + public MessageEvent(Object source, AMessage msg) { super(source); myMessage = msg; } @@ -62,7 +62,7 @@ * * @return {@link Message} */ - public Message getMessage() { + public AMessage getMessage() { return myMessage; } Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-02-29 16:15:31 UTC (rev 64) @@ -32,6 +32,7 @@ import javax.swing.event.EventListenerList; +import de.dlr.davinspector.http.HTTPMessageParser; import de.dlr.davinspector.relay.DataEvent; import de.dlr.davinspector.relay.IClientListener; import de.dlr.davinspector.relay.IRelayModel; @@ -71,7 +72,7 @@ /** * This vector stores the messages. */ - private List<Message> myMessages = null; + private List<AMessage> myMessages = null; /** * Reference to the relay model. @@ -87,7 +88,7 @@ */ public MessageHistory(IRelayModel relay) { myRelay = relay; - myMessages = new Vector<Message>(); + myMessages = new Vector<AMessage>(); myClientsideBuffer = ""; myServersideBuffer = ""; @@ -104,11 +105,17 @@ * @param timestamp Date */ public void storeMessage(String data, Boolean toClient, Date timestamp) { + + AMessage message = new Message(); + //TODO: add decorator dependent on protocol (switch http, ...). + message = new HTTPMessageParser(message); + + message.setMessageDirection(toClient); + message.setRawData(data); + message.setTimestamp(timestamp); + message.parseMessage(); + // store Message - Message message = new Message(); - message.setMessageType(toClient); - message.setData(data); - message.setTimestamp(new Date()); myMessages.add(message); notifyNewMessage(new MessageEvent(this, message)); @@ -121,8 +128,8 @@ * @param id int */ public void loadMessageByID(int id) { - for (Iterator<Message> iterator = myMessages.iterator(); iterator.hasNext();) { - Message message = (Message) iterator.next(); + for (Iterator<AMessage> iterator = myMessages.iterator(); iterator.hasNext();) { + AMessage message = (AMessage) iterator.next(); if (message.getId() == id) { notifyRefreshMessage(new MessageEvent(this, message)); break; @@ -137,7 +144,6 @@ */ public void newClientData(DataEvent newDataEvent) { myClientsideBuffer += newDataEvent.getData(); - processRawData(); storeMessage(myClientsideBuffer, false, new Date()); myClientsideBuffer = ""; } @@ -149,21 +155,10 @@ */ public void newServerData(DataEvent newDataEvent) { myServersideBuffer += newDataEvent.getData(); - processRawData(); storeMessage(myServersideBuffer, true, new Date()); myServersideBuffer = ""; } - /** - * Processes Client and Server data. - * Data is split into messages by Content-Header-Length (if set) or EOF. - * TODO: maybe here or in the message class itsself !? - * TODO: automatic end of message detection (interface for this would be nice) - */ - private void processRawData() { - - } - /** * Adds an {@link INewMessageListener} to MessageHistory. * Deleted: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessage.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessage.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessage.java 2008-02-29 16:15:31 UTC (rev 64) @@ -1,104 +0,0 @@ -/* - * HTTPMessage.java - * - * TODO: wues_ha Enter comment! - * - * Created: 23.01.2008 Jochen Wuest <joc...@dl...> - * Changed: - * - * $Id$ - * - * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.dlr.davinspector.http; - - -/** - * TODO: wues_ha: Enter comment! - * ##{@link #addData(String)}interface?? - * @version $LastChangedRevision$ - * @author Jochen Wuest - */ -public class HTTPMessage { - // CHECKSTYLE:OFF - /** - * TODO: wues_ha: Enter comment! - */ - public enum MessageType { - Request, - Response - } - - private String msg; - private String header; - private String body; - private MessageType type; - private Boolean isComplete; - - public HTTPMessage() { - - } - - //### evtl stream - public HTTPMessage(String data) { - - } - - public void addData(String data) { - - } - - // TODO: header auseinandernehmen (REQ-RES/LEN/ENC) - // TODO: body zusammenstellen - // TODO: StringTokenizer - private void processMessage() { - String result = ""; - - // HTTP/1.1 HTTP/1.0 HTTP/0.9 - // TODO: split input into different HTTP messages - //String[] httpMessages = input.split("HTTP/[1.1|1.0|0.9]{1}"); - - // TODO: nur die erste Nachricht wird angezeigt - //input = httpMessages[0]; - - String[] s = msg.split("\r\n\r\n"); - header = s[0]; - for (int i = 1; i < s.length; i++) { - result = s[i]; - } - - - // detect and process chunked data - // split the input in the different chunks. - // each chunk starts with the length of the chunk in hex. - String[] lines = result.split("(\r\n[0-9a-fA-F]+\r\n)"); - result = ""; - for (int i = 0; i < lines.length; i++) { - result += lines[i]; - } - - } - - // TODO: Col/vec o.\xE4. - public String getHeader() { - return header; - } - - public String getBody() { - return body; - } - // CHECKSTYLE:ON -} Copied: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java (from rev 63, trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessage.java) =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-02-29 16:15:31 UTC (rev 64) @@ -0,0 +1,135 @@ +/* + * HTTPMessageParser.java + * + * TODO: wues_ha Enter comment! + * + * Created: 23.01.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.http; + +import de.dlr.davinspector.history.AMessage; +import de.dlr.davinspector.history.AMessageParser; + + +/** + * TODO: wues_ha: Enter comment! + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public class HTTPMessageParser extends AMessageParser { + + /** + * + */ + private AMessage myMessage; + + /** + * Constructor. + * + * @param aMessage AMessage + */ + public HTTPMessageParser(AMessage aMessage) { + myMessage = aMessage; + } + + /** + * Extracts the body of the message from the raw data. + * + * @param input String containig http packet + * @return String with body + */ + private String extractMessageBody(String input) { + String result = ""; + + // HTTP/1.1 HTTP/1.0 HTTP/0.9 + // TODO: split input into different HTTP messages + //String[] httpMessages = input.split("HTTP/[1.1|1.0|0.9]{1}"); + + // TODO: nur die erste Nachricht wird angezeigt + //input = httpMessages[0]; + + if (input != null) { + String[] s = input.split("\r\n\r\n"); + for (int i = 1; i < s.length; i++) { + result = s[i]; + } + } else { + result = "--leer--"; + } + + + // detect and process chunked data + // split the input in the different chunks. + // each chunk starts with the length of the chunk in hex. + String[] lines = result.split("(\r\n[0-9a-fA-F]+\r\n)"); + result = ""; + for (int i = 0; i < lines.length; i++) { + result += lines[i]; + } + + return result; + } + + /** + * Extracts the header of the message from the raw data. + * + * @param input String containing http packet + * @return String with headers + */ + private String extractMessageHeader(String input) { + if (input != null) { + String[] s = input.split("\r\n\r\n"); + return s[0]; + } else { + return "--leer--"; + } + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.history.AMessageParser#parseMessage() + */ + public void parseMessage() { + //super.setMessageBody(extractMessageBody(super.getRawData())); + //super.setMessageHeader(extractMessageHeader(super.getRawData())); + } + + /** + * Returns the head of the message. + * + * @return String + */ + public String getMessageHeader() { +//System.out.println(myMessage.getRawData() + " \xE4 \xE4 \xE4 " + super.getRawData()); + return extractMessageHeader(super.getRawData()); + } + + /** + * Returns the body of the message. + * + * @return String + */ + public String getMessageBody() { + return extractMessageBody(super.getRawData()); + } +} Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java 2008-02-29 16:15:31 UTC (rev 64) @@ -26,7 +26,7 @@ package de.dlr.davinspector.plugin; -import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.AMessage; @@ -39,9 +39,9 @@ */ public interface IEditPlugin extends IPlugin { /** - * Returns the processed {@link Message} of the plugin. + * Returns the processed {@link AMessage} of the plugin. * - * @return Message + * @return AMessage */ - Message getOutput(); + AMessage getOutput(); } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java 2008-02-29 16:15:31 UTC (rev 64) @@ -25,7 +25,7 @@ package de.dlr.davinspector.plugin; -import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.AMessage; /** * General plugin interface definition. @@ -78,9 +78,9 @@ /** * Starts processing of the message. * - * @param msg Message + * @param msg AMessage */ - void update(Message msg); + void update(AMessage msg); /** * Clears all data. Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-02-29 16:15:31 UTC (rev 64) @@ -34,7 +34,7 @@ import java.util.Vector; import de.dlr.davinspector.common.Constant; -import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.AMessage; /** * This class loads all available plugins and manages the activated plugins @@ -169,7 +169,7 @@ * * @param message Message */ - public void updateActivePluginsServer(Message message) { + public void updateActivePluginsServer(AMessage message) { for (Iterator<IPlugin> iterator = myActivePluginsServer.iterator(); iterator.hasNext();) { IPlugin plugin = (IPlugin) iterator.next(); plugin.update(message); @@ -182,7 +182,7 @@ * * @param message Message */ - public void updateActivePluginsClient(Message message) { + public void updateActivePluginsClient(AMessage message) { for (Iterator<IPlugin> iterator = myActivePluginsClient.iterator(); iterator.hasNext();) { IPlugin plugin = (IPlugin) iterator.next(); plugin.update(message); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-02-29 16:15:31 UTC (rev 64) @@ -28,7 +28,7 @@ import javax.swing.JComponent; import javax.swing.JTextPane; -import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.plugin.IViewPlugin; @@ -140,7 +140,7 @@ * * @see de.dlr.DAVInspector.Plugin.IPlugin#update(java.lang.String) */ - public void update(Message msg) { + public void update(AMessage msg) { if (isActive && myJTextPane != null) { myJTextPane.setText(msg.getMessageHeader()); } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-02-29 16:15:31 UTC (rev 64) @@ -27,7 +27,7 @@ import javax.swing.JComponent; -import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.plugin.IViewPlugin; @@ -139,8 +139,8 @@ * * @see de.dlr.DAVInspector.Plugin.IPlugin#update(java.lang.String) */ - public void update(Message msg) { - if (isActive && myXMLTextPane != null) { + public void update(AMessage msg) { + if (isActive && myXMLTextPane != null) { myXMLTextPane.setText(msg.getMessageBody()); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-02-29 16:15:31 UTC (rev 64) @@ -31,7 +31,7 @@ import org.xml.sax.SAXException; -import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.plugin.IViewPlugin; @@ -142,7 +142,7 @@ * * @see de.dlr.DAVInspector.Plugin.IPlugin#update(java.lang.String) */ - public void update(Message msg) { + public void update(AMessage msg) { if (isActive && myXMLTreeView != null) { updateTree(msg.getMessageBody()); } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-02-29 16:15:31 UTC (rev 64) @@ -28,11 +28,12 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.io.PrintStream; import java.net.Socket; import java.net.SocketException; import java.util.List; +import org.apache.commons.logging.Log; + import de.dlr.davinspector.common.Constant; /** @@ -47,32 +48,38 @@ /** * */ - public static final String COLON = ":"; + public static final String COLON = ": "; + /** * */ private Socket myInputSocket; + /** * */ private Socket myOutputSocket; + /** * */ private boolean myDone = false; + /** * */ private ChannelThread myPeer; + /** * */ private boolean toClient = false; /** - * + * The logger. */ - private PrintStream errorPrintStream; + private Log myLogger; + /** * */ @@ -94,16 +101,16 @@ * @param inputSocket Socket input socket * @param outputSocket Socket output socket * @param relay lock object - * @param psErr Printstream for error messages + * @param logger Logger * @param connections List */ public ChannelThread(Socket inputSocket, Socket outputSocket, IRelayModel relay, - PrintStream psErr, List<ChannelThread> connections) { - this.myInputSocket = inputSocket; - this.myOutputSocket = outputSocket; - this.myLock = relay; - this.errorPrintStream = psErr; - this.myConnections = connections; + Log logger, List<ChannelThread> connections) { + myInputSocket = inputSocket; + myOutputSocket = outputSocket; + myLock = relay; + myLogger = logger; + myConnections = connections; } /** @@ -129,15 +136,15 @@ count = in.read(buffer); } } catch (IOException ioe) { - errorPrintStream.println(myThreadName + ioe); + myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } finally { // The input and output streams will be closed when the sockets themselves are closed. //# out.flush(); - errorPrintStream.println(myThreadName + "flushing"); + myLogger.info(myThreadName + COLON + "flushing"); flushOut(); } } catch (IOException ioe) { - errorPrintStream.println(myThreadName + ioe); + myLogger.error(myThreadName + ioe.getMessage(), ioe); } synchronized (myLock) { @@ -147,17 +154,17 @@ // Cleanup if there is only one peer OR if _both_ peers are done myInputSocket.close(); myOutputSocket.close(); - errorPrintStream.println(myThreadName + "closing"); + myLogger.info(myThreadName + COLON + "closing"); } else { // Signal the peer (if any) that we're done on this side of the connection // flushOut(); - errorPrintStream.println(myThreadName + "interrupting peer"); + myLogger.info(myThreadName + COLON + "interrupting peer"); myPeer.interrupt(); } } catch (IOException ioe) { - errorPrintStream.println(myThreadName + COLON + ioe); + myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } finally { - errorPrintStream.println(myThreadName + "removing connection"); + myLogger.info(myThreadName + COLON + "removing connection"); myConnections.remove(this); } } @@ -198,7 +205,7 @@ * @param threadName String thread name. */ public void setTName(String threadName) { - myThreadName = threadName + ": "; + myThreadName = threadName; } /** @@ -217,7 +224,7 @@ out.flush(); } } catch (IOException ioe) { - errorPrintStream.println(myThreadName + COLON + ioe); + myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } } @@ -228,9 +235,9 @@ try { myOutputSocket.getOutputStream().flush(); } catch (SocketException se) { - errorPrintStream.println(myThreadName + COLON + se); + myLogger.error(myThreadName + COLON + se.getMessage(), se); } catch (IOException ioe) { - errorPrintStream.println(myThreadName + COLON + ioe); + myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } } @@ -303,7 +310,7 @@ outStream.write(buffer.getBytes()); outStream.flush(); } catch (IOException ioe) { - errorPrintStream.println(ioe); + myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-02-29 16:15:31 UTC (rev 64) @@ -25,10 +25,7 @@ package de.dlr.davinspector.relay; -import java.io.PrintStream; - import de.dlr.davinspector.configuration.Configuration; -import de.dlr.davinspector.history.Message; import de.dlr.davinspector.history.MessageHistory; @@ -43,10 +40,8 @@ * This method starts the relay with the given configuration. * * @param configuration Configuration - * @param outStream PrintStream - * @param errStream PrintStream */ - void startRelay(Configuration configuration, PrintStream outStream, PrintStream errStream); + void startRelay(Configuration configuration); /** * This method stops the relay. All open connections are closed. @@ -55,7 +50,7 @@ /** * This method writes data to the client. - * INFO: Maybe {@link Message} instead of a string!? + * INFO: Maybe Message instead of a string!? * @param data String */ void writeToClient(String data); Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-02-29 16:15:31 UTC (rev 64) @@ -27,7 +27,6 @@ package de.dlr.davinspector.relay; import java.io.IOException; -import java.io.PrintStream; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; @@ -38,6 +37,9 @@ import javax.swing.event.EventListenerList; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.configuration.Configuration; import de.dlr.davinspector.history.MessageHistory; @@ -63,14 +65,19 @@ private EventListenerList myServerListeners = new EventListenerList(); /** + * Logger, Apache Commons Logging. + */ + private Log myLogger = LogFactory.getLog(RelayModel.class); + + /** * Address to forward connections to. */ - private InetAddress destinationAddress; + private InetAddress myDestinationAddress; /** * Port to forward connections to. */ - private int destinationPort; + private int myDestinationPort; /** * This proxy's server socket. @@ -78,17 +85,6 @@ private ServerSocket serverSocket; /** - * Log stream for output messages. - * TODO: use logger instead. - */ - private PrintStream outPrintStream; - - /** - * Log stream for error messages. - */ - private PrintStream errorPrintStream; - - /** * The lock object is used for synchronizing the ChannelThreads. */ private Object lock = new Object(); @@ -150,7 +146,7 @@ /** * Notifies all {@link IServerListener}s that have registered interest for - * notification on an {@link DataEvent}. + * notification on a {@link DataEvent}. * * @param event the {@link DataEvent} object */ @@ -180,7 +176,7 @@ /** * Notifies all {@link IClientListener}s that have registered interest for - * notification on an {@link DataEvent}. + * notification on a {@link DataEvent}. * * @param event the {@link DataEvent} object */ @@ -195,24 +191,22 @@ * * @see de.dlr.DAVInspector.Relay.IRelayModel#startRelay() */ - public void startRelay(Configuration configuration, PrintStream outStream, PrintStream errStream) { + public void startRelay(Configuration configuration) { try { InetAddress serverAddress = InetAddress.getByName(configuration.getClientAddress()); InetAddress clientAddress = InetAddress.getByName(configuration.getServerAddress()); - this.outPrintStream = outStream; - this.errorPrintStream = errStream; if (clientAddress == null) { - this.serverSocket = new ServerSocket(configuration.getClientPort(), Constant.RELAY_BACKLOG); + serverSocket = new ServerSocket(configuration.getClientPort(), Constant.RELAY_BACKLOG); } else { - this.serverSocket = new ServerSocket(configuration.getClientPort(), Constant.RELAY_BACKLOG, clientAddress); + serverSocket = new ServerSocket(configuration.getClientPort(), Constant.RELAY_BACKLOG, clientAddress); } - this.destinationAddress = serverAddress; - this.destinationPort = configuration.getServerPort(); + myDestinationAddress = serverAddress; + myDestinationPort = configuration.getServerPort(); } catch (UnknownHostException uhe) { - errorPrintStream.println(uhe); + myLogger.error(uhe.getMessage(), uhe); } catch (IOException ioe) { - errorPrintStream.println(ioe); + myLogger.error(ioe.getMessage(), ioe); } start(); } @@ -223,7 +217,7 @@ * @see java.lang.Thread#run() */ public void run() { - outPrintStream.println("starting"); + myLogger.info("Relay is starting"); try { while (!isInterrupted()) { Socket serverSideSocket = serverSocket.accept(); @@ -231,12 +225,12 @@ clientBuffer = ""; serverBuffer = ""; serverSideSocket.setSoLinger(true, Constant.RELAY_LINGERTIME); - Socket clientSideSocket = new Socket(destinationAddress, destinationPort); + Socket clientSideSocket = new Socket(myDestinationAddress, myDestinationPort); clientSideSocket.setSoLinger(true, Constant.RELAY_LINGERTIME); ChannelThread serverToClientChannel = new ChannelThread(serverSideSocket, clientSideSocket, - (IRelayModel) this, errorPrintStream, connections); + (IRelayModel) this, myLogger, connections); ChannelThread clientToServerChannel = new ChannelThread(clientSideSocket, serverSideSocket, - (IRelayModel) this, errorPrintStream, connections); + (IRelayModel) this, myLogger, connections); serverToClientChannel.setPeer(clientToServerChannel); clientToServerChannel.setPeer(serverToClientChannel); serverToClientChannel.setToClient(true); @@ -250,15 +244,15 @@ clientToServerChannel.start(); } } catch (SocketException se) { - errorPrintStream.println(se); + myLogger.error(se); } } serverSocket.close(); } catch (IOException ioe) { - errorPrintStream.println(ioe); + myLogger.error(ioe.getMessage(), ioe); } finally { cleanup(); - outPrintStream.println("stopped"); + myLogger.info("Relay stopped"); } } @@ -270,17 +264,21 @@ * @see de.dlr.davinspector.relay.IRelayModel#stopRelay() */ public void stopRelay() { - interrupt(); - - outPrintStream.println("stopping ..."); + myLogger.info("stopping stage 1"); + try { + interrupt(); + } catch (SecurityException se) { + myLogger.info(se); + } + myLogger.info("stopping stage 2"); } /** - * All StreamCopyThreads are interrupted and joined. + * All ChannelThreads are interrupted and joined. */ private void cleanup() { synchronized (lock) { - outPrintStream.println("stopping .."); + myLogger.info("stopping stage 3"); try { while (connections.size() > 0) { ChannelThread channelThread = (ChannelThread) connections.get(0); @@ -288,7 +286,7 @@ channelThread.join(Constant.RELAY_THREADTIMEOUT); } } catch (InterruptedException ie) { - errorPrintStream.println(ie); + myLogger.error(ie.getMessage(), ie); } } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-02-29 16:15:31 UTC (rev 64) @@ -155,8 +155,8 @@ jTextPane.setText("\nVersion " + Constant.APP_VERSION + "\n\nApache 2.0 Lizenz" + "\n(c) Copyright Jochen Wuest, Markus Litz, DLR 2007-2008" + + "\n\nCommons Logging, Apache 2.0 Lizenz\nhttp://commons.apache.org/logging/" + "\n\nIcons used by this Application:\nCrystal Project Icons by Everaldo Coelho\nhttp://www.everaldo.com\n"); - // TODO: Add icon license and JCL license. } return jTextPane; } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java 2008-02-29 16:15:31 UTC (rev 64) @@ -110,12 +110,19 @@ private JButton jButtonOk = null; /** + * The View. + */ + private MainView myMainView = null; + + /** * Constructor of the configuration dialog. * * @param owner Frame + * @param main MainView */ - public ConfigurationDialog(Frame owner) { + public ConfigurationDialog(Frame owner, MainView main) { super(owner); + myMainView = main; initialize(); } @@ -210,7 +217,8 @@ config.setServerAddress(jTextFieldServerAddress.getText()); config.setServerPort(jTextFieldServerPort.getText()); config.storeConfiguration(); - // TODO: refresh/restart the relay with the new configuration + // Restart the relay with the new configuration. + myMainView.restartRelay(); } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-02-29 16:15:31 UTC (rev 64) @@ -64,7 +64,7 @@ */ public void startRelay() { Configuration config = new Configuration(); - myRelay.startRelay(config, System.out, System.err); + myRelay.startRelay(config); } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-02-26 21:46:46 UTC (rev 63) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-02-29 16:15:31 UTC (rev 64) @@ -56,11 +56,11 @@ import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.common.Util; +import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.history.HistoryTableCellRenderer; import de.dlr.davinspector.history.HistoryTableModel; import de.dlr.davinspector.history.INewMessageListener; import de.dlr.davinspector.history.IRefreshMessageListener; -import de.dlr.davinspector.history.Message; import de.dlr.davinspector.history.MessageEvent; import de.dlr.davinspector.plugin.IPlugin; import de.dlr.davinspector.plugin.IViewPlugin; @@ -356,7 +356,7 @@ public void actionPerformed(ActionEvent e) { if (myConfigDialog == null) { - myConfigDialog = new ConfigurationDialog(jFrame); + myConfigDialog = new ConfigurationDialog(jFrame, myController.getView()); } myConfigDialog.setVisible(true); } @@ -584,7 +584,7 @@ * @see de.dlr.davinspector.history.INewMessageListener#newMessage(de.dlr.davinspector.history.MessageEvent) */ public void newMessage(MessageEvent newMessageEvent) { - Message msg = newMessageEvent.getMessage(); + AMessage msg = newMessageEvent.getMessage(); updateMessage(msg); } @@ -594,7 +594,7 @@ * @see de.dlr.davinspector.history.IRefreshMessageListener#refreshMessage(de.dlr.davinspector.history.MessageEvent) */ public void refreshMessage(MessageEvent refreshMessageEvent) { - Message msg = refreshMessageEvent.getMessage(); + AMessage msg = refreshMessageEvent.getMessage(); updateMessage(msg); } @@ -603,12 +603,12 @@ * * @param message Message */ - private void updateMessage(Message message) { - if (message.getMessageType().equals(Message.MessageType.Request)) { - jTextPaneClientRaw.setText(message.getData()); + private void updateMessage(AMessage message) { + if (message.getMessageDirection().equals(AMessage.MessageDirection.Request)) { + jTextPaneClientRaw.setText(message.getRawData()); myPluginManager.updateActivePluginsClient(message); } else { - jTextPaneServerRaw.setText(message.getData()); + jTextPaneServerRaw.setText(message.getRawData()); myPluginManager.updateActivePluginsServer(message); } } @@ -622,7 +622,7 @@ if (jBtnSendToServer == null) { jBtnSendToServer = new JButton(sendToServerAction); jBtnSendToServer.setHideActionText(true); - jBtnSendToServer.setMargin(new Insets(2, 2, 2, 2)); + jBtnSendToServer.setMargin(new ... [truncated message content] |
From: <wu...@us...> - 2008-03-04 13:08:26
|
Revision: 71 http://davinspector.svn.sourceforge.net/davinspector/?rev=71&view=rev Author: wuest Date: 2008-03-04 05:07:57 -0800 (Tue, 04 Mar 2008) Log Message: ----------- Moved instance of the PluginManager from the view to the model and added a system logger. Modified Paths: -------------- trunk/DAVInspector/config.properties trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java Added Paths: ----------- trunk/DAVInspector/.classpath trunk/DAVInspector/.project Added: trunk/DAVInspector/.classpath =================================================================== --- trunk/DAVInspector/.classpath (rev 0) +++ trunk/DAVInspector/.classpath 2008-03-04 13:07:57 UTC (rev 71) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry exported="true" kind="lib" path="lib/commons-logging.jar"> + <attributes> + <attribute name="javadoc_location" value="jar:platform:/resource/DAVInspector/lib/commons-logging-javadoc.jar!/"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/DAVInspector/.project =================================================================== --- trunk/DAVInspector/.project (rev 0) +++ trunk/DAVInspector/.project 2008-03-04 13:07:57 UTC (rev 71) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>DAVInspector</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + <nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> + </natures> +</projectDescription> Modified: trunk/DAVInspector/config.properties =================================================================== --- trunk/DAVInspector/config.properties 2008-03-04 10:20:48 UTC (rev 70) +++ trunk/DAVInspector/config.properties 2008-03-04 13:07:57 UTC (rev 71) @@ -1,4 +1,4 @@ -#Mon Feb 04 20:56:00 CET 2008 +#Tue Mar 04 09:35:50 CET 2008 ClientPort=9999 ServerPort=8080 ServerAddress=localhost Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-04 10:20:48 UTC (rev 70) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-04 13:07:57 UTC (rev 71) @@ -73,7 +73,7 @@ /** * */ - private boolean toClient = false; + private boolean myDirection; /** * The logger. @@ -124,22 +124,18 @@ try { InputStream in = myInputSocket.getInputStream(); -//# OutputStream out = outSock.getOutputStream(); try { count = in.read(buffer); while ((count != Constant.EOF) && !isInterrupted()) { -//# out.write(buf, 0, count); synchronized (myLock) { - myLock.updateData(new String(buffer, 0, count, "utf-8"), toClient); - myLock.notifyListeners(toClient); + // TODO: add encoding to configuration and set encoding from configuration + myLock.updateData(new String(buffer, 0, count, "utf-8"), myDirection); } count = in.read(buffer); } } catch (IOException ioe) { myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } finally { - // The input and output streams will be closed when the sockets themselves are closed. -//# out.flush(); myLogger.info(myThreadName + COLON + "flushing"); flushOut(); } @@ -151,15 +147,14 @@ myDone = true; try { if ((myPeer == null) || myPeer.isDone()) { - // Cleanup if there is only one peer OR if _both_ peers are done + // if the peer is already closed or has transferred all data, shutdown myInputSocket.close(); myOutputSocket.close(); myLogger.info(myThreadName + COLON + "closing"); } else { - // Signal the peer (if any) that we're done on this side of the connection -// flushOut(); - myLogger.info(myThreadName + COLON + "interrupting peer"); + // signal the peer we are done myPeer.interrupt(); + myLogger.info(myThreadName + COLON + "interrupting peer"); } } catch (IOException ioe) { myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); @@ -175,10 +170,10 @@ * true = from server to client<br> * false = from client to server<br> * - * @param bToClient Boolean + * @param direction Boolean */ - public void setToClient(boolean bToClient) { - this.toClient = bToClient; + public void setDirection(boolean direction) { + this.myDirection = direction; } /** @@ -214,7 +209,7 @@ * * @param data String data to send. */ - public void writeOut(String data) { + public void write(String data) { try { OutputStream out = myOutputSocket.getOutputStream(); if (isChunked(data)) { @@ -258,7 +253,7 @@ * @return Boolean */ public Boolean getDirection() { - return toClient; + return myDirection; } /** @@ -269,6 +264,7 @@ */ private Boolean isChunked(String data) { // TODO: RFC 2616 14.39 TE / 14.41 Transfer-Encoding + // Output decorator!? Boolean result = false; if (data.contains("Transfer-Encoding: chunked")) { result = true; Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-04 10:20:48 UTC (rev 70) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-04 13:07:57 UTC (rev 71) @@ -25,8 +25,11 @@ package de.dlr.davinspector.relay; +import org.apache.commons.logging.Log; + import de.dlr.davinspector.configuration.Configuration; import de.dlr.davinspector.history.MessageHistory; +import de.dlr.davinspector.plugin.PluginManager; /** @@ -50,20 +53,19 @@ /** * This method writes data to the client. - * INFO: Maybe Message instead of a string!? * @param data String */ void writeToClient(String data); /** * This method writes data to the server. - * INFO: Maybe {@link Message} instead of a string!? * @param data String */ void writeToServer(String data); /** - * This method adds the data to the string buffer for server or client depending on the <code>toClient</code> parameter. + * This method notifies the listeners for server or client depending on the <code>toClient</code> + * parameter and uses the <code>data</code> to create a new {@link DataEvent}. * * @param data String * @param toClient Boolean @@ -71,19 +73,26 @@ void updateData(String data, Boolean toClient); /** - * This method calls the notify methods for server or client depending on the <code>toClient</code> parameter. + * Returns the MessageHistory object. * - * @param toClient Boolean + * @return {@link MessageHistory} */ - void notifyListeners(Boolean toClient); + MessageHistory getMessageHistory(); /** - * Returns the MessageHistory object. + * Returns the PluginManager. * - * @return {@link MessageHistory} + * @return {@link PluginManager} */ - MessageHistory getMessageHistory(); + PluginManager getPluginManager(); + /** + * Returns Log object from Apache Commons Logging. + * + * @return Log + */ + Log getSystemLog(); + /** * Adds an {@link IServerListener} to RelayModel. * Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-04 10:20:48 UTC (rev 70) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-04 13:07:57 UTC (rev 71) @@ -42,7 +42,9 @@ import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.configuration.Configuration; +import de.dlr.davinspector.configuration.PluginConfiguration; import de.dlr.davinspector.history.MessageHistory; +import de.dlr.davinspector.plugin.PluginManager; /** * Implementation of the relay interface. Provides the server socket @@ -85,21 +87,16 @@ private ServerSocket serverSocket; /** + * Plugin manager. + */ + private PluginManager myPluginManager = null; + + /** * The lock object is used for synchronizing the ChannelThreads. */ private Object lock = new Object(); /** - * Client side string buffer. - */ - private String clientBuffer; - - /** - * Server side string buffer. - */ - private String serverBuffer; - - /** * Contains all current connections (ChannelThreads). */ private List<ChannelThread> connections = new Vector<ChannelThread>(); @@ -107,24 +104,50 @@ /** * The message history object. */ - private MessageHistory messageHistory = null; + private MessageHistory myMessageHistory = null; /** * Constructor of RelayModel. * The constructor creates a new {@link MessageHistory} object. */ public RelayModel() { - messageHistory = new MessageHistory(this); + myMessageHistory = new MessageHistory(this); + myPluginManager = PluginManager.getInstance(); + // load available plugins + myPluginManager.loadAllPlugins(); + // load plugin configuration (if available) + PluginConfiguration pluginConfiguration = new PluginConfiguration(); + pluginConfiguration.loadConfiguration(); + myPluginManager.setActivePluginsClient(pluginConfiguration.getActivePluginsClient()); + myPluginManager.setActivePluginsServer(pluginConfiguration.getActivePluginsServer()); } /** * {@inheritDoc} * + * @see de.dlr.davinspector.relay.IRelayModel#getPluginManager() + */ + public PluginManager getPluginManager() { + return myPluginManager; + } + + /** + * {@inheritDoc} + * * @see de.dlr.davinspector.relay.IRelayModel#getMessageHistory() */ public MessageHistory getMessageHistory() { - return messageHistory; + return myMessageHistory; } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.relay.IRelayModel#getSystemLog() + */ + public Log getSystemLog() { + return myLogger; + } /** * {@inheritDoc} @@ -201,6 +224,7 @@ } else { serverSocket = new ServerSocket(configuration.getClientPort(), Constant.RELAY_BACKLOG, clientAddress); } + serverSocket.setReuseAddress(true); myDestinationAddress = serverAddress; myDestinationPort = configuration.getServerPort(); } catch (UnknownHostException uhe) { @@ -222,8 +246,6 @@ while (!isInterrupted()) { Socket serverSideSocket = serverSocket.accept(); try { - clientBuffer = ""; - serverBuffer = ""; serverSideSocket.setSoLinger(true, Constant.RELAY_LINGERTIME); Socket clientSideSocket = new Socket(myDestinationAddress, myDestinationPort); clientSideSocket.setSoLinger(true, Constant.RELAY_LINGERTIME); @@ -233,8 +255,8 @@ (IRelayModel) this, myLogger, connections); serverToClientChannel.setPeer(clientToServerChannel); clientToServerChannel.setPeer(serverToClientChannel); - serverToClientChannel.setToClient(true); - clientToServerChannel.setToClient(false); + serverToClientChannel.setDirection(true); + clientToServerChannel.setDirection(false); serverToClientChannel.setTName("ServerToClientThread"); clientToServerChannel.setTName("ClientToServerThread"); synchronized (lock) { @@ -292,16 +314,15 @@ } /** - * TODO: Enter comment! Not quite correct ... + * TODO: Not quite correct ... * - * * @param data String * @param toClient Boolean */ private void write(String data, Boolean toClient) { for (ChannelThread connection : connections) { if (connection.getDirection() != toClient) { - connection.writeOut(data); + connection.write(data); } } } @@ -332,22 +353,9 @@ */ public void updateData(String data, Boolean toClient) { if (toClient) { - clientBuffer += data; + notifyClientListeners(new DataEvent(this, data)); } else { - serverBuffer += data; + notifyServerListeners(new DataEvent(this, data)); } } - - /** - * {@inheritDoc} - * - * @see de.dlr.DAVInspector.Relay.IRelayModel#notifyListeners(java.lang.Boolean) - */ - public void notifyListeners(Boolean toClient) { - if (toClient) { - notifyClientListeners(new DataEvent(this, clientBuffer)); - } else { - notifyServerListeners(new DataEvent(this, serverBuffer)); - } - } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-04 10:20:48 UTC (rev 70) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-04 13:07:57 UTC (rev 71) @@ -517,8 +517,7 @@ myRelay.getMessageHistory().addNewMessageListener(this); myRelay.getMessageHistory().addRefreshMessageListener(this); - myPluginManager = PluginManager.getInstance(); - myPluginManager.loadAllPlugins(); + myPluginManager = myRelay.getPluginManager(); jFrame = getJFrame(); jFrame.pack(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-08 19:35:36
|
Revision: 79 http://davinspector.svn.sourceforge.net/davinspector/?rev=79&view=rev Author: wuest Date: 2008-03-08 11:35:31 -0800 (Sat, 08 Mar 2008) Log Message: ----------- Added recording plugin package. Added new plugin to build script. Modified Paths: -------------- trunk/DAVInspector/build-user.xml Added Paths: ----------- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/package.html Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-03-08 19:34:07 UTC (rev 78) +++ trunk/DAVInspector/build-user.xml 2008-03-08 19:35:31 UTC (rev 79) @@ -49,6 +49,10 @@ basedir="bin" includes="de/dlr/davinspector/plugins/xmltreeplugin/**"> </jar> + <jar jarfile="${dist}/plugins/RecordingPlugin.jar" + basedir="bin" + includes="de/dlr/davinspector/plugins/recordingplugin/**"> + </jar> <!-- Copy DAVInspector resource files --> <copy todir="bin/de/dlr/davinspector/resource"> Added: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java 2008-03-08 19:35:31 UTC (rev 79) @@ -0,0 +1,194 @@ +/* + * RecordingConfigurationPanel.java + * + * This class is the UI for the RecordingPlugin. + * + * Created: 08.03.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.plugins.recordingplugin; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.GroupLayout; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.LayoutStyle; + +import de.dlr.davinspector.common.Util; +import de.dlr.davinspector.plugin.IPlugin.Direction; + +/** + * This class is the UI for the RecordingPlugin. + * TODO: constant def, complete comments. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public class RecordingConfigurationPanel extends JPanel { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * + */ + private JButton jButtonOpenFileChooser; + + /** + * + */ + private JLabel jLabelFilename; + + /** + * + */ + private JTextField jTextFieldFilename; + + /** + * The filename. + */ + private String myFilename = ""; + + /** + * The RecordingPlugin. + */ + private RecordingPlugin myParent; + + /** + * Constructor. + * + * @param plugin Reference to the plugin object. + */ + public RecordingConfigurationPanel(RecordingPlugin plugin) { + myParent = plugin; + myFilename = getDefaultFileName(); + initComponents(); + Util.setUIDesign(); + } + + /** + * This method returns the filename of the file to write the data to. + * If <code>myFilename</code> is not set the default filename is returned. + * + * @return String + */ + public String getFilename() { + if (myFilename.equals("")) { + return getDefaultFileName(); + } else { + return myFilename; + } + } + + /** + * TODO: HJW: Enter comment! + * + * @param evt + * Event + */ + private void jButtonOpenFileChooserActionPerformed(java.awt.event.ActionEvent evt) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + fileChooser.setDialogTitle("Select recording file"); + fileChooser.setSelectedFile(new File(myFilename)); + fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + + int returnVal = fileChooser.showOpenDialog(null); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fileChooser.getSelectedFile(); + myFilename = file.getAbsolutePath(); + myParent.setRecordingFile(file); + } + jTextFieldFilename.setText(myFilename); + } + + /** + * This method returns the default filename. + * + * + * @return String + */ + private String getDefaultFileName() { + Date now = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_hh-mm"); + + String side = "_server_"; + if (myParent.getDirection() == Direction.CLIENT) { + side = "_client_"; + } + + return "davi" + side + dateFormat.format(now) + ".rec"; + } + + /** + * TODO: HJW: Enter comment! + * + */ + private void initComponents() { + jTextFieldFilename = new JTextField(); + jButtonOpenFileChooser = new JButton(); + jLabelFilename = new JLabel(); + + jButtonOpenFileChooser.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButtonOpenFileChooserActionPerformed(evt); + } + }); + + jTextFieldFilename.setText(myFilename); + jButtonOpenFileChooser.setText("..."); + jButtonOpenFileChooser.setToolTipText("Choose file for recording."); + + jLabelFilename.setText("File:"); + + GroupLayout layout = new GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabelFilename) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTextFieldFilename, GroupLayout.DEFAULT_SIZE, Byte.MAX_VALUE * 2, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButtonOpenFileChooser) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(jLabelFilename) + .addComponent(jButtonOpenFileChooser) + .addComponent(jTextFieldFilename, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + } +} Added: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java 2008-03-08 19:35:31 UTC (rev 79) @@ -0,0 +1,238 @@ +/* + * RecordingPlugin.java + * + * The RecordingPlugin enables the user to record the network traffic to the default or a + * user specific file. + * + * Created: 08.03.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.plugins.recordingplugin; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import javax.swing.JComponent; + +import de.dlr.davinspector.history.AMessage; +import de.dlr.davinspector.plugin.IViewPlugin; + + +/** + * The RecordingPlugin enables the user to record the network traffic to the default or a + * user specific file. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public class RecordingPlugin implements IViewPlugin { + + /** + * State of the plugin. + */ + private Boolean isActive = true; + + /** + * The UI of the RecordingPlugin. + */ + private RecordingConfigurationPanel myPanel = null; + + /** + * The filename of the file to which the data is written. + */ + private String myFilename; + + /** + * The BufferedWriter for writing the data to the file. + */ + private BufferedWriter myBufferedWriter = null; + + /** + * This saves side assigned to the current plugin object. + */ + private Direction myDirection; + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IViewPlugin#getUI() + */ + public JComponent getUI() { + return myPanel; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#clear() + */ + public void clear() { + // do nothing ... + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#getAuthor() + */ + public String getAuthor() { + return "Jochen Wuest"; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#getDescription() + */ + public String getDescription() { + return "This plugin enables the user to record network traffic to a file."; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#getName() + */ + public String getName() { + return "Recording Plugin"; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#getType() + */ + public PlugInType getType() { + return PlugInType.VIEW_GENERAL; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#getVersion() + */ + public int getVersion() { + return 1; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#init() + */ + public void init(Direction direction) { + myDirection = direction; + if (myPanel == null) { + myPanel = new RecordingConfigurationPanel(this); + } + myFilename = myPanel.getFilename(); + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#shutdown() + */ + public void shutdown() { + if (myBufferedWriter != null) { + try { + myBufferedWriter.close(); + } catch (IOException ioe) { + System.err.println(ioe.getMessage()); + } + myBufferedWriter = null; + } + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#isActive() + */ + public Boolean isActive() { + return isActive; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#setActive(java.lang.Boolean) + */ + public void setActive(Boolean state) { + isActive = state; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IPlugin#update(de.dlr.davinspector.history.AMessage) + */ + public void update(AMessage msg) { + if (isActive) { + // if not already initialized, initialize the BufferedWriter + if (myBufferedWriter == null) { + openBufferedWriter(); + } + try { + myBufferedWriter.append(msg.getRawData()); + } catch (IOException ioe) { + System.err.println(ioe.getMessage()); + } + } + } + + /** + * This method opens the file <code>myFilename</code> and + * initializes the <code>BufferedWriter</code>. + * + */ + private void openBufferedWriter() { + if (myBufferedWriter == null) { + File recordFile = new File(myFilename); + try { + // Append data to the choosen file. + FileWriter fileWriter = new FileWriter(recordFile, true); + myBufferedWriter = new BufferedWriter(fileWriter); + } catch (IOException ioe) { + System.err.println(ioe.getMessage()); + } + } + } + + /** + * This method sets the filename to write the data to. + * + * @param file The choosen file object. + */ + public void setRecordingFile(File file) { + myFilename = file.getAbsolutePath(); + } + + /** + * Return the side the current plugin object is assigned to. + * + * @return Returns the direction of the plugin object. + */ + public Direction getDirection() { + return myDirection; + } +} Added: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/package.html =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/package.html (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/package.html 2008-03-08 19:35:31 UTC (rev 79) @@ -0,0 +1,6 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" +"http://www.w3.org/TR/REC-html40/loose.dtd"> + +<html><head><title>Recording Plugin</title></head><body> +This package contains all classes needed to record network traffic to a file. +</body></html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-10 14:31:05
|
Revision: 84 http://davinspector.svn.sourceforge.net/davinspector/?rev=84&view=rev Author: wuest Date: 2008-03-10 07:31:00 -0700 (Mon, 10 Mar 2008) Log Message: ----------- JUnit test case for http parser. Not complete. Initial commit. Added Paths: ----------- trunk/DAVInspector/test/ trunk/DAVInspector/test/de/ trunk/DAVInspector/test/de/dlr/ trunk/DAVInspector/test/de/dlr/davinspector/ trunk/DAVInspector/test/de/dlr/davinspector/http/ trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java Added: trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java =================================================================== --- trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java (rev 0) +++ trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java 2008-03-10 14:31:00 UTC (rev 84) @@ -0,0 +1,176 @@ +/* + * HTTPTest.java + * + * TODO: wues_ha Enter comment! + * + * Created: 10.03.2008 wues_ha <email> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.http; + +import static org.junit.Assert.fail; + +import java.util.Calendar; +import java.util.Date; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import de.dlr.davinspector.history.AMessage; +import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.history.AMessage.MessageDirection; + + +public class HTTPTest { + + private AMessage message; + private Date timestamp; + private Boolean direction; + private String data; + private static int idCounter = 0; + + @BeforeClass //once + public static void setUpBeforeClass() throws Exception { + + } + + @AfterClass //once + public static void tearDownAfterClass() throws Exception { + } + + @Before + public void setUp() throws Exception { + idCounter++; + timestamp = new Date(); + direction = false; + data = "This is a test"; + message = new Message(); + message.setMessageDirection(direction); + message.setRawData(data); + message.setTimestamp(timestamp); + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGetId() { + Assert.assertEquals(idCounter, message.getId()); + } + + @Test + public void testGetTimestamp() { + Assert.assertEquals(timestamp, message.getTimestamp()); + } + + @Test + public void testSetTimestamp() { + Calendar cal = Calendar.getInstance(); + cal.set(2008, 11, 11, 11, 11, 11); + timestamp = cal.getTime(); + message.setTimestamp(timestamp); + Assert.assertEquals(timestamp, message.getTimestamp()); + } + + @Test + public void testGetMessageDirection() { + Assert.assertEquals(MessageDirection.Request, message.getMessageDirection()); + } + + @Test + public void testSetMessageType() { + MessageDirection msgDir = message.getMessageDirection(); + if (msgDir == MessageDirection.Request) { + msgDir = MessageDirection.Response; + } else { + msgDir = MessageDirection.Request; + } + message.setMessageType(msgDir); + Assert.assertEquals(msgDir, message.getMessageDirection()); + } + + @Test + public void testSetMessageDirection() { + Boolean toClient; + MessageDirection msgDir = message.getMessageDirection(); + if (msgDir == MessageDirection.Request) { + toClient = true; + msgDir = MessageDirection.Response; + } else { + toClient = false; + msgDir = MessageDirection.Request; + } + message.setMessageDirection(toClient); + Assert.assertEquals(msgDir, message.getMessageDirection()); + } + + @Test + public void testGetSize() { + Assert.assertEquals(data.length(), message.getSize()); + } + + @Test + public void testGetRawData() { + Assert.assertEquals(data, message.getRawData()); + } + + @Test + public void testSetRawData() { + String testdata = "Mir lose de Dom in koelle."; + message.setRawData(testdata); + Assert.assertEquals(testdata, message.getRawData()); + } + + @Test + public void testGetMessageHeader() { + fail("Not yet implemented"); + } + + @Test + public void testGetRawHeader() { + fail("Not yet implemented"); + } + + @Test + public void testGetMessageBody() { + fail("Not yet implemented"); + } + + @Test + public void testGetRawBody() { + fail("Not yet implemented"); + } + + @Test + public void testParseMessage() { + fail("Not yet implemented"); + } + + @Test + public void testIsComplete() { + fail("Not yet implemented"); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-12 16:13:36
|
Revision: 86 http://davinspector.svn.sourceforge.net/davinspector/?rev=86&view=rev Author: wuest Date: 2008-03-12 09:13:29 -0700 (Wed, 12 Mar 2008) Log Message: ----------- Added documentation to HTTPMessageParser. Modified Paths: -------------- trunk/DAVInspector/.classpath trunk/DAVInspector/logging.properties trunk/DAVInspector/plugin-config.properties trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java Modified: trunk/DAVInspector/.classpath =================================================================== --- trunk/DAVInspector/.classpath 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/.classpath 2008-03-12 16:13:29 UTC (rev 86) @@ -1,11 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry exported="true" kind="lib" path="lib/commons-logging.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:platform:/resource/DAVInspector/lib/commons-logging-javadoc.jar!/"/> - </attributes> - </classpathentry> + <classpathentry kind="src" path="test"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="lib/commons-logging.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/DAVInspector/logging.properties =================================================================== --- trunk/DAVInspector/logging.properties 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/logging.properties 2008-03-12 16:13:29 UTC (rev 86) @@ -1,8 +1,9 @@ # Add a FileHandler handlers=java.util.logging.FileHandler -# Default global logging level. -.level = ALL +# global +java.util.logging.level=FINE # Describes specific configuration info for the Handlers. -java.util.logging.FileHandler.pattern = log/relay.log -java.util.logging.FileHandler.limit = 50000 -java.util.logging.FileHandler.count = 1 +java.util.logging.FileHandler.level=FINEST +java.util.logging.FileHandler.pattern=log/relay.log +java.util.logging.FileHandler.limit=50000 +java.util.logging.FileHandler.count=1 Modified: trunk/DAVInspector/plugin-config.properties =================================================================== --- trunk/DAVInspector/plugin-config.properties 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/plugin-config.properties 2008-03-12 16:13:29 UTC (rev 86) @@ -1,3 +1,3 @@ -#Fri Feb 29 14:08:56 CET 2008 +#Thu Mar 06 14:38:28 CET 2008 PluginsServer= PluginsClient= Modified: trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-12 16:13:29 UTC (rev 86) @@ -25,6 +25,9 @@ package de.dlr.davinspector; +import java.io.FileInputStream; +import java.io.IOException; + import de.dlr.davinspector.relay.IRelayModel; import de.dlr.davinspector.relay.RelayModel; import de.dlr.davinspector.ui.MainController; @@ -49,6 +52,13 @@ * @param args String[] */ public static void main(String[] args) { + // init java internal logging + try { + FileInputStream file = new FileInputStream("logging.properties"); + java.util.logging.LogManager.getLogManager().readConfiguration(file); + } catch (IOException ioe) { + System.err.println(ioe); + } // TODO: i18n //Locale loc = Locale.getDefault(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-12 16:13:29 UTC (rev 86) @@ -35,6 +35,11 @@ * @author Jochen Wuest */ public final class Constant { + + /** + * Basis of the hexadecimal number system. + */ + public static final int HEX_RADIX = 16; /** * Main window width. Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-03-12 16:13:29 UTC (rev 86) @@ -187,7 +187,7 @@ /** * TODO: wues_ha: Enter comment! - * + * @return String */ public String parseMessage() { return ""; Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-12 16:13:29 UTC (rev 86) @@ -107,6 +107,7 @@ public void storeMessage(String data, Boolean toClient, Date timestamp) { //TODO: add decorator dependent on protocol (switch http, ...). + //INFO: idCounter != number of messages HTTPMessageParser message = new HTTPMessageParser(new Message()); message.setMessageDirection(toClient); @@ -124,9 +125,6 @@ } else { myServersideBuffer = carry; } - System.err.println("Complete\n"); - } else { - System.err.println("Not Complete\n"); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-12 16:13:29 UTC (rev 86) @@ -28,19 +28,30 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.history.AMessageParser; +import de.dlr.davinspector.relay.RelayModel; /** * This class is a very simple approach to parse http messages. - * TODO: Add comments and logging. + * More information: + * HTTP/1.1 RFC 2616 + * HTTP/1.0 RFC 1945 + * * @version $LastChangedRevision$ * @author Jochen Wuest */ public class HTTPMessageParser extends AMessageParser { /** - * + * This expression matches the http request line. + * (METHOD) SPACE (URL) SPACE (VERSION) CRLF + * RFC 2616: Request-Line = Method SP Request-URI SP HTTP-Version CRLF + * TODO: URL scanning not complete. */ private static final String REGEX_HTTP_REQUEST_LINE = "^(\\bUNKNOWN\\b|\\bHEAD\\b|\\bGET\\b|\\bPOST\\b|\\bPUT\\b|" + "\\bDELETE\\b|\\bOPTIONS\\b|\\bTRACE\\b|\\bCONNECT\\b|\\bPROPFIND\\b|\\bPROPPATCH\\b|\\bMKCOL\\b|" @@ -49,37 +60,68 @@ + " (\\bHTTP/1.1\\b|\\bHTTP/1.0\\b|\\bHTTP/0.9\\b){1}\r\n"; /** - * + * This expression matches the http status line. + * (VERSION) SPACE (STATUS-CODE) SPACE (REASON) CRLF + * RFC 2616: Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF */ private static final String REGEX_HTTP_STATUS_LINE = "^(\\bHTTP/1.1\\b|\\bHTTP/1.0\\b|\\bHTTP/0.9\\b){1}" + " ([0-9]{3})" + " ([\\w|-]+)\r\n"; /** - * + * This expression matches an empty line. These empty lines divide a message + * into header and body. If the data is chunk-encoded, the chunks are also divided by an empty line. */ private static final String REGEX_EMPTY_LINE = "\r\n\r\n"; /** - * + * This expression matches the content-length information of a http message. + * Content-length: SPACE* (LENGTH) CRLF */ private static final String REGEX_CONTENT_LENGTH = "Content-length:[ ]*([0-9]+)\r\n"; /** - * Currently no chunk extensions are handled. - * chunk-extension = ( ";" chunk-ext-name [ "=" chunk-ext-val ] ). + * This expression matches the length information of a chunk. + * CRLF (LENGTH-IN-HEX) CRLF + * INFO: Currently no chunk extensions are handled. */ private static final String REGEX_CHUNK_SIZE = "\r\n([0-9a-fA-F]+)\r\n"; /** - * Currently no transfer extensions are handled. + * This expression matches the transfer encoding of a message. + * Transfer-Encoding: SPACE* chunked CRLF + * INFO: Currently no transfer extensions are handled. */ private static final String REGEX_IS_CHUNKED = "Transfer-Encoding:[ ]*chunked\r\n"; + + /** + * Logger, Apache Commons Logging. + */ + private static Log myLogger = LogFactory.getLog(RelayModel.class); - private String method; - private int status = 0; - private String protocolVersion = ""; + /** + * The http request method. + */ + private String myMethod; + + /** + * The http response status code. + */ + private int myStatusCode = 0; + + /** + * Version of the http protocol uesed by the message. + */ + private String myProtocolVersion = ""; + + /** + * <code>True</code> if the message uses chunked encoding. + */ private Boolean isChunked = false; + + /** + * Length of the message body in bytes. + */ private int myContentLength = 0; /** @@ -93,6 +135,7 @@ } /** + * TODO: wues_ha: Enter comment! * */ private void extractHeaderBody() { @@ -107,9 +150,12 @@ * {@inheritDoc} * * @see de.dlr.davinspector.history.AMessageParser#parseMessage() - */ + */ public String parseMessage() { -System.out.println("\n" + myDirection); + myLogger.debug("\n" + myDirection); + + String carryover = ""; + myParsedHeader = ""; myRawHeader = ""; myParsedBody = ""; @@ -119,68 +165,62 @@ Pattern pattern = Pattern.compile(REGEX_HTTP_STATUS_LINE, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(myRawData); if (matcher.find()) { -System.out.println("found status line"); - method = ""; // TODO: set last method - status = Integer.parseInt(matcher.group(2)); - protocolVersion = matcher.group(1); + myLogger.debug("found status line"); + myMethod = ""; // TODO: set last method + myStatusCode = Integer.parseInt(matcher.group(2)); + myProtocolVersion = matcher.group(1); isChunked = isChunked(); myContentLength = getContentLength(); } else { - System.out.println("No status line found."); - return ""; + myLogger.debug("No status line found."); } - } else { Pattern pattern = Pattern.compile(REGEX_HTTP_REQUEST_LINE, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(myRawData); if (matcher.find()) { -System.out.println("found request line"); - method = matcher.group(1); - status = 0; - protocolVersion = matcher.group(3); + myLogger.debug("found request line"); + myMethod = matcher.group(1); + myStatusCode = 0; + myProtocolVersion = matcher.group(3); isChunked = false; myContentLength = getContentLength(); } else { - System.out.println("No request line found."); - return ""; + myLogger.debug("No request line found."); } } -System.out.println("###############"); -System.out.println("Method:" + method); -System.out.println("Status:" + status); -System.out.println("Version:" + protocolVersion); -System.out.println("Len:" + myContentLength); -System.out.println("Chunked:" + isChunked); -System.out.println("###############"); + if (myLogger.isDebugEnabled()) { + myLogger.debug("###############"); + myLogger.debug("Method:" + myMethod); + myLogger.debug("Status:" + myStatusCode); + myLogger.debug("Version:" + myProtocolVersion); + myLogger.debug("Len:" + myContentLength); + myLogger.debug("Chunked:" + isChunked); + myLogger.debug("###############"); + } - // versuchen eine nachricht lesen extractHeaderBody(); - - String carryover = ""; - myParsedHeader = myRawHeader; // Content-length = 0 or no body -> empty body - if (status != HTTPStatusCode.HTTP_MULTISTATUS && (myContentLength == 0 || !hasBody())) { -System.out.println("no body"); + // TODO: && content-encoding != chunked + if (myStatusCode != HTTPStatusCode.HTTP_MULTISTATUS && (myContentLength == 0 || !hasBody())) { + myLogger.debug("no body"); myParsedBody = ""; - carryover = ""; // TODO + carryover = ""; // TODO: myParsingState = true; } else { if (isChunked) { -System.out.println("decode chunk"); + myLogger.debug("decode chunked encoding"); myParsedBody = decodeChunkedEncoding(myRawBody); - carryover = ""; // TODO + carryover = ""; // TODO: if (!myParsingState) { -System.out.println("decode chunk not finished"); - return ""; + myLogger.debug("decoding chunked encoding not finished"); } } else { -System.out.println("normal msg"); + myLogger.debug("normal message"); if (myContentLength > myRawBody.length()) { -System.out.println("early return"); - return ""; + myLogger.debug("normal message not finished"); } myParsedBody = myRawBody.substring(0, myContentLength); carryover = myRawBody.substring(myContentLength, myRawBody.length()); @@ -188,9 +228,7 @@ } } -System.out.println("Body:" + myParsedBody); -System.out.println("Carry:" + carryover); -System.out.println("------------------\n"); + myLogger.debug("Carry:" + carryover + "\n\n"); return carryover; } @@ -204,17 +242,17 @@ */ private Boolean hasBody() { if (myDirection == MessageDirection.Response) { - if (status == HTTPStatusCode.HTTP_CONTINUE - || status == HTTPStatusCode.HTTP_SWITCHING_PROTOCOLS - || status == HTTPStatusCode.HTTP_NO_CONTENT - || status == HTTPStatusCode.HTTP_NOT_MODIFIED) { + if (myStatusCode == HTTPStatusCode.HTTP_CONTINUE + || myStatusCode == HTTPStatusCode.HTTP_SWITCHING_PROTOCOLS + || myStatusCode == HTTPStatusCode.HTTP_NO_CONTENT + || myStatusCode == HTTPStatusCode.HTTP_NOT_MODIFIED) { // status code 1xx, 204, and 304 -> no body return false; } } else { - if (method == HTTPMethod.HTTP_METHOD_GET - || method == HTTPMethod.HTTP_METHOD_HEAD - || method == HTTPMethod.HTTP_METHOD_OPTIONS) { + if (myMethod == HTTPMethod.HTTP_METHOD_GET + || myMethod == HTTPMethod.HTTP_METHOD_HEAD + || myMethod == HTTPMethod.HTTP_METHOD_OPTIONS) { // Method Get, Head, options, ... -> no body return false; } @@ -222,6 +260,12 @@ return true; } + /** + * This method returns the content length of the message body in bytes. + * If no content length information is found, the method returns zero. + * + * @return Integer specifying the length of the message body in byte. + */ private int getContentLength() { Pattern pattern = Pattern.compile(REGEX_CONTENT_LENGTH, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(myRawData); @@ -245,31 +289,55 @@ return false; } + /** + * TODO: wues_ha: Enter comment! + * + * @see RFC 2616: 3.6.1 Chunked Transfer Coding + * Chunked-Body = *chunk + * last-chunk + * trailer + * CRLF + * + * chunk = chunk-size [ chunk-extension ] CRLF + * chunk-data CRLF + * chunk-size = 1*HEX + * last-chunk = 1*("0") [ chunk-extension ] CRLF + * + * @param data String + * @return String + */ private String decodeChunkedEncoding(String data) { - int length = 0; + // size of the current chunk int chunksize = 0; + // number of chunks int parts = 0; + // the decoded content String result = ""; + // the last chunk is empty and has a length of 0 + // have we already read the last chunk? Boolean readEmptyChunk = false; // read chunk-size, chunk-extension (if any) and CRLF + // INFO: chunk-extensions are currently ignored Pattern pattern = Pattern.compile(REGEX_CHUNK_SIZE); Matcher matcher = pattern.matcher(myRawData); while (matcher.find()) { parts++; - // hex umwandlung? - chunksize = Integer.parseInt(matcher.group(1), 16); + // convert content-length value from hex string to int + chunksize = Integer.parseInt(matcher.group(1), Constant.HEX_RADIX); + // the last chunk is empty and has a length of 0 if (chunksize == 0) { readEmptyChunk = true; -System.out.println("LAST CHUNK " + parts); + myLogger.debug("Last chunk: " + parts); } int start = matcher.end(); int stopp = matcher.end() + chunksize; -System.out.println("CHUNK " + parts); result += myRawData.substring(start, stopp); -System.out.println(start + " - " + stopp); + + myLogger.debug("Chunk: " + parts); + myLogger.debug("Chunk from index " + start + " to " + stopp); } - + // if we read the last chunk, the parsing is complete. myParsingState = readEmptyChunk; return result; } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-12 16:13:29 UTC (rev 86) @@ -87,7 +87,7 @@ /** * */ - private IRelayModel myLock = null; + private IRelayModel myRelay = null; /** * @@ -107,7 +107,7 @@ Log logger, List<ChannelThread> connections) { myInputSocket = inputSocket; myOutputSocket = outputSocket; - myLock = relay; + myRelay = relay; myLogger = logger; myConnections = connections; } @@ -126,39 +126,39 @@ try { count = in.read(buffer); while ((count != Constant.EOF) && !isInterrupted()) { - synchronized (myLock) { + synchronized (myRelay) { // TODO: add encoding to configuration and set encoding from configuration - myLock.updateData(new String(buffer, 0, count, "utf-8"), myDirection); + myRelay.updateData(new String(buffer, 0, count, "utf-8"), myDirection); } count = in.read(buffer); } } catch (IOException ioe) { myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } finally { - myLogger.info(myThreadName + COLON + "flushing"); + myLogger.debug(myThreadName + COLON + "flushing"); flushOut(); } } catch (IOException ioe) { myLogger.error(myThreadName + ioe.getMessage(), ioe); } - synchronized (myLock) { + synchronized (myRelay) { myDone = true; try { if ((myPeer == null) || myPeer.isDone()) { // if the peer is already closed or has transferred all data, shutdown myInputSocket.close(); myOutputSocket.close(); - myLogger.info(myThreadName + COLON + "closing"); + myLogger.debug(myThreadName + COLON + "closing"); } else { // signal the peer we are done myPeer.interrupt(); - myLogger.info(myThreadName + COLON + "interrupting peer"); + myLogger.debug(myThreadName + COLON + "interrupting peer"); } } catch (IOException ioe) { myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } finally { - myLogger.info(myThreadName + COLON + "removing connection"); + myLogger.debug(myThreadName + COLON + "removing connection"); myConnections.remove(this); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-11 17:39:06 UTC (rev 85) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-12 16:13:29 UTC (rev 86) @@ -241,7 +241,7 @@ * @see java.lang.Thread#run() */ public void run() { - myLogger.info("Relay is starting"); + myLogger.debug("Relay is starting"); try { while (!isInterrupted()) { //looping Socket serverSideSocket = serverSocket.accept(); @@ -280,7 +280,7 @@ myLogger.error(ioe.getMessage(), ioe); } finally { cleanup(); - myLogger.info("Relay stopped"); + myLogger.debug("Relay stopped"); } } @@ -292,16 +292,16 @@ * @see de.dlr.davinspector.relay.IRelayModel#stopRelay() */ public void stopRelay() { - myLogger.info("stopping stage 1"); + myLogger.debug("stopping stage 1"); try { this.interrupt(); // this.join(); } catch (SecurityException se) { - myLogger.info(se); + myLogger.debug(se); // } catch (InterruptedException ie) { // myLogger.info(ie); } - myLogger.info("stopping stage 2"); + myLogger.debug("stopping stage 2"); } /** @@ -309,7 +309,7 @@ */ private void cleanup() { synchronized (lock) { - myLogger.info("stopping stage 3"); + myLogger.debug("stopping stage 3"); try { while (connections.size() > 0) { ChannelThread channelThread = (ChannelThread) connections.get(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-17 15:57:52
|
Revision: 87 http://davinspector.svn.sourceforge.net/davinspector/?rev=87&view=rev Author: wuest Date: 2008-03-17 08:57:00 -0700 (Mon, 17 Mar 2008) Log Message: ----------- Added Apache log4j. XML-errors are now displayed by the XML-Plugins in a text area. Modified Paths: -------------- trunk/DAVInspector/.classpath trunk/DAVInspector/build-user.xml trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java Added Paths: ----------- trunk/DAVInspector/lib/log4j.jar Modified: trunk/DAVInspector/.classpath =================================================================== --- trunk/DAVInspector/.classpath 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/.classpath 2008-03-17 15:57:00 UTC (rev 87) @@ -3,7 +3,8 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="test"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="lib" path="lib/commons-logging.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> + <classpathentry kind="lib" path="C:/Dokumente und Einstellungen/wues_ha/workspace/DAVInspector/lib/log4j.jar"/> + <classpathentry kind="lib" path="C:/Dokumente und Einstellungen/wues_ha/workspace/DAVInspector/lib/commons-logging.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/build-user.xml 2008-03-17 15:57:00 UTC (rev 87) @@ -67,7 +67,7 @@ <manifest> <attribute name="Main-Class" value="de/dlr/davinspector.DAVInspector"/> <attribute name="Built-By" value="${user.name}"/> - <attribute name="Class-Path" value=". lib/commons-logging.jar logging.properties"/> + <attribute name="Class-Path" value=". lib/commons-logging.jar logging.properties lib/log4j.jar"/> <section name="DAVInspector"> <attribute name="Specification-Title" value="${project.name}"/> Added: trunk/DAVInspector/lib/log4j.jar =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/lib/log4j.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-17 15:57:00 UTC (rev 87) @@ -25,16 +25,18 @@ package de.dlr.davinspector.http; +import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.log4j.FileAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.SimpleLayout; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.history.AMessageParser; -import de.dlr.davinspector.relay.RelayModel; /** * This class is a very simple approach to parse http messages. @@ -95,9 +97,9 @@ private static final String REGEX_IS_CHUNKED = "Transfer-Encoding:[ ]*chunked\r\n"; /** - * Logger, Apache Commons Logging. + * Logger, Apache log4j. */ - private static Log myLogger = LogFactory.getLog(RelayModel.class); + private static Logger myLogger = Logger.getLogger("de.dlr.http.HTTPMessageParser"); /** * The http request method. @@ -132,6 +134,16 @@ public HTTPMessageParser(AMessage aMessage) { super(aMessage); myParsingState = false; + // configure logging + SimpleLayout layout = new SimpleLayout(); + try { + FileAppender fileAppender = new FileAppender(layout, "HTTPMessageParser.log", false); + myLogger.addAppender(fileAppender); + // ALL | DEBUG | INFO | WARN | ERROR | FATAL | OFF: + myLogger.setLevel(Level.ALL); + } catch (IOException ioe) { + System.err.println("Could not initilaize logger! " + ioe.getMessage()); + } } /** @@ -151,8 +163,9 @@ * * @see de.dlr.davinspector.history.AMessageParser#parseMessage() */ - public String parseMessage() { - myLogger.debug("\n" + myDirection); + public String parseMessage() { + myLogger.debug("---- new data event ----"); + myLogger.debug("Direction: " + myDirection); String carryover = ""; @@ -203,8 +216,7 @@ myParsedHeader = myRawHeader; // Content-length = 0 or no body -> empty body - // TODO: && content-encoding != chunked - if (myStatusCode != HTTPStatusCode.HTTP_MULTISTATUS && (myContentLength == 0 || !hasBody())) { + if (!isChunked && (myContentLength == 0 || !hasBody())) { myLogger.debug("no body"); myParsedBody = ""; carryover = ""; // TODO: @@ -222,13 +234,18 @@ if (myContentLength > myRawBody.length()) { myLogger.debug("normal message not finished"); } + // TODO: ung\xFCltige l\xE4nge abfangen! + if (myContentLength > myRawBody.length()) { + myContentLength = myRawBody.length(); + myLogger.debug("invalid content length"); + } myParsedBody = myRawBody.substring(0, myContentLength); carryover = myRawBody.substring(myContentLength, myRawBody.length()); myParsingState = true; } } - myLogger.debug("Carry:" + carryover + "\n\n"); + myLogger.debug("Carry: " + carryover.length()); return carryover; } @@ -270,6 +287,7 @@ Pattern pattern = Pattern.compile(REGEX_CONTENT_LENGTH, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(myRawData); if (matcher.find()) { + myLogger.debug("content length found: " + matcher.group(1)); return Integer.parseInt(matcher.group(1)); } return 0; @@ -284,6 +302,7 @@ Pattern pattern = Pattern.compile(REGEX_IS_CHUNKED, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(myRawData); if (matcher.find()) { + myLogger.debug("message is chunked"); return true; } return false; @@ -332,10 +351,21 @@ } int start = matcher.end(); int stopp = matcher.end() + chunksize; - result += myRawData.substring(start, stopp); - + + // TODO: ung\xFCltige l\xE4ngen abfangen! + if (stopp > myRawData.length()) { + myLogger.debug("chunk decoding: invalid right boundary " + stopp); + stopp = myRawData.length(); + } + if (start < 0) { + myLogger.debug("chunk decoding: invalid left boundary " + start); + start = 0; + } + myLogger.debug("Chunk: " + parts); myLogger.debug("Chunk from index " + start + " to " + stopp); + + result += myRawData.substring(start, stopp); } // if we read the last chunk, the parsing is complete. myParsingState = readEmptyChunk; Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java 2008-03-17 15:57:00 UTC (rev 87) @@ -30,6 +30,7 @@ import java.util.Iterator; import java.util.Map; +import javax.swing.JTextArea; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Element; @@ -59,16 +60,18 @@ /** * Character/s for indent. */ - private static final String INDENT = " "; + private static final String INDENT = " "; /** * */ private static final Color STYLE_XML_TAG = Color.BLUE; + /** * */ private static final Color STYLE_XML_CONTENT = Color.BLACK; + /** * */ @@ -108,13 +111,20 @@ * String buffer for the start tag. */ private String myBufferStartTag; + + /** + * This text area displays errors. + */ + private JTextArea myJTextAreaError; /** * Constructor, initializes all buffers and sets up the document. * * @param document StyledDocument + * @param jTextAreaError JTextArea */ - public JTextPaneContentHandler(StyledDocument document) { + public JTextPaneContentHandler(StyledDocument document, JTextArea jTextAreaError) { + myJTextAreaError = jTextAreaError; namespaceMappings = new HashMap<String, String>(); myStyledDocument = document; Element rootElement = myStyledDocument.getDefaultRootElement(); @@ -142,7 +152,8 @@ try { myStyledDocument.insertString(myStyledDocument.getLength(), text, myAttributeSet); } catch (BadLocationException ble) { - System.err.println(ble); + // INFO: Maybe logger instead? + myJTextAreaError.append(ble.getMessage() + ": " + ble.offsetRequested()); } myStyledDocument.setCharacterAttributes(myStyledDocument.getLength() - text.length(), text.length(), attributeSet, false); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-17 15:57:00 UTC (rev 87) @@ -25,9 +25,12 @@ package de.dlr.davinspector.plugins.xmlplugin; +import java.awt.SystemColor; import java.io.IOException; import javax.swing.JComponent; +import javax.swing.JSplitPane; +import javax.swing.JTextArea; import org.xml.sax.SAXException; @@ -45,6 +48,11 @@ public class XMLPlugin implements IViewPlugin { /** + * + */ + private static final double SPLITTER_POSITION = 0.8; + + /** * State of the plugin. */ private Boolean isActive = true; @@ -52,7 +60,17 @@ /** * The GUI object. */ + private JSplitPane jSplitPane; + + /** + * This text pane displays the formated XML. + */ private XMLTextPane myXMLTextPane; + + /** + * This text area displays XML errors. + */ + private JTextArea jTextArea; /** * {@inheritDoc} @@ -60,7 +78,7 @@ * @see de.dlr.DAVInspector.Plugin.IViewPlugin#getUI() */ public JComponent getUI() { - return myXMLTextPane; + return jSplitPane; } /** @@ -114,11 +132,23 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ public void init(Direction direction) { - if (myXMLTextPane == null) { + if (jSplitPane == null) { + jTextArea = new JTextArea(); + jTextArea.setLineWrap(true); + jTextArea.setEditable(false); + jTextArea.setForeground(SystemColor.RED); + myXMLTextPane = new XMLTextPane(); myXMLTextPane.setEditable(false); + + jSplitPane = new JSplitPane(); + jSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); + jSplitPane.setResizeWeight(SPLITTER_POSITION); + jSplitPane.setBottomComponent(jTextArea); + jSplitPane.setTopComponent(myXMLTextPane); } myXMLTextPane.setText(""); + jTextArea.setText(""); Util.setUIDesign(); } @@ -157,12 +187,12 @@ public void update(AMessage msg) { if (isActive && myXMLTextPane != null) { try { - myXMLTextPane.init(msg.getMessageBody()); + myXMLTextPane.init(msg.getMessageBody(), jTextArea); } catch (SAXException se) { - System.err.println(se.getMessage()); + jTextArea.append(se.getMessage()); } catch (IOException ioe) { - System.err.println(ioe.getMessage()); - } + jTextArea.append(ioe.getMessage()); + } } } @@ -174,6 +204,7 @@ public void clear() { if (myXMLTextPane != null) { myXMLTextPane.setText(""); + jTextArea.setText(""); } } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java 2008-03-17 15:57:00 UTC (rev 87) @@ -29,6 +29,7 @@ import java.io.IOException; import java.io.StringReader; +import javax.swing.JTextArea; import javax.swing.JTextPane; import javax.swing.text.StyledDocument; @@ -56,13 +57,12 @@ * The document. */ private StyledDocument myDocument; - + /** * Constructor, empty. */ public XMLTextPane() { -// myDocument = new XmlStyledDocument(); -// setStyledDocument(myDocument); + } /** @@ -93,17 +93,18 @@ * This method initializes the <code>StyledDocument</code> and starts the XML parser. * * @param xmlInput String + * @param jTextAreaError JTextArea * @throws IOException if IO fails * @throws SAXException if SAX fails */ - public void init(String xmlInput) throws IOException, SAXException { + public void init(String xmlInput, JTextArea jTextAreaError) throws IOException, SAXException { setText(""); myDocument = getStyledDocument(); if (!xmlInput.trim().equals("")) { // Create instances needed for parsing XMLReader reader = XMLReaderFactory.createXMLReader(); - ContentHandler jTextPaneContentHandler = new JTextPaneContentHandler(myDocument); + ContentHandler jTextPaneContentHandler = new JTextPaneContentHandler(myDocument, jTextAreaError); // Register content handler reader.setContentHandler(jTextPaneContentHandler); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-17 15:57:00 UTC (rev 87) @@ -25,9 +25,12 @@ package de.dlr.davinspector.plugins.xmltreeplugin; +import java.awt.SystemColor; import java.io.IOException; import javax.swing.JComponent; +import javax.swing.JSplitPane; +import javax.swing.JTextArea; import org.xml.sax.SAXException; @@ -43,6 +46,11 @@ * @author Jochen Wuest */ public class XMLTreePlugin implements IViewPlugin { + + /** + * + */ + private static final double SPLITTER_POSITION = 0.8; /** * State of the plugin. @@ -50,6 +58,16 @@ private Boolean isActive = true; /** + * The GUI object. + */ + private JSplitPane jSplitPane; + + /** + * This text area displays XML errors. + */ + private JTextArea jTextArea; + + /** * The XMLTree component. */ private XMLTreeView myXMLTreeView; @@ -60,7 +78,7 @@ * @see de.dlr.DAVInspector.Plugin.IViewPlugin#getUI() */ public JComponent getUI() { - return myXMLTreeView; + return jSplitPane; } /** @@ -114,11 +132,24 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ public void init(Direction direction) { - if (myXMLTreeView == null) { + if (jSplitPane == null) { + jTextArea = new JTextArea(); + jTextArea.setLineWrap(true); + jTextArea.setEditable(false); + jTextArea.setForeground(SystemColor.RED); + myXMLTreeView = new XMLTreeView(); - } + myXMLTreeView.setEditable(false); + + jSplitPane = new JSplitPane(); + jSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); + jSplitPane.setResizeWeight(SPLITTER_POSITION); + jSplitPane.setBottomComponent(jTextArea); + jSplitPane.setTopComponent(myXMLTreeView); + } + jTextArea.setText(""); + updateTree(""); Util.setUIDesign(); - updateTree(""); } /** @@ -168,9 +199,9 @@ try { myXMLTreeView.init(data); } catch (SAXException se) { - System.err.println(se); + jTextArea.append(se.getMessage()); } catch (IOException ioe) { - System.err.println(ioe); + jTextArea.append(ioe.getMessage()); } } Modified: trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java =================================================================== --- trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java 2008-03-12 16:13:29 UTC (rev 86) +++ trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java 2008-03-17 15:57:00 UTC (rev 87) @@ -25,7 +25,6 @@ package de.dlr.davinspector.http; -import static org.junit.Assert.fail; import java.util.Calendar; import java.util.Date; @@ -38,27 +37,67 @@ import org.junit.Test; import de.dlr.davinspector.history.AMessage; +import de.dlr.davinspector.history.AMessage.MessageDirection; import de.dlr.davinspector.history.Message; -import de.dlr.davinspector.history.AMessage.MessageDirection; +/** + * TODO: wues_ha: Enter comment! + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ public class HTTPTest { + /** + * + */ + private static int idCounter = 0; + + /** + * + */ private AMessage message; + + /** + * + */ private Date timestamp; + + /** + * + */ private Boolean direction; + + /** + * + */ private String data; - private static int idCounter = 0; + /** + * TODO: wues_ha: Enter comment! + * + * @throws Exception Exception + */ @BeforeClass //once public static void setUpBeforeClass() throws Exception { } + /** + * TODO: wues_ha: Enter comment! + * + * @throws Exception Exception + */ @AfterClass //once public static void tearDownAfterClass() throws Exception { } + /** + * TODO: wues_ha: Enter comment! + * + * @throws Exception Exception + */ @Before public void setUp() throws Exception { idCounter++; @@ -71,20 +110,37 @@ message.setTimestamp(timestamp); } + /** + * TODO: wues_ha: Enter comment! + * + * @throws Exception Exception + */ @After public void tearDown() throws Exception { } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetId() { Assert.assertEquals(idCounter, message.getId()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetTimestamp() { Assert.assertEquals(timestamp, message.getTimestamp()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testSetTimestamp() { Calendar cal = Calendar.getInstance(); @@ -94,11 +150,19 @@ Assert.assertEquals(timestamp, message.getTimestamp()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetMessageDirection() { Assert.assertEquals(MessageDirection.Request, message.getMessageDirection()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testSetMessageType() { MessageDirection msgDir = message.getMessageDirection(); @@ -111,6 +175,10 @@ Assert.assertEquals(msgDir, message.getMessageDirection()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testSetMessageDirection() { Boolean toClient; @@ -126,16 +194,28 @@ Assert.assertEquals(msgDir, message.getMessageDirection()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetSize() { Assert.assertEquals(data.length(), message.getSize()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetRawData() { Assert.assertEquals(data, message.getRawData()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testSetRawData() { String testdata = "Mir lose de Dom in koelle."; @@ -143,34 +223,58 @@ Assert.assertEquals(testdata, message.getRawData()); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetMessageHeader() { - fail("Not yet implemented"); + junit.framework.TestCase.fail("Not yet implemented"); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetRawHeader() { - fail("Not yet implemented"); + junit.framework.TestCase.fail("Not yet implemented"); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetMessageBody() { - fail("Not yet implemented"); + junit.framework.TestCase.fail("Not yet implemented"); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testGetRawBody() { - fail("Not yet implemented"); + junit.framework.TestCase.fail("Not yet implemented"); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testParseMessage() { - fail("Not yet implemented"); + junit.framework.TestCase.fail("Not yet implemented"); } + /** + * TODO: wues_ha: Enter comment! + * + */ @Test public void testIsComplete() { - fail("Not yet implemented"); + junit.framework.TestCase.fail("Not yet implemented"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-18 13:58:17
|
Revision: 88 http://davinspector.svn.sourceforge.net/davinspector/?rev=88&view=rev Author: wuest Date: 2008-03-18 06:58:05 -0700 (Tue, 18 Mar 2008) Log Message: ----------- Deleted Apache Commons Logging. Modified Paths: -------------- trunk/DAVInspector/.classpath trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java Removed Paths: ------------- trunk/DAVInspector/lib/commons-logging.jar trunk/DAVInspector/logging.properties Modified: trunk/DAVInspector/.classpath =================================================================== --- trunk/DAVInspector/.classpath 2008-03-17 15:57:00 UTC (rev 87) +++ trunk/DAVInspector/.classpath 2008-03-18 13:58:05 UTC (rev 88) @@ -5,6 +5,5 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="lib" path="C:/Dokumente und Einstellungen/wues_ha/workspace/DAVInspector/lib/log4j.jar"/> - <classpathentry kind="lib" path="C:/Dokumente und Einstellungen/wues_ha/workspace/DAVInspector/lib/commons-logging.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Deleted: trunk/DAVInspector/lib/commons-logging.jar =================================================================== (Binary files differ) Deleted: trunk/DAVInspector/logging.properties =================================================================== --- trunk/DAVInspector/logging.properties 2008-03-17 15:57:00 UTC (rev 87) +++ trunk/DAVInspector/logging.properties 2008-03-18 13:58:05 UTC (rev 88) @@ -1,9 +0,0 @@ -# Add a FileHandler -handlers=java.util.logging.FileHandler -# global -java.util.logging.level=FINE -# Describes specific configuration info for the Handlers. -java.util.logging.FileHandler.level=FINEST -java.util.logging.FileHandler.pattern=log/relay.log -java.util.logging.FileHandler.limit=50000 -java.util.logging.FileHandler.count=1 Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-17 15:57:00 UTC (rev 87) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-18 13:58:05 UTC (rev 88) @@ -99,7 +99,7 @@ /** * Logger, Apache log4j. */ - private static Logger myLogger = Logger.getLogger("de.dlr.http.HTTPMessageParser"); + private static Logger myLogger = Logger.getLogger(HTTPMessageParser.class); /** * The http request method. Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-17 15:57:00 UTC (rev 87) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-18 13:58:05 UTC (rev 88) @@ -33,6 +33,8 @@ import java.util.List; import java.util.Vector; +import org.apache.log4j.Logger; + import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; @@ -53,6 +55,11 @@ private static PluginManager instance = new PluginManager(); /** + * Logger, Apache log4j. + */ + private static Logger myLogger = Logger.getLogger(PluginManager.class); + + /** * Vector containing all loaded plugins. */ private List<IPlugin> myPluginVector = new Vector<IPlugin>(); @@ -89,10 +96,12 @@ public void loadAllPlugins() { File pluginDirectory = new File("plugins"); if (pluginDirectory.isDirectory()) { + myLogger.debug("Reading plugin directory"); String[] jarFiles = pluginDirectory.list(new JarFilenameFilter()); String pathToPluginDir = pluginDirectory.getAbsolutePath(); for (String jarFile : jarFiles) { File plug = new File(pathToPluginDir + "/" + jarFile); + myLogger.debug("Loading plugin: " + jarFile); loadPlugin(plug.getAbsoluteFile()); } } @@ -107,11 +116,14 @@ IPlugin plugin = null; String name = jarFile.getName().substring(0, jarFile.getName().lastIndexOf(".")); try { + myLogger.debug("Trying to load plugin: " + name); URLClassLoader jClassLoader = new URLClassLoader(new URL[] { jarFile.toURI().toURL() }); Class<?> c = jClassLoader.loadClass(Constant.PLUGIN_CLASSPATH + name.toLowerCase() + "." + name); // lets try to load the plugin... plugin = (IPlugin) c.newInstance(); + myLogger.debug("Plugin loaded: " + name); plugin.init(null); + myLogger.debug("Plugin initialised: " + name); // ok, the plugin is initialized if (plugin != null) { myPluginVector.add(plugin); @@ -126,14 +138,13 @@ myActivePluginsServer.add(plugin); } } catch (ClassNotFoundException cnfe) { - System.err.println(cnfe); + myLogger.warn("Class Not Found: " + cnfe.getMessage(), cnfe); } catch (InstantiationException ie) { - System.err.println(ie); + myLogger.warn("Instantiation: " + ie.getMessage(), ie); } catch (IllegalAccessException iae) { - System.err.println(iae); + myLogger.warn("Illegal Access: " + iae.getMessage(), iae); } catch (IOException ioe) { - System.err.println(ioe); - jarFile.delete(); + myLogger.warn("IO Error: " + ioe.getMessage(), ioe); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-17 15:57:00 UTC (rev 87) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-18 13:58:05 UTC (rev 88) @@ -32,7 +32,7 @@ import java.net.SocketException; import java.util.List; -import org.apache.commons.logging.Log; +import org.apache.log4j.Logger; import de.dlr.davinspector.common.Constant; @@ -77,7 +77,7 @@ /** * The logger. */ - private Log myLogger; + private Logger myLogger; /** * @@ -104,7 +104,7 @@ * @param connections List */ public ChannelThread(Socket inputSocket, Socket outputSocket, IRelayModel relay, - Log logger, List<ChannelThread> connections) { + Logger logger, List<ChannelThread> connections) { myInputSocket = inputSocket; myOutputSocket = outputSocket; myRelay = relay; @@ -264,6 +264,7 @@ private Boolean isChunked(String data) { // TODO: RFC 2616 14.39 TE / 14.41 Transfer-Encoding // Output decorator!? + // see: HTTPMessageParser Boolean result = false; if (data.contains("Transfer-Encoding: chunked")) { result = true; Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-17 15:57:00 UTC (rev 87) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-18 13:58:05 UTC (rev 88) @@ -25,7 +25,7 @@ package de.dlr.davinspector.relay; -import org.apache.commons.logging.Log; +import org.apache.log4j.Logger; import de.dlr.davinspector.configuration.Configuration; import de.dlr.davinspector.history.MessageHistory; @@ -87,11 +87,11 @@ PluginManager getPluginManager(); /** - * Returns Log object from Apache Commons Logging. + * Returns Log object from Apache log4j Logging. * - * @return Log + * @return Logger */ - Log getSystemLog(); + Logger getSystemLog(); /** * Adds an {@link IServerListener} to RelayModel. Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-17 15:57:00 UTC (rev 87) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-18 13:58:05 UTC (rev 88) @@ -37,8 +37,7 @@ import javax.swing.event.EventListenerList; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.log4j.Logger; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.configuration.Configuration; @@ -57,6 +56,11 @@ public class RelayModel extends Thread implements IRelayModel { /** + * Logger, Apache log4j. + */ + private static Logger myLogger = Logger.getLogger(RelayModel.class); + + /** * List of listeners for new client data. */ private EventListenerList myClientListeners = new EventListenerList(); @@ -67,11 +71,6 @@ private EventListenerList myServerListeners = new EventListenerList(); /** - * Logger, Apache Commons Logging. - */ - private Log myLogger = LogFactory.getLog(RelayModel.class); - - /** * Address to forward connections to. */ private InetAddress myDestinationAddress; @@ -145,7 +144,7 @@ * * @see de.dlr.davinspector.relay.IRelayModel#getSystemLog() */ - public Log getSystemLog() { + public Logger getSystemLog() { return myLogger; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-18 17:22:49
|
Revision: 89 http://davinspector.svn.sourceforge.net/davinspector/?rev=89&view=rev Author: wuest Date: 2008-03-18 10:22:46 -0700 (Tue, 18 Mar 2008) Log Message: ----------- Enabled auto mode for automatic data transfer from client to server and vice versa. Modified Paths: -------------- trunk/DAVInspector/build-user.xml trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java Added Paths: ----------- trunk/DAVInspector/logging.properties trunk/DAVInspector/resource/wizard_off.png Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/build-user.xml 2008-03-18 17:22:46 UTC (rev 89) @@ -67,7 +67,7 @@ <manifest> <attribute name="Main-Class" value="de/dlr/davinspector.DAVInspector"/> <attribute name="Built-By" value="${user.name}"/> - <attribute name="Class-Path" value=". lib/commons-logging.jar logging.properties lib/log4j.jar"/> + <attribute name="Class-Path" value=". logging.properties lib/log4j.jar"/> <section name="DAVInspector"> <attribute name="Specification-Title" value="${project.name}"/> Added: trunk/DAVInspector/logging.properties =================================================================== --- trunk/DAVInspector/logging.properties (rev 0) +++ trunk/DAVInspector/logging.properties 2008-03-18 17:22:46 UTC (rev 89) @@ -0,0 +1,17 @@ +# Log-Level of the root Logger +log4j.rootLogger=ERROR + +# Set Log-Level for DAVInspector +log4j.logger.de.dlr.davinpsector=DEBUG + +# Configuration of the Log-File +# log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=log/log4j.log + +# Max Log-File size +log4j.appender.file.MaxFileSize=100KB +# Keep one Backup +log4j.appender.file.MaxBackupIndex=1 +# Define logger layout +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%p %t %c - %m%n Added: trunk/DAVInspector/resource/wizard_off.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/resource/wizard_off.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-18 17:22:46 UTC (rev 89) @@ -198,6 +198,11 @@ public static final int PLUGIN_CONFIG_NAME_COL = 2; /** + * System logger configuration file (log4j). + */ + public static final String SYSTEM_LOGGER_CONFIGURATION = "logging.properties"; + + /** * Empty Constructor. */ private Constant() { Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-18 17:22:46 UTC (rev 89) @@ -125,6 +125,16 @@ } else { myServersideBuffer = carry; } + + // automatic send the message to client/server + // TODO: Steuerung nachrichten aus mainview raus!! + if (myRelay.getStateAutomode()) { + if (toClient) { + myRelay.writeToClient(message.getRawData()); + } else { + myRelay.writeToServer(message.getRawData()); + } + } } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-18 17:22:46 UTC (rev 89) @@ -25,14 +25,11 @@ package de.dlr.davinspector.http; -import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.log4j.FileAppender; -import org.apache.log4j.Level; import org.apache.log4j.Logger; -import org.apache.log4j.SimpleLayout; +import org.apache.log4j.PropertyConfigurator; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; @@ -134,16 +131,8 @@ public HTTPMessageParser(AMessage aMessage) { super(aMessage); myParsingState = false; - // configure logging - SimpleLayout layout = new SimpleLayout(); - try { - FileAppender fileAppender = new FileAppender(layout, "HTTPMessageParser.log", false); - myLogger.addAppender(fileAppender); - // ALL | DEBUG | INFO | WARN | ERROR | FATAL | OFF: - myLogger.setLevel(Level.ALL); - } catch (IOException ioe) { - System.err.println("Could not initilaize logger! " + ioe.getMessage()); - } + // Configure Logger + PropertyConfigurator.configure(Constant.SYSTEM_LOGGER_CONFIGURATION); } /** @@ -203,13 +192,13 @@ } if (myLogger.isDebugEnabled()) { - myLogger.debug("###############"); - myLogger.debug("Method:" + myMethod); - myLogger.debug("Status:" + myStatusCode); + myLogger.debug("########"); + myLogger.debug("Method :" + myMethod); + myLogger.debug("Status :" + myStatusCode); myLogger.debug("Version:" + myProtocolVersion); - myLogger.debug("Len:" + myContentLength); + myLogger.debug("Len :" + myContentLength); myLogger.debug("Chunked:" + isChunked); - myLogger.debug("###############"); + myLogger.debug("########"); } extractHeaderBody(); @@ -219,26 +208,22 @@ if (!isChunked && (myContentLength == 0 || !hasBody())) { myLogger.debug("no body"); myParsedBody = ""; - carryover = ""; // TODO: + carryover = ""; // TODO: Set carry. myParsingState = true; } else { if (isChunked) { myLogger.debug("decode chunked encoding"); myParsedBody = decodeChunkedEncoding(myRawBody); - carryover = ""; // TODO: + carryover = ""; // TODO: Set carry. if (!myParsingState) { myLogger.debug("decoding chunked encoding not finished"); } } else { myLogger.debug("normal message"); if (myContentLength > myRawBody.length()) { + myContentLength = 0; myLogger.debug("normal message not finished"); } - // TODO: ung\xFCltige l\xE4nge abfangen! - if (myContentLength > myRawBody.length()) { - myContentLength = myRawBody.length(); - myLogger.debug("invalid content length"); - } myParsedBody = myRawBody.substring(0, myContentLength); carryover = myRawBody.substring(myContentLength, myRawBody.length()); myParsingState = true; Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-18 17:22:46 UTC (rev 89) @@ -34,6 +34,7 @@ import java.util.Vector; import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; @@ -86,6 +87,8 @@ * @return PluginManager */ public static PluginManager getInstance() { + // Configure Logger + PropertyConfigurator.configure(Constant.SYSTEM_LOGGER_CONFIGURATION); return instance; } @@ -116,7 +119,7 @@ IPlugin plugin = null; String name = jarFile.getName().substring(0, jarFile.getName().lastIndexOf(".")); try { - myLogger.debug("Trying to load plugin: " + name); + myLogger.debug("Trying to load class: " + name); URLClassLoader jClassLoader = new URLClassLoader(new URL[] { jarFile.toURI().toURL() }); Class<?> c = jClassLoader.loadClass(Constant.PLUGIN_CLASSPATH + name.toLowerCase() + "." + name); // lets try to load the plugin... Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-18 17:22:46 UTC (rev 89) @@ -93,6 +93,24 @@ */ Logger getSystemLog(); + /** + * Returns the state of the automode.<br> + * true: ON<br> + * false: OFF<br> + * + * @return Boolean + */ + Boolean getStateAutomode(); + + /** + * Activate/Deactivate the automode.<br> + * true: ON<br> + * false: OFF<br> + * + * @param state Boolean + */ + void setStateAutomode(Boolean state); + /** * Adds an {@link IServerListener} to RelayModel. * Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-18 17:22:46 UTC (rev 89) @@ -38,6 +38,7 @@ import javax.swing.event.EventListenerList; import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.configuration.Configuration; @@ -106,10 +107,18 @@ private MessageHistory myMessageHistory = null; /** + * State of the automode. + */ + private Boolean myStateAutomode = false; + + /** * Constructor of RelayModel. * The constructor creates a new {@link MessageHistory} object. */ public RelayModel() { + // Configure Logger + PropertyConfigurator.configure(Constant.SYSTEM_LOGGER_CONFIGURATION); + myMessageHistory = new MessageHistory(this); myPluginManager = PluginManager.getInstance(); // load available plugins @@ -151,6 +160,24 @@ /** * {@inheritDoc} * + * @see de.dlr.davinspector.relay.IRelayModel#getStateAutomode() + */ + public Boolean getStateAutomode() { + return myStateAutomode; + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.relay.IRelayModel#setStateAutomode(java.lang.Boolean) + */ + public void setStateAutomode(Boolean state) { + myStateAutomode = state; + } + + /** + * {@inheritDoc} + * * @see de.dlr.davinspector.relay.IRelayModel#addServerListener(de.dlr.davinspector.relay.IServerListener) */ public void addServerListener(IServerListener listener) { Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java 2008-03-18 17:22:46 UTC (rev 89) @@ -63,4 +63,14 @@ * @return MainView */ MainView getView(); + + /** + * Activates the automode of the relay. + */ + void enableAutomode(); + + /** + * Deactivates the automode of the relay. + */ + void disableAutomode(); } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-03-18 17:22:46 UTC (rev 89) @@ -102,4 +102,26 @@ public MainView getView() { return myView; } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.ui.IMainController#enableAutomode() + */ + public void enableAutomode() { + if (!myRelay.getStateAutomode()) { + myRelay.setStateAutomode(true); + } + } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.ui.IMainController#disableAutomode() + */ + public void disableAutomode() { + if (myRelay.getStateAutomode()) { + myRelay.setStateAutomode(false); + } + } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-18 17:22:46 UTC (rev 89) @@ -282,6 +282,11 @@ private Boolean myRelayIsActive = false; /** + * Current state of the automode. + */ + private Boolean myAutomodeIsActive = false; + + /** * Toggle button for controlling the auto mode. */ private JToggleButton jToggleButtonAutomode = null; @@ -406,6 +411,7 @@ * Action: Start or stop the relay. */ private Action relayAction = new AbstractAction() { + // INFO: myRelayIsActive local var!? static final long serialVersionUID = 1L; { putValue(Action.NAME, "Start Relay"); @@ -414,12 +420,10 @@ } public void actionPerformed(ActionEvent e) { - if (myRelayIsActive) { putValue(Action.NAME, "Start Relay"); putValue(Action.SHORT_DESCRIPTION, "Start the relay."); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_START)); - // TODO: Move to ctrl myRelayIsActive = false; myPluginManager.shutdownActivePlugins(); myController.stopRelay(); @@ -427,7 +431,6 @@ putValue(Action.NAME, "Stop Relay"); putValue(Action.SHORT_DESCRIPTION, "Stop the relay."); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_STOP)); - // TODO: Move to ctrl myController.startRelay(); myRelayIsActive = true; } @@ -491,15 +494,28 @@ * Action: Enable or disable automode. */ private Action automodeAction = new AbstractAction() { + // INFO: myAutomodeIsActive local var!? static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Automode"); - putValue(Action.SHORT_DESCRIPTION, "Data is automatically transfered from Client to Server and vice versa."); - putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_AUTOMODE)); + putValue(Action.NAME, "Enable Auto Mode"); + putValue(Action.SHORT_DESCRIPTION, "Data is automatically transfered."); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_AUTOMODE_ON)); } - + public void actionPerformed(ActionEvent e) { - // TODO: ctrl activate automode + if (myAutomodeIsActive) { + putValue(Action.NAME, "Enable Auto Mode"); + putValue(Action.SHORT_DESCRIPTION, "Data is automatically transfered."); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_AUTOMODE_ON)); + myAutomodeIsActive = false; + myController.disableAutomode(); + } else { + putValue(Action.NAME, "Disable Auto Mode"); + putValue(Action.SHORT_DESCRIPTION, "No automtic data transfer."); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_AUTOMODE_OFF)); + myController.enableAutomode(); + myAutomodeIsActive = true; + } } }; Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-03-18 13:58:05 UTC (rev 88) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-03-18 17:22:46 UTC (rev 89) @@ -63,11 +63,16 @@ /** * */ - public static final String ICON_AUTOMODE = "wizard.png"; + public static final String ICON_AUTOMODE_ON = "wizard.png"; /** * */ + public static final String ICON_AUTOMODE_OFF = "wizard_off.png"; + + /** + * + */ public static final String ICON_EXIT = "exit.png"; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-19 13:04:57
|
Revision: 90 http://davinspector.svn.sourceforge.net/davinspector/?rev=90&view=rev Author: wuest Date: 2008-03-19 06:04:03 -0700 (Wed, 19 Mar 2008) Log Message: ----------- Added basic i18n support. Modified Paths: -------------- trunk/DAVInspector/build-user.xml trunk/DAVInspector/resource/wizard_off.png trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/http/package.html trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java Added Paths: ----------- trunk/DAVInspector/test/de/dlr/davinspector/http/package.html Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/build-user.xml 2008-03-19 13:04:03 UTC (rev 90) @@ -56,7 +56,7 @@ <!-- Copy DAVInspector resource files --> <copy todir="bin/de/dlr/davinspector/resource"> - <fileset dir="resource" includes="*.png" /> + <fileset dir="resource" includes="*.png *.properties" /> </copy> <!-- Create DAVInspector jar file --> Modified: trunk/DAVInspector/resource/wizard_off.png =================================================================== (Binary files differ) Modified: trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-19 13:04:03 UTC (rev 90) @@ -25,9 +25,9 @@ package de.dlr.davinspector; -import java.io.FileInputStream; -import java.io.IOException; +import java.util.Locale; +import de.dlr.davinspector.common.Util; import de.dlr.davinspector.relay.IRelayModel; import de.dlr.davinspector.relay.RelayModel; import de.dlr.davinspector.ui.MainController; @@ -51,20 +51,10 @@ * * @param args String[] */ - public static void main(String[] args) { - // init java internal logging - try { - FileInputStream file = new FileInputStream("logging.properties"); - java.util.logging.LogManager.getLogManager().readConfiguration(file); - } catch (IOException ioe) { - System.err.println(ioe); - } - - // TODO: i18n - //Locale loc = Locale.getDefault(); - //Locale loc = Locale.GERMANY; - //Locale loc = Locale.US; - //ResourceBundle resourceBundle = ResourceBundle.getBundle("DAVInspectorLang", loc); + public static void main(String[] args) { + // for testing i18n support +// Locale.setDefault(new Locale("EN")); +// Locale.setDefault(new Locale("DE")); IRelayModel model = new RelayModel(); new MainController(model); Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-03-19 13:04:03 UTC (rev 90) @@ -28,6 +28,8 @@ import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; +import java.util.Locale; +import java.util.ResourceBundle; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; @@ -40,6 +42,12 @@ * @author Jochen Wuest */ public final class Util { + + /** + * + */ + private static final ResourceBundle RESOURCE_BUNDLE = + ResourceBundle.getBundle("de/dlr/davinspector/resource/TextBundle", Locale.getDefault()); /** * Empty Contructor for utility class. @@ -47,6 +55,16 @@ private Util() { } + + /** + * TODO: wues_ha: Enter comment! + * + * @param key String + * @return String + */ + public static String getTranslation(String key) { + return RESOURCE_BUNDLE.getString(key); + } /** * This method tries to set the look & feel of the current OS. Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-03-19 13:04:03 UTC (rev 90) @@ -27,6 +27,8 @@ import javax.swing.table.DefaultTableModel; +import de.dlr.davinspector.common.Util; + /** * Data model for the history table. * @@ -44,10 +46,10 @@ * Column Definition for history table. */ private String[] columnNames = { - "Type", - "ID", - "Timestamp", - "Size" + Util.getTranslation("column_name_type"), + Util.getTranslation("column_name_id"), + Util.getTranslation("column_name_timestamp"), + Util.getTranslation("column_name_size") }; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/package.html =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/package.html 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/package.html 2008-03-19 13:04:03 UTC (rev 90) @@ -1,12 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html><head><title>BLUB B</title></head><body> - -BLUB B - -<h2>Package Specification</h2> - -BLUB B - +<html><head><title>Package HTTP</title></head><body> +This package contains all classes needed for basic HTTP message parsing. </body></html> \ No newline at end of file Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-19 13:04:03 UTC (rev 90) @@ -38,6 +38,7 @@ import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; +import de.dlr.davinspector.history.Message; /** * This class loads all available plugins and manages the activated plugins @@ -204,6 +205,18 @@ } } + public AMessage getEditedMessageClient() { + AMessage buffer = null; + for (Iterator<IPlugin> iterator = myActivePluginsClient.iterator(); iterator.hasNext();) { + IPlugin plugin = (IPlugin) iterator.next(); + if (plugin.getType() == IPlugin.PlugInType.EDIT_CLIENT) { + IEditPlugin editPlugin = (IEditPlugin) plugin; + buffer = editPlugin.getOutput(); + } + } + return buffer; + } + /** * This method sets the active plugins for the client side. * Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-19 13:04:03 UTC (rev 90) @@ -30,7 +30,8 @@ import de.dlr.davinspector.common.Util; import de.dlr.davinspector.history.AMessage; -import de.dlr.davinspector.plugin.IViewPlugin; +import de.dlr.davinspector.history.Message; +import de.dlr.davinspector.plugin.IEditPlugin; /** @@ -39,7 +40,7 @@ * @version $LastChangedRevision$ * @author Jochen Wuest */ -public class HeaderPlugin implements IViewPlugin { +public class HeaderPlugin implements IEditPlugin { /** * State of the plugin. @@ -93,7 +94,7 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#getType() */ public PlugInType getType() { - return PlugInType.VIEW_CLIENT; + return PlugInType.EDIT_CLIENT; } /** @@ -167,4 +168,13 @@ myJTextPane.setText(""); } } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.plugin.IEditPlugin#getOutput() + */ + public AMessage getOutput() { + return new Message(); + } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-03-19 13:04:03 UTC (rev 90) @@ -102,7 +102,7 @@ */ private void initialize() { this.setSize(Constant.UI_ABOUT_DIALOG_WIDTH, Constant.UI_ABOUT_DIALOG_HEIGTH); - this.setTitle(Constant.APP_TITLE + " About"); + this.setTitle(Util.getTranslation("dlg_about_title")); this.setContentPane(getJContentPane()); Util.centerWindow((Window) this); } @@ -140,7 +140,7 @@ private JButton getJButtonOk() { if (jButtonOk == null) { jButtonOk = new JButton(); - jButtonOk.setText("Ok"); + jButtonOk.setText(Util.getTranslation("dlg_about_close")); jButtonOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeWindow(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java 2008-03-19 13:04:03 UTC (rev 90) @@ -28,7 +28,6 @@ import java.awt.Frame; import java.awt.GridLayout; import java.awt.Window; -import java.awt.event.KeyEvent; import javax.swing.BorderFactory; import javax.swing.JButton; @@ -132,7 +131,7 @@ */ private void initialize() { this.setSize(Constant.UI_CONFIG_DIALOG_WIDTH, Constant.UI_CONFIG_DIALOG_HEIGHT); - this.setTitle(Constant.APP_TITLE + " Configuration"); + this.setTitle(Constant.APP_TITLE + " " + Util.getTranslation("dlg_configuration_title")); this.setContentPane(this.getJContentPane()); this.setModal(true); Util.centerWindow((Window) this); @@ -152,16 +151,16 @@ private JPanel getJContentPane() { if (jContentPane == null) { jLabelServerAddress = new JLabel(); - jLabelServerAddress.setText("Server Address:"); + jLabelServerAddress.setText(Util.getTranslation("dlg_configuration_server_address") + ':'); jLabelServerAddress.setHorizontalAlignment(SwingConstants.RIGHT); jLabelClientPort = new JLabel(); - jLabelClientPort.setText("Client Port:"); + jLabelClientPort.setText(Util.getTranslation("dlg_configuration_client_port") + ':'); jLabelClientPort.setHorizontalAlignment(SwingConstants.RIGHT); jLabelClientAddress = new JLabel(); - jLabelClientAddress.setText("Client Address:"); + jLabelClientAddress.setText(Util.getTranslation("dlg_configuration_client_address") + ':'); jLabelClientAddress.setHorizontalAlignment(SwingConstants.RIGHT); jLabelServerPort = new JLabel(); - jLabelServerPort.setText("Server Port:"); + jLabelServerPort.setText(Util.getTranslation("dlg_configuration_server_port") + ':'); jLabelServerPort.setHorizontalAlignment(SwingConstants.RIGHT); GridLayout gridLayout = new GridLayout(5, 2, 10, 10); jContentPane = new JPanel(); @@ -189,8 +188,7 @@ private JButton getJButtonCancel() { if (jButtonCancel == null) { jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setMnemonic(KeyEvent.VK_C); + jButtonCancel.setText(Util.getTranslation("dlg_configuration_cancel")); jButtonCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeWindow(); @@ -283,8 +281,7 @@ private JButton getJButtonOk() { if (jButtonOk == null) { jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setMnemonic(KeyEvent.VK_O); + jButtonOk.setText(Util.getTranslation("dlg_configuration_ok")); jButtonOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { saveConfiguration(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-19 13:04:03 UTC (rev 90) @@ -69,10 +69,10 @@ /** * The main window of the application. - * Gui todos: + * GUI todos: * INFO: Place buttons of the dialog windows in the lower right corner of the window. - * INFO: Resize columns of the tables to the needed space. * INFO: Adjust alignment of table columns. + * INFO: i18n support into separate class!? * * TODO: getMessageHistory restructure model/relay * @@ -302,12 +302,12 @@ private Action exitAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Exit"); - putValue(Action.SHORT_DESCRIPTION, "Exit the program"); + putValue(Action.NAME, Util.getTranslation("ac_exit")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_exit_description")); putValue(Action.MNEMONIC_KEY, KeyEvent.VK_X); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_EXIT)); } - + public void actionPerformed(ActionEvent e) { // INFO: Currently shutdownActivePlugins maybe called twice. myPluginManager.shutdownActivePlugins(); @@ -321,8 +321,8 @@ private Action sendToServerAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Send to Server"); - putValue(Action.SHORT_DESCRIPTION, "Send Client data to the Server."); + putValue(Action.NAME, Util.getTranslation("ac_send_to_server")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_send_to_server_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_RIGHT_ARROW)); } @@ -338,8 +338,8 @@ private Action sendToClientAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Send to Client"); - putValue(Action.SHORT_DESCRIPTION, "Send Server data to the Client."); + putValue(Action.NAME, Util.getTranslation("ac_send_to_client")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_send_to_client_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_LEFT_ARROW)); } @@ -355,8 +355,8 @@ private Action configureAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Configure"); - putValue(Action.SHORT_DESCRIPTION, "Configure the application."); + putValue(Action.NAME, Util.getTranslation("ac_configure")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_configure_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_CONFIGURE)); } @@ -374,8 +374,8 @@ private Action configurePluginsAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Configure"); - putValue(Action.SHORT_DESCRIPTION, "Configure the loaded plugins."); + putValue(Action.NAME, Util.getTranslation("ac_configure_plugins")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_configure_plugins_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_PLUGINS)); } @@ -394,8 +394,8 @@ private Action aboutAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "About"); - putValue(Action.SHORT_DESCRIPTION, "Display information about the application."); + putValue(Action.NAME, Util.getTranslation("ac_about")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_about_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_ABOUT)); } @@ -414,22 +414,22 @@ // INFO: myRelayIsActive local var!? static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Start Relay"); - putValue(Action.SHORT_DESCRIPTION, "Start the relay."); + putValue(Action.NAME, Util.getTranslation("ac_start_relay")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_start_relay_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_START)); } public void actionPerformed(ActionEvent e) { if (myRelayIsActive) { - putValue(Action.NAME, "Start Relay"); - putValue(Action.SHORT_DESCRIPTION, "Start the relay."); + putValue(Action.NAME, Util.getTranslation("ac_start_relay")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_start_relay_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_START)); myRelayIsActive = false; myPluginManager.shutdownActivePlugins(); myController.stopRelay(); } else { - putValue(Action.NAME, "Stop Relay"); - putValue(Action.SHORT_DESCRIPTION, "Stop the relay."); + putValue(Action.NAME, Util.getTranslation("ac_stop_relay")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_stop_relay_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_STOP)); myController.startRelay(); myRelayIsActive = true; @@ -438,13 +438,13 @@ }; /** - * Action: Clear content of left (client) raw pane. + * Action: Clear content of client raw pane. */ - private Action clearLeftAction = new AbstractAction() { + private Action clearClientAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Clear Client"); - putValue(Action.SHORT_DESCRIPTION, "Clear the Client side data."); + putValue(Action.NAME, Util.getTranslation("ac_clear_client")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_clear_client_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_CLEAR_CLIENT)); } @@ -455,13 +455,13 @@ }; /** - * Action: Clear content of right (server) raw pane. + * Action: Clear content of server raw pane. */ - private Action clearRightAction = new AbstractAction() { + private Action clearServerAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Clear Server"); - putValue(Action.SHORT_DESCRIPTION, "Clear the Server side data."); + putValue(Action.NAME, Util.getTranslation("ac_clear_server")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_clear_server_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_CLEAR_SERVER)); } @@ -477,8 +477,8 @@ private Action clearAllAction = new AbstractAction() { static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Clear All"); - putValue(Action.SHORT_DESCRIPTION, "Clear all data."); + putValue(Action.NAME, Util.getTranslation("ac_clear_all")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_clear_all_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_CLEAR_ALL)); } @@ -497,21 +497,21 @@ // INFO: myAutomodeIsActive local var!? static final long serialVersionUID = 1L; { - putValue(Action.NAME, "Enable Auto Mode"); - putValue(Action.SHORT_DESCRIPTION, "Data is automatically transfered."); + putValue(Action.NAME, Util.getTranslation("ac_enable_auto_mode")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_enable_auto_mode_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_AUTOMODE_ON)); } public void actionPerformed(ActionEvent e) { if (myAutomodeIsActive) { - putValue(Action.NAME, "Enable Auto Mode"); - putValue(Action.SHORT_DESCRIPTION, "Data is automatically transfered."); + putValue(Action.NAME, Util.getTranslation("ac_enable_auto_mode")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_enable_auto_mode_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_AUTOMODE_ON)); myAutomodeIsActive = false; myController.disableAutomode(); } else { - putValue(Action.NAME, "Disable Auto Mode"); - putValue(Action.SHORT_DESCRIPTION, "No automtic data transfer."); + putValue(Action.NAME, Util.getTranslation("ac_disable_auto_mode")); + putValue(Action.SHORT_DESCRIPTION, Util.getTranslation("ac_disable_auto_mode_description")); putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_AUTOMODE_OFF)); myController.enableAutomode(); myAutomodeIsActive = true; @@ -680,7 +680,7 @@ private JTabbedPane getJTabbedPaneClient() { if (jTabbedPaneClient == null) { jTabbedPaneClient = new JTabbedPane(); - jTabbedPaneClient.addTab("Raw", null, getJScrollPaneClientRaw(), null); + jTabbedPaneClient.addTab(Util.getTranslation("tab_raw"), null, getJScrollPaneClientRaw(), null); //update plugins if (myPluginManager != null) { @@ -721,7 +721,7 @@ private JTabbedPane getJTabbedPaneServer() { if (jTabbedPaneServer == null) { jTabbedPaneServer = new JTabbedPane(); - jTabbedPaneServer.addTab("Raw", null, getJScrollPaneServerRaw(), null); + jTabbedPaneServer.addTab(Util.getTranslation("tab_raw"), null, getJScrollPaneServerRaw(), null); //update plugins if (myPluginManager != null) { @@ -791,8 +791,7 @@ private JMenu getJMenuFile() { if (jMenuFile == null) { jMenuFile = new JMenu(); - jMenuFile.setText("File"); - jMenuFile.setMnemonic(KeyEvent.VK_F); + jMenuFile.setText(Util.getTranslation("menu_file")); jMenuFile.add(getJMenuItemConfigure()); jMenuFile.add(getJMenuItemExit()); } @@ -820,8 +819,7 @@ private JMenu getJMenuView() { if (jMenuView == null) { jMenuView = new JMenu(); - jMenuView.setText("View"); - jMenuView.setMnemonic(KeyEvent.VK_V); + jMenuView.setText(Util.getTranslation("menu_view")); jMenuView.add(getJMenuItemClearAll()); jMenuView.add(getJMenuItemClearClient()); jMenuView.add(getJMenuItemClearServer()); @@ -848,7 +846,7 @@ */ private JMenuItem getJMenuItemClearClient() { if (jMenuItemClearLeft == null) { - jMenuItemClearLeft = new JMenuItem(clearLeftAction); + jMenuItemClearLeft = new JMenuItem(clearClientAction); } return jMenuItemClearLeft; } @@ -860,7 +858,7 @@ */ private JMenuItem getJMenuItemClearServer() { if (jMenuItemClearRight == null) { - jMenuItemClearRight = new JMenuItem(clearRightAction); + jMenuItemClearRight = new JMenuItem(clearServerAction); } return jMenuItemClearRight; } @@ -873,8 +871,7 @@ private JMenu getJMenuHelp() { if (jMenuHelp == null) { jMenuHelp = new JMenu(); - jMenuHelp.setText("Help"); - jMenuHelp.setMnemonic(KeyEvent.VK_HELP); + jMenuHelp.setText(Util.getTranslation("menu_help")); jMenuHelp.add(getJMenuItemAbout()); } return jMenuHelp; @@ -912,7 +909,7 @@ private JMenu getJMenuPlugins() { if (jMenuPlugins == null) { jMenuPlugins = new JMenu(); - jMenuPlugins.setText("Plugins"); + jMenuPlugins.setText(Util.getTranslation("menu_plugins")); jMenuPlugins.add(getJMenuItemConfigurePlugins()); } return jMenuPlugins; @@ -1011,7 +1008,8 @@ jPanelRight = null; jSplitPaneHorizontal.setLeftComponent(getJTabbedPaneClient()); jSplitPaneHorizontal.setRightComponent(getJPanelRight()); - jSplitPaneHorizontal.setDividerLocation(DIVIDER_HORZ); + // set divider location + jSplitPaneHorizontal.setResizeWeight(DIVIDER_HORZ); jSplitPaneHorizontal.repaint(); } } @@ -1034,11 +1032,10 @@ */ private JSplitPane getJSplitPaneVertical() { if (jSplitPaneVertical == null) { - //TODO: splitter settings -// splitPane.setResizeWeight(0.5); jSplitPaneVertical = new JSplitPane(); jSplitPaneVertical.setOrientation(JSplitPane.VERTICAL_SPLIT); - jSplitPaneVertical.setDividerLocation(DIVIDER_VERT); + // set divider location + jSplitPaneVertical.setResizeWeight(DIVIDER_VERT); jSplitPaneVertical.setBottomComponent(getJPanelHistory()); jSplitPaneVertical.setTopComponent(getJSplitPaneHorizontal()); } @@ -1073,6 +1070,18 @@ jTableHistory = new JTable(myHistoryTableModel); jTableHistory.setShowGrid(true); jTableHistory.setAutoCreateRowSorter(true); +// // Disable auto resizing +// jTableHistory.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); +// // Set the column widths +// TableColumn column = jTableHistory.getColumnModel().getColumn(0); +// column.setPreferredWidth(100); +// column = jTableHistory.getColumnModel().getColumn(1); +// column.setPreferredWidth(100); +// column = jTableHistory.getColumnModel().getColumn(2); +// column.setPreferredWidth(100); +// column = jTableHistory.getColumnModel().getColumn(3); +// column.setPreferredWidth(100); + jTableHistory.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java 2008-03-19 13:04:03 UTC (rev 90) @@ -39,6 +39,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; +import javax.swing.table.TableColumn; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.common.Util; @@ -60,6 +61,56 @@ private static final long serialVersionUID = 1L; /** + * Width of the column client (checkbox) in pixel. + */ + private static final int COLUMN_WIDTH_CLIENT = 50; + /** + * Width of the column server (checkbox) in pixel. + */ + private static final int COLUMN_WIDTH_SERVER = 50; + /** + * Width of the column name in pixel. + */ + private static final int COLUMN_WIDTH_NAME = 100; + /** + * Width of the column version in pixel. + */ + private static final int COLUMN_WIDTH_VERSION = 50; + /** + * Width of the column author in pixel. + */ + private static final int COLUMN_WIDTH_AUTHOR = 100; + /** + * Width of the column description in pixel. + */ + private static final int COLUMN_WIDTH_DESCRIPTION = 350; + + /** + * Index of the column client (checkbox). + */ + private static final int COLUMN_INDEX_CLIENT = 0; + /** + * Index of the column server (checkbox). + */ + private static final int COLUMN_INDEX_SERVER = 1; + /** + * Index of the column name. + */ + private static final int COLUMN_INDEX_NAME = 2; + /** + * Index of the column version. + */ + private static final int COLUMN_INDEX_VERSION = 3; + /** + * Index of the column author. + */ + private static final int COLUMN_INDEX_AUTHOR = 4; + /** + * Index of the column description. + */ + private static final int COLUMN_INDEX_DESCRIPTION = 5; + + /** * */ private JPanel jContentPane = null; @@ -167,7 +218,7 @@ */ private void initialize() { this.setSize(Constant.UI_PLUGIN_CONFIG_DIALOG_WIDTH, Constant.UI_PLUGIN_CONFIG_DIALOG_HEIGTH); - this.setTitle(Constant.APP_TITLE + " Plugin Configuration Dialog"); + this.setTitle(Constant.APP_TITLE + " " + Util.getTranslation("dlg_plugin_configuration_title")); this.setContentPane(getJContentPane()); this.setModal(true); Util.centerWindow((Window) this); @@ -229,6 +280,23 @@ // do NOT allow reordering of the columns! // in future you may enable this, but you also have to convert the column indices (view/table data model) jTable.getTableHeader().setReorderingAllowed(false); + + // Disable auto resizing + jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + // Set the column widths + TableColumn column = jTable.getColumnModel().getColumn(COLUMN_INDEX_CLIENT); + column.setPreferredWidth(COLUMN_WIDTH_CLIENT); + column = jTable.getColumnModel().getColumn(COLUMN_INDEX_SERVER); + column.setPreferredWidth(COLUMN_WIDTH_SERVER); + column = jTable.getColumnModel().getColumn(COLUMN_INDEX_NAME); + column.setPreferredWidth(COLUMN_WIDTH_NAME); + column = jTable.getColumnModel().getColumn(COLUMN_INDEX_VERSION); + column.setPreferredWidth(COLUMN_WIDTH_VERSION); + column = jTable.getColumnModel().getColumn(COLUMN_INDEX_AUTHOR); + column.setPreferredWidth(COLUMN_WIDTH_AUTHOR); + column = jTable.getColumnModel().getColumn(COLUMN_INDEX_DESCRIPTION); + column.setPreferredWidth(COLUMN_WIDTH_DESCRIPTION); + jTable.setDefaultRenderer(Boolean.class, new PluginConfigurationTableCellRenderer(myAvailablePlugins)); } return jTable; @@ -287,7 +355,7 @@ private JButton getJButtonCancel() { if (jButtonCancel == null) { jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); + jButtonCancel.setText(Util.getTranslation("dlg_plugin_configuration_cancel")); jButtonCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeWindow(); @@ -305,7 +373,7 @@ private JButton getJButtonOk() { if (jButtonOk == null) { jButtonOk = new JButton(); - jButtonOk.setText("Ok"); + jButtonOk.setText(Util.getTranslation("dlg_plugin_configuration_ok")); jButtonOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { savePluginConfiguration(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java 2008-03-19 13:04:03 UTC (rev 90) @@ -27,7 +27,9 @@ import javax.swing.table.DefaultTableModel; +import de.dlr.davinspector.common.Util; + /** * Table model for the table in the plugin configuration dialog. * @@ -45,12 +47,12 @@ * Column definition. */ private String[] columnNames = { - "Client", - "Server", - "Name", - "Version", - "Author", - "Description" + Util.getTranslation("column_name_client"), + Util.getTranslation("column_name_server"), + Util.getTranslation("column_name_name"), + Util.getTranslation("column_name_version"), + Util.getTranslation("column_name_author"), + Util.getTranslation("column_name_description") }; /** Modified: trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java =================================================================== --- trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java 2008-03-18 17:22:46 UTC (rev 89) +++ trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java 2008-03-19 13:04:03 UTC (rev 90) @@ -50,6 +50,11 @@ public class HTTPTest { /** + * Comment for not yet implemented tests. + */ + private static final String NOT_YET = "Not yet implemented"; + + /** * */ private static int idCounter = 0; @@ -103,6 +108,7 @@ idCounter++; timestamp = new Date(); direction = false; + // TODO: Read test data from file. data = "This is a test"; message = new Message(); message.setMessageDirection(direction); @@ -144,7 +150,7 @@ @Test public void testSetTimestamp() { Calendar cal = Calendar.getInstance(); - cal.set(2008, 11, 11, 11, 11, 11); + cal.set(1, 1, 1, 1, 1, 1); // ### timestamp = cal.getTime(); message.setTimestamp(timestamp); Assert.assertEquals(timestamp, message.getTimestamp()); @@ -218,6 +224,7 @@ */ @Test public void testSetRawData() { + // TODO: Read test data from file. String testdata = "Mir lose de Dom in koelle."; message.setRawData(testdata); Assert.assertEquals(testdata, message.getRawData()); @@ -229,7 +236,7 @@ */ @Test public void testGetMessageHeader() { - junit.framework.TestCase.fail("Not yet implemented"); + junit.framework.TestCase.fail(NOT_YET); } /** @@ -238,7 +245,7 @@ */ @Test public void testGetRawHeader() { - junit.framework.TestCase.fail("Not yet implemented"); + junit.framework.TestCase.fail(NOT_YET); } /** @@ -247,7 +254,7 @@ */ @Test public void testGetMessageBody() { - junit.framework.TestCase.fail("Not yet implemented"); + junit.framework.TestCase.fail(NOT_YET); } /** @@ -256,7 +263,7 @@ */ @Test public void testGetRawBody() { - junit.framework.TestCase.fail("Not yet implemented"); + junit.framework.TestCase.fail(NOT_YET); } /** @@ -265,7 +272,7 @@ */ @Test public void testParseMessage() { - junit.framework.TestCase.fail("Not yet implemented"); + junit.framework.TestCase.fail(NOT_YET); } /** @@ -274,7 +281,7 @@ */ @Test public void testIsComplete() { - junit.framework.TestCase.fail("Not yet implemented"); + junit.framework.TestCase.fail(NOT_YET); } } Added: trunk/DAVInspector/test/de/dlr/davinspector/http/package.html =================================================================== --- trunk/DAVInspector/test/de/dlr/davinspector/http/package.html (rev 0) +++ trunk/DAVInspector/test/de/dlr/davinspector/http/package.html 2008-03-19 13:04:03 UTC (rev 90) @@ -0,0 +1,6 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" +"http://www.w3.org/TR/REC-html40/loose.dtd"> + +<html><head><title>Package unit tests for HTTP</title></head><body> +This package contains all unit test classes for the basic HTTP message parser. +</body></html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-19 17:42:53
|
Revision: 92 http://davinspector.svn.sourceforge.net/davinspector/?rev=92&view=rev Author: wuest Date: 2008-03-19 10:42:10 -0700 (Wed, 19 Mar 2008) Log Message: ----------- Updated i18n support (moved from Util to Internationalization). Added and reformated documentation and comments. Moved state variables of the toggle buttons from MainView into the corresponding actions. Modified Paths: -------------- trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java trunk/DAVInspector/src/de/dlr/davinspector/configuration/Configuration.java trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPStatusCode.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/IViewPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/JarFilenameFilter.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreeView.java trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/DataEvent.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/package.html trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/ConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableCellRenderer.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java Added Paths: ----------- trunk/DAVInspector/src/de/dlr/davinspector/common/Internationalization.java Modified: trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-19 17:42:10 UTC (rev 92) @@ -27,7 +27,6 @@ import java.util.Locale; -import de.dlr.davinspector.common.Util; import de.dlr.davinspector.relay.IRelayModel; import de.dlr.davinspector.relay.RelayModel; import de.dlr.davinspector.ui.MainController; @@ -53,8 +52,8 @@ */ public static void main(String[] args) { // for testing i18n support -// Locale.setDefault(new Locale("EN")); -// Locale.setDefault(new Locale("DE")); + Locale.setDefault(new Locale("en")); +// Locale.setDefault(new Locale("de")); IRelayModel model = new RelayModel(); new MainController(model); Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-19 17:42:10 UTC (rev 92) @@ -36,176 +36,107 @@ */ public final class Constant { - /** - * Basis of the hexadecimal number system. - */ + /** Basis of the hexadecimal number system. */ public static final int HEX_RADIX = 16; - - /** - * Main window width. - */ + + /** Main window width. */ public static final int UI_MAIN_WINDOW_WIDTH = 800; - - /** - * Main window height. - */ + + /** Main window height. */ public static final int UI_MAIN_WINDOW_HEIGHT = 600; - - /** - * Configuration dialog width. - */ + + /** Configuration dialog width. */ public static final int UI_CONFIG_DIALOG_WIDTH = 300; - - /** - * Configuration dialog height. - */ + + /** Configuration dialog height. */ public static final int UI_CONFIG_DIALOG_HEIGHT = 200; - - /** - * Plugin configuration width. - */ + + /** Plugin configuration width. */ public static final int UI_PLUGIN_CONFIG_DIALOG_WIDTH = 650; - - /** - * Plugin configuration height. - */ + + /** Plugin configuration height. */ public static final int UI_PLUGIN_CONFIG_DIALOG_HEIGTH = 250; - - /** - * About dialog width. - */ + + /** About dialog width. */ public static final int UI_ABOUT_DIALOG_WIDTH = 250; - - /** - * About dialog height. - */ + + /** About dialog height. */ public static final int UI_ABOUT_DIALOG_HEIGTH = 275; - - /** - * Backgroundcolor of replies. - */ - public static final Color UI_REPLY_COLOR = new Color(255, 204, 102); - - /** - * Backgroundcolor of requests. - */ - public static final Color UI_REQUEST_COLOR = new Color(170, 240, 240); - - /** - * Line Feed + Carriage Return. - */ + + /** Backgroundcolor of replies. */ + public static final Color UI_REPLY_COLOR = new Color(255, 232, 140); + + /** Backgroundcolor of requests. */ + public static final Color UI_REQUEST_COLOR = new Color(210, 255, 210); + + /** Line Feed + Carriage Return. */ public static final String LFCR = "\r\n"; - - /** - * Line Feed. - */ + + /** Line Feed. */ public static final String LF = "\r"; - - /** - * Carriage Return. - */ + + /** Carriage Return. */ public static final String CR = "\n"; - - /** - * End Of File. - */ + + /** End Of File. */ public static final int EOF = -1; - - /** - * Application Title. - */ + + /** Application Title. */ public static final String APP_TITLE = "DAVInspector"; - - /** - * Version of the application. - */ + + /** Version of the application. */ public static final String APP_VERSION = "0.1"; - - /** - * Filename of the configuration file. - */ + + /** Filename of the configuration file. */ public static final String APP_CONFIGURATION_FILENAME = "config.properties"; - - /** - * Filename of the plugin configuration file. - */ + + /** Filename of the plugin configuration file. */ public static final String APP_PLUGIN_CONFIGURATION_FILENAME = "plugin-config.properties"; - - /** - * Timeout waiting for a ChannelThread to finish in ms. - */ + + /** Timeout waiting for a ChannelThread to finish in ms. */ public static final int RELAY_THREADTIMEOUT = 100; - - /** - * Linger time in seconds for socket. - */ + + /** Linger time in seconds for socket. */ public static final int RELAY_LINGERTIME = 100; - - /** - * Size of the receive buffer. - */ + + /** Size of the receive buffer. */ public static final int RELAY_RECVBUFFERSIZE = 2048; - /** - * Backlog parameter used when creating the ServerSocket. - */ + /** Backlog parameter used when creating the ServerSocket. */ public static final int RELAY_BACKLOG = 1; - - /** - * Address of the Server. IP address or domain name. - */ - public static final String RELAY_SERVERADDRESS = "localhost"; //"bsasdf01.as.bs.dlr.de"; - - /** - * Server port. - */ + + /** Address of the Server. IP address or domain name. */ + public static final String RELAY_SERVERADDRESS = "localhost"; + + /** Server port. */ public static final int RELAY_SERVERPORT = 8080; - - /** - * Address of the Client. Normally this is empty and - * the address of the client is of no importance. - */ + + /** Address of the Client. Normally this is empty and the address of the client is of no importance. */ public static final String RELAY_CLIENTADDRESS = ""; - - /** - * Client port. - */ + + /** Client port. */ public static final int RELAY_CLIENTPORT = 8888; - /** - * Classpath to the plugins. - */ + /** Classpath to the plugins. */ public static final String PLUGIN_CLASSPATH = "de.dlr.davinspector.plugins."; - /** - * Path to the resources, e.g. graphics and icons. - */ - public static final String RESOURCE_PATH = "/de/dlr/davinspector/resource/"; + /** Path to the resources, e.g. graphics, icons and language files. */ + public static final String RESOURCE_PATH = "de/dlr/davinspector/resource/"; - /** - * Column index of the enable/disable plugin for the client column in the plugin configuration dialog. - */ + /** Column index of the enable/disable plugin for the client column in the plugin configuration dialog. */ public static final int PLUGIN_CONFIG_CLIENT_COL = 0; - /** - * Column index of the enable/disable plugin for the server column in the plugin configuration dialog. - */ + /** Column index of the enable/disable plugin for the server column in the plugin configuration dialog. */ public static final int PLUGIN_CONFIG_SERVER_COL = 1; - /** - * Column index of the plugin name column in the plugin configuration dialog. - */ + /** Column index of the plugin name column in the plugin configuration dialog. */ public static final int PLUGIN_CONFIG_NAME_COL = 2; - /** - * System logger configuration file (log4j). - */ + /** System logger configuration file (log4j). */ public static final String SYSTEM_LOGGER_CONFIGURATION = "logging.properties"; - /** - * Empty Constructor. + /** + * Hide class constructor. */ - private Constant() { - - } + private Constant() { } } Added: trunk/DAVInspector/src/de/dlr/davinspector/common/Internationalization.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Internationalization.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Internationalization.java 2008-03-19 17:42:10 UTC (rev 92) @@ -0,0 +1,59 @@ +/* + * Internationalization.java + * + * This class provides all methods needed for internationalization. + * + * Created: 19.03.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.common; + +import java.util.Locale; +import java.util.ResourceBundle; + + +/** + * This class provides all methods needed for internationalization. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public final class Internationalization { + + /** The resource bundle. */ + static final ResourceBundle RESOURCE_BUNDLE = + ResourceBundle.getBundle(Constant.RESOURCE_PATH + "TextBundle", Locale.getDefault()); + + /** + * Hide class constructor. + */ + private Internationalization() { } + + /** + * This method returns the translation for the given key. + * The information is extracted from the proper language file. + * + * @param key String + * @return String + */ + public static String getTranslation(String key) { + return Internationalization.RESOURCE_BUNDLE.getString(key); + } +} Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-03-19 17:42:10 UTC (rev 92) @@ -28,8 +28,6 @@ import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; -import java.util.Locale; -import java.util.ResourceBundle; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; @@ -43,30 +41,12 @@ */ public final class Util { - /** - * + /** + * Hide class constructor. */ - private static final ResourceBundle RESOURCE_BUNDLE = - ResourceBundle.getBundle("de/dlr/davinspector/resource/TextBundle", Locale.getDefault()); - - /** - * Empty Contructor for utility class. - */ - private Util() { - - } + private Util() { } /** - * TODO: wues_ha: Enter comment! - * - * @param key String - * @return String - */ - public static String getTranslation(String key) { - return RESOURCE_BUNDLE.getString(key); - } - - /** * This method tries to set the look & feel of the current OS. */ public static void setUIDesign() { Modified: trunk/DAVInspector/src/de/dlr/davinspector/configuration/Configuration.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/configuration/Configuration.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/configuration/Configuration.java 2008-03-19 17:42:10 UTC (rev 92) @@ -41,31 +41,21 @@ */ public class Configuration { - /** - * - */ + /** The properties object. */ private Properties myProperties; - /** - * Port number of the server connection. - */ + /** Port number of the server connection. */ private int myServerPort; - /** - * Port number of the client connection. - */ + /** Port number of the client connection. */ private int myClientPort; - /** - * Address of the server. - */ + /** Address of the server.*/ private String myServerAddress; - /** - * Address of the client. - */ + /** Address of the client. */ private String myClientAddress; - + /** * Constructor, loads the configuration from the configuration file. */ Modified: trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/configuration/PluginConfiguration.java 2008-03-19 17:42:10 UTC (rev 92) @@ -43,24 +43,16 @@ */ public class PluginConfiguration { - /** - * Symbol used for separating the plugin names. - */ + /** Symbol used for separating the plugin names. */ private static final String DELIMITER = ","; - /** - * - */ + /** The properties object. */ private Properties myProperties; - - /** - * This list contains the names of all plugins to view messages to the server. - */ + + /** This list contains the names of all plugins to view messages to the server. */ private List<String> myActivePluginsServer; - /** - * This list contains the names of all plugins to view messages to the client. - */ + /** This list contains the names of all plugins to view messages to the client. */ private List<String> myActivePluginsClient; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-03-19 17:42:10 UTC (rev 92) @@ -1,9 +1,9 @@ /* * AMessage.java * - * TODO: wues_ha Enter comment! + * The abstract class for messages. * - * Created: 29.02.2008 wues_ha <email> + * Created: 29.02.2008 Jochen Wuest <joc...@dl...> * Changed: * * $Id$ @@ -29,16 +29,14 @@ /** - * TODO: wues_ha: Enter comment! + * The abstract class for messages. * * @version $LastChangedRevision$ * @author Jochen Wuest */ public abstract class AMessage { - /** - * - */ + /** The counter for unique numbering. */ protected static int idCounter; /** @@ -52,69 +50,42 @@ * @author Jochen Wuest */ public enum MessageDirection { - /** - * - */ + /** Data from client to server. */ Request, - /** - * - */ + /** Data from server to client. */ Response } - /** - * Parsing state of the message. - */ + /** Parsing state of the message. */ protected Boolean myParsingState; - /** - * Unique ID of a message. - */ + /** Unique ID of a message. */ protected int myID; - - /** - * Timestamp of the current message. - */ + + /** Timestamp of the current message. */ protected Date myTimestamp; - /** - * myDirection indicates the direction of the message. - * @see MessageDirection - */ + /** myDirection indicates the direction of the message. @see MessageDirection */ protected MessageDirection myDirection; - /** - * This string contains the raw data of the message. - */ + /** This string contains the raw data of the message. */ protected String myRawData; - /** - * - */ + /** This string contains the unprocessed header of the message. */ protected String myRawHeader; - /** - * - */ + /** This string contains the unprocessed body of the message. */ protected String myRawBody; - - /** - * - */ + + /** This string contains the processed header of the message. */ protected String myParsedHeader; - /** - * - */ + /** This string contains the processed body of the message. */ protected String myParsedBody; - - /** - * The size in bytes of the current message. - */ + + /** The size in bytes of the current message. */ protected int mySize; - - /** * This method returns the ID of the message. * @@ -186,7 +157,9 @@ } /** - * TODO: wues_ha: Enter comment! + * This method parses the current raw data. + * If the buffer contains more than only the data for the current message, the rest is returned. + * * @return String */ public String parseMessage() { @@ -194,7 +167,8 @@ } /** - * TODO: wues_ha: Enter comment! + * This method returns <code>true</code> if the message processing is done + * and a valid message has been recognized. * * @return Boolean */ Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/AMessageParser.java 2008-03-19 17:42:10 UTC (rev 92) @@ -1,9 +1,9 @@ /* * AMessageParser.java * - * TODO: wues_ha Enter comment! + * The abstract class for message parsers. * - * Created: 29.02.2008 wues_ha <email> + * Created: 29.02.2008 Jochen Wuest <joc...@dl...> * Changed: * * $Id$ @@ -27,20 +27,18 @@ /** - * TODO: wues_ha: Enter comment! + * The abstract class for message parsers. * * @version $LastChangedRevision$ * @author Jochen Wuest */ public abstract class AMessageParser extends AMessage { - /** - * - */ + /** The Message. */ protected AMessage myMessage; /** - * TODO: wues_ha: enter comment! + * Constructor of the abstract MessageParser class. * * @param aMessage AMessage */ Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-03-19 17:42:10 UTC (rev 92) @@ -43,14 +43,10 @@ */ public class HistoryTableCellRenderer extends DefaultTableCellRenderer implements TableCellRenderer { - /** - * - */ + /** Serial Version UID, not valid. */ private static final long serialVersionUID = 1L; - /** - * Used to save the direction of a message to color a complete row. - */ + /** Used to save the direction of a message to color a complete row. */ private Boolean isRequest; /** @@ -87,7 +83,7 @@ setBackground(Constant.UI_REPLY_COLOR); } } - + return this; } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-03-19 17:42:10 UTC (rev 92) @@ -27,7 +27,7 @@ import javax.swing.table.DefaultTableModel; -import de.dlr.davinspector.common.Util; +import de.dlr.davinspector.common.Internationalization; /** * Data model for the history table. @@ -37,19 +37,15 @@ */ public class HistoryTableModel extends DefaultTableModel implements INewMessageListener { - /** - * - */ + /** Serial Version UID, not valid. */ private static final long serialVersionUID = 0L; - /** - * Column Definition for history table. - */ + /** Column Definition for history table. */ private String[] columnNames = { - Util.getTranslation("column_name_type"), - Util.getTranslation("column_name_id"), - Util.getTranslation("column_name_timestamp"), - Util.getTranslation("column_name_size") + Internationalization.getTranslation("column_name_type"), + Internationalization.getTranslation("column_name_id"), + Internationalization.getTranslation("column_name_timestamp"), + Internationalization.getTranslation("column_name_size") }; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageEvent.java 2008-03-19 17:42:10 UTC (rev 92) @@ -36,14 +36,10 @@ */ public class MessageEvent extends EventObject { - /** - * - */ + /** Serial Version UID, not valid. */ private static final long serialVersionUID = 1L; - /** - * The message. - */ + /** The message. */ private AMessage myMessage; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-19 17:42:10 UTC (rev 92) @@ -40,43 +40,29 @@ /** - * This class saves and provides access - * to the processed messages. + * This class saves and provides access to the processed messages. * * @version $LastChangedRevision$ * @author Jochen Wuest */ public class MessageHistory implements IServerListener, IClientListener { - - /** - * List of listeners for new messages. - */ + /** List of listeners for new messages. */ private EventListenerList myListenersNewMessage = new EventListenerList(); - /** - * List of listeners for refresh. - */ + /** List of listeners for refresh. */ private EventListenerList myListenersRefreshMessage = new EventListenerList(); - - /** - * This string buffers the client side raw data. - */ + + /** This string buffers the client side raw data. */ private String myClientsideBuffer; - /** - * This string buffers the server side raw data. - */ + /** This string buffers the server side raw data. */ private String myServersideBuffer; - - /** - * This vector stores the messages. - */ + + /** This vector stores the messages. */ private List<AMessage> myMessages = null; - /** - * Reference to the relay model. - */ + /** Reference to the relay model. */ private IRelayModel myRelay = null; /** @@ -107,7 +93,7 @@ public void storeMessage(String data, Boolean toClient, Date timestamp) { //TODO: add decorator dependent on protocol (switch http, ...). - //INFO: idCounter != number of messages + // Notice: idCounter != number of messages HTTPMessageParser message = new HTTPMessageParser(new Message()); message.setMessageDirection(toClient); @@ -140,7 +126,6 @@ /** * Deletes all stored messages. - * */ public void deleteAllMessages() { myMessages.clear(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-19 17:42:10 UTC (rev 92) @@ -85,42 +85,30 @@ * INFO: Currently no chunk extensions are handled. */ private static final String REGEX_CHUNK_SIZE = "\r\n([0-9a-fA-F]+)\r\n"; - + /** * This expression matches the transfer encoding of a message. * Transfer-Encoding: SPACE* chunked CRLF * INFO: Currently no transfer extensions are handled. */ private static final String REGEX_IS_CHUNKED = "Transfer-Encoding:[ ]*chunked\r\n"; - - /** - * Logger, Apache log4j. - */ + + /** Logger, Apache log4j. */ private static Logger myLogger = Logger.getLogger(HTTPMessageParser.class); - /** - * The http request method. - */ + /** The http request method. */ private String myMethod; - /** - * The http response status code. - */ + /** The http response status code. */ private int myStatusCode = 0; - /** - * Version of the http protocol uesed by the message. - */ + /** Version of the http protocol uesed by the message. */ private String myProtocolVersion = ""; - /** - * <code>True</code> if the message uses chunked encoding. - */ + /** <code>True</code> if the message uses chunked encoding. */ private Boolean isChunked = false; - /** - * Length of the message body in bytes. - */ + /** Length of the message body in bytes. */ private int myContentLength = 0; /** @@ -136,8 +124,9 @@ } /** - * TODO: wues_ha: Enter comment! - * + * This method extracts the header and body from the raw data of the message. + * The data from the start to the first empty line presents the <code>myRawHeader</code>, + * the data from the first empty line until the end of the raw data presents the <code>myRawBody</code>. */ private void extractHeaderBody() { String[] s = myRawData.split(REGEX_EMPTY_LINE); @@ -168,7 +157,7 @@ Matcher matcher = pattern.matcher(myRawData); if (matcher.find()) { myLogger.debug("found status line"); - myMethod = ""; // TODO: set last method + myMethod = ""; // INFO: set last method myStatusCode = Integer.parseInt(matcher.group(2)); myProtocolVersion = matcher.group(1); isChunked = isChunked(); @@ -294,7 +283,9 @@ } /** - * TODO: wues_ha: Enter comment! + * The method <code>decodeChunkedEncoding</code> tries to read all chunks of the message. + * If the all chunks have been recognized the content of all chunks is returned and the + * <code>myParsingState</code> is set to <code>true</code>. * * @see RFC 2616: 3.6.1 Chunked Transfer Coding * Chunked-Body = *chunk @@ -337,7 +328,7 @@ int start = matcher.end(); int stopp = matcher.end() + chunksize; - // TODO: ung\xFCltige l\xE4ngen abfangen! + // check if lengths are valid if (stopp > myRawData.length()) { myLogger.debug("chunk decoding: invalid right boundary " + stopp); stopp = myRawData.length(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java 2008-03-19 17:42:10 UTC (rev 92) @@ -1,7 +1,7 @@ /* * HTTPMethod.java * - * TODO: wues_ha Enter comment! + * HTTP methodes according to RFC2616 (HTTP1.1) and RFC 4918 (WebDAV). * * Created: 23.01.2008 Jochen Wuest <joc...@dl...> * Changed: @@ -27,29 +27,58 @@ /** - * HTTP methodes according to - * RFC2616 (HTTP1.1) and RFC 4918 (WebDAV). + * HTTP methodes according to RFC2616 (HTTP1.1) and RFC 4918 (WebDAV). * * @version $LastChangedRevision$ * @author Jochen Wuest */ public class HTTPMethod { - // CHECKSTYLE:OFF + + /** */ public static final String HTTP_METHOD_UNKNOWN = "UNKOWN"; + + /** */ public static final String HTTP_METHOD_HEAD = "HEAD"; + + /** */ public static final String HTTP_METHOD_GET = "GET"; + + /** */ public static final String HTTP_METHOD_POST = "POST"; + + /** */ public static final String HTTP_METHOD_PUT = "PUT"; + + /** */ public static final String HTTP_METHOD_DELETE = "DELETE"; + + /** */ public static final String HTTP_METHOD_OPTIONS = "OPTIONS"; + + /** */ public static final String HTTP_METHOD_TRACE = "TRACE"; + + /** */ public static final String HTTP_METHOD_CONNECT = "CONNECT"; + + /** */ public static final String HTTP_METHOD_PROPFIND = "PROPFIND"; + + /** */ public static final String HTTP_METHOD_PROPPATCH = "PROPPATCH"; + + /** */ public static final String HTTP_METHOD_MKCOL = "MKCOL"; + + /** */ public static final String HTTP_METHOD_COPY = "COPY"; + + /** */ public static final String HTTP_METHOD_MOVE = "MOVE"; + + /** */ public static final String HTTP_METHOD_LOCK = "LOCK"; + + /** */ public static final String HTTP_METHOD_UNLOCK = "UNLOCK"; -// CHECKSTYLE:ON } Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPStatusCode.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPStatusCode.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPStatusCode.java 2008-03-19 17:42:10 UTC (rev 92) @@ -1,7 +1,7 @@ /* * HTTPStatusCode.java * - * TODO: wues_ha Enter comment! + * HTTP status codes according to RFC2616 (HTTP1.1) and RFC 4918 (WebDAV). * * Created: 23.01.2008 Jochen Wuest <joc...@dl...> * Changed: @@ -26,13 +26,13 @@ package de.dlr.davinspector.http; /** - * HTTP status codes according to - * RFC2616 (HTTP1.1) and RFC 4918 (WebDAV). + * HTTP status codes according to RFC2616 (HTTP1.1) and RFC 4918 (WebDAV). * * @version $LastChangedRevision$ * @author Jochen Wuest */ public final class HTTPStatusCode { + // CHECKSTYLE:OFF /* * 1xx: Informational - Request received, continuing process @@ -101,10 +101,7 @@ // CHECKSTYLE:ON /** - * TODO: HJW: enter comment! - * + * Hide class constructor. */ - private HTTPStatusCode() { - - } + private HTTPStatusCode() { } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/IEditPlugin.java 2008-03-19 17:42:10 UTC (rev 92) @@ -38,6 +38,7 @@ * @author Jochen Wuest */ public interface IEditPlugin extends IPlugin { + /** * Returns the processed {@link AMessage} of the plugin. * Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java 2008-03-19 17:42:10 UTC (rev 92) @@ -113,29 +113,17 @@ * Indentifier for plugin-type. */ public enum PlugInType { - /** - * Plugin has GUI, client and server. - */ + /** Plugin has GUI, client and server. */ VIEW_GENERAL, - /** - * Plugin allows editing of the content, client and server. - */ + /** Plugin allows editing of the content, client and server. */ EDIT_GENERAL, - /** - * Plugin has GUI, only client. - */ + /** Plugin has GUI, only client. */ VIEW_CLIENT, - /** - * Plugin has GUI, only server. - */ + /** Plugin has GUI, only server. */ VIEW_SERVER, - /** - * Plugin allows editing of the content, only client. - */ + /** Plugin allows editing of the content, only client. */ EDIT_CLIENT, - /** - * Plugin allows editing of the content, only server. - */ + /** Plugin allows editing of the content, only server. */ EDIT_SERVER } @@ -148,13 +136,9 @@ * @author Jochen Wuest */ public enum Direction { - /** - * - */ + /** Plugin on the client side. */ CLIENT, - /** - * - */ + /** Plugin on the server side. */ SERVER } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/IViewPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/IViewPlugin.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/IViewPlugin.java 2008-03-19 17:42:10 UTC (rev 92) @@ -36,6 +36,7 @@ * @author Jochen Wuest */ public interface IViewPlugin extends IPlugin { + /** * Returns the JComponent of the plugin. * Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/JarFilenameFilter.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/JarFilenameFilter.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/JarFilenameFilter.java 2008-03-19 17:42:10 UTC (rev 92) @@ -45,5 +45,4 @@ public boolean accept(File directory, String filename) { return filename.toLowerCase().endsWith(".jar"); } - } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-19 17:42:10 UTC (rev 92) @@ -38,7 +38,6 @@ import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; -import de.dlr.davinspector.history.Message; /** * This class loads all available plugins and manages the activated plugins @@ -51,29 +50,19 @@ */ public final class PluginManager { - /** - * - */ + /** The plugin manager. */ private static PluginManager instance = new PluginManager(); - - /** - * Logger, Apache log4j. - */ + + /** Logger, Apache log4j. */ private static Logger myLogger = Logger.getLogger(PluginManager.class); - - /** - * Vector containing all loaded plugins. - */ + + /** Vector containing all loaded plugins. */ private List<IPlugin> myPluginVector = new Vector<IPlugin>(); - - /** - * This list contains all plugins to view/edit messages to the server. - */ + + /** This list contains all plugins to view/edit messages to the server. */ private List<IPlugin> myActivePluginsServer = new Vector<IPlugin>(); - /** - * This list contains all plugins to view/edit messages to the client. - */ + /** This list contains all plugins to view/edit messages to the client. */ private List<IPlugin> myActivePluginsClient = new Vector<IPlugin>(); /** @@ -132,7 +121,7 @@ if (plugin != null) { myPluginVector.add(plugin); - // TODO: only add plugin if specified for client/server side + // INFO: only add plugin if specified for client/server side // INFO: alternative Direction could be specified here by PluginType!? plugin = (IPlugin) c.newInstance(); plugin.init(IPlugin.Direction.CLIENT); @@ -205,6 +194,11 @@ } } + /** + * TODO: wues_ha: Enter comment! + * + * @return AMessage + */ public AMessage getEditedMessageClient() { AMessage buffer = null; for (Iterator<IPlugin> iterator = myActivePluginsClient.iterator(); iterator.hasNext();) { Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-19 17:42:10 UTC (rev 92) @@ -42,14 +42,10 @@ */ public class HeaderPlugin implements IEditPlugin { - /** - * State of the plugin. - */ + /** State of the plugin. */ private Boolean isActive = true; - /** - * The text pane. - */ + /** The text pane. */ private JTextPane myJTextPane = null; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java 2008-03-19 17:42:10 UTC (rev 92) @@ -42,45 +42,32 @@ /** * This class is the UI for the RecordingPlugin. - * TODO: constant def, complete comments. * * @version $LastChangedRevision$ * @author Jochen Wuest */ public class RecordingConfigurationPanel extends JPanel { - /** - * - */ + /** Serial Version UID, not valid. */ private static final long serialVersionUID = 1L; - /** - * - */ + /** This button opens the file chooser dialog. */ private JButton jButtonOpenFileChooser; - /** - * - */ + /** The label for the file name field. */ private JLabel jLabelFilename; - /** - * - */ + /** The file name field. */ private JTextField jTextFieldFilename; - /** - * The filename. - */ + /** The filename. */ private String myFilename = ""; - /** - * The RecordingPlugin. - */ + /** The RecordingPlugin. */ private RecordingPlugin myParent; - /** - * Constructor. + /** + * Constructor of RecordingConfigurationPanel. * * @param plugin Reference to the plugin object. */ @@ -98,7 +85,7 @@ * @return String */ public String getFilename() { - if (myFilename.equals("")) { + if (myFilename.isEmpty()) { return getDefaultFileName(); } else { return myFilename; @@ -106,21 +93,22 @@ } /** - * TODO: HJW: Enter comment! + * This method opens a file chooser dialog and evaluates the result. + * If a valid file is chosen, the local variable <code>myFilename</code> is updated and + * the method <code>setRecordingFile()</code> of the RecordingPlugin is called. * - * @param evt - * Event + * @param event Event */ - private void jButtonOpenFileChooserActionPerformed(java.awt.event.ActionEvent evt) { + private void jButtonOpenFileChooserActionPerformed(java.awt.event.ActionEvent event) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); fileChooser.setDialogTitle("Select recording file"); fileChooser.setSelectedFile(new File(myFilename)); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - int returnVal = fileChooser.showOpenDialog(null); + int returnValue = fileChooser.showOpenDialog(null); - if (returnVal == JFileChooser.APPROVE_OPTION) { + if (returnValue == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); myFilename = file.getAbsolutePath(); myParent.setRecordingFile(file); @@ -146,8 +134,7 @@ } /** - * TODO: HJW: Enter comment! - * + * This method initializes the graphical elements of the plugin. */ private void initComponents() { jTextFieldFilename = new JTextField(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java 2008-03-19 17:42:10 UTC (rev 92) @@ -46,29 +46,19 @@ */ public class RecordingPlugin implements IViewPlugin { - /** - * State of the plugin. - */ + /** State of the plugin. */ private Boolean isActive = true; - /** - * The UI of the RecordingPlugin. - */ + /** The UI of the RecordingPlugin. */ private RecordingConfigurationPanel myPanel = null; - /** - * The filename of the file to which the data is written. - */ + /** The filename of the file to which the data is written. */ private String myFilename; - /** - * The BufferedWriter for writing the data to the file. - */ + /** The BufferedWriter for writing the data to the file. */ private BufferedWriter myBufferedWriter = null; - /** - * This saves the side assigned to the current plugin object. - */ + /** This saves the side assigned to the current plugin object. */ private Direction myDirection; /** @@ -203,7 +193,6 @@ /** * This method opens the file <code>myFilename</code> and * initializes the <code>BufferedWriter</code>. - * */ private void openBufferedWriter() { if (myBufferedWriter == null) { Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/JTextPaneContentHandler.java 2008-03-19 17:42:10 UTC (rev 92) @@ -52,69 +52,43 @@ */ public class JTextPaneContentHandler implements ContentHandler { - /** - * Character/s for newline. - */ + /** Character/s for newline. */ private static final String NEWLINE = "\r\n"; - /** - * Character/s for indent. - */ + /** Character/s for indent. */ private static final String INDENT = " "; - /** - * - */ + /** Foreground color definition for XML tags. */ private static final Color STYLE_XML_TAG = Color.BLUE; - /** - * - */ + /** Foreground color definition for content between XML tags. */ private static final Color STYLE_XML_CONTENT = Color.BLACK; - /** - * - */ + /** Foreground color definition for XML definition. */ private static final Color STYLE_XML_DEF = Color.LIGHT_GRAY; - /** - * Store URI to prefix mappings. - */ + /** Store URI to prefix mappings. */ private Map<String, String> namespaceMappings; - /** - * The document. - */ + /** The document. */ private StyledDocument myStyledDocument; - /** - * The attributes of the document. - */ + /** The attributes of the document. */ private AttributeSet myAttributeSet; - /** - * This stores the current nesting level. - */ + /** This stores the current nesting level. */ private int myLevel; - /** - * String buffer for the character data. - */ + /** String buffer for the character data. */ private String myBufferCharacterData; - /** - * String buffer for the end tag. - */ + /** String buffer for the end tag. */ private String myBufferEndTag; - /** - * String buffer for the start tag. - */ + /** String buffer for the start tag. */ private String myBufferStartTag; - /** - * This text area displays errors. - */ + /** This text area displays errors. */ private JTextArea myJTextAreaError; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-19 17:42:10 UTC (rev 92) @@ -47,29 +47,19 @@ */ public class XMLPlugin implements IViewPlugin { - /** - * - */ + /** */ private static final double SPLITTER_POSITION = 0.8; - /** - * State of the plugin. - */ + /** State of the plugin. */ private Boolean isActive = true; - /** - * The GUI object. - */ + /** The GUI object. */ private JSplitPane jSplitPane; - /** - * This text pane displays the formated XML. - */ + /** This text pane displays the formated XML. */ private XMLTextPane myXMLTextPane; - /** - * This text area displays XML errors. - */ + /** This text area displays XML errors. */ private JTextArea jTextArea; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLTextPane.java 2008-03-19 17:42:10 UTC (rev 92) @@ -48,23 +48,17 @@ */ public class XMLTextPane extends JTextPane { - /** - * - */ - static final long serialVersionUID = 0; + /** Serial Version UID, not valid. */ + static final long serialVersionUID = 0L; - /** - * The document. - */ + /** The document. */ private StyledDocument myDocument; /** * Constructor, empty. */ - public XMLTextPane() { + public XMLTextPane() { } - } - /** * To achieve no word wrap. * {@inheritDoc} Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java 2008-03-19 17:42:10 UTC (rev 92) @@ -47,19 +47,13 @@ */ class JTreeContentHandler implements ContentHandler { - /** - * - */ + /** */ private static final String APOSTROPHE = "'"; - /** - * Store URI to prefix mappings. - */ + /** Store URI to prefix mappings. */ private Map<String, String> namespaceMappings; - /** - * Current node to add sub-nodes to. - */ + /** Current node to add sub-nodes to. */ private DefaultMutableTreeNode current; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-19 17:42:10 UTC (rev 92) @@ -47,29 +47,19 @@ */ public class XMLTreePlugin implements IViewPlugin { - /** - * - */ + /** */ private static final double SPLITTER_POSITION = 0.8; - /** - * State of the plugin. - */ + /** State of the plugin. */ private Boolean isActive = true; - /** - * The GUI object. - */ + /** The GUI object. */ private JSplitPane jSplitPane; - /** - * This text area displays XML errors. - */ + /** This text area displays XML errors. */ private JTextArea jTextArea; - /** - * The XMLTree component. - */ + /** The XMLTree component. */ private XMLTreeView myXMLTreeView; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreeView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreeView.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreeView.java 2008-03-19 17:42:10 UTC (rev 92) @@ -47,23 +47,17 @@ */ public class XMLTreeView extends JTree { - /** - * - */ - static final long serialVersionUID = 0; + /** Serial Version UID, not valid. */ + static final long serialVersionUID = 0L; - /** - * Data model for the tree. - */ + /** Data model for the tree. */ private DefaultTreeModel myDefaultTreeModel; /** * Constructor, empty. */ - public XMLTreeView() { + public XMLTreeView() { } - } - /** * This method initializes the tree and the tree data model. * Afterwards <code>buildTree</code> is called. Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-19 17:42:10 UTC (rev 92) @@ -44,58 +44,38 @@ */ public class ChannelThread extends Thread { - /** - * - */ + /** */ public static final String COLON = ": "; - /** - * - */ + /** */ private Socket myInputSocket; - /** - * - */ + /** */ private Socket myOutputSocket; - /** - * - */ + /** */ private boolean myDone = false; - /** - * - */ + /** */ private ChannelThread myPeer; - /** - * - */ + /** */ private boolean myDirection; - /** - * The logger. - */ + /** The logger. */ private Logger myLogger; - /** - * - */ + /** */ private String myThreadName = ""; - /** - * - */ + /** */ private IRelayModel myRelay = null; - /** - * - */ + /** */ private List<ChannelThread> myConnections; /** - * Constructor. + * Constructor of a ChannelThread. * * @param inputSocket Socket input socket * @param outputSocket Socket output socket Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/DataEvent.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/DataEvent.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/DataEvent.java 2008-03-19 17:42:10 UTC (rev 92) @@ -36,14 +36,10 @@ */ public class DataEvent extends EventObject { - /** - * - */ + /** Serial Version UID, not valid. */ private static final long serialVersionUID = 1L; - /** - * The data. - */ + /** The data. */ private String myData; /** @@ -65,5 +61,4 @@ public String getData() { return myData; } - } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-19 17:42:10 UTC (rev 92) @@ -39,6 +39,7 @@ * @author Jochen Wuest */ public interface IRelayModel { + /** * This method starts the relay with the given configuration. * Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-19 17:42:10 UTC (rev 92) @@ -50,69 +50,48 @@ * Implementation of the relay interface. Provides the server socket * and manages the channel threads. * FIXME: stopping of the relay and freeing of the server socket. + * TODO:No appenders could be found for logger (de.dlr.davinspector.relay.RelayModel). * * @version $LastChangedRevision$ * @author Jochen Wuest */ public class RelayModel extends Thread implements IRelayModel { - /** - * Logger, Apache log4j. - */ + /** Logger, Apache log4j. */ private static Logger myLogger = Logger.getLogger(RelayModel.class); - /** - * List of listeners for new client data. - */ + /** List of listeners for new client data. */ private EventListenerList myClientListeners = new EventListenerList(); - /** - * List of listeners for server data. - */ + /** List of listeners for server data. */ private EventListenerList myServerListeners = new EventListenerList(); - /** - * Address to forward connections to. - */ + /** Address to forward connections to. */ private InetAddress myDestinationAddress; - /** - * Port to forward connections to. - */ + /** Port to forward connections to. */ private int myDestinationPort; - /** - * This proxy's server socket. - */ + /** This proxy's server socket. */ private ServerSocket serverSocket; - /** - * Plugin manager. - */ + /** The plugin manager. */ private PluginManager myPluginManager = null; - /** - * The lock object is used for synchronizing the ChannelThreads. - */ + /** The lock object is used for synchronizing the ChannelThreads. */ private Object lock = new Object(); - /** - * Contains all current connections (ChannelThreads). - */ + /** Contains all current connections (ChannelThreads). */ private List<ChannelThread> connections = new Vector<ChannelThread>(); - /** - * The message history object. - */ + /** The message history object. */ private MessageHistory myMessageHistory = null; - /** - * State of the automode. - */ + /** State of the automode. */ private Boolean myStateAutomode = false; /** - * Constructor of RelayModel. + * Constructor of a RelayModel. * The constructor creates a new {@link MessageHistory} object. */ public RelayModel() { Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/package.html =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/package.html 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/package.html 2008-03-19 17:42:10 UTC (rev 92) @@ -1,12 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html><head><title>BLUB B</title></head><body> - -BLUB B - -<h2>Package Specification</h2> - -BLUB B - +<html><head><title>Relay package</title></head><body> +This package contains all classes to handle the network traffic. </body></html> \ No newline at end of file Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-03-19 13:05:53 UTC (rev 91) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/AboutDialog.java 2008-03-19 17:42:10 UTC (rev 92) @@ -39,6 +39,7 @@ import javax.swing.JTextPane; import de.dlr.davinspector.common.Constant; +import de.dlr.davinspector.common.Internationalization; import de.dlr.davinspector.common.Util; /** @@ -49,47 +50,33 @@ */ public class AboutDialog extends JDialog { - /** - * - */ + /** Serial Version UID, not valid. */ private static final long serialVersionUID = 1L; - /** - * - */ + /** */ private static final int FONT_SIZE_... [truncated message content] |
From: <wu...@us...> - 2008-03-19 19:17:13
|
Revision: 93 http://davinspector.svn.sourceforge.net/davinspector/?rev=93&view=rev Author: wuest Date: 2008-03-19 12:16:55 -0700 (Wed, 19 Mar 2008) Log Message: ----------- Added hidden constructor and declared class as final. Changed path of log4j to relative path. Modified Paths: -------------- trunk/DAVInspector/.classpath trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java Modified: trunk/DAVInspector/.classpath =================================================================== --- trunk/DAVInspector/.classpath 2008-03-19 17:42:10 UTC (rev 92) +++ trunk/DAVInspector/.classpath 2008-03-19 19:16:55 UTC (rev 93) @@ -3,7 +3,7 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="test"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="lib" path="C:/Dokumente und Einstellungen/wues_ha/workspace/DAVInspector/lib/log4j.jar"/> + <classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> + <classpathentry kind="lib" path="lib/log4j.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java 2008-03-19 17:42:10 UTC (rev 92) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMethod.java 2008-03-19 19:16:55 UTC (rev 93) @@ -32,7 +32,7 @@ * @version $LastChangedRevision$ * @author Jochen Wuest */ -public class HTTPMethod { +public final class HTTPMethod { /** */ public static final String HTTP_METHOD_UNKNOWN = "UNKOWN"; @@ -81,4 +81,9 @@ /** */ public static final String HTTP_METHOD_UNLOCK = "UNLOCK"; + + /** + * Hide class constructor. + */ + private HTTPMethod() { } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-20 12:07:06
|
Revision: 94 http://davinspector.svn.sourceforge.net/davinspector/?rev=94&view=rev Author: wuest Date: 2008-03-20 05:06:59 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Added plugin type column to plugin configuration dialog. Changed alignment and format of the history table columns. Added translations to the EN and DE resource files. Modified Paths: -------------- trunk/DAVInspector/logging.properties trunk/DAVInspector/resource/TextBundle.properties trunk/DAVInspector/resource/TextBundle_de_DE.properties trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java Modified: trunk/DAVInspector/logging.properties =================================================================== --- trunk/DAVInspector/logging.properties 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/logging.properties 2008-03-20 12:06:59 UTC (rev 94) @@ -5,7 +5,7 @@ log4j.logger.de.dlr.davinpsector=DEBUG # Configuration of the Log-File -# log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=log/log4j.log # Max Log-File size Modified: trunk/DAVInspector/resource/TextBundle.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle.properties 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/resource/TextBundle.properties 2008-03-20 12:06:59 UTC (rev 94) @@ -52,17 +52,27 @@ dlg_plugin_configuration_title=Plugin Configuration dlg_plugin_configuration_ok=Ok dlg_plugin_configuration_cancel=Cancel +dlg_plugin_configuration_type_edit=Edit +dlg_plugin_configuration_type_view=View #PluginConfigurationTableModel -column_name_client=Client -column_name_server=Server -column_name_name=Name -column_name_version=Version -column_name_author=Author -column_name_description=Description +#Column names +col_plugin_configuration_client=Client +col_plugin_configuration_server=Server +col_plugin_configuration_name=Name +col_plugin_configuration_type=Type +col_plugin_configuration_version=Version +col_plugin_configuration_author=Author +col_plugin_configuration_description=Description #HistoryTableModel -column_name_type=Direction -column_name_id=ID -column_name_timestamp=Timestamp -column_name_size=Size +#Column names +col_history_type=Direction +col_history_id=ID +col_history_timestamp=Timestamp +col_history_size=Size + +#HistoryTableCellRenderer +#Column type terms +col_history_type_request=Request +col_history_type_response=Response Modified: trunk/DAVInspector/resource/TextBundle_de_DE.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-03-20 12:06:59 UTC (rev 94) @@ -52,17 +52,26 @@ dlg_plugin_configuration_title=Plugin Einstellungen dlg_plugin_configuration_ok=Ok dlg_plugin_configuration_cancel=Abbrechen +dlg_plugin_configuration_type_edit=R/W +dlg_plugin_configuration_type_view=RO #PluginConfigurationTableModel -column_name_client=Client -column_name_server=Server -column_name_name=Name -column_name_version=Version -column_name_author=Autor -column_name_description=Beschreibung +col_plugin_configuration_client=Client +col_plugin_configuration_server=Server +col_plugin_configuration_name=Name +col_plugin_configuration_type=Typ +col_plugin_configuration_version=Version +col_plugin_configuration_author=Autor +col_plugin_configuration_description=Beschreibung #HistoryTableModel -column_name_type=Richtung -column_name_id=ID -column_name_timestamp=Zeitmarke -column_name_size=Gr\xF6\xDFe +col_history_type=Richtung +col_history_id=ID +col_history_timestamp=Zeitmarke +col_history_size=Gr\xF6\xDFe + +#HistoryTableCellRenderer +#Column type terms +col_history_type_request=Anfrage +col_history_type_response=Antwort + Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-20 12:06:59 UTC (rev 94) @@ -63,10 +63,10 @@ /** About dialog height. */ public static final int UI_ABOUT_DIALOG_HEIGTH = 275; - /** Backgroundcolor of replies. */ + /** Background color of replies. */ public static final Color UI_REPLY_COLOR = new Color(255, 232, 140); - /** Backgroundcolor of requests. */ + /** Background color of requests. */ public static final Color UI_REQUEST_COLOR = new Color(210, 255, 210); /** Line Feed + Carriage Return. */ Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-03-20 12:06:59 UTC (rev 94) @@ -28,6 +28,7 @@ import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; +import java.text.DecimalFormat; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; @@ -80,4 +81,29 @@ } window.setLocation((screenSize.width - windowSize.width) / 2, (screenSize.height - windowSize.height) / 2); } + + /** + * This method formats bytes. + * NOTE: This method does *NOT* use the correct SI Units. + * See http://en.wikipedia.org/wiki/Byte + * + * @param size Size in Bytes. + * @return String with the formated quantity of bytes with the correct unit. + */ + public static String formatByteSize(int size) { + final int divider = 1024; + String[] units = { " B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; + + int unitsLength = units.length - 1; + int unitIndex = 0; + double result = size; + + while (result >= divider && unitIndex < unitsLength) { + result /= divider; + unitIndex++; + } + + DecimalFormat decimalFormat = new DecimalFormat("###,##0.#"); + return decimalFormat.format(result) + ' ' + units[unitIndex]; + } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-03-20 12:06:59 UTC (rev 94) @@ -26,13 +26,18 @@ package de.dlr.davinspector.history; import java.awt.Component; -import java.awt.SystemColor; +import java.text.DateFormat; +import java.util.Date; +import java.util.Locale; import javax.swing.JTable; +import javax.swing.SwingConstants; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import de.dlr.davinspector.common.Constant; +import de.dlr.davinspector.common.Internationalization; +import de.dlr.davinspector.common.Util; /** @@ -46,8 +51,23 @@ /** Serial Version UID, not valid. */ private static final long serialVersionUID = 1L; + /** Index of the column type. */ + private static final int COLUMN_INDEX_TYPE = 0; + + /** Index of the column ID. */ + private static final int COLUMN_INDEX_ID = 1; + + /** Index of the column timestamp. */ + private static final int COLUMN_INDEX_TIMESTAMP = 2; + + /** Index of the column size. */ + private static final int COLUMN_INDEX_SIZE = 3; + /** Used to save the direction of a message to color a complete row. */ private Boolean isRequest; + + /** Definition of the format for the timestamp column. */ + private DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.getDefault()); /** * {@inheritDoc} @@ -60,23 +80,34 @@ super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - if (value instanceof AMessage.MessageDirection){ + if (column == COLUMN_INDEX_TYPE){ + setHorizontalAlignment(SwingConstants.LEFT); if (value.equals(AMessage.MessageDirection.Request)) { - setText("Request"); + setText(Internationalization.getTranslation("col_history_type_request")); isRequest = true; } else { - setText("Reply"); + setText(Internationalization.getTranslation("col_history_type_response")); isRequest = false; } + } else if (column == COLUMN_INDEX_ID) { + setHorizontalAlignment(SwingConstants.RIGHT); + setText(value.toString()); + } else if (column == COLUMN_INDEX_TIMESTAMP) { + setHorizontalAlignment(SwingConstants.RIGHT); + setText(dateFormat.format((Date) value)); + } else if (column == COLUMN_INDEX_SIZE) { + setHorizontalAlignment(SwingConstants.RIGHT); + setText(Util.formatByteSize(Integer.parseInt(value.toString()))); } else { + setHorizontalAlignment(SwingConstants.LEFT); setText(value.toString()); } if (hasFocus || isSelected) { - setForeground(SystemColor.textHighlightText); - setBackground(SystemColor.textHighlight); + setForeground(table.getSelectionForeground()); + setBackground(table.getSelectionBackground()); } else { - setForeground(SystemColor.textText); + setForeground(table.getForeground()); if (isRequest) { setBackground(Constant.UI_REQUEST_COLOR); } else { Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableModel.java 2008-03-20 12:06:59 UTC (rev 94) @@ -42,10 +42,11 @@ /** Column Definition for history table. */ private String[] columnNames = { - Internationalization.getTranslation("column_name_type"), - Internationalization.getTranslation("column_name_id"), - Internationalization.getTranslation("column_name_timestamp"), - Internationalization.getTranslation("column_name_size") + Internationalization.getTranslation("col_history_type"), + Internationalization.getTranslation("col_history_id"), + Internationalization.getTranslation("col_history_timestamp"), + Internationalization.getTranslation("col_history_size") + // TODO: display more information depending on message type }; /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-20 12:06:59 UTC (rev 94) @@ -32,6 +32,7 @@ import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.history.Message; import de.dlr.davinspector.plugin.IEditPlugin; +import de.dlr.davinspector.plugin.IViewPlugin; /** @@ -40,7 +41,7 @@ * @version $LastChangedRevision$ * @author Jochen Wuest */ -public class HeaderPlugin implements IEditPlugin { +public class HeaderPlugin implements IEditPlugin, IViewPlugin { /** State of the plugin. */ private Boolean isActive = true; Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-20 12:06:59 UTC (rev 94) @@ -72,8 +72,7 @@ * The main window of the application. * GUI todos: * INFO: Place buttons of the dialog windows in the lower right corner of the window. - * INFO: Adjust alignment of table columns. - * INFO: i18n support into separate class!? + * INFO: Adjust alignment of table columns ID and size of the history table. * * TODO: getMessageHistory restructure model/relay * @@ -405,7 +404,6 @@ * Action: Enable or disable automode. */ private Action automodeAction = new AbstractAction() { - // INFO: myAutomodeIsActive local var!? static final long serialVersionUID = 1L; { putValue(Action.NAME, Internationalization.getTranslation("ac_enable_auto_mode")); @@ -922,8 +920,7 @@ jPanelRight = null; jSplitPaneHorizontal.setLeftComponent(getJTabbedPaneClient()); jSplitPaneHorizontal.setRightComponent(getJPanelRight()); - // set divider location - jSplitPaneHorizontal.setResizeWeight(DIVIDER_HORZ); + jSplitPaneHorizontal.setDividerLocation(DIVIDER_HORZ); jSplitPaneHorizontal.repaint(); } } @@ -945,8 +942,7 @@ if (jSplitPaneVertical == null) { jSplitPaneVertical = new JSplitPane(); jSplitPaneVertical.setOrientation(JSplitPane.VERTICAL_SPLIT); - // set divider location - jSplitPaneVertical.setResizeWeight(DIVIDER_VERT); + jSplitPaneVertical.setDividerLocation(DIVIDER_VERT); jSplitPaneVertical.setBottomComponent(getJPanelHistory()); jSplitPaneVertical.setTopComponent(getJSplitPaneHorizontal()); } @@ -981,17 +977,9 @@ jTableHistory = new JTable(myHistoryTableModel); jTableHistory.setShowGrid(true); jTableHistory.setAutoCreateRowSorter(true); -// // Disable auto resizing -// jTableHistory.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); -// // Set the column widths -// TableColumn column = jTableHistory.getColumnModel().getColumn(0); -// column.setPreferredWidth(100); -// column = jTableHistory.getColumnModel().getColumn(1); -// column.setPreferredWidth(100); -// column = jTableHistory.getColumnModel().getColumn(2); -// column.setPreferredWidth(100); -// column = jTableHistory.getColumnModel().getColumn(3); -// column.setPreferredWidth(100); + // do NOT allow reordering of the columns! + // in future you may enable this, but you also have to convert the column indices (view/table data model) + jTableHistory.getTableHeader().setReorderingAllowed(false); jTableHistory.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationDialog.java 2008-03-20 12:06:59 UTC (rev 94) @@ -60,14 +60,17 @@ private static final long serialVersionUID = 1L; /** Width of the column client (checkbox) in pixel. */ - private static final int COLUMN_WIDTH_CLIENT = 50; + private static final int COLUMN_WIDTH_CLIENT = 40; /** Width of the column server (checkbox) in pixel. */ - private static final int COLUMN_WIDTH_SERVER = 50; + private static final int COLUMN_WIDTH_SERVER = 40; /** Width of the column name in pixel. */ private static final int COLUMN_WIDTH_NAME = 100; + /** Width of the column type in pixel. */ + private static final int COLUMN_WIDTH_TYPE = 50; + /** Width of the column version in pixel. */ private static final int COLUMN_WIDTH_VERSION = 50; @@ -86,14 +89,17 @@ /** Index of the column name. */ private static final int COLUMN_INDEX_NAME = 2; + /** Index of the column type. */ + private static final int COLUMN_INDEX_TYPE = 3; + /** Index of the column version. */ - private static final int COLUMN_INDEX_VERSION = 3; + private static final int COLUMN_INDEX_VERSION = 4; /** Index of the column author. */ - private static final int COLUMN_INDEX_AUTHOR = 4; + private static final int COLUMN_INDEX_AUTHOR = 5; /** Index of the column description. */ - private static final int COLUMN_INDEX_DESCRIPTION = 5; + private static final int COLUMN_INDEX_DESCRIPTION = 6; /** */ private JPanel jContentPane = null; @@ -147,6 +153,7 @@ public void addPlugins(List<IPlugin> availablePlugins) { Boolean isAvailableForClient = false; Boolean isAvailableForServer = false; + String pluginType; // empty the table first myTableModel.setRowCount(0); @@ -154,6 +161,7 @@ PluginConfiguration myPluginConfiguration = new PluginConfiguration(); for (IPlugin plugin : availablePlugins) { + // check availability of the plugin (client/server) if (plugin.getType() == (IPlugin.PlugInType.VIEW_CLIENT) || plugin.getType() == (IPlugin.PlugInType.EDIT_CLIENT) || plugin.getType() == (IPlugin.PlugInType.VIEW_GENERAL) @@ -166,13 +174,22 @@ || plugin.getType() == (IPlugin.PlugInType.EDIT_GENERAL)) { isAvailableForServer = true; } + // check the plugin type + if (plugin.getType() == (IPlugin.PlugInType.EDIT_CLIENT) + || plugin.getType() == (IPlugin.PlugInType.EDIT_SERVER) + || plugin.getType() == (IPlugin.PlugInType.EDIT_GENERAL)) { + pluginType = Internationalization.getTranslation("dlg_plugin_configuration_type_edit"); + } else { + pluginType = Internationalization.getTranslation("dlg_plugin_configuration_type_view"); + } + myAvailablePlugins.put(plugin.getName(), new Boolean[] {isAvailableForClient, isAvailableForServer}); // Is the plugin in the list of loaded plugins? If so mark the plugin as enabled. Boolean clientEnabled = myPluginConfiguration.getActivePluginsClient().contains(plugin.getName()); Boolean serverEnabled = myPluginConfiguration.getActivePluginsServer().contains(plugin.getName()); - myTableModel.addRow(new Object[]{clientEnabled, serverEnabled, plugin.getName(), + myTableModel.addRow(new Object[]{clientEnabled, serverEnabled, plugin.getName(), pluginType, plugin.getVersion(), plugin.getAuthor(), plugin.getDescription()}); } myTableModel.fireTableDataChanged(); @@ -255,6 +272,8 @@ column.setPreferredWidth(COLUMN_WIDTH_SERVER); column = jTable.getColumnModel().getColumn(COLUMN_INDEX_NAME); column.setPreferredWidth(COLUMN_WIDTH_NAME); + column = jTable.getColumnModel().getColumn(COLUMN_INDEX_TYPE); + column.setPreferredWidth(COLUMN_WIDTH_TYPE); column = jTable.getColumnModel().getColumn(COLUMN_INDEX_VERSION); column.setPreferredWidth(COLUMN_WIDTH_VERSION); column = jTable.getColumnModel().getColumn(COLUMN_INDEX_AUTHOR); Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java 2008-03-19 19:16:55 UTC (rev 93) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableModel.java 2008-03-20 12:06:59 UTC (rev 94) @@ -43,12 +43,13 @@ /** Column definition. */ private String[] columnNames = { - Internationalization.getTranslation("column_name_client"), - Internationalization.getTranslation("column_name_server"), - Internationalization.getTranslation("column_name_name"), - Internationalization.getTranslation("column_name_version"), - Internationalization.getTranslation("column_name_author"), - Internationalization.getTranslation("column_name_description") + Internationalization.getTranslation("col_plugin_configuration_client"), + Internationalization.getTranslation("col_plugin_configuration_server"), + Internationalization.getTranslation("col_plugin_configuration_name"), + Internationalization.getTranslation("col_plugin_configuration_type"), + Internationalization.getTranslation("col_plugin_configuration_version"), + Internationalization.getTranslation("col_plugin_configuration_author"), + Internationalization.getTranslation("col_plugin_configuration_description") }; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-20 15:12:53
|
Revision: 95 http://davinspector.svn.sourceforge.net/davinspector/?rev=95&view=rev Author: wuest Date: 2008-03-20 08:12:50 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Changed configuration file name logging.properties to log4j.properties. Removed scroll panes for the plugins from MainView. Now every plugin can have it's own scroll pane, if needed. Modified Paths: -------------- trunk/DAVInspector/build-user.xml trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableCellRenderer.java Added Paths: ----------- trunk/DAVInspector/log4j.properties Removed Paths: ------------- trunk/DAVInspector/logging.properties trunk/DAVInspector/test/de/dlr/davinspector/http/package.html Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/build-user.xml 2008-03-20 15:12:50 UTC (rev 95) @@ -67,7 +67,7 @@ <manifest> <attribute name="Main-Class" value="de/dlr/davinspector.DAVInspector"/> <attribute name="Built-By" value="${user.name}"/> - <attribute name="Class-Path" value=". logging.properties lib/log4j.jar"/> + <attribute name="Class-Path" value=". log4j.properties lib/log4j.jar"/> <section name="DAVInspector"> <attribute name="Specification-Title" value="${project.name}"/> Copied: trunk/DAVInspector/log4j.properties (from rev 94, trunk/DAVInspector/logging.properties) =================================================================== --- trunk/DAVInspector/log4j.properties (rev 0) +++ trunk/DAVInspector/log4j.properties 2008-03-20 15:12:50 UTC (rev 95) @@ -0,0 +1,28 @@ +# Log-Level of the root Logger +log4j.rootLogger=FATAL, system + +# Set Log-Level for DAVInspector +log4j.logger.de.dlr.davinspector=ERROR, system +log4j.logger.de.dlr.davinspector.plugin=DEBUG, plugin +log4j.logger.de.dlr.davinspector.plugins=DEBUG, plugin +log4j.logger.de.dlr.davinspector.http=DEBUG, messageparser +log4j.logger.de.dlr.davinspector.history=DEBUG, messageparser + +# Configuration of the general Log-File +log4j.appender.system=org.apache.log4j.FileAppender +log4j.appender.system.File=log/davinspector.log +log4j.appender.system.Append=false +log4j.appender.system.layout=org.apache.log4j.PatternLayout +log4j.appender.system.layout.ConversionPattern=%p %t %c - %m%n + +# Configuration of the Log-File for plugin manager and plugins +log4j.appender.plugin=org.apache.log4j.FileAppender +log4j.appender.plugin.File=log/plugin.log +log4j.appender.plugin.layout=org.apache.log4j.PatternLayout +log4j.appender.plugin.layout.ConversionPattern=%p %t %c - %m%n + +# Configuration of the Log-File for http parser and history +log4j.appender.messageparser=org.apache.log4j.FileAppender +log4j.appender.messageparser.File=log/messageparser.log +log4j.appender.messageparser.layout=org.apache.log4j.PatternLayout +log4j.appender.messageparser.layout.ConversionPattern=%p %t %c - %m%n Deleted: trunk/DAVInspector/logging.properties =================================================================== --- trunk/DAVInspector/logging.properties 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/logging.properties 2008-03-20 15:12:50 UTC (rev 95) @@ -1,17 +0,0 @@ -# Log-Level of the root Logger -log4j.rootLogger=ERROR - -# Set Log-Level for DAVInspector -log4j.logger.de.dlr.davinpsector=DEBUG - -# Configuration of the Log-File -log4j.appender.file=org.apache.log4j.RollingFileAppender -log4j.appender.file.File=log/log4j.log - -# Max Log-File size -log4j.appender.file.MaxFileSize=100KB -# Keep one Backup -log4j.appender.file.MaxBackupIndex=1 -# Define logger layout -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%p %t %c - %m%n Modified: trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/DAVInspector.java 2008-03-20 15:12:50 UTC (rev 95) @@ -27,6 +27,9 @@ import java.util.Locale; +import org.apache.log4j.PropertyConfigurator; + +import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.relay.IRelayModel; import de.dlr.davinspector.relay.RelayModel; import de.dlr.davinspector.ui.MainController; @@ -51,6 +54,8 @@ * @param args String[] */ public static void main(String[] args) { + // Configure Logger + PropertyConfigurator.configure(Constant.SYSTEM_LOGGER_CONFIGURATION); // for testing i18n support Locale.setDefault(new Locale("en")); // Locale.setDefault(new Locale("de")); Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-20 15:12:50 UTC (rev 95) @@ -133,7 +133,7 @@ public static final int PLUGIN_CONFIG_NAME_COL = 2; /** System logger configuration file (log4j). */ - public static final String SYSTEM_LOGGER_CONFIGURATION = "logging.properties"; + public static final String SYSTEM_LOGGER_CONFIGURATION = "log4j.properties"; /** * Hide class constructor. Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-20 15:12:50 UTC (rev 95) @@ -29,7 +29,6 @@ import java.util.regex.Pattern; import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; @@ -119,8 +118,6 @@ public HTTPMessageParser(AMessage aMessage) { super(aMessage); myParsingState = false; - // Configure Logger - PropertyConfigurator.configure(Constant.SYSTEM_LOGGER_CONFIGURATION); } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-20 15:12:50 UTC (rev 95) @@ -34,7 +34,6 @@ import java.util.Vector; import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.history.AMessage; @@ -77,8 +76,6 @@ * @return PluginManager */ public static PluginManager getInstance() { - // Configure Logger - PropertyConfigurator.configure(Constant.SYSTEM_LOGGER_CONFIGURATION); return instance; } @@ -94,7 +91,7 @@ String pathToPluginDir = pluginDirectory.getAbsolutePath(); for (String jarFile : jarFiles) { File plug = new File(pathToPluginDir + "/" + jarFile); - myLogger.debug("Loading plugin: " + jarFile); + myLogger.debug("Loading file: " + jarFile); loadPlugin(plug.getAbsoluteFile()); } } @@ -109,7 +106,7 @@ IPlugin plugin = null; String name = jarFile.getName().substring(0, jarFile.getName().lastIndexOf(".")); try { - myLogger.debug("Trying to load class: " + name); + myLogger.debug("Loading plugin: " + name); URLClassLoader jClassLoader = new URLClassLoader(new URL[] { jarFile.toURI().toURL() }); Class<?> c = jClassLoader.loadClass(Constant.PLUGIN_CLASSPATH + name.toLowerCase() + "." + name); // lets try to load the plugin... Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-20 15:12:50 UTC (rev 95) @@ -26,6 +26,7 @@ package de.dlr.davinspector.plugins.headerplugin; import javax.swing.JComponent; +import javax.swing.JScrollPane; import javax.swing.JTextPane; import de.dlr.davinspector.common.Util; @@ -49,13 +50,16 @@ /** The text pane. */ private JTextPane myJTextPane = null; + /** The scroll pane. */ + private JScrollPane myJScrollPane = null; + /** * {@inheritDoc} * * @see de.dlr.DAVInspector.Plugin.IViewPlugin#getUI() */ public JComponent getUI() { - return myJTextPane; + return myJScrollPane; } /** @@ -109,9 +113,11 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ public void init(Direction direction) { - if (myJTextPane == null) { + if (myJScrollPane == null) { + myJScrollPane = new JScrollPane(); myJTextPane = new JTextPane(); myJTextPane.setEditable(false); + myJScrollPane.setViewportView(myJTextPane); } myJTextPane.setText(""); Util.setUIDesign(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-20 15:12:50 UTC (rev 95) @@ -29,6 +29,7 @@ import java.io.IOException; import javax.swing.JComponent; +import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextArea; @@ -52,15 +53,21 @@ /** State of the plugin. */ private Boolean isActive = true; + + /** The scroll pane of the view. */ + private JScrollPane myJScrollPaneView = null; + + /** The scroll pane of the text area for errors. */ + private JScrollPane myJScrollPaneError = null; /** The GUI object. */ - private JSplitPane jSplitPane; + private JSplitPane myJSplitPane; /** This text pane displays the formated XML. */ private XMLTextPane myXMLTextPane; /** This text area displays XML errors. */ - private JTextArea jTextArea; + private JTextArea myJTextArea; /** * {@inheritDoc} @@ -68,7 +75,7 @@ * @see de.dlr.DAVInspector.Plugin.IViewPlugin#getUI() */ public JComponent getUI() { - return jSplitPane; + return myJSplitPane; } /** @@ -122,23 +129,30 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ public void init(Direction direction) { - if (jSplitPane == null) { - jTextArea = new JTextArea(); - jTextArea.setLineWrap(true); - jTextArea.setEditable(false); - jTextArea.setForeground(SystemColor.RED); + if (myJSplitPane == null) { + myJTextArea = new JTextArea(); + myJTextArea.setLineWrap(true); + myJTextArea.setEditable(false); + myJTextArea.setForeground(SystemColor.RED); + myJScrollPaneError = new JScrollPane(); + myJScrollPaneError.setViewportView(myJTextArea); + myXMLTextPane = new XMLTextPane(); myXMLTextPane.setEditable(false); - jSplitPane = new JSplitPane(); - jSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); - jSplitPane.setResizeWeight(SPLITTER_POSITION); - jSplitPane.setBottomComponent(jTextArea); - jSplitPane.setTopComponent(myXMLTextPane); + myJScrollPaneView = new JScrollPane(); + myJScrollPaneView.setViewportView(myXMLTextPane); + + myJSplitPane = new JSplitPane(); + myJSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); + myJSplitPane.setDividerLocation(SPLITTER_POSITION); + myJSplitPane.setResizeWeight(SPLITTER_POSITION); + myJSplitPane.setBottomComponent(myJScrollPaneError); + myJSplitPane.setTopComponent(myJScrollPaneView); } myXMLTextPane.setText(""); - jTextArea.setText(""); + myJTextArea.setText(""); Util.setUIDesign(); } @@ -177,11 +191,11 @@ public void update(AMessage msg) { if (isActive && myXMLTextPane != null) { try { - myXMLTextPane.init(msg.getMessageBody(), jTextArea); + myXMLTextPane.init(msg.getMessageBody(), myJTextArea); } catch (SAXException se) { - jTextArea.append(se.getMessage()); + myJTextArea.append(se.getMessage()); } catch (IOException ioe) { - jTextArea.append(ioe.getMessage()); + myJTextArea.append(ioe.getMessage()); } } } @@ -194,7 +208,7 @@ public void clear() { if (myXMLTextPane != null) { myXMLTextPane.setText(""); - jTextArea.setText(""); + myJTextArea.setText(""); } } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/JTreeContentHandler.java 2008-03-20 15:12:50 UTC (rev 95) @@ -192,8 +192,10 @@ public void characters(char[] ch, int start, int length) throws SAXException { String s = new String(ch, start, length).trim(); - DefaultMutableTreeNode data = new DefaultMutableTreeNode("Character Data: '" + s + APOSTROPHE); - current.add(data); + if (!s.isEmpty()) { + DefaultMutableTreeNode data = new DefaultMutableTreeNode("Character Data: '" + s + APOSTROPHE); + current.add(data); + } } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-20 15:12:50 UTC (rev 95) @@ -29,6 +29,7 @@ import java.io.IOException; import javax.swing.JComponent; +import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextArea; @@ -52,15 +53,21 @@ /** State of the plugin. */ private Boolean isActive = true; - + + /** The scroll pane of the tree. */ + private JScrollPane myJScrollPaneTree = null; + + /** The scroll pane of the text area for errors. */ + private JScrollPane myJScrollPaneError = null; + /** The GUI object. */ - private JSplitPane jSplitPane; + private JSplitPane myJSplitPane = null; /** This text area displays XML errors. */ - private JTextArea jTextArea; + private JTextArea myJTextArea = null; /** The XMLTree component. */ - private XMLTreeView myXMLTreeView; + private XMLTreeView myXMLTreeView = null; /** * {@inheritDoc} @@ -68,7 +75,7 @@ * @see de.dlr.DAVInspector.Plugin.IViewPlugin#getUI() */ public JComponent getUI() { - return jSplitPane; + return myJSplitPane; } /** @@ -122,22 +129,28 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ public void init(Direction direction) { - if (jSplitPane == null) { - jTextArea = new JTextArea(); - jTextArea.setLineWrap(true); - jTextArea.setEditable(false); - jTextArea.setForeground(SystemColor.RED); + if (myJSplitPane == null) { + myJTextArea = new JTextArea(); + myJTextArea.setLineWrap(true); + myJTextArea.setEditable(false); + myJTextArea.setForeground(SystemColor.RED); + myJScrollPaneError = new JScrollPane(); + myJScrollPaneError.setViewportView(myJTextArea); + myXMLTreeView = new XMLTreeView(); myXMLTreeView.setEditable(false); - jSplitPane = new JSplitPane(); - jSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); - jSplitPane.setResizeWeight(SPLITTER_POSITION); - jSplitPane.setBottomComponent(jTextArea); - jSplitPane.setTopComponent(myXMLTreeView); + myJScrollPaneTree = new JScrollPane(); + myJScrollPaneTree.setViewportView(myXMLTreeView); + + myJSplitPane = new JSplitPane(); + myJSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); + myJSplitPane.setDividerLocation(SPLITTER_POSITION); + myJSplitPane.setBottomComponent(myJScrollPaneError); + myJSplitPane.setTopComponent(myJScrollPaneTree); } - jTextArea.setText(""); + myJTextArea.setText(""); updateTree(""); Util.setUIDesign(); } @@ -189,9 +202,9 @@ try { myXMLTreeView.init(data); } catch (SAXException se) { - jTextArea.append(se.getMessage()); + myJTextArea.append(se.getMessage()); } catch (IOException ioe) { - jTextArea.append(ioe.getMessage()); + myJTextArea.append(ioe.getMessage()); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-20 15:12:50 UTC (rev 95) @@ -38,7 +38,6 @@ import javax.swing.event.EventListenerList; import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.configuration.Configuration; @@ -50,7 +49,6 @@ * Implementation of the relay interface. Provides the server socket * and manages the channel threads. * FIXME: stopping of the relay and freeing of the server socket. - * TODO:No appenders could be found for logger (de.dlr.davinspector.relay.RelayModel). * * @version $LastChangedRevision$ * @author Jochen Wuest @@ -95,16 +93,12 @@ * The constructor creates a new {@link MessageHistory} object. */ public RelayModel() { - // Configure Logger - PropertyConfigurator.configure(Constant.SYSTEM_LOGGER_CONFIGURATION); - myMessageHistory = new MessageHistory(this); myPluginManager = PluginManager.getInstance(); // load available plugins myPluginManager.loadAllPlugins(); // load plugin configuration (if available) PluginConfiguration pluginConfiguration = new PluginConfiguration(); - pluginConfiguration.loadConfiguration(); myPluginManager.setActivePluginsClient(pluginConfiguration.getActivePluginsClient()); myPluginManager.setActivePluginsServer(pluginConfiguration.getActivePluginsServer()); } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-03-20 15:12:50 UTC (rev 95) @@ -601,9 +601,7 @@ IPlugin plugin = (IPlugin) iterator.next(); if (plugin.isActive()) { IViewPlugin viewPlugin = (IViewPlugin) plugin; - JScrollPane jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(viewPlugin.getUI()); - jTabbedPaneClient.addTab(viewPlugin.getName(), null, jScrollPane, null); + jTabbedPaneClient.addTab(viewPlugin.getName(), null, viewPlugin.getUI(), null); } } } @@ -642,9 +640,7 @@ IPlugin plugin = (IPlugin) iterator.next(); if (plugin.isActive()) { IViewPlugin viewPlugin = (IViewPlugin) plugin; - JScrollPane jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(viewPlugin.getUI()); - jTabbedPaneServer.addTab(viewPlugin.getName(), null, jScrollPane, null); + jTabbedPaneServer.addTab(viewPlugin.getName(), null, viewPlugin.getUI(), null); } } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableCellRenderer.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableCellRenderer.java 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/PluginConfigurationTableCellRenderer.java 2008-03-20 15:12:50 UTC (rev 95) @@ -108,7 +108,6 @@ /** * This method returns the availability of the plugin with <code>pluginName</code> * for client and server side. (client = 0, server = 1) - * INFO: use constants instead of int * * @param pluginName String * @param columnIndex int Deleted: trunk/DAVInspector/test/de/dlr/davinspector/http/package.html =================================================================== --- trunk/DAVInspector/test/de/dlr/davinspector/http/package.html 2008-03-20 12:06:59 UTC (rev 94) +++ trunk/DAVInspector/test/de/dlr/davinspector/http/package.html 2008-03-20 15:12:50 UTC (rev 95) @@ -1,6 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" -"http://www.w3.org/TR/REC-html40/loose.dtd"> - -<html><head><title>Package unit tests for HTTP</title></head><body> -This package contains all unit test classes for the basic HTTP message parser. -</body></html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-03-27 14:18:23
|
Revision: 98 http://davinspector.svn.sourceforge.net/davinspector/?rev=98&view=rev Author: wuest Date: 2008-03-27 07:18:11 -0700 (Thu, 27 Mar 2008) Log Message: ----------- Corrected spelling in text bundles. Separated RelayModel into model-part and relay-part, work still in progress. Unified naming of data/message directions. Added log4j appender for the relay package. Modified Paths: -------------- trunk/DAVInspector/DAVInspector.bat trunk/DAVInspector/log4j.properties trunk/DAVInspector/resource/TextBundle.properties trunk/DAVInspector/resource/TextBundle_de_DE.properties trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/test/de/dlr/davinspector/http/HTTPTest.java Added Paths: ----------- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java trunk/DAVInspector/src/de/dlr/davinspector/relay/INewClientDataListener.java trunk/DAVInspector/src/de/dlr/davinspector/relay/INewServerDataListener.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayThread.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayThread.java Removed Paths: ------------- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IClientListener.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IServerListener.java Modified: trunk/DAVInspector/DAVInspector.bat =================================================================== --- trunk/DAVInspector/DAVInspector.bat 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/DAVInspector.bat 2008-03-27 14:18:11 UTC (rev 98) @@ -1,3 +1,3 @@ @echo off -java -jar DAVInspector.jar -D java.util.logging.config.file=C:/Programme/DAVInspector/logging.properties +java -jar DAVInspector.jar Modified: trunk/DAVInspector/log4j.properties =================================================================== --- trunk/DAVInspector/log4j.properties 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/log4j.properties 2008-03-27 14:18:11 UTC (rev 98) @@ -7,6 +7,7 @@ log4j.logger.de.dlr.davinspector.plugins=DEBUG, plugin log4j.logger.de.dlr.davinspector.http=DEBUG, messageparser log4j.logger.de.dlr.davinspector.history=DEBUG, messageparser +log4j.logger.de.dlr.davinspector.relay=DEBUG, relay # Configuration of the general Log-File log4j.appender.system=org.apache.log4j.FileAppender @@ -26,3 +27,9 @@ log4j.appender.messageparser.File=log/messageparser.log log4j.appender.messageparser.layout=org.apache.log4j.PatternLayout log4j.appender.messageparser.layout.ConversionPattern=%p %t %c - %m%n + +# Configuration of the Log-File for relay and channel threads +log4j.appender.relay=org.apache.log4j.FileAppender +log4j.appender.relay.File=log/relay.log +log4j.appender.relay.layout=org.apache.log4j.PatternLayout +log4j.appender.relay.layout.ConversionPattern=%p %t %c - %m%n Modified: trunk/DAVInspector/resource/TextBundle.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle.properties 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/resource/TextBundle.properties 2008-03-27 14:18:11 UTC (rev 98) @@ -1,30 +1,30 @@ # actions ac_exit=Exit -ac_exit_description=Exit the program. +ac_exit_description=Exit the program ac_send_to_server=Send to Server -ac_send_to_server_description=Send Client data to the Server. +ac_send_to_server_description=Send Client data to the Server ac_send_to_client=Send to Client -ac_send_to_client_description=Send Server data to the Client. +ac_send_to_client_description=Send Server data to the Client ac_configure=Configure -ac_configure_description=Configure the application. +ac_configure_description=Configure the application ac_configure_plugins=Configure -ac_configure_plugins_description=Configure the loaded plugins. +ac_configure_plugins_description=Configure the loaded plugins ac_about=About -ac_about_description=Display information about the application. +ac_about_description=Display information about the application ac_start_relay=Start Relay -ac_start_relay_description=Start the relay. +ac_start_relay_description=Start the relay ac_stop_relay=Stop Relay -ac_stop_relay_description=Stop the relay. +ac_stop_relay_description=Stop the relay ac_clear_client=Clear Client -ac_clear_client_description=Clear the Client side data. +ac_clear_client_description=Clear the Client side data ac_clear_server=Clear Server -ac_clear_server_description=Clear the Server side data. +ac_clear_server_description=Clear the Server side data ac_clear_all=Clear All -ac_clear_all_description=Clear all data. +ac_clear_all_description=Clear all data ac_enable_auto_mode=Enable Auto Mode -ac_enable_auto_mode_description=Data is automatically transfered. +ac_enable_auto_mode_description=Data is automatically transfered ac_disable_auto_mode=Disable Auto Mode -ac_disable_auto_mode_description=No automtic data transfer. +ac_disable_auto_mode_description=No automatic data transfer #tabs tab_raw=Raw Modified: trunk/DAVInspector/resource/TextBundle_de_DE.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-03-27 14:18:11 UTC (rev 98) @@ -1,30 +1,30 @@ #actions ac_exit=Beenden -ac_exit_description=Das Programm schlie\xDFen. +ac_exit_description=Das Programm schlie\xDFen ac_send_to_server=Sende zum Server -ac_send_to_server_description=Client Daten zum Server \xFCbertragen. +ac_send_to_server_description=Client-Daten zum Server \xFCbertragen ac_send_to_client=Sende zum Client -ac_send_to_client_description=Server Daten zum Client \xFCbertragen. +ac_send_to_client_description=Server-Daten zum Client \xFCbertragen ac_configure=Einstellungen -ac_configure_description=Die Einstellungen des Programms \xE4ndern. +ac_configure_description=Die Einstellungen des Programms \xE4ndern ac_configure_plugins=Konfiguration -ac_configure_plugins_description=Die geladene Plugins konfigurieren. +ac_configure_plugins_description=Die geladenen Plugins konfigurieren ac_about=\xDCber... -ac_about_description=Information zum Programm anzeigen. +ac_about_description=Information zum Programm anzeigen ac_start_relay=Relais starten -ac_start_relay_description=Startet das Relais. +ac_start_relay_description=Startet das Relais ac_stop_relay=Relais stoppen -ac_stop_relay_description=Stoppt das Relais. +ac_stop_relay_description=Stoppt das Relais ac_clear_client=Client leeren -ac_clear_client_description=Client Ansicht leeren. +ac_clear_client_description=Client-Ansicht leeren ac_clear_server=Server leeren -ac_clear_server_description=Server Ansicht leeren. +ac_clear_server_description=Server-Ansicht leeren ac_clear_all=Alle leeren -ac_clear_all_description=Alle Ansichten leeren. +ac_clear_all_description=Alle Ansichten leeren ac_enable_auto_mode=Automatik aktivieren -ac_enable_auto_mode_description=Die Daten werden automatisch \xFCbertragen. +ac_enable_auto_mode_description=Die Daten werden automatisch \xFCbertragen ac_disable_auto_mode=Automatik deaktivieren -ac_disable_auto_mode_description=Die Daten m\xFCssen manuell \xFCbertragen werden. +ac_disable_auto_mode_description=Die Daten m\xFCssen manuell \xFCbertragen werden #tabs tab_raw=Rohdaten @@ -49,7 +49,7 @@ dlg_configuration_client_port=Client-Port #PluginConfigurationDialog -dlg_plugin_configuration_title=Plugin Einstellungen +dlg_plugin_configuration_title=Plugin-Einstellungen dlg_plugin_configuration_ok=Ok dlg_plugin_configuration_cancel=Abbrechen dlg_plugin_configuration_type_edit=R/W Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-03-27 14:18:11 UTC (rev 98) @@ -36,9 +36,6 @@ */ public final class Constant { - /** Basis of the hexadecimal number system. */ - public static final int HEX_RADIX = 16; - /** Main window width. */ public static final int UI_MAIN_WINDOW_WIDTH = 800; @@ -94,13 +91,13 @@ public static final String APP_PLUGIN_CONFIGURATION_FILENAME = "plugin-config.properties"; /** Timeout waiting for a ChannelThread to finish in ms. */ - public static final int RELAY_THREADTIMEOUT = 100; + public static final int RELAY_THREADTIMEOUT = 10; /** Linger time in seconds for socket. */ - public static final int RELAY_LINGERTIME = 100; + public static final int RELAY_LINGERTIME = 10; /** Size of the receive buffer. */ - public static final int RELAY_RECVBUFFERSIZE = 2048; + public static final int RELAY_RECVBUFFERSIZE = 1024; /** Backlog parameter used when creating the ServerSocket. */ public static final int RELAY_BACKLOG = 1; @@ -135,6 +132,22 @@ /** System logger configuration file (log4j). */ public static final String SYSTEM_LOGGER_CONFIGURATION = "log4j.properties"; + /** Basis of the hexadecimal number system. */ + public static final int HEX_RADIX = 16; + + /** + * Indicates the direction of the message. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ + public enum Direction { + /** From client to server. */ + ClientToServer, + /** From server to client. */ + ServerToClient + } + /** * Hide class constructor. */ Deleted: trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-03-27 14:18:11 UTC (rev 98) @@ -1,237 +0,0 @@ -/* - * AMessage.java - * - * The abstract class for messages. - * - * Created: 29.02.2008 Jochen Wuest <joc...@dl...> - * Changed: - * - * $Id$ - * - * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.dlr.davinspector.history; - -import java.util.Date; - - -/** - * The abstract class for messages. - * - * @version $LastChangedRevision$ - * @author Jochen Wuest - */ -public abstract class AMessage { - - /** The counter for unique numbering. */ - protected static int idCounter; - - /** - * Message type indicates the direction of the message: - * <ul> - * <li>Message from client to server: Request.</li> - * <li>Message from server to client: Response.</li> - * </ul> - * - * @version $LastChangedRevision$ - * @author Jochen Wuest - */ - public enum MessageDirection { - /** Data from client to server. */ - Request, - /** Data from server to client. */ - Response - } - - /** Parsing state of the message. */ - protected Boolean myParsingState; - - /** Unique ID of a message. */ - protected int myID; - - /** Timestamp of the current message. */ - protected Date myTimestamp; - - /** myDirection indicates the direction of the message. @see MessageDirection */ - protected MessageDirection myDirection; - - /** This string contains the raw data of the message. */ - protected String myRawData; - - /** This string contains the unprocessed header of the message. */ - protected String myRawHeader; - - /** This string contains the unprocessed body of the message. */ - protected String myRawBody; - - /** This string contains the processed header of the message. */ - protected String myParsedHeader; - - /** This string contains the processed body of the message. */ - protected String myParsedBody; - - /** The size in bytes of the current message. */ - protected int mySize; - - /** - * This method returns the ID of the message. - * - * @return id - */ - public int getId() { - return myID; - } - - /** - * This method returns the timestamp of the message. - * - * @return timestamp - */ - public Date getTimestamp() { - return myTimestamp; - } - - /** - * This method sets the timestamp of the current message. - * - * @param timestamp Date/Timestamp - */ - public void setTimestamp(Date timestamp) { - myTimestamp = timestamp; - } - - /** - * Returns the direction (request/reply) of the message. - * @see MessageDirection - * - * @return MessageDirection - */ - public MessageDirection getMessageDirection() { - return myDirection; - } - - /** - * This method sets the direction (request/reply) of the message. - * @see MessageDirection - * - * @param direction MessageDirection - */ - public void setMessageType(MessageDirection direction) { - myDirection = direction; - } - - /** - * This method sets the message direction. - * @see MessageDirection - * - * @param toClient Boolean - */ - public void setMessageDirection(Boolean toClient) { - if (toClient) { - myDirection = MessageDirection.Response; - } else { - myDirection = MessageDirection.Request; - } - } - - /** - * Returns the size of the message in bytes. - * - * @return size int - */ - public int getSize() { - return mySize; - } - - /** - * This method parses the current raw data. - * If the buffer contains more than only the data for the current message, the rest is returned. - * - * @return String - */ - public String parseMessage() { - return ""; - } - - /** - * This method returns <code>true</code> if the message processing is done - * and a valid message has been recognized. - * - * @return Boolean - */ - public Boolean isComplete() { - return myParsingState; - } - - /** - * Returns the raw data of the message. - * - * @return data String - */ - public String getRawData() { - return myRawData; - } - - /** - * Sets the raw data of the current message. - * Message size, ID, body and header are automatically added. - * - * @param msg String - */ - public void setRawData(String msg) { - myRawData = msg; - mySize = msg.length(); - myID = idCounter; - } - - /** - * Returns the parsed head of the message. - * By default this returns the same as <code>getRawHeader</code>. - * - * @return String - */ - public String getMessageHeader() { - return myParsedHeader; - } - - /** - * Returns the raw, unparsed head of the message. - * - * @return String - */ - public String getRawHeader() { - return myRawHeader; - } - - /** - * Returns the parsed body of the message. - * By default this returns the same as <code>getRawBody</code>. - * - * @return String - */ - public String getMessageBody() { - return myParsedBody; - } - - /** - * Returns the raw, unparsed body of the message. - * - * @return String - */ - public String getRawBody() { - return myRawBody; - } -} Added: trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/AMessage.java 2008-03-27 14:18:11 UTC (rev 98) @@ -0,0 +1,208 @@ +/* + * AMessage.java + * + * The abstract class for messages. + * + * Created: 29.02.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.history; + +import java.util.Date; + +import de.dlr.davinspector.common.Constant.Direction; + + +/** + * The abstract class for messages. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public abstract class AMessage { + + /** The counter for unique numbering. */ + protected static int idCounter; + + /** Parsing state of the message. */ + protected Boolean myParsingState; + + /** Unique ID of a message. */ + protected int myID; + + /** Timestamp of the current message. */ + protected Date myTimestamp; + + /** myDirection indicates the direction of the message. @see MessageDirection */ + protected Direction myDirection; + + /** This string contains the raw data of the message. */ + protected String myRawData; + + /** This string contains the unprocessed header of the message. */ + protected String myRawHeader; + + /** This string contains the unprocessed body of the message. */ + protected String myRawBody; + + /** This string contains the processed header of the message. */ + protected String myParsedHeader; + + /** This string contains the processed body of the message. */ + protected String myParsedBody; + + /** The size in bytes of the current message. */ + protected int mySize; + + /** + * This method returns the ID of the message. + * + * @return id + */ + public int getId() { + return myID; + } + + /** + * This method returns the timestamp of the message. + * + * @return timestamp + */ + public Date getTimestamp() { + return myTimestamp; + } + + /** + * This method sets the timestamp of the current message. + * + * @param timestamp Date/Timestamp + */ + public void setTimestamp(Date timestamp) { + myTimestamp = timestamp; + } + + /** + * Returns the direction (request/reply) of the message. + * @see MessageDirection + * + * @return MessageDirection + */ + public Direction getMessageDirection() { + return myDirection; + } + + /** + * This method sets the message direction. + * @see MessageDirection + * + * @param direction Direction + */ + public void setMessageDirection(Direction direction) { + myDirection = direction; + } + + /** + * Returns the size of the message in bytes. + * + * @return size int + */ + public int getSize() { + return mySize; + } + + /** + * This method parses the current raw data. + * If the buffer contains more than only the data for the current message, the rest is returned. + * + * @return String + */ + public String parseMessage() { + return ""; + } + + /** + * This method returns <code>true</code> if the message processing is done + * and a valid message has been recognized. + * + * @return Boolean + */ + public Boolean isComplete() { + return myParsingState; + } + + /** + * Returns the raw data of the message. + * + * @return data String + */ + public String getRawData() { + return myRawData; + } + + /** + * Sets the raw data of the current message. + * Message size, ID, body and header are automatically added. + * + * @param msg String + */ + public void setRawData(String msg) { + myRawData = msg; + mySize = msg.length(); + myID = idCounter; + } + + /** + * Returns the parsed head of the message. + * By default this returns the same as <code>getRawHeader</code>. + * + * @return String + */ + public String getMessageHeader() { + return myParsedHeader; + } + + /** + * Returns the raw, unparsed head of the message. + * + * @return String + */ + public String getRawHeader() { + return myRawHeader; + } + + /** + * Returns the parsed body of the message. + * By default this returns the same as <code>getRawBody</code>. + * + * @return String + */ + public String getMessageBody() { + return myParsedBody; + } + + /** + * Returns the raw, unparsed body of the message. + * + * @return String + */ + public String getRawBody() { + return myRawBody; + } +} Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/HistoryTableCellRenderer.java 2008-03-27 14:18:11 UTC (rev 98) @@ -36,6 +36,7 @@ import javax.swing.table.TableCellRenderer; import de.dlr.davinspector.common.Constant; +import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.common.Internationalization; import de.dlr.davinspector.common.Util; @@ -82,7 +83,7 @@ if (column == COLUMN_INDEX_TYPE){ setHorizontalAlignment(SwingConstants.LEFT); - if (value.equals(AMessage.MessageDirection.Request)) { + if (value.equals(Direction.ClientToServer)) { setText(Internationalization.getTranslation("col_history_type_request")); isRequest = true; } else { Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-03-27 14:18:11 UTC (rev 98) @@ -32,11 +32,12 @@ import javax.swing.event.EventListenerList; +import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.http.HTTPMessageParser; import de.dlr.davinspector.relay.DataEvent; -import de.dlr.davinspector.relay.IClientListener; +import de.dlr.davinspector.relay.INewClientDataListener; +import de.dlr.davinspector.relay.INewServerDataListener; import de.dlr.davinspector.relay.IRelayModel; -import de.dlr.davinspector.relay.IServerListener; /** @@ -45,7 +46,7 @@ * @version $LastChangedRevision$ * @author Jochen Wuest */ -public class MessageHistory implements IServerListener, IClientListener { +public class MessageHistory implements INewServerDataListener, INewClientDataListener { /** List of listeners for new messages. */ private EventListenerList myListenersNewMessage = new EventListenerList(); @@ -54,10 +55,10 @@ private EventListenerList myListenersRefreshMessage = new EventListenerList(); /** This string buffers the client side raw data. */ - private String myClientsideBuffer; + private String myClientToServerBuffer; /** This string buffers the server side raw data. */ - private String myServersideBuffer; + private String myServerToClientBuffer; /** This vector stores the messages. */ private List<AMessage> myMessages = null; @@ -75,11 +76,11 @@ public MessageHistory(IRelayModel relay) { myRelay = relay; myMessages = new Vector<AMessage>(); - myClientsideBuffer = ""; - myServersideBuffer = ""; + myClientToServerBuffer = ""; + myServerToClientBuffer = ""; - myRelay.addClientListener(this); - myRelay.addServerListener(this); + myRelay.addNewClientDataListener(this); + myRelay.addNewServerDataListener(this); } /** @@ -87,16 +88,16 @@ * Afterwards a {@link MessageEvent} is generated and all {@link INewMessageListener} are notified. * * @param data String - * @param toClient Boolean + * @param direction Direction * @param timestamp Date */ - public void storeMessage(String data, Boolean toClient, Date timestamp) { + public void storeMessage(String data, Direction direction, Date timestamp) { // INFO: add decorator dependent on protocol (switch http, ...). // Notice: idCounter != number of messages HTTPMessageParser message = new HTTPMessageParser(new Message()); - message.setMessageDirection(toClient); + message.setMessageDirection(direction); message.setRawData(data); message.setTimestamp(timestamp); String carry = message.parseMessage(); @@ -106,16 +107,16 @@ myMessages.add(message); notifyNewMessage(new MessageEvent(this, message)); // clear buffer - if (!toClient) { - myClientsideBuffer = carry; + if (direction == Direction.ServerToClient) { + myClientToServerBuffer = carry; } else { - myServersideBuffer = carry; + myServerToClientBuffer = carry; } // automatic send the message to client/server // TODO: Steuerung nachrichten aus mainview raus!! if (myRelay.getStateAutomode()) { - if (toClient) { + if (direction == Direction.ServerToClient) { myRelay.writeToClient(message.getRawData()); } else { myRelay.writeToServer(message.getRawData()); @@ -150,21 +151,21 @@ /** * {@inheritDoc} * - * @see de.dlr.davinspector.relay.IClientListener#newClientData(de.dlr.davinspector.relay.DataEvent) + * @see de.dlr.davinspector.relay.INewClientDataListener#newClientData(de.dlr.davinspector.relay.DataEvent) */ public void newClientData(DataEvent newDataEvent) { - myClientsideBuffer += newDataEvent.getData(); - storeMessage(myClientsideBuffer, false, new Date()); + myClientToServerBuffer += newDataEvent.getData(); + storeMessage(myClientToServerBuffer, Direction.ClientToServer, new Date()); } /** * {@inheritDoc} * - * @see de.dlr.davinspector.relay.IServerListener#newServerData(de.dlr.davinspector.relay.DataEvent) + * @see de.dlr.davinspector.relay.INewServerDataListener#newServerData(de.dlr.davinspector.relay.DataEvent) */ public void newServerData(DataEvent newDataEvent) { - myServersideBuffer += newDataEvent.getData(); - storeMessage(myServersideBuffer, true, new Date()); + myServerToClientBuffer += newDataEvent.getData(); + storeMessage(myServerToClientBuffer, Direction.ServerToClient, new Date()); } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/http/HTTPMessageParser.java 2008-03-27 14:18:11 UTC (rev 98) @@ -31,6 +31,7 @@ import org.apache.log4j.Logger; import de.dlr.davinspector.common.Constant; +import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.history.AMessage; import de.dlr.davinspector.history.AMessageParser; @@ -139,6 +140,8 @@ * {@inheritDoc} * * @see de.dlr.davinspector.history.AMessageParser#parseMessage() + * + * TODO: extract "100 Continue" Messages */ public String parseMessage() { myLogger.debug("---- new data event ----"); @@ -151,7 +154,7 @@ myParsedBody = ""; myRawBody = ""; - if (myDirection == MessageDirection.Response) { + if (myDirection == Direction.ServerToClient) { Pattern pattern = Pattern.compile(REGEX_HTTP_STATUS_LINE, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(myRawData); if (matcher.find()) { @@ -231,7 +234,7 @@ * @return Boolean */ private Boolean hasBody() { - if (myDirection == MessageDirection.Response) { + if (myDirection == Direction.ServerToClient) { if (myStatusCode == HTTPStatusCode.HTTP_CONTINUE || myStatusCode == HTTPStatusCode.HTTP_SWITCHING_PROTOCOLS || myStatusCode == HTTPStatusCode.HTTP_NO_CONTENT Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/IPlugin.java 2008-03-27 14:18:11 UTC (rev 98) @@ -75,7 +75,7 @@ * * @param direction Indicates the assignement of the plugin to server or client side. */ - void init(Direction direction); + void init(PlugInDirection direction); /** * Starts processing of the message. @@ -128,14 +128,14 @@ } /** - * The <tt>Direction</tt> indicates the assignment of + * The <tt>PlugInDirection</tt> indicates the assignment of * a plugin object to the server or client side. * Only needed by <code>*_GENERAL</code> plugins. * * @version $LastChangedRevision$ * @author Jochen Wuest */ - public enum Direction { + public enum PlugInDirection { /** Plugin on the client side. */ CLIENT, /** Plugin on the server side. */ Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugin/PluginManager.java 2008-03-27 14:18:11 UTC (rev 98) @@ -121,10 +121,10 @@ // INFO: only add plugin if specified for client/server side // INFO: alternative Direction could be specified here by PluginType!? plugin = (IPlugin) c.newInstance(); - plugin.init(IPlugin.Direction.CLIENT); + plugin.init(IPlugin.PlugInDirection.CLIENT); myActivePluginsClient.add(plugin); plugin = (IPlugin) c.newInstance(); - plugin.init(IPlugin.Direction.SERVER); + plugin.init(IPlugin.PlugInDirection.SERVER); myActivePluginsServer.add(plugin); } } catch (ClassNotFoundException cnfe) { Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-03-27 14:18:11 UTC (rev 98) @@ -112,7 +112,7 @@ * * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ - public void init(Direction direction) { + public void init(PlugInDirection direction) { if (myJScrollPane == null) { myJScrollPane = new JScrollPane(); myJTextPane = new JTextPane(); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingConfigurationPanel.java 2008-03-27 14:18:11 UTC (rev 98) @@ -38,7 +38,7 @@ import javax.swing.LayoutStyle; import de.dlr.davinspector.common.Util; -import de.dlr.davinspector.plugin.IPlugin.Direction; +import de.dlr.davinspector.plugin.IPlugin.PlugInDirection; /** * This class is the UI for the RecordingPlugin. @@ -126,7 +126,7 @@ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_hh-mm"); String side = "_server_"; - if (myParent.getDirection() == Direction.CLIENT) { + if (myParent.getDirection() == PlugInDirection.CLIENT) { side = "_client_"; } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/recordingplugin/RecordingPlugin.java 2008-03-27 14:18:11 UTC (rev 98) @@ -59,7 +59,7 @@ private BufferedWriter myBufferedWriter = null; /** This saves the side assigned to the current plugin object. */ - private Direction myDirection; + private PlugInDirection myDirection; /** * {@inheritDoc} @@ -129,7 +129,7 @@ * * @see de.dlr.davinspector.plugin.IPlugin#init() */ - public void init(Direction direction) { + public void init(PlugInDirection direction) { myDirection = direction; if (myPanel == null) { myPanel = new RecordingConfigurationPanel(this); @@ -221,7 +221,7 @@ * * @return Returns the direction of the plugin object. */ - public Direction getDirection() { + public PlugInDirection getDirection() { return myDirection; } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmlplugin/XMLPlugin.java 2008-03-27 14:18:11 UTC (rev 98) @@ -128,7 +128,7 @@ * * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ - public void init(Direction direction) { + public void init(PlugInDirection direction) { if (myJSplitPane == null) { myJTextArea = new JTextArea(); myJTextArea.setLineWrap(true); Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/xmltreeplugin/XMLTreePlugin.java 2008-03-27 14:18:11 UTC (rev 98) @@ -128,7 +128,7 @@ * * @see de.dlr.DAVInspector.Plugin.IPlugin#init() */ - public void init(Direction direction) { + public void init(PlugInDirection direction) { if (myJSplitPane == null) { myJTextArea = new JTextArea(); myJTextArea.setLineWrap(true); Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/ChannelThread.java 2008-03-27 14:18:11 UTC (rev 98) @@ -30,11 +30,11 @@ import java.io.OutputStream; import java.net.Socket; import java.net.SocketException; -import java.util.List; import org.apache.log4j.Logger; import de.dlr.davinspector.common.Constant; +import de.dlr.davinspector.common.Constant.Direction; /** * This class copies data from one socket to another. @@ -47,6 +47,9 @@ /** */ public static final String COLON = ": "; + /** Logger, Apache log4j. */ + private static Logger myLogger = Logger.getLogger(ChannelThread.class); + /** */ private Socket myInputSocket; @@ -60,36 +63,25 @@ private ChannelThread myPeer; /** */ - private boolean myDirection; + private Direction myDirection; - /** The logger. */ - private Logger myLogger; - /** */ private String myThreadName = ""; /** */ - private IRelayModel myRelay = null; + private IRelayThread myRelayThread = null; - /** */ - private List<ChannelThread> myConnections; - /** * Constructor of a ChannelThread. * * @param inputSocket Socket input socket * @param outputSocket Socket output socket - * @param relay lock object - * @param logger Logger - * @param connections List + * @param relayThread lock object */ - public ChannelThread(Socket inputSocket, Socket outputSocket, IRelayModel relay, - Logger logger, List<ChannelThread> connections) { + public ChannelThread(Socket inputSocket, Socket outputSocket, IRelayThread relayThread) { myInputSocket = inputSocket; myOutputSocket = outputSocket; - myRelay = relay; - myLogger = logger; - myConnections = connections; + myRelayThread = relayThread; } /** @@ -106,52 +98,51 @@ try { count = in.read(buffer); while ((count != Constant.EOF) && !isInterrupted()) { - synchronized (myRelay) { + synchronized (myRelayThread) { // TODO: add encoding to configuration and set encoding from configuration - myRelay.updateData(new String(buffer, 0, count, "utf-8"), myDirection); + myLogger.debug(myThreadName + COLON + "Got input " + myDirection); + + myRelayThread.newData(new String(buffer, 0, count, "utf-8"), myDirection); } count = in.read(buffer); } } catch (IOException ioe) { myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } finally { - myLogger.debug(myThreadName + COLON + "flushing"); + myLogger.debug(myThreadName + COLON + "Flushing " + activeCount()); flushOut(); } } catch (IOException ioe) { myLogger.error(myThreadName + ioe.getMessage(), ioe); } - synchronized (myRelay) { + synchronized (myRelayThread) { + myLogger.debug(myThreadName + COLON + "Done " + activeCount()); myDone = true; try { if ((myPeer == null) || myPeer.isDone()) { // if the peer is already closed or has transferred all data, shutdown myInputSocket.close(); myOutputSocket.close(); - myLogger.debug(myThreadName + COLON + "closing"); + // TODO: irgendwie mitteilen, dass sockets nun geschlossen sind + myLogger.debug(myThreadName + COLON + "Closing sockets " + activeCount()); } else { // signal the peer we are done myPeer.interrupt(); - myLogger.debug(myThreadName + COLON + "interrupting peer"); + myLogger.debug(myThreadName + COLON + "Interrupting peer " + activeCount()); } } catch (IOException ioe) { myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); - } finally { - myLogger.debug(myThreadName + COLON + "removing connection"); - myConnections.remove(this); } } } /** - * Defines whether this is a client or server connection.<br> - * true = from server to client<br> - * false = from client to server<br> + * Defines whether this is a client or server connection. * - * @param direction Boolean + * @param direction Direction */ - public void setDirection(boolean direction) { + public void setDirection(Direction direction) { this.myDirection = direction; } @@ -190,6 +181,7 @@ */ public void write(String data) { try { + myLogger.debug(myThreadName + COLON + "Writing data"); OutputStream out = myOutputSocket.getOutputStream(); if (isChunked(data)) { sendChunkedData(out, data); @@ -225,13 +217,11 @@ } /** - * Returns the direction of the connection.<br> - * true = from server to client<br> - * false = from client to server<br> + * Returns the direction of the connection. * - * @return Boolean + * @return Direction */ - public Boolean getDirection() { + public Direction getDirection() { return myDirection; } @@ -289,5 +279,5 @@ myLogger.error(myThreadName + COLON + ioe.getMessage(), ioe); } } - } + } } Deleted: trunk/DAVInspector/src/de/dlr/davinspector/relay/IClientListener.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IClientListener.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IClientListener.java 2008-03-27 14:18:11 UTC (rev 98) @@ -1,45 +0,0 @@ -/* - * IClientListener.java - * - * New data from client listener interface. - * - * Created: 29.01.2008 Jochen Wuest <joc...@dl...> - * Changed: - * - * $Id$ - * - * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.dlr.davinspector.relay; - -import java.util.EventListener; - - -/** - * New data from client listener interface. - * - * @version $LastChangedRevision$ - * @author Jochen Wuest - */ -public interface IClientListener extends EventListener { - - /** - * Invoked when new data from the client has arrived. - * - * @param newDataEvent {@link DataEvent} - */ - void newClientData(DataEvent newDataEvent); -} Copied: trunk/DAVInspector/src/de/dlr/davinspector/relay/INewClientDataListener.java (from rev 97, trunk/DAVInspector/src/de/dlr/davinspector/relay/IClientListener.java) =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/INewClientDataListener.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/INewClientDataListener.java 2008-03-27 14:18:11 UTC (rev 98) @@ -0,0 +1,45 @@ +/* + * IClientListener.java + * + * New data from client listener interface. + * + * Created: 29.01.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.relay; + +import java.util.EventListener; + + +/** + * New data from client listener interface. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public interface INewClientDataListener extends EventListener { + + /** + * Invoked when new data from the client has arrived. + * + * @param newDataEvent {@link DataEvent} + */ + void newClientData(DataEvent newDataEvent); +} Copied: trunk/DAVInspector/src/de/dlr/davinspector/relay/INewServerDataListener.java (from rev 97, trunk/DAVInspector/src/de/dlr/davinspector/relay/IServerListener.java) =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/INewServerDataListener.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/INewServerDataListener.java 2008-03-27 14:18:11 UTC (rev 98) @@ -0,0 +1,44 @@ +/* + * IServerListener.java + * + * New data from server listener interface. + * + * Created: 29.01.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.relay; + +import java.util.EventListener; + +/** + * New data from server listener interface. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public interface INewServerDataListener extends EventListener { + + /** + * Invoked when new data from the server has arrived. + * + * @param newDataEvent {@link DataEvent} + */ + void newServerData(DataEvent newDataEvent); +} Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-03-27 14:18:11 UTC (rev 98) @@ -25,8 +25,7 @@ package de.dlr.davinspector.relay; -import org.apache.log4j.Logger; - +import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.configuration.Configuration; import de.dlr.davinspector.history.MessageHistory; import de.dlr.davinspector.plugin.PluginManager; @@ -65,13 +64,13 @@ void writeToServer(String data); /** - * This method notifies the listeners for server or client depending on the <code>toClient</code> + * This method notifies the listeners for server or client depending on the <code>direction</code> * parameter and uses the <code>data</code> to create a new {@link DataEvent}. * * @param data String - * @param toClient Boolean + * @param direction Direction */ - void updateData(String data, Boolean toClient); + void updateData(String data, Direction direction); /** * Returns the MessageHistory object. @@ -88,13 +87,6 @@ PluginManager getPluginManager(); /** - * Returns Log object from Apache log4j Logging. - * - * @return Logger - */ - Logger getSystemLog(); - - /** * Returns the state of the automode.<br> * true: ON<br> * false: OFF<br> @@ -113,30 +105,30 @@ void setStateAutomode(Boolean state); /** - * Adds an {@link IServerListener} to RelayModel. + * Adds an {@link INewServerDataListener} to RelayModel. * - * @param listener the {@link IServerListener} to be added + * @param listener the {@link INewServerDataListener} to be added */ - void addServerListener(IServerListener listener); + void addNewServerDataListener(INewServerDataListener listener); /** - * Removes an {@link IServerListener} from RelayModel. + * Removes an {@link INewServerDataListener} from RelayModel. * - * @param listener the {@link IServerListener} to be removed + * @param listener the {@link INewServerDataListener} to be removed */ - void removeServerListener(IServerListener listener); + void removeNewServerDataListener(INewServerDataListener listener); /** - * Adds an {@link IClientListener} to RelayModel. + * Adds an {@link INewClientDataListener} to RelayModel. * - * @param listener the {@link IClientListener} to be added + * @param listener the {@link INewClientDataListener} to be added */ - void addClientListener(IClientListener listener); + void addNewClientDataListener(INewClientDataListener listener); /** - * Removes an {@link IClientListener} from RelayModel. + * Removes an {@link INewClientDataListener} from RelayModel. * - * @param listener the {@link IClientListener} to be removed + * @param listener the {@link INewClientDataListener} to be removed */ - void removeClientListener(IClientListener listener); + void removeNewClientDataListener(INewClientDataListener listener); } Added: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayThread.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayThread.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayThread.java 2008-03-27 14:18:11 UTC (rev 98) @@ -0,0 +1,61 @@ +/* + * IRelayThread.java + * + * TODO: wues_ha Enter comment! + * + * Created: 26.03.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.relay; + +import de.dlr.davinspector.common.Constant.Direction; + + + +/** + * TODO: wues_ha: Enter comment! + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public interface IRelayThread { + + /** + * Invokes the shutdown of the RelayThread. + * + */ + void stopRelay(); + + /** + * TODO: wues_ha: Enter comment! + * + * @param data String + * @param direction Direction + */ + void write(String data, Direction direction); + + /** + * TODO: wues_ha: Enter comment! + * + * @param data String + * @param direction Direction + */ + void newData(String data, Direction direction); +} Deleted: trunk/DAVInspector/src/de/dlr/davinspector/relay/IServerListener.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IServerListener.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IServerListener.java 2008-03-27 14:18:11 UTC (rev 98) @@ -1,44 +0,0 @@ -/* - * IServerListener.java - * - * New data from server listener interface. - * - * Created: 29.01.2008 Jochen Wuest <joc...@dl...> - * Changed: - * - * $Id$ - * - * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.dlr.davinspector.relay; - -import java.util.EventListener; - -/** - * New data from server listener interface. - * - * @version $LastChangedRevision$ - * @author Jochen Wuest - */ -public interface IServerListener extends EventListener { - - /** - * Invoked when new data from the server has arrived. - * - * @param newDataEvent {@link DataEvent} - */ - void newServerData(DataEvent newDataEvent); -} Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-24 12:46:42 UTC (rev 97) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-03-27 14:18:11 UTC (rev 98) @@ -26,20 +26,11 @@ package de.dlr.davinspector.relay; -import java.io.IOException; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketException; -import java.net.UnknownHostException; -import java.util.List; -import java.util.Vector; - import javax.swing.event.EventListenerList; import org.apache.log4j.Logger; -import de.dlr.davinspector.common.Constant; +import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.configuration.Configuration; import de.dlr.davinspector.configuration.PluginConfiguration; import de.dlr.davinspector.history.MessageHistory; @@ -48,46 +39,34 @@ /** * Implementation of the relay interface. Provides the server socket * and manages the channel threads. - * FIXME: stopping of the relay and freeing of the server socket. + * TODO: add logging * * @version $LastChangedRevision$ * @author Jochen Wuest */ -public class RelayModel extends Thread implements IRelayModel { +public class RelayModel implements IRelayModel { /** Logger, Apache log4j. */ private static Logger myLogger = Logger.getLogger(RelayModel.class); /** List of listeners for new client data. */ - private EventListenerList myClientListeners = new EventListenerList(); + private EventListenerList myNewClientDataListeners = new EventListenerList(); /** List of listeners for server data. */ - private EventListenerList myServerListeners = new EventListenerList(); + private EventListenerList myNewServerDataListeners = new EventListenerList(); - /** Address to forward connections to. */ - private InetAddress myDestinationAddress; - - /** Port to forward connections to. */ - private int myDestinationPort; - - /** This proxy's server socket. */ - private ServerSocket serverSocket; - /** The plugin manager. */ private PluginManager myPluginManager = null; - /** The lock object is used for synchronizing the ChannelThreads. */ - private Object lock = new Object(); - - /** Contains all current connections (ChannelThreads). */ - private List<ChannelThread> connections = new Vector<ChannelThread>(); - /** The message history object. */ private MessageHistory myMessageHistory = null; /** State of the automode. */ private Boolean myStateAutomode = false; + /** */ + private IRelayThread theRelay = null; + /** * Constructor of a RelayModel. * The constructor creates a new {@link MessageHistory} object. @@ -120,15 +99,6 @@ public MessageHistory getMessageHistory() { return myMessageHistory; } - - /** - * {@inheritDoc} - * - * @see de.dlr.davinspector.relay.IRelayModel#getSystemLog() - */ - public Logger getSystemLog() { - return myLogger; - } /** * {@inheritDoc} @@ -151,29 +121,29 @@ /** * {@inheritDoc} * - * @see de.dlr.davinspector.relay.IRelayModel#addServerListener(de.dlr.davinspector.relay.IServerListener) + * @see de.dlr.davinspector.relay.IRelayModel#addNewServerDataListener(de.dlr.davinspector.relay.INewServerDataListener) */ - public void addServerListener(IServerListener listener) { - myServerListeners.add(IServerListener.class, listener); + public void addNewServerDataListener(INewServerDataListener listener) { + myNewServerDataListeners.add(INewServerDataListener.class, listener); } /** * {@inheritDoc} * - * @see de.dlr.davinspector.relay.IRelayModel#removeServerListener(de.dlr.davinspector.relay.IServerListener) + * @see de.dlr.davinspector.relay.IRelayModel#removeNewServerDataListener(de.dlr.davinspector.relay.INewServerDataListener) */ - public void removeServerListener(IServerListener listener) { - myServerListeners.remove(IServerListener.class, listener); + public void removeNewServerDataListener(INewServerDataListener listener) { + myNewServerDataListeners.remove(INewServerDataListener.class, listener); } /** - * Notifies all {@link IServerListener}s that have registered interest for + * Notifies all {@link INewServerDataListener}s that have registered interest for * notification on a {@link DataEvent}. * * @param event the {@link DataEvent} object */ - protected synchronized void notifyServerListeners... [truncated message content] |
From: <wu...@us...> - 2008-04-03 16:36:34
|
Revision: 102 http://davinspector.svn.sourceforge.net/davinspector/?rev=102&view=rev Author: wuest Date: 2008-04-03 09:36:25 -0700 (Thu, 03 Apr 2008) Log Message: ----------- Added new visual component to display header information in different categories. Modified Paths: -------------- trunk/DAVInspector/build-user.xml trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java Added Paths: ----------- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/minus.png trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/plus.png Modified: trunk/DAVInspector/build-user.xml =================================================================== --- trunk/DAVInspector/build-user.xml 2008-04-03 16:33:49 UTC (rev 101) +++ trunk/DAVInspector/build-user.xml 2008-04-03 16:36:25 UTC (rev 102) @@ -53,6 +53,10 @@ basedir="bin" includes="de/dlr/davinspector/plugins/recordingplugin/**"> </jar> + <jar jarfile="${dist}/plugins/RawEditPlugin.jar" + basedir="bin" + includes="de/dlr/davinspector/plugins/raweditplugin/**"> + </jar> <!-- Copy DAVInspector resource files --> <copy todir="bin/de/dlr/davinspector/resource"> @@ -67,7 +71,7 @@ <manifest> <attribute name="Main-Class" value="de/dlr/davinspector.DAVInspector"/> <attribute name="Built-By" value="${user.name}"/> - <attribute name="Class-Path" value=". log4j.properties lib/log4j.jar"/> + <attribute name="Class-Path" value=". /plugins/RecordingPlugin.jar log4j.properties lib/log4j.jar"/> <section name="DAVInspector"> <attribute name="Specification-Title" value="${project.name}"/> Modified: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-04-03 16:33:49 UTC (rev 101) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/HeaderPlugin.java 2008-04-03 16:36:25 UTC (rev 102) @@ -25,9 +25,9 @@ package de.dlr.davinspector.plugins.headerplugin; +import javax.swing.BoxLayout; import javax.swing.JComponent; -import javax.swing.JScrollPane; -import javax.swing.JTextPane; +import javax.swing.JPanel; import de.dlr.davinspector.common.Util; import de.dlr.davinspector.history.AMessage; @@ -49,19 +49,28 @@ /** State of the plugin. */ private Boolean isActive = true; - /** The text pane. */ - private JTextPane myJTextPane = null; + /** The panel. */ + private JPanel myJPanel = null; - /** The scroll pane. */ - private JScrollPane myJScrollPane = null; + /** */ + private JCategoryTable myResponseHeaders; + /** */ + private JCategoryTable myRequestHeaders; + + /** */ + private JCategoryTable myMiscHeaders; + + /** */ + private JCategoryTable myCommonHeaders; + /** * {@inheritDoc} * * @see de.dlr.DAVInspector.Plugin.IViewPlugin#getUI() */ public JComponent getUI() { - return myJScrollPane; + return myJPanel; } /** @@ -106,7 +115,7 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#getVersion() */ public int getVersion() { - return 1; + return 2; } /** @@ -116,13 +125,27 @@ */ public void init(PluginManager pluginManager, PluginDirection direction) { myPlugInDirection = direction; - if (myJScrollPane == null) { - myJScrollPane = new JScrollPane(); - myJTextPane = new JTextPane(); - myJTextPane.setEditable(false); - myJScrollPane.setViewportView(myJTextPane); + if (myJPanel == null) { + + myJPanel = new JPanel(); + myJPanel.setLayout(new BoxLayout(myJPanel, BoxLayout.PAGE_AXIS)); + + myCommonHeaders = new JCategoryTable(myJPanel, "Common"); + myResponseHeaders = new JCategoryTable(myJPanel, "Response"); + myRequestHeaders = new JCategoryTable(myJPanel, "Request"); + myMiscHeaders = new JCategoryTable(myJPanel, "Misc"); + + myJPanel.add(myCommonHeaders); + myJPanel.add(myResponseHeaders); + myJPanel.add(myRequestHeaders); + myJPanel.add(myMiscHeaders); + + // test data + myCommonHeaders.addRow(new Object[]{"ert", "zui"}); + myResponseHeaders.addRow(new Object[]{"test", "test2"}); + myRequestHeaders.addRow(new Object[]{"test3", "test4"}); + myMiscHeaders.addRow(new Object[]{"ghj", "l\xF6\xE4"}); } - myJTextPane.setText(""); Util.setUIDesign(); } @@ -168,8 +191,12 @@ * @see de.dlr.DAVInspector.Plugin.IPlugin#update(java.lang.String) */ public void update(AMessage msg) { - if (isActive && myJTextPane != null) { - myJTextPane.setText(msg.getHeader()); + if (isActive && myJPanel != null) { + // TODO: Update tables; +// myCommonHeaders.clearTable(); +// myResponseHeaders.clearTable(); +// myRequestHeaders.clearTable(); +// myMiscHeaders.clearTable(); } } @@ -179,17 +206,11 @@ * @see de.dlr.davinspector.plugin.IPlugin#clear() */ public void clear() { - if (myJTextPane != null) { - myJTextPane.setText(""); + if (myJPanel != null) { + myCommonHeaders.clearTable(); + myResponseHeaders.clearTable(); + myRequestHeaders.clearTable(); + myMiscHeaders.clearTable(); } } - -// /** -// * {@inheritDoc} -// * -// * @see de.dlr.davinspector.plugin.IEditPlugin#getOutput() -// */ -// public AMessage getOutput() { -// return new Message(); -// } } Added: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/JCategoryTable.java 2008-04-03 16:36:25 UTC (rev 102) @@ -0,0 +1,169 @@ +/* + * JCategoryTable.java + * + * TODO: wues_ha Enter comment! + * + * Created: 03.04.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.plugins.headerplugin; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.SystemColor; + +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JToggleButton; +import javax.swing.SwingConstants; +import javax.swing.table.DefaultTableModel; + + +/** + * TODO: wues_ha: Enter comment! + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public class JCategoryTable extends JPanel { + + /** Serial Version UID, not valid. */ + private static final long serialVersionUID = 1L; + + /** */ + private final ImageIcon iconPlus = + new ImageIcon(JCategoryTable.class.getResource("/de/dlr/davinspector/plugins/headerplugin/plus.png")); + + /** */ + private final ImageIcon iconMinus = + new ImageIcon(JCategoryTable.class.getResource("/de/dlr/davinspector/plugins/headerplugin/minus.png")); + + /** */ + private JToggleButton jToggleButton; + + /** */ + private JScrollPane jScrollPane; + + /** */ + private JTable jTable; + + /** */ + private Dimension sizePanel; + + /** */ + private DefaultTableModel myCategoryTableModel; + + /** */ + private JComponent myComponent; + + /** + * Constructor for JCategoryTable. + * + * @param component {@link JComponent} The parent JComponent object. + * @param tableTitle {@link String} The title of the Table. + */ + public JCategoryTable(JComponent component, String tableTitle) { + myComponent = component; + init(tableTitle); + } + + /** + * This method initializes all visual elements. + * + * @param tableTitle The title of the Table. + */ + private void init(String tableTitle) { + + jToggleButton = new JToggleButton(); + jScrollPane = new JScrollPane(); + jTable = new JTable(); + + jToggleButton.setIcon(iconPlus); + jToggleButton.setSelectedIcon(iconMinus); + jToggleButton.setSelected(true); + jToggleButton.setText(tableTitle); + jToggleButton.setBorder(null); + jToggleButton.setBorderPainted(false); + jToggleButton.setFocusPainted(false); + jToggleButton.setBackground(SystemColor.LIGHT_GRAY); + jToggleButton.setHorizontalAlignment(SwingConstants.LEFT); + + jToggleButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jToggleButtonActionPerformed(evt); + } + }); + + myCategoryTableModel = new DefaultTableModel(); + myCategoryTableModel.addColumn("Key"); + myCategoryTableModel.addColumn("Value"); + + // TODO: do not allow editing of table data + jTable.setModel(myCategoryTableModel); + jTable.setTableHeader(null); + + jScrollPane.setViewportView(jTable); + + setLayout(new BorderLayout()); + add(jToggleButton, BorderLayout.NORTH); + add(jScrollPane, BorderLayout.CENTER); + } + + /** + * This method handles the toggle button event. On action "hide" the current size of + * the panel is stored in <code>sizePanel</code>, the table is set invisible and the + * parent component is forced to refresh the layout. On action "show" the stored panel + * size is restored and the parent component is forced to refresh it's layout. + * + * @param evt Event + */ + private void jToggleButtonActionPerformed(java.awt.event.ActionEvent evt) { + if (jScrollPane.isVisible()) { + jScrollPane.setVisible(false); + sizePanel = getSize(); + setSize(jToggleButton.getSize()); + myComponent.validate(); + } else { + jScrollPane.setVisible(true); + setSize(sizePanel); + myComponent.validate(); + } + } + + /** + * This method adds a row to the table. + * A row consists of two columns: key and value. + * + * @param rowData Object[] + */ + public void addRow(Object[] rowData) { + myCategoryTableModel.addRow(rowData); + } + + /** + * This method deletes all rows. + */ + public void clearTable() { + myCategoryTableModel.setRowCount(0); + } +} Added: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/minus.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/minus.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/plus.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/src/de/dlr/davinspector/plugins/headerplugin/plus.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-04-05 15:43:45
|
Revision: 104 http://davinspector.svn.sourceforge.net/davinspector/?rev=104&view=rev Author: wuest Date: 2008-04-05 08:43:38 -0700 (Sat, 05 Apr 2008) Log Message: ----------- Added a pop up menu for the raw text panes. Now you can cut, copy and paste text from/to the clip board. Furthermore you can save the text to a file. Modified Paths: -------------- trunk/DAVInspector/resource/TextBundle.properties trunk/DAVInspector/resource/TextBundle_de_DE.properties trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java Added Paths: ----------- trunk/DAVInspector/resource/editcopy.png trunk/DAVInspector/resource/editcut.png trunk/DAVInspector/resource/editpaste.png trunk/DAVInspector/resource/filesaveas.png trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java Modified: trunk/DAVInspector/resource/TextBundle.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle.properties 2008-04-03 16:37:44 UTC (rev 103) +++ trunk/DAVInspector/resource/TextBundle.properties 2008-04-05 15:43:38 UTC (rev 104) @@ -25,7 +25,22 @@ ac_enable_auto_mode_description=Data is automatically transfered ac_disable_auto_mode=Disable Auto Mode ac_disable_auto_mode_description=No automatic data transfer +#ac popup menu +ac_paste=Paste +ac_paste_description=Paste +ac_cut=Cut +ac_cut_description=Cut +ac_copy=Copy +ac_copy_description=Copy +ac_saveas=Save as ... +ac_saveas_description=Save text in a file +#save as dialog file chooser +dlg_title_saveas=Save as ... +#io error dialog +dlg_ioerror_title=Error +dlg_ioerror_text=File IO-Error. + #tabs tab_raw=Raw Modified: trunk/DAVInspector/resource/TextBundle_de_DE.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-04-03 16:37:44 UTC (rev 103) +++ trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-04-05 15:43:38 UTC (rev 104) @@ -25,7 +25,22 @@ ac_enable_auto_mode_description=Die Daten werden automatisch \xFCbertragen ac_disable_auto_mode=Automatik deaktivieren ac_disable_auto_mode_description=Die Daten m\xFCssen manuell \xFCbertragen werden +#ac popup menu +ac_paste=Einf\xFCgen +ac_paste_description=Text aus Zwischenablage einf\xFCgen +ac_cut=Ausschneiden +ac_cut_description=Text ausschneiden und in die Zwischenablage einf\xFCgen +ac_copy=Kopieren +ac_copy_description=Text in die Zwischenablage einf\xFCgen +ac_saveas=Speichern unter ... +ac_saveas_description=Text in einer Datei speichern +#save as dialog file chooser +dlg_title_saveas=Speichern unter ... +#io error dialog +dlg_ioerror_title=Fehler +dlg_ioerror_text=Fehler bei der Ein-/Ausgabe. + #tabs tab_raw=Rohdaten Added: trunk/DAVInspector/resource/editcopy.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/resource/editcopy.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/DAVInspector/resource/editcut.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/resource/editcut.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/DAVInspector/resource/editpaste.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/resource/editpaste.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/DAVInspector/resource/filesaveas.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/resource/filesaveas.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/JRawTextPane.java 2008-04-05 15:43:38 UTC (rev 104) @@ -0,0 +1,282 @@ +/* + * JRawTextPane.java + * + * This is an extended JTextPane with a pop up menu. The pop up menu + * allows the user to cut, copy and paste text from/to the clip board and + * save the text in a file. + * + * Created: 05.04.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.ui; + +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.event.ActionEvent; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.JFileChooser; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; +import javax.swing.JTextPane; +import javax.swing.text.BadLocationException; + +import org.apache.log4j.Logger; + +import de.dlr.davinspector.common.Constant.Direction; +import de.dlr.davinspector.common.Internationalization; + + +/** + * This is an extended JTextPane with a pop up menu. The pop up menu + * allows the user to cut, copy and paste text from/to the clip board and + * save the text in a file. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public class JRawTextPane extends JTextPane implements ClipboardOwner { + + /** */ + static final long serialVersionUID = 1L; + + /** Logger, Apache log4j. */ + private static Logger myLogger = Logger.getLogger(JRawTextPane.class); + + /** The clip board. */ + private Clipboard myClipboard; + + /** This. Reference needed for the actions. */ + private JRawTextPane myRawTextPane; + + /** The pop up menu. */ + private JPopupMenu myJPopupMenu; + + /** Direction of the text pane. */ + private Direction myDirection; + + /** + * Action: Insert text from the clip board at the cursor. + * If a text range is selected, the selection will be overwritten with the text from the clip board. + */ + private Action pasteAction = new AbstractAction() { + static final long serialVersionUID = 1L; + { + putValue(Action.NAME, Internationalization.getTranslation("ac_paste")); + putValue(Action.SHORT_DESCRIPTION, Internationalization.getTranslation("ac_paste_description")); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_PASTE)); + } + + public void actionPerformed(ActionEvent e) { + // paste + int pos = getCaretPosition(); + int start = getSelectionStart(); + int end = getSelectionEnd(); + + Transferable content = myClipboard.getContents(this); + if (content != null) { + try { + String s = (String) content.getTransferData(DataFlavor.stringFlavor); + if ((start >= 0) && (end >= 0) && (start < end)) { + // some text is selected, overwrite with clip board + setText(getText(0, start) + s + getText(end, getText().length() - end)); + } else { + // no text selected, insert clip board at cursor + setText(getText(0, pos) + s + getText(pos, getText().length() - pos)); + } + // TODO: place the cursor at the end of the edited text + } catch (IOException ioe) { + myLogger.error(ioe.getMessage(), ioe); + } catch (UnsupportedFlavorException usfe) { + myLogger.error(usfe.getMessage(), usfe); + } catch (BadLocationException ble) { + myLogger.error(ble.getMessage(), ble); + } + } + } + }; + + /** + * Action: Copy selected text to the clip board. + */ + private Action copyAction = new AbstractAction() { + static final long serialVersionUID = 1L; + { + putValue(Action.NAME, Internationalization.getTranslation("ac_copy")); + putValue(Action.SHORT_DESCRIPTION, Internationalization.getTranslation("ac_copy_description")); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_COPY)); + } + + public void actionPerformed(ActionEvent e) { + // copy + int start = getSelectionStart(); + int end = getSelectionEnd(); + try { + StringSelection content = new StringSelection(getText(start, end - start)); + myClipboard.setContents(content, myRawTextPane); + setText(getText(0, start) + getText(end, getText().length() - end)); + } catch (IllegalStateException ise) { + myLogger.error(ise.getMessage(), ise); + } catch (BadLocationException ble) { + myLogger.error(ble.getMessage(), ble); + } + } + }; + + /** + * Action: Cut. Selected text is copied to the clip board. + */ + private Action cutAction = new AbstractAction() { + static final long serialVersionUID = 1L; + { + putValue(Action.NAME, Internationalization.getTranslation("ac_cut")); + putValue(Action.SHORT_DESCRIPTION, Internationalization.getTranslation("ac_cut_description")); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_CUT)); + } + + public void actionPerformed(ActionEvent e) { + // cut + int start = getSelectionStart(); + int end = getSelectionEnd(); + try { + StringSelection content = new StringSelection(getText(start, end - start)); + myClipboard.setContents(content, myRawTextPane); + } catch (IllegalStateException ise) { + myLogger.error(ise.getMessage(), ise); + } catch (BadLocationException ble) { + myLogger.error(ble.getMessage(), ble); + } + } + }; + + /** + * Action: Save as. Selected text is saved in a file. + */ + private Action saveAsAction = new AbstractAction() { + static final long serialVersionUID = 1L; + { + putValue(Action.NAME, Internationalization.getTranslation("ac_saveas")); + putValue(Action.SHORT_DESCRIPTION, Internationalization.getTranslation("ac_saveas_description")); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_SAVEAS)); + } + + public void actionPerformed(ActionEvent e) { + // save as + int start = getSelectionStart(); + int end = getSelectionEnd(); + String buffer = ""; + + try { + if ((start >= 0) && (end >= 0) && (start < end)) { + // if text is selected, save only selected text + buffer = getText(start, end - start); + } else { + // save the whole text + buffer = getText(); + } + } catch (BadLocationException ble) { + myLogger.error(ble.getMessage(), ble); + } + + JFileChooser jFileChooser = new JFileChooser(); + jFileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + jFileChooser.setDialogTitle(Internationalization.getTranslation("dlg_title_saveas")); + jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + jFileChooser.setSelectedFile(new File(getDefaultFileName())); + + if (jFileChooser.showSaveDialog(myRawTextPane) == JFileChooser.APPROVE_OPTION) { + File file = jFileChooser.getSelectedFile(); + try { + FileOutputStream out = new FileOutputStream(file); + out.write(buffer.getBytes()); + out.flush(); + out.close(); + } catch (IOException ioe) { + JOptionPane.showMessageDialog(myRawTextPane, + Internationalization.getTranslation("dlg_ioerror_text") + "\n" + + ioe.getLocalizedMessage(), + Internationalization.getTranslation("dlg_ioerror_title"), + JOptionPane.ERROR_MESSAGE); + } + } + } + }; + + /** + * Constructor of JRawTextPane. + * + * @param direction Direction the text pane is used for displaying content (client or server). + */ + public JRawTextPane(Direction direction) { + myRawTextPane = this; + myDirection = direction; + initPopupMenu(); + myClipboard = getToolkit().getSystemClipboard(); + setComponentPopupMenu(myJPopupMenu); + } + + /** + * Initialize the pop up menu. + */ + private void initPopupMenu() { + myJPopupMenu = new JPopupMenu(); + myJPopupMenu.add(new JMenuItem(cutAction)); + myJPopupMenu.add(new JMenuItem(copyAction)); + myJPopupMenu.add(new JMenuItem(pasteAction)); + myJPopupMenu.add(new JMenuItem(saveAsAction)); + } + + /** + * This method returns the default filename. + * + * @return String + */ + private String getDefaultFileName() { + Date now = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); + + String side = "_server_"; + if (myDirection == Direction.ClientToServer) { + side = "_client_"; + } + + return "msg" + side + dateFormat.format(now) + ".rec"; + } + + /** + * {@inheritDoc} + * + * @see java.awt.datatransfer.ClipboardOwner#lostOwnership(java.awt.datatransfer.Clipboard, java.awt.datatransfer.Transferable) + */ + public void lostOwnership(Clipboard clipboard, Transferable content) { + myLogger.info("Clipboard overwritten by another application!"); + } +} Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-04-03 16:37:44 UTC (rev 103) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-04-05 15:43:38 UTC (rev 104) @@ -136,7 +136,7 @@ private JMenuItem jMenuItemClearRight = null; /** Client text pane. */ - private JTextPane jTextPaneClientRaw = null; + private JRawTextPane jTextPaneClientRaw = null; /** Client tab pane. */ private JTabbedPane jTabbedPaneClient = null; @@ -157,7 +157,7 @@ private JScrollPane jScrollPaneServerRaw = null; /** Server text pane. */ - private JTextPane jTextPaneServerRaw = null; + private JRawTextPane jTextPaneServerRaw = null; /** Menu item "about". */ private JMenuItem jMenuItemAbout = null; @@ -582,7 +582,7 @@ */ private JTextPane getJTextPaneClientRaw() { if (jTextPaneClientRaw == null) { - jTextPaneClientRaw = new JTextPane(); + jTextPaneClientRaw = new JRawTextPane(Direction.ClientToServer); jTextPaneClientRaw.setText(""); jTextPaneClientRaw.setEditable(true); } @@ -675,7 +675,7 @@ */ private JTextPane getJTextPaneServerRaw() { if (jTextPaneServerRaw == null) { - jTextPaneServerRaw = new JTextPane(); + jTextPaneServerRaw = new JRawTextPane(Direction.ServerToClient); jTextPaneServerRaw.setText(""); jTextPaneServerRaw.setEditable(true); } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-04-03 16:37:44 UTC (rev 103) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-04-05 15:43:38 UTC (rev 104) @@ -84,7 +84,19 @@ /** */ public static final String ICON_CONFIGURE = "configure.png"; + + /** */ + public static final String ICON_PASTE = "editpaste.png"; + + /** */ + public static final String ICON_COPY = "editcopy.png"; + /** */ + public static final String ICON_CUT = "editcut.png"; + + /** */ + public static final String ICON_SAVEAS = "filesaveas.png"; + /** This hash map is used to cache the ImageIcons. */ private static final Map<String, ImageIcon> RESOURCE_MAP = new HashMap<String, ImageIcon>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-04-06 13:54:41
|
Revision: 106 http://davinspector.svn.sourceforge.net/davinspector/?rev=106&view=rev Author: wuest Date: 2008-04-06 06:54:38 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Added export dialog to the main window. You can now export the client or server message history to a file. Added an IOException dialog to Util. Modified Paths: -------------- trunk/DAVInspector/resource/TextBundle.properties trunk/DAVInspector/resource/TextBundle_de_DE.properties trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java Added Paths: ----------- trunk/DAVInspector/resource/fileexport.png trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java Modified: trunk/DAVInspector/resource/TextBundle.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle.properties 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/resource/TextBundle.properties 2008-04-06 13:54:38 UTC (rev 106) @@ -7,7 +7,7 @@ ac_send_to_client_description=Send Server data to the Client ac_configure=Configure ac_configure_description=Configure the application -ac_configure_plugins=Configure +ac_configure_plugins=Configure Plugins ac_configure_plugins_description=Configure the loaded plugins ac_about=About ac_about_description=Display information about the application @@ -25,6 +25,9 @@ ac_enable_auto_mode_description=Data is automatically transfered ac_disable_auto_mode=Disable Auto Mode ac_disable_auto_mode_description=No automatic data transfer +ac_export=Export ... +ac_export_description=Export client or server messages to a file + #ac popup menu ac_paste=Paste ac_paste_description=Paste @@ -48,7 +51,6 @@ menu_file=File menu_view=View menu_help=Help -menu_plugins=Plugins #AboutDialog dlg_about_title=About DAVInspector @@ -70,6 +72,13 @@ dlg_plugin_configuration_type_edit=Edit dlg_plugin_configuration_type_view=View +#ExportDialog +dlg_export_title=Export +dlg_export_label_file=File +dlg_export_radio_client=Export Client Messages +dlg_export_radio_server=Export Server Messages +dlg_export_save_dialog_title=Save Export to ... + #PluginConfigurationTableModel #Column names col_plugin_configuration_client=Client Modified: trunk/DAVInspector/resource/TextBundle_de_DE.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-04-06 13:54:38 UTC (rev 106) @@ -7,7 +7,7 @@ ac_send_to_client_description=Server-Daten zum Client \xFCbertragen ac_configure=Einstellungen ac_configure_description=Die Einstellungen des Programms \xE4ndern -ac_configure_plugins=Konfiguration +ac_configure_plugins=Konfiguration Plugins ac_configure_plugins_description=Die geladenen Plugins konfigurieren ac_about=\xDCber... ac_about_description=Information zum Programm anzeigen @@ -25,6 +25,9 @@ ac_enable_auto_mode_description=Die Daten werden automatisch \xFCbertragen ac_disable_auto_mode=Automatik deaktivieren ac_disable_auto_mode_description=Die Daten m\xFCssen manuell \xFCbertragen werden +ac_export=Export ... +ac_export_description=Client- oder Servernachrichten in einer Datei speichern + #ac popup menu ac_paste=Einf\xFCgen ac_paste_description=Text aus Zwischenablage einf\xFCgen @@ -48,7 +51,6 @@ menu_file=Datei menu_view=Ansicht menu_help=Hilfe -menu_plugins=Plugins #AboutDialog dlg_about_title=\xDCber DAVInspector @@ -79,6 +81,13 @@ col_plugin_configuration_author=Autor col_plugin_configuration_description=Beschreibung +#ExportDialog +dlg_export_title=Export +dlg_export_label_file=Datei +dlg_export_radio_client=Exportiere Client-Nachrichten +dlg_export_radio_server=Exportiere Server-Nachrichten +dlg_export_save_dialog_title=Speichere Export unter ... + #HistoryTableModel col_history_type=Richtung col_history_id=ID Added: trunk/DAVInspector/resource/fileexport.png =================================================================== (Binary files differ) Property changes on: trunk/DAVInspector/resource/fileexport.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-04-06 13:54:38 UTC (rev 106) @@ -60,6 +60,12 @@ /** About dialog height. */ public static final int UI_ABOUT_DIALOG_HEIGTH = 275; + /** Export dialog width. */ + public static final int UI_EXPORT_DIALOG_WIDTH = 500; + + /** Export dialog height. */ + public static final int UI_EXPORT_DIALOG_HEIGTH = 175; + /** Background color of replies. */ public static final Color UI_REPLY_COLOR = new Color(255, 232, 140); Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Util.java 2008-04-06 13:54:38 UTC (rev 106) @@ -28,8 +28,10 @@ import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; +import java.io.IOException; import java.text.DecimalFormat; +import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; @@ -106,4 +108,17 @@ DecimalFormat decimalFormat = new DecimalFormat("###,##0.#"); return decimalFormat.format(result) + ' ' + units[unitIndex]; } + + /** + * This method opens a dialog window displaying the IOError. + * + * @param ioe {@link IOException} + */ + public static void showIOExceptionMessageDialog(IOException ioe) { + JOptionPane.showMessageDialog(null, + Internationalization.getTranslation("dlg_ioerror_text") + "\n" + + ioe.getLocalizedMessage(), + Internationalization.getTranslation("dlg_ioerror_title"), + JOptionPane.ERROR_MESSAGE); + } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-04-06 13:54:38 UTC (rev 106) @@ -25,14 +25,20 @@ package de.dlr.davinspector.history; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.swing.event.EventListenerList; +import de.dlr.davinspector.common.Constant.Direction; +import de.dlr.davinspector.common.Util; + /** * This class saves and provides access to the processed messages. * @@ -71,6 +77,33 @@ } /** + * Save the message history of the client or server in a file. + * + * @param direction Direction + * @param filename String + */ + public void exportToFile(Direction direction, String filename) { + String buffer = ""; + File file = new File(filename); + try { + FileOutputStream out = new FileOutputStream(file); + for (Iterator<AMessage> iterator = myMessages.iterator(); iterator.hasNext();) { + AMessage message = (AMessage) iterator.next(); + if (message.getDirection() == direction) { + // INFO: maybe let the user choose to export full data, only headers or body ... + // TODO: write delimiter for export + buffer = message.getRawData(); + out.write(buffer.getBytes()); + } + } + out.flush(); + out.close(); + } catch (IOException ioe) { + Util.showIOExceptionMessageDialog(ioe); + } + } + + /** * Deletes all stored messages. */ public void deleteAllMessages() { Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/IRelayModel.java 2008-04-06 13:54:38 UTC (rev 106) @@ -67,6 +67,14 @@ * @param id Integer */ void loadMessageById(Integer id); + + /** + * Export the message history of one side (client or server) to a file. + * + * @param direction Direction + * @param filename String + */ + void exportHistory(Direction direction, String filename); /** * This method notifies the listeners for server or client depending on the <code>direction</code> Modified: trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/relay/RelayModel.java 2008-04-06 13:54:38 UTC (rev 106) @@ -44,8 +44,6 @@ /** * Implementation of the relay interface. Provides the server socket * and manages the channel threads. - * TODO: edit-plugin - * TODO: breakpoint-plugin * * @version $LastChangedRevision$ * @author Jochen Wuest @@ -136,6 +134,15 @@ /** * {@inheritDoc} * + * @see de.dlr.davinspector.relay.IRelayModel#exportHistory(de.dlr.davinspector.common.Constant.Direction, java.lang.String) + */ + public void exportHistory(Direction direction, String filename) { + myMessageHistory.exportToFile(direction, filename); + } + + /** + * {@inheritDoc} + * * @see de.dlr.davinspector.relay.IRelayModel#isAutomodeActive() */ public Boolean isAutomodeActive() { Added: trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java (rev 0) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java 2008-04-06 13:54:38 UTC (rev 106) @@ -0,0 +1,353 @@ +/* + * ExportDialog.java + * + * This dialog lets the user choose if he wants to export the client or server + * messages to a choosen file. + * + * Created: 05.04.2008 Jochen Wuest <joc...@dl...> + * Changed: + * + * $Id$ + * + * Copyright 2007 Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR) + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.dlr.davinspector.ui; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Window; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.GroupLayout; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; +import javax.swing.LayoutStyle; + +import de.dlr.davinspector.common.Constant; +import de.dlr.davinspector.common.Constant.Direction; +import de.dlr.davinspector.common.Internationalization; +import de.dlr.davinspector.common.Util; + + +/** + * This dialog lets the user choose if he wants to export the client or server + * messages to a choosen file. + * + * @version $LastChangedRevision$ + * @author Jochen Wuest + */ +public class ExportDialog extends JDialog { + + /** Serial Version UID, not valid. */ + private static final long serialVersionUID = 1L; + + /** */ + private JPanel jContentPane = null; + + /** */ + private JButton jButtonOk = null; + + /** */ + private JButton jButtonCancel = null; + + /** */ + private ButtonGroup buttonGroup = new ButtonGroup(); + + /** */ + private JTextField jTextField = new JTextField(); + + /** */ + private JLabel jLabel = new JLabel(); + + /** */ + private JButton jButton = new JButton(); + + /** */ + private JRadioButton jRadioButtonClient = new JRadioButton(); + + /** */ + private JRadioButton jRadioButtonServer = new JRadioButton(); + + /** */ + private JPanel jPanelButtonBar = null; + + /** */ + private JPanel jPanelExport = null; + + /** The Controller. */ + private IMainController myController; + + /** The parent frame. */ + private Frame myParent; + + /** + * Constructor of AboutDialog. + * + * @param owner Parent Frame + * @param controller IMainController + */ + public ExportDialog(Frame owner, IMainController controller) { + super(owner); + myParent = owner; + myController = controller; + initialize(); + } + + /** + * This method initializes this. + */ + private void initialize() { + setSize(Constant.UI_EXPORT_DIALOG_WIDTH, Constant.UI_EXPORT_DIALOG_HEIGTH); + setTitle(Constant.APP_TITLE + " " + Internationalization.getTranslation("dlg_export_title")); + setContentPane(this.getJContentPane()); + setModal(true); + setResizable(false); + Util.centerWindow((Window) this); + } + + /** + * This method initializes jContentPane. + * + * @return javax.swing.JPanel + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(new BorderLayout()); + jContentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jContentPane.add(getExportPanel(), BorderLayout.CENTER); + jContentPane.add(getJPanelButtonBar(), BorderLayout.SOUTH); + } + return jContentPane; + } + + /** + * This method initializes jButtonCancel. + * + * @return javax.swing.JButton + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setText(Internationalization.getTranslation("dlg_configuration_cancel")); + jButtonCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + closeWindow(); + } + + }); + } + return jButtonCancel; + } + + /** + * This method closes the window. + */ + public void closeWindow() { + setVisible(false); + dispose(); + } + + /** + * This method returns the default filename. + * + * @return String + */ + private String getDefaultFileName() { + String path = ""; + // if a filename is already set, + // get the path and add the new filename + if (!jTextField.getText().isEmpty()) { + String oldFilename = jTextField.getText(); + path = new File(oldFilename).getParent(); + // if getParent() returns null there is no parent + if (path == null) { + path = ""; + } else { + path += File.separatorChar; + } + } + + Date now = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm"); + + String side = "_server_"; + if (jRadioButtonClient.isSelected()) { + side = "_client_"; + } + return path + "export" + side + dateFormat.format(now) + ".rec"; + } + + /** + * This method initializes jButtonOk. + * + * @return javax.swing.JButton + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setText(Internationalization.getTranslation("dlg_configuration_ok")); + jButtonOk.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + myController.exportHistory(getDirection(), getFilename()); + closeWindow(); + } + }); + } + return jButtonOk; + } + + /** + * This Method returns the chosen filename from the text field. + * + * @return String + */ + private String getFilename() { + return jTextField.getText(); + } + + /** + * This method returns the selected direction from the radio group. + * + * @return Direction + */ + private Direction getDirection() { + if (jRadioButtonClient.isSelected()) { + return Direction.ClientToServer; + } else { + return Direction.ServerToClient; + } + } + + /** + * This method initializes jPanelButtonBar. + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelButtonBar() { + if (jPanelButtonBar == null) { + jPanelButtonBar = new JPanel(); + jPanelButtonBar.setLayout(new BoxLayout(jPanelButtonBar, BoxLayout.LINE_AXIS)); + jPanelButtonBar.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + jPanelButtonBar.setAlignmentX(Component.RIGHT_ALIGNMENT); + jPanelButtonBar.add(Box.createHorizontalGlue()); + jPanelButtonBar.add(getJButtonOk()); + jPanelButtonBar.add(Box.createRigidArea(new Dimension(10, 0))); + jPanelButtonBar.add(getJButtonCancel()); + } + return jPanelButtonBar; + } + + /** + * This method opens a file chooser dialog and evaluates the result. + * If a valid file is chosen, the local variable <code>myFilename</code> is updated and + * the method <code>setRecordingFile()</code> of the RecordingPlugin is called. + * + * @param event Event + */ + private void jButtonOpenFileChooserActionPerformed(java.awt.event.ActionEvent event) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + fileChooser.setDialogTitle(Internationalization.getTranslation("dlg_export_save_dialog_title")); + fileChooser.setSelectedFile(new File(getDefaultFileName())); + fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + + if (fileChooser.showSaveDialog(myParent) == JFileChooser.APPROVE_OPTION) { + File file = fileChooser.getSelectedFile(); + jTextField.setText(file.getAbsolutePath()); + } + } + + /** + * This method initializes jPanelExport. + * + * @return javax.swing.JPanel + */ + private JPanel getExportPanel() { + if (jPanelExport == null) { + jPanelExport = new JPanel(); + + buttonGroup.add(jRadioButtonClient); + jRadioButtonClient.setSelected(true); + jRadioButtonClient.setText(Internationalization.getTranslation("dlg_export_radio_client")); + jRadioButtonClient.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField.setText(getDefaultFileName()); + } + }); + + buttonGroup.add(jRadioButtonServer); + jRadioButtonServer.setText(Internationalization.getTranslation("dlg_export_radio_server")); + jRadioButtonServer.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField.setText(getDefaultFileName()); + } + }); + + jLabel.setText(Internationalization.getTranslation("dlg_export_label_file") + ':'); + jTextField.setText(getDefaultFileName()); + jButton.setText("..."); + jButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButtonOpenFileChooserActionPerformed(evt); + } + }); + + GroupLayout layout = new GroupLayout(jPanelExport); + jPanelExport.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jRadioButtonClient) + .addComponent(jRadioButtonServer) + .addGroup(layout.createSequentialGroup() + .addComponent(jTextField, GroupLayout.DEFAULT_SIZE, Byte.MAX_VALUE * 3, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(jLabel) + .addComponent(jButton) + .addComponent(jTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jRadioButtonClient) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jRadioButtonServer)) + ); + } + return jPanelExport; + } +} Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/IMainController.java 2008-04-06 13:54:38 UTC (rev 106) @@ -25,7 +25,9 @@ package de.dlr.davinspector.ui; +import de.dlr.davinspector.common.Constant.Direction; + /** * This is the interface of the controller. * @@ -77,4 +79,12 @@ * @param id Integer */ void loadMessage(Integer id); + + /** + * Export the message history of one side (client or server) to a file. + * + * @param direction Direction + * @param filename String + */ + void exportHistory(Direction direction, String filename); } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainController.java 2008-04-06 13:54:38 UTC (rev 106) @@ -25,6 +25,7 @@ package de.dlr.davinspector.ui; +import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.configuration.Configuration; import de.dlr.davinspector.relay.IRelayModel; @@ -53,6 +54,7 @@ myView = new MainView(this, myRelay); // Init view myView.disableSendToActions(); + myView.disableExportAction(); } /** @@ -63,6 +65,7 @@ public void enableRelay() { Configuration config = new Configuration(); myRelay.startRelay(config); + myView.enableExportAction(); // enable sendTo-Actions only if automode is not active if (myRelay.isAutomodeActive()) { myView.disableSendToActions(); @@ -145,4 +148,13 @@ public void loadMessage(Integer id) { myRelay.loadMessageById(id); } + + /** + * {@inheritDoc} + * + * @see de.dlr.davinspector.ui.IMainController#exportHistory(de.dlr.davinspector.common.Constant.Direction, java.lang.String) + */ + public void exportHistory(Direction direction, String filename) { + myRelay.exportHistory(direction, filename); + } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/MainView.java 2008-04-06 13:54:38 UTC (rev 106) @@ -45,6 +45,7 @@ import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JSeparator; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTable; @@ -162,15 +163,18 @@ /** Menu item "about". */ private JMenuItem jMenuItemAbout = null; - /** Plugin menu. */ - private JMenu jMenuPlugins = null; - /** Menu item "configure plugins". */ private JMenuItem jMenuItemConfigurePlugins = null; + /** Menu item export. */ + private JMenuItem jMenuItemExport = null; + /** Configuration dialog. */ private ConfigurationDialog myConfigDialog = null; + /** Export dialog. */ + private ExportDialog myExportDialog = null; + /** Plugin configuration dialog. */ private PluginConfigurationDialog myPluginConfigurationDialog = null; @@ -434,6 +438,25 @@ } }; + /** + * Action: Export history. + */ + private Action exportAction = new AbstractAction() { + static final long serialVersionUID = 1L; + { + putValue(Action.NAME, Internationalization.getTranslation("ac_export")); + putValue(Action.SHORT_DESCRIPTION, Internationalization.getTranslation("ac_export_description")); + putValue(Action.SMALL_ICON, UIResource.getIcon(UIResource.ICON_EXPORT)); + } + + public void actionPerformed(ActionEvent e) { + if (myExportDialog == null) { + myExportDialog = new ExportDialog(jFrame, myController); + } + myExportDialog.setVisible(true); + } + }; + /** * Constructor of MainView. Initializes the GUI elements, * loads the plugins and registers listeners. @@ -692,7 +715,6 @@ jJMenuBar = new JMenuBar(); jJMenuBar.add(getJMenuFile()); jJMenuBar.add(getJMenuView()); - jJMenuBar.add(getJMenuPlugins()); jJMenuBar.add(getJMenuHelp()); } return jJMenuBar; @@ -708,6 +730,10 @@ jMenuFile = new JMenu(); jMenuFile.setText(Internationalization.getTranslation("menu_file")); jMenuFile.add(getJMenuItemConfigure()); + jMenuFile.add(getJMenuItemConfigurePlugins()); + jMenuFile.add(new JSeparator()); + jMenuFile.add(getJMenuItemExport()); + jMenuFile.add(new JSeparator()); jMenuFile.add(getJMenuItemExit()); } return jMenuFile; @@ -817,20 +843,6 @@ } /** - * This method initializes jMenuPlugins. - * - * @return javax.swing.JMenu - */ - private JMenu getJMenuPlugins() { - if (jMenuPlugins == null) { - jMenuPlugins = new JMenu(); - jMenuPlugins.setText(Internationalization.getTranslation("menu_plugins")); - jMenuPlugins.add(getJMenuItemConfigurePlugins()); - } - return jMenuPlugins; - } - - /** * This method initializes jMenuItemConfigurePlugins. * * @return javax.swing.JMenuItem. @@ -841,6 +853,18 @@ } return jMenuItemConfigurePlugins; } + + /** + * This method initializes jMenuItemExport. + * + * @return javax.swing.JMenuItem. + */ + private JMenuItem getJMenuItemExport() { + if (jMenuItemExport == null) { + jMenuItemExport = new JMenuItem(exportAction); + } + return jMenuItemExport; + } /** * This method initializes jSplitPaneHorizontal. @@ -1058,4 +1082,18 @@ sendToClientAction.setEnabled(false); sendToServerAction.setEnabled(false); } + + /** + * Enable the export menu item. + */ + public void enableExportAction() { + exportAction.setEnabled(true); + } + + /** + * Disable the export menu item. + */ + public void disableExportAction() { + exportAction.setEnabled(false); + } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-04-05 15:46:01 UTC (rev 105) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/UIResource.java 2008-04-06 13:54:38 UTC (rev 106) @@ -97,6 +97,9 @@ /** */ public static final String ICON_SAVEAS = "filesaveas.png"; + /** */ + public static final String ICON_EXPORT = "fileexport.png"; + /** This hash map is used to cache the ImageIcons. */ private static final Map<String, ImageIcon> RESOURCE_MAP = new HashMap<String, ImageIcon>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wu...@us...> - 2008-04-09 12:49:24
|
Revision: 114 http://davinspector.svn.sourceforge.net/davinspector/?rev=114&view=rev Author: wuest Date: 2008-04-09 05:36:34 -0700 (Wed, 09 Apr 2008) Log Message: ----------- Added "export all" option to export dialog. Modified Paths: -------------- trunk/DAVInspector/resource/TextBundle.properties trunk/DAVInspector/resource/TextBundle_de_DE.properties trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java Modified: trunk/DAVInspector/resource/TextBundle.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle.properties 2008-04-09 11:38:30 UTC (rev 113) +++ trunk/DAVInspector/resource/TextBundle.properties 2008-04-09 12:36:34 UTC (rev 114) @@ -77,6 +77,7 @@ dlg_export_label_file=File dlg_export_radio_client=Export Client Messages dlg_export_radio_server=Export Server Messages +dlg_export_radio_all=Export All Messages dlg_export_save_dialog_title=Save Export to ... #PluginConfigurationTableModel Modified: trunk/DAVInspector/resource/TextBundle_de_DE.properties =================================================================== --- trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-04-09 11:38:30 UTC (rev 113) +++ trunk/DAVInspector/resource/TextBundle_de_DE.properties 2008-04-09 12:36:34 UTC (rev 114) @@ -86,6 +86,7 @@ dlg_export_label_file=Datei dlg_export_radio_client=Exportiere Client-Nachrichten dlg_export_radio_server=Exportiere Server-Nachrichten +dlg_export_radio_all=Exportiere alle Nachrichten dlg_export_save_dialog_title=Speichere Export unter ... #HistoryTableModel Modified: trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-04-09 11:38:30 UTC (rev 113) +++ trunk/DAVInspector/src/de/dlr/davinspector/common/Constant.java 2008-04-09 12:36:34 UTC (rev 114) @@ -141,6 +141,9 @@ /** Basis of the hexadecimal number system. */ public static final int HEX_RADIX = 16; + /** Delimiter for export of messages. */ + public static final String EXPORT_DELIMITER = LFCR + LFCR + LFCR; + /** * Indicates the direction of the message. * @@ -151,7 +154,9 @@ /** From client to server. */ ClientToServer, /** From server to client. */ - ServerToClient + ServerToClient, + /** All messages, don't mind the direction. */ + DontCare } /** Modified: trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-04-09 11:38:30 UTC (rev 113) +++ trunk/DAVInspector/src/de/dlr/davinspector/history/MessageHistory.java 2008-04-09 12:36:34 UTC (rev 114) @@ -34,6 +34,7 @@ import javax.swing.event.EventListenerList; +import de.dlr.davinspector.common.Constant; import de.dlr.davinspector.common.Constant.Direction; import de.dlr.davinspector.common.Util; @@ -89,10 +90,11 @@ FileOutputStream out = new FileOutputStream(file); for (Iterator<AMessage> iterator = myMessages.iterator(); iterator.hasNext();) { AMessage message = (AMessage) iterator.next(); - if (message.getDirection() == direction) { + if (message.getDirection() == direction || direction == Direction.DontCare) { // INFO: maybe let the user choose to export full data, only headers or body ... - // TODO: write delimiter for export buffer = message.getRawData(); + // INFO: let the user choose a delimiter for export + buffer += Constant.EXPORT_DELIMITER; out.write(buffer.getBytes()); } } Modified: trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java =================================================================== --- trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java 2008-04-09 11:38:30 UTC (rev 113) +++ trunk/DAVInspector/src/de/dlr/davinspector/ui/ExportDialog.java 2008-04-09 12:36:34 UTC (rev 114) @@ -95,6 +95,9 @@ private JRadioButton jRadioButtonServer = new JRadioButton(); /** */ + private JRadioButton jRadioButtonAll = new JRadioButton(); + + /** */ private JPanel jPanelButtonBar = null; /** */ @@ -200,6 +203,8 @@ String side = "_server_"; if (jRadioButtonClient.isSelected()) { side = "_client_"; + } else if (jRadioButtonAll.isSelected()) { + side = "_all_"; } return path + "export" + side + dateFormat.format(now) + ".rec"; } @@ -240,8 +245,10 @@ private Direction getDirection() { if (jRadioButtonClient.isSelected()) { return Direction.ClientToServer; + } else if (jRadioButtonServer.isSelected()) { + return Direction.ServerToClient; } else { - return Direction.ServerToClient; + return Direction.DontCare; } } @@ -310,6 +317,14 @@ } }); + buttonGroup.add(jRadioButtonAll); + jRadioButtonAll.setText(Internationalization.getTranslation("dlg_export_radio_all")); + jRadioButtonAll.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField.setText(getDefaultFileName()); + } + }); + jLabel.setText(Internationalization.getTranslation("dlg_export_label_file") + ':'); jTextField.setText(getDefaultFileName()); jButton.setText("..."); @@ -329,6 +344,7 @@ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jRadioButtonClient) .addComponent(jRadioButtonServer) + .addComponent(jRadioButtonAll) .addGroup(layout.createSequentialGroup() .addComponent(jTextField, GroupLayout.DEFAULT_SIZE, Byte.MAX_VALUE * 3, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) @@ -345,7 +361,9 @@ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jRadioButtonClient) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jRadioButtonServer)) + .addComponent(jRadioButtonServer) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jRadioButtonAll)) ); } return jPanelExport; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |