diff --git a/bin/ammacatch-process.sh b/bin/ammacatch-process.sh index 855e9f06d4c60df749101ab1a802e521e4943385..f8d0c224b098860ed449501c2536529943b74411 100755 --- a/bin/ammacatch-process.sh +++ b/bin/ammacatch-process.sh @@ -2,7 +2,7 @@ PROJECT=AMMA-CATCH -DO_GET=1 +DO_GET=0 CONF=../conf/$PROJECT INPUT=$CONF/inputs/ diff --git a/bin/env.sh b/bin/env.sh index 31d17ff317d4b202bdb805f414541414820ce2d9..cbda15128039c2f936827453cb038164c45b9b3d 100755 --- a/bin/env.sh +++ b/bin/env.sh @@ -17,5 +17,5 @@ export JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8" export APP_CMD="java $JAVA_OPTS -jar doimgr-trunk.jar --v=3" -echo "JAVA_OPTS: $JAVA_OPTS" +#echo "JAVA_OPTS: $JAVA_OPTS" diff --git a/bin/ohmcv-process.sh b/bin/ohmcv-process.sh index 9feed23a93d7162e62d49ab6dc8eaf86efe81fb0..28054a78d6305e053dd5da8a5115b8ee4e46c7f7 100755 --- a/bin/ohmcv-process.sh +++ b/bin/ohmcv-process.sh @@ -18,19 +18,38 @@ mkdir -p $TMP # 0. GetRecords from sedoo: if [ $DO_GET -eq 1 ] then - for url in $(cat $INPUT/urls.txt) + + # Prepare data access url mapping: + echo "# DOI_suffix;data_access_url" > $CONF/doi_url_data_access.csv + + for row in $(cat $INPUT/doi_id.txt) do + doi=${row%;*} + id=${row#*;} + + echo "doi: $doi" +# echo "id: $id" + + url="http://mistrals.sedoo.fr/xml/bdToIso.php?datsId=$id" + if [ ${url:0:4} = "http" ]; then - echo $url +# echo $url + +# wget -O $TMP/${doi}.xml $url +# cp $TMP/${doi}.xml $INPUT/mistrals/ + + # fix bad <xml> header (manual) - filename=$(basename $url) - id=${filename##*id=} + xsltproc -o $INPUT/${doi}.csv --stringparam DOI_SUFFIX_START "$PROJECT" --stringparam USE_END_DATE "true" $XSL/csw2txt_ohmcv.xsl $INPUT/mistrals/${doi}.xml - echo $id + # replace Hymex ID by DOI + EXPR="s/identifier:DOI;.*/identifier:DOI;10.5072\/${doi}/" - wget -O $TMP/$id.xml $url + sed -i "$EXPR" $INPUT/${doi}.csv - xsltproc -o $INPUT/$id.csv --stringparam DOI_SUFFIX_START "$PROJECT" --stringparam USE_END_DATE "true" $XSL/csw2txt_ohmcv.xsl $TMP/$id.xml + # add url data access: + url="http://www.ohmcv.fr/P000_download.php?fic=$id" + echo "${doi};$url" >> $CONF/doi_url_data_access.csv if [ $? -ne 0 ]; then echo "xsltproc failed" diff --git a/src/main/java/fr/osug/util/ChecksumOutputStream.java b/src/main/java/fr/osug/util/ChecksumOutputStream.java deleted file mode 100644 index 1ae946b661e2c23904d755f78ca0937b967e4b27..0000000000000000000000000000000000000000 --- a/src/main/java/fr/osug/util/ChecksumOutputStream.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * OSUG-DOI project ( http://doi.osug.fr ) - Copyright (C) CNRS. - ******************************************************************************/ -package fr.osug.util; - -import java.io.OutputStream; - -/** - * Compute the Seaman-Pence 32-bit 1's complement checksum over the byte stream EFFICIENTLY. - * @author bourgesl - */ -public final class ChecksumOutputStream extends OutputStream { - - /* members */ - private boolean _open; - /* partial sums */ - private long _hi; - private long _lo; - /* checksum */ - private long _checksum; - - ChecksumOutputStream() { - reset(); - } - - void reset() { - _open = true; - _hi = 0l; - _lo = 0l; - _checksum = 0l; - } - - long getChecksum() { - /* close if needed to compute checksum */ - close(); - return _checksum; - } - - @Override - public void write(final int b) { - throw new UnsupportedOperationException("Not supported: use write(byte b[], int off, int len)."); - } - - @Override - public void write(byte data[], int offset, int length) { - // check parameters: - if (offset != 0) { - throw new UnsupportedOperationException("Not supported: offset parameter must be 0."); - } - - /* - * Calculate the Seaman-Pence 32-bit 1's complement checksum over the byte stream. The option - * to start from an intermediate checksum accumulated over another previous - * byte stream is not implemented. - * The implementation accumulates in two 64-bit integer values the two low-order and the two - * high-order bytes of adjacent 4-byte groups. A carry-over of bits is never done within the main - * loop (only once at the end at reduction to a 32-bit positive integer) since an overflow - * of a 64-bit value (signed, with maximum at 2^63-1) by summation of 16-bit values could only - * occur after adding approximately 140G short values (=2^47) (280GBytes) or more. We assume - * for now that this routine here is never called to swallow FITS files of that size or larger. - * @param data the byte sequence - * @return the 32bit checksum in the range from 0 to 2^32-1 - * @see "http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/checksum.html" - * @author R J Mathar - * @since 2005-10-05 - */ - /* get current state */ - long hi = _hi; - long lo = _lo; - - final int len = length >> 1; // 2 * (length / 4) - // System.out.println(length + " bytes") ; - final int remain = length % 4; - /* a write(2) on Sparc/PA-RISC would write the MSB first, on Linux the LSB; by some kind - * of coincidence, we can stay with the byte order known from the original C version of - * the algorithm. - */ - for (int i = 0, j; i < len; i += 2) { - /* The four bytes in this block handled by a single 'i' are each signed (-128 to 127) - * in Java and need to be masked indivdually to avoid sign extension /propagation. - */ - j = i << 1; - hi += (data[j] << 8) & 0xff00L | data[j + 1] & 0xffL; - lo += (data[j + 2] << 8) & 0xff00L | data[j + 3] & 0xffL; - } - - /* The following three cases actually cannot happen since FITS records are multiples of 2880 bytes. - */ - if (remain >= 1) { - hi += (data[2 * len] << 8) & 0xff00L; - } - if (remain >= 2) { - hi += data[2 * len + 1] & 0xffL; - } - if (remain >= 3) { - lo += (data[2 * len + 2] << 8) & 0xff00L; - } - - /* update current state */ - _hi = hi; - _lo = lo; - } - - @Override - public void close() { - if (_open) { - _open = false; - /* get current state */ - long hi = _hi; - long lo = _lo; - - long hicarry = hi >>> 16; - long locarry = lo >>> 16; - while (hicarry != 0 || locarry != 0) { - hi = (hi & 0xffffL) + locarry; - lo = (lo & 0xffffL) + hicarry; - hicarry = hi >>> 16; - locarry = lo >>> 16; - } - _checksum = (hi << 16) + lo; - } - } -} diff --git a/src/main/resources/config/application-test.yml b/src/main/resources/config/application-test.yml new file mode 100644 index 0000000000000000000000000000000000000000..998c874bccddc0fbb6504c7acc4e01e4ad20bba5 --- /dev/null +++ b/src/main/resources/config/application-test.yml @@ -0,0 +1,31 @@ +# =================================================================== +# Spring Boot configuration for the "dev" profile. +# +# This configuration overrides the application.yml file. +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +debug: true + +spring: + datasource: +# go into osug-doi/tmp/ folder: + url: jdbc:h2:file:../tmp/h2db/doi;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + name: + username: doi + password: + h2: + console: + enabled: true + jpa: + database: H2 + database-platform: org.hibernate.dialect.PostgreSQL9Dialect + show_sql: true + hibernate: + ddl-auto: none +# ddl-auto: create