1) download zip
2) unzip
- unzip CSR_LIBRARY_SAMPLE.zip
you will get a main directory CSR_LIBRARY_SAMPLE containing :
- lib/mikado.jar (mikado software used as CSR library)
- lib/SdnVocabulary.jar (Soap client and library for BODC vocabularies)
- lib/*.jar (jars for JAX-WS 2.2.6)
- LOCAL_DIRECTORY (directory storing mikado configuration)
- SAMPLES (directory containing the CSR sample CSR_ISO19139_full_example_v4.0.0.xml)
- samples/ReadCsrSample.java (java sample code reading CSR, see below)
- samples/WriteCsrSample.java (java sample code writing CSR, see below)
3) compiling
- samples/ReadCsrSample.class and samples/WriteCsrSample.class are in zip
- to rebuild them go in CSR_LIBRARY_SAMPLE directory and run :
- Unix :
- javac -cp lib/mikado.jar:lib/SdnVocabulary.jar samples/WriteCsrSample.java
- javac -cp .:lib/mikado.jar:lib/SdnVocabulary.jar samples/ReadCsrSample.java
- Windows, same commands with ; instead : for classpath separator (-cp)
4) running samples
- go in CSR_LIBRARY_SAMPLE directory and run :
- Unix ORACLE JDK 8 :
- java -cp .:lib/mikado.jar:lib/SdnVocabulary.jar samples.ReadCsrSample
- java -cp .:lib/mikado.jar:lib/SdnVocabulary.jar samples.WriteCsrSample
- Unix OPENJDK 13 :
- java -Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -cp .:lib/mikado.jar:lib/SdnVocabulary.jar samples.ReadCsrSample
- java -Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -cp .:lib/mikado.jar:lib/SdnVocabulary.jar samples.WriteCsrSample
- Windows, same commands with ; instead : for classpath separator (-cp)
ReadCsrSample.java
This sample code shows how to
- initialize environment for library, directories in LOCAL_DIRECTORY are required for using the library,
LOCAL_DIRECTORY/conf contains configuration files for mikado, eg xsd for xml validation
LOCAL_DIRECTORY/language contains messages for mikado software
LOCAL_DIRECTORY/lists contains vocabularies (lists from BODC, EDMO from MARIS, EDMERP from MARIS)
- read the CSR file SAMPLES/CSR_ISO19139_full_example_v4.0.0.xml in memory (MetadataCsrIso19139 class with getters and setters)
- validate the CSR in memory with xsd
- dump variables from the CSR in memory with naming convention of mikado automatic (var01, var02 ...)
- dump XML from memory (Xml rebuild by MetadataCsrIso19139 class)
View ReadCsrSample.java
View ReadCsrSample output
WriteCsrSample.java
- initialize environment for library, directories in LOCAL_DIRECTORY are required for using the library,
LOCAL_DIRECTORY/conf contains configuration files for mikado, eg xsd for xml validation
LOCAL_DIRECTORY/language contains messages for mikado software
LOCAL_DIRECTORY/lists contains vocabularies (lists from BODC, EDMO from MARIS, EDMERP from MARIS)
- update vocabularies files in LOCAL_DIRECTORY/lists directory (lists from BODC, EDMO from MARIS, EDMERP from MARIS)
- load EDMO and EDMERP lists in memory
- BODC lists are managed with SdnVocabulary library (see documentation)
- dump all code/label lists used in CSR L21,C38,C32,C17,L06,C19,P02,L05,L08,C77,L18,EDMO,EDMERP
they may be used to populate human-machine interface
- use setters to build a CSR xml from scratch in memory (MetadataCsrIso19139 class)
- dump XML from memory (Xml build by MetadataCsrIso19139 class)
- validate the CSR in memory with xsd
View WriteCsrSample.java
View WriteCsrSample output