Permalink
Browse files

Initial import of eqmessageutils

  • Loading branch information...
0 parents commit 6bcfc46e2c2ada6f9dc78a20d95fbd792c7bcad5 @jmfee-usgs jmfee-usgs committed Jun 13, 2012
Showing with 13,368 additions and 0 deletions.
  1. +9 −0 .classpath
  2. +17 −0 .project
  3. +12 −0 .settings/org.eclipse.jdt.core.prefs
  4. +1 −0 LICENSE
  5. +22 −0 README
  6. +127 −0 build.xml
  7. +58 −0 etc/eqxml/ANSS_EQ_XML.bindings.xml
  8. +2,027 −0 etc/eqxml/ANSS_EQ_XML_doc.xsd
  9. +106 −0 etc/eqxml/eqxml_to_product.txt
  10. +75 −0 etc/eqxml/generateBindings.py
  11. +5 −0 etc/ndk/sample.ndk
  12. +68 −0 etc/quakeml_1.1/QuakeML-BED-1.1.bindings.xml
  13. +547 −0 etc/quakeml_1.1/QuakeML-BED-1.1.xsd
  14. +558 −0 etc/quakeml_1.1/QuakeML-BED-1.1_jaxb.xsd
  15. BIN etc/quakeml_1.1/QuakeML-BED.pdf
  16. +108 −0 etc/quakeml_1.1/generateBindings.py
  17. BIN etc/quakeml_1.1/quakeml-1.1-classdiag.pdf
  18. +91 −0 etc/quakeml_1.2rc3/AnssCatalog-0.1.xsd
  19. +23 −0 etc/quakeml_1.2rc3/QuakeML-1.2.xsd
  20. +39 −0 etc/quakeml_1.2rc3/QuakeML-1.2_jaxb.xsd
  21. +89 −0 etc/quakeml_1.2rc3/QuakeML-1.2rc3.bindings.xml
  22. +721 −0 etc/quakeml_1.2rc3/QuakeML-BED-1.2.xsd
  23. +694 −0 etc/quakeml_1.2rc3/QuakeML-BED-1.2_jaxb.xsd
  24. +104 −0 etc/quakeml_1.2rc3/generateBindings.py
  25. +66 −0 etc/quakeml_1.2rc3/qml-example-1.2-RC3.xml
  26. BIN etc/quakeml_1.2rc3/quakeml-1.2-classdiag.pdf
  27. +23 −0 etc/quakeml_rt_1.2rc3/QuakeML-RT-1.2.xsd
  28. +39 −0 etc/quakeml_rt_1.2rc3/QuakeML-RT-1.2_jaxb.xsd
  29. +90 −0 etc/quakeml_rt_1.2rc3/QuakeML-RT-1.2rc3.bindings.xml
  30. +736 −0 etc/quakeml_rt_1.2rc3/QuakeML-RT-BED-1.2.xsd
  31. +692 −0 etc/quakeml_rt_1.2rc3/QuakeML-RT-BED-1.2_jaxb.xsd
  32. +132 −0 etc/quakeml_rt_1.2rc3/generateBindings.py
  33. +66 −0 etc/quakeml_rt_1.2rc3/qml-example-RT-1.2-RC3.xml
  34. BIN etc/quakeml_rt_1.2rc3/quakeml-RT-1.2-classdiag.pdf
  35. +19 −0 etc/vax/b00083i6.rmt
  36. +21 −0 etc/vax/c0006zwa.wcmt
  37. BIN lib/jaxb-api.jar
  38. BIN lib/jaxb-impl.jar
  39. BIN lib/jaxb-xjc.jar
  40. BIN lib/jsr173_1.0_api.jar
  41. BIN lib/junit-4.7.jar
  42. +137 −0 src/gov/usgs/earthquake/cube/CubeAddon.java
  43. +73 −0 src/gov/usgs/earthquake/cube/CubeChecksum.java
  44. +105 −0 src/gov/usgs/earthquake/cube/CubeDelete.java
  45. +714 −0 src/gov/usgs/earthquake/cube/CubeEvent.java
  46. +231 −0 src/gov/usgs/earthquake/cube/CubeMessage.java
  47. +43 −0 src/gov/usgs/earthquake/cube/CubeTest.java
  48. +108 −0 src/gov/usgs/earthquake/cube/CubeTrump.java
  49. +7 −0 src/gov/usgs/earthquake/cube/package-info.java
  50. +82 −0 src/gov/usgs/earthquake/eqxml/EQMessageParser.java
  51. +109 −0 src/gov/usgs/earthquake/eqxml/QWEventsDump.java
  52. +7 −0 src/gov/usgs/earthquake/eqxml/package-info.java
  53. +299 −0 src/gov/usgs/earthquake/event/Converter.java
  54. +78 −0 src/gov/usgs/earthquake/event/ConverterTest.java
  55. +270 −0 src/gov/usgs/earthquake/event/CubeToEQMessageConverter.java
  56. +84 −0 src/gov/usgs/earthquake/event/CubeToEQMessageConverterTest.java
  57. +349 −0 src/gov/usgs/earthquake/event/CubeToQuakemlConverter.java
  58. +72 −0 src/gov/usgs/earthquake/event/CubeToQuakemlConverterTest.java
  59. +266 −0 src/gov/usgs/earthquake/event/EQMessageToCubeConverter.java
  60. +53 −0 src/gov/usgs/earthquake/event/EidsToQuakemlConverter.java
  61. +128 −0 src/gov/usgs/earthquake/event/MagnitudeType.java
  62. +290 −0 src/gov/usgs/earthquake/event/QuakemlToCubeConverter.java
  63. +6 −0 src/gov/usgs/earthquake/event/package-info.java
  64. +29 −0 src/gov/usgs/earthquake/focalmechanism/NDKTest.java
  65. +280 −0 src/gov/usgs/earthquake/focalmechanism/NDKToQuakemlConverter.java
  66. +575 −0 src/gov/usgs/earthquake/focalmechanism/RawMechanismConverter.java
  67. +29 −0 src/gov/usgs/earthquake/focalmechanism/VaxTest.java
  68. +374 −0 src/gov/usgs/earthquake/focalmechanism/VaxToQuakemlConverter.java
  69. +7 −0 src/gov/usgs/earthquake/focalmechanism/package-info.java
  70. +49 −0 src/gov/usgs/earthquake/quakeml/FileToQuakeml.java
  71. +25 −0 src/gov/usgs/earthquake/quakeml/FileToQuakemlConverter.java
  72. +53 −0 src/gov/usgs/earthquake/quakeml/QuakemlDateParser.java
  73. +175 −0 src/gov/usgs/earthquake/quakeml/QuakemlPublicId.java
  74. +116 −0 src/gov/usgs/earthquake/quakeml/QuakemlPublicIdTest.java
  75. +26 −0 src/gov/usgs/earthquake/quakeml/QuakemlToQuakemlConverter.java
  76. +78 −0 src/gov/usgs/earthquake/quakeml/Quakeml_1_1_Parser.java
  77. +135 −0 src/gov/usgs/earthquake/quakeml/Quakeml_1_2rc3_Parser.java
  78. +48 −0 src/gov/usgs/earthquake/quakeml/Quakeml_1_2rc3_Test.java
  79. +122 −0 src/gov/usgs/earthquake/quakeml/Quakeml_RT_1_2rc3_Parser.java
  80. +49 −0 src/gov/usgs/earthquake/quakeml/Quakeml_RT_1_2rc3_Test.java
  81. +6 −0 src/gov/usgs/earthquake/quakeml/package-info.java
  82. +236 −0 src/gov/usgs/earthquake/util/IOUtil.java
  83. +56 −0 src/gov/usgs/earthquake/util/ISO8601.java
  84. +4 −0 src/gov/usgs/earthquake/util/package-info.java
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gensrc"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="lib" path="lib/junit-4.7.jar"/>
+ <classpathentry kind="lib" path="lib/jaxb-impl.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>MessageUtils</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>
@@ -0,0 +1,12 @@
+#Tue Nov 02 10:35:01 MDT 2010
+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
@@ -0,0 +1 @@
+This software is in the public domain because it contains materials that originally came from the United States Geological Survey, an agency of the United States Department of Interior. For more information, see the official USGS copyright policy at http://www.usgs.gov/visual-id/credit_usgs.html#copyright
22 README
@@ -0,0 +1,22 @@
+Earthquake Message Format Utilities
+Jeremy Fee <jmfee@usgs.gov>
+2012-06-13
+
+
+This java library is built using an ANT build script (build.xml).
+To build this project, you need:
+ - JDK 1.6
+ - Ant
+
+Eclipse project files are included, but any editor may be used.
+You will need to run an ant task to generate jaxb classes after first opening in eclipse.
+
+
+Files:
+ - All non-generated source code is in the "src/" directory.
+ - All generated source code is created in a "gensrc/" directory, by the ANT target "gensrc".
+ - Schemas and sample files are in the "etc/" directory.
+
+Interesting Classes:
+ - gov.usgs.earthquake.event.Converter has methods for converting most formats.
+ - gov.usgs.earthquake.quakeml.FileToQuakemlConverter is an interface for parsers to create Quakeml from other formats.
127 build.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="MessageUtils" default="jar" basedir=".">
+
+ <description>
+ The MessageUtils project provides utilities for generating, parsing, sending, and receiving earthquake messages.
+
+ Using ant it should be fairly easy to build this project from source (try "ant jar").
+ </description>
+
+
+ <property name="etc" location="etc" />
+ <property name="src" location="src" />
+ <property name="gensrc" location="gensrc" />
+ <property name="build" location="build" />
+ <property name="lib" location="lib" />
+ <property name="dist" location="dist" />
+ <property name="jarfile" location="${dist}/${ant.project.name}.jar" />
+ <property name="compile.debug" value="true" />
+
+
+
+ <fileset id="lib.jars" dir="${lib}">
+ <include name="*.jar" />
+ <!-- only need this for compilation -->
+ <exclude name="jaxb-xjc.jar" />
+ <exclude name="junit-4.7.jar" />
+ </fileset>
+
+ <path id="classpath">
+ <fileset refid="lib.jars" />
+ </path>
+
+ <path id="classpath-test">
+ <pathelement location="${lib}/junit-4.7.jar" />
+ <path refid="classpath" />
+ <pathelement path="${build}" />
+ </path>
+
+
+ <!-- for auto generating classes from xml schema -->
+ <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
+ <classpath>
+ <pathelement location="${lib}/jaxb-xjc.jar" />
+ <pathelement location="${lib}/jaxb-api.jar" />
+ <pathelement location="${lib}/jaxb-impl.jar" />
+ <pathelement location="${lib}/jsr173_1.0_api.jar" />
+ </classpath>
+ </taskdef>
+
+ <target name="gensrc" description="Generate JAXB classes">
+ <mkdir dir="${gensrc}"/>
+
+ <!-- EQXML -->
+ <xjc destdir="${gensrc}" schema="${etc}/eqxml/ANSS_EQ_XML_doc.xsd" binding="${etc}/eqxml/ANSS_EQ_XML.bindings.xml" removeOldOutput="yes">
+ <produces dir="${gensrc}/gov/usgs/ansseqmsg" includes="*" />
+ </xjc>
+
+ <!-- QuakeML 1.1 -->
+ <xjc destdir="${gensrc}" binding="${etc}/quakeml_1.1/QuakeML-BED-1.1.bindings.xml" removeOldOutput="yes">
+ <schema dir="${etc}/quakeml_1.1" includes="*_jaxb.xsd" />
+ <produces dir="${gensrc}/org/quakeml1_1" includes="*" />
+ </xjc>
+
+ <!-- QuakeML 1.2rc3 -->
+ <xjc destdir="${gensrc}" binding="${etc}/quakeml_1.2rc3/QuakeML-1.2rc3.bindings.xml" removeOldOutput="yes" extension="true">
+ <schema dir="${etc}/quakeml_1.2rc3" includes="*_jaxb.xsd" />
+ <produces dir="${gensrc}/org/quakeml1_2rc3" includes="*" />
+ </xjc>
+
+ <!-- QuakeML RT 1.2rc3 -->
+ <xjc destdir="${gensrc}" binding="${etc}/quakeml_rt_1.2rc3/QuakeML-RT-1.2rc3.bindings.xml" removeOldOutput="yes" extension="true">
+ <schema dir="${etc}/quakeml_rt_1.2rc3" includes="*_jaxb.xsd" />
+ <produces dir="${gensrc}/org/quakeml_rt_1_2rc3" includes="*" />
+ </xjc>
+
+ </target>
+
+
+
+ <target name="compile" depends="gensrc" description="Compile code">
+ <mkdir dir="${build}" />
+ <mkdir dir="${lib}" />
+
+ <javac srcdir="${src}" destdir="${build}" source="1.5" target="1.5" includeAntRuntime="no" classpathref="classpath-test" debug="${compile.debug}">
+ <src path="${src}"/>
+ <src path="${gensrc}"/>
+ </javac>
+ </target>
+
+ <target name="test" depends="compile" description="Run JUnit tests">
+ <junit printsummary="yes" haltonfailure="yes">
+ <classpath refid="classpath-test" />
+
+ <formatter type="plain" usefile="false" />
+
+ <batchtest>
+ <!-- any class with the name Test in its name -->
+ <fileset dir="${build}" includes="**/*Test.class" />
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="jar" depends="compile" description="Build jar">
+ <mkdir dir="${dist}" />
+ <jar jarfile="${jarfile}" basedir="${build}" excludes="**/*Test*">
+ <zipgroupfileset refid="lib.jars" />
+ </jar>
+ </target>
+
+
+
+ <target name="javadoc" depends="jar" description="Generate Javadoc">
+ <javadoc destdir="${dist}/javadoc" packagenames="gov**" classpathref="classpath">
+ <fileset dir="${src}" excludes="**/*Test*" />
+ <fileset dir="${gensrc}" />
+ </javadoc>
+ </target>
+
+ <target name="all" depends="clean,test,javadoc,jar" description="clean, test, jar, and javadoc" />
+
+ <target name="clean" description="Remove build and dist directories">
+ <delete dir="${build}" />
+ <delete dir="${dist}" />
+ <delete dir="${gensrc}" />
+ </target>
+
+</project>
@@ -0,0 +1,58 @@
+<bindings version="1.0"
+ xmlns="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:eqxml="http://www.usgs.gov/ansseqmsg">
+
+<globalBindings
+ fixedAttributeAsConstantProperty="true"
+ generateIsSetMethod="false">
+
+ <!-- override default Float mapping for floats -->
+ <javaType xmlType="xs:float" name="java.math.BigDecimal"
+ parseMethod="javax.xml.bind.DatatypeConverter.parseDecimal"
+ printMethod="javax.xml.bind.DatatypeConverter.printDecimal" />
+
+ <!-- override default XMLGregorianCalendar mapping for dates. -->
+ <javaType xmlType="xs:dateTime" name="java.util.Date"
+ parseMethod="gov.usgs.util.XmlUtils.getDate"
+ printMethod="gov.usgs.util.XmlUtils.formatDate" />
+
+</globalBindings>
+
+<bindings schemaLocation="ANSS_EQ_XML_doc.xsd" node="/xs:schema">
+<package name="gov.usgs.ansseqmsg"/>
+
+<bindings node="//xs:simpleType[@name='ActionSimType']"><typesafeEnumClass name="Action"/></bindings>
+<bindings node="//xs:simpleType[@name='AxisLengthUnitSimType']"><typesafeEnumClass name="AxisLengthUnit"/></bindings>
+<bindings node="//xs:simpleType[@name='EventActionSimType']"><typesafeEnumClass name="EventAction"/></bindings>
+<bindings node="//xs:simpleType[@name='EventScopeSimType']"><typesafeEnumClass name="EventScope"/></bindings>
+<bindings node="//xs:simpleType[@name='EventTypeSimType']"><typesafeEnumClass name="EventType"/></bindings>
+<bindings node="//xs:simpleType[@name='EventUsageSimType']"><typesafeEnumClass name="EventUsage"/></bindings>
+<bindings node="//xs:simpleType[@name='OriginStatusSimType']"><typesafeEnumClass name="OriginStatus"/></bindings>
+<bindings node="//xs:complexType[@name='EventCpxType']"><class name="Event"/></bindings>
+<bindings node="//xs:complexType[@name='OriginCpxType']"><class name="Origin"/></bindings>
+<bindings node="//xs:complexType[@name='ProductLinkCpxType']"><class name="ProductLink"/></bindings>
+<bindings node="//xs:complexType[@name='CommentCpxType']"><class name="Comment"/></bindings>
+<bindings node="//xs:complexType[@name='LocalTimeCpxType']"><class name="LocalTime"/></bindings>
+<bindings node="//xs:complexType[@name='ErrorAxesCpxType']"><class name="ErrorAxes"/></bindings>
+<bindings node="//xs:complexType[@name='MagnitudeCpxType']"><class name="Magnitude"/></bindings>
+<bindings node="//xs:complexType[@name='MomentTensorCpxType']"><class name="MomentTensor"/></bindings>
+<bindings node="//xs:complexType[@name='FocalMechCpxType']"><class name="FocalMech"/></bindings>
+<bindings node="//xs:complexType[@name='PhaseCpxType']"><class name="Phase"/></bindings>
+<bindings node="//xs:complexType[@name='PickCpxType']"><class name="Pick"/></bindings>
+<bindings node="//xs:complexType[@name='AmplitudeCpxType']"><class name="Amplitude"/></bindings>
+<bindings node="//xs:complexType[@name='DurationCpxType']"><class name="Duration"/></bindings>
+<bindings node="//xs:complexType[@name='AxisCpxType']"><class name="Axis"/></bindings>
+<bindings node="//xs:complexType[@name='TensorCpxType']"><class name="Tensor"/></bindings>
+<bindings node="//xs:complexType[@name='FaultCpxType']"><class name="Fault"/></bindings>
+<bindings node="//xs:complexType[@name='SrcTimeFnCpxType']"><class name="SrcTimeFn"/></bindings>
+<bindings node="//xs:complexType[@name='MethodCpxType']"><class name="Method"/></bindings>
+<bindings node="//xs:complexType[@name='PrincAxesCpxType']"><class name="PrincAxes"/></bindings>
+<bindings node="//xs:complexType[@name='NodalPlanesCpxType']"><class name="NodalPlanes"/></bindings>
+<bindings node="//xs:complexType[@name='ErrorTensorCpxType']"><class name="ErrorTensor"/></bindings>
+<bindings node="//xs:complexType[@name='ErrorFaultsCpxType']"><class name="ErrorFaults"/></bindings>
+<bindings node="//xs:complexType[@name='DataUsedCpxType']"><class name="DataUsed"/></bindings>
+
+</bindings>
+</bindings>
+
Oops, something went wrong.

0 comments on commit 6bcfc46

Please sign in to comment.