Skip to content
Snippets Groups Projects
Commit 7f07430d authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

mc

parent 7d0cfb38
No related branches found
No related tags found
No related merge requests found
......@@ -74,28 +74,22 @@
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.slf4j</groupId> -->
<!-- <artifactId>jcl-over-slf4j</artifactId> -->
<!-- <version>${slf4j.version}</version> -->
<!-- <scope>runtime</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.slf4j</groupId> -->
<!-- <artifactId>slf4j-log4j12</artifactId> -->
<!-- <version>${slf4j.version}</version> -->
<!-- <scope>runtime</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>log4j</groupId> -->
<!-- <artifactId>log4j</artifactId> -->
<!-- <version>1.2.14</version> -->
<!-- </dependency> -->
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.classicmayan.tools</groupId>
......
......@@ -37,7 +37,7 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType;
public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
private static Log logger = LogFactory.getLog(IdentifierListDelivererDC.class);
private static Log log = LogFactory.getLog(IdentifierListDelivererDC.class);
private static final int lifeTimeResToken = 100;
private static final String DH_ES_DIVIDER_CHAR = ".";
......@@ -167,12 +167,12 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
long size = listFurtherValues.getHits().totalHits;
setResultSize(size);
logger.info(" ## hits --> " + size);
log.info(" ## hits --> " + size);
for (SearchHit hit : listFurtherValues.getHits().getHits()) {
i++;
this.logger.info(" ## hit --> " + hit.getId());
log.info(" ## hit --> " + hit.getId());
// Handle TextGrid.
if (this.textgrid) {
......@@ -181,9 +181,9 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
try {
datestamp = OAIPMHUtilities.convertDateFormat(datestamp).toXMLFormat();
} catch (ParseException e) {
this.logger.error(e.getMessage());
log.error(e.getMessage());
} catch (DatatypeConfigurationException e) {
this.logger.error(e.getMessage());
log.error(e.getMessage());
}
String identifier = hit.getSourceAsMap().get(this.identifierField).toString();
lit = setListIdentifierHeader(datestamp, identifier, lit, set);
......@@ -192,7 +192,7 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
// Handle DARIAH.
else if (this.dariah) {
this.logger.info(" ## dateOfObjectCreation --> " + this.dateOfObjectCreation);
log.info(" ## dateOfObjectCreation --> " + this.dateOfObjectCreation);
JSONObject json = new JSONObject(hit.getSourceAsMap());
......@@ -231,17 +231,17 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
// Convert datestamp.
try {
this.logger.info(" ## datestamp --> " + this.datestamp);
log.info(" ## datestamp --> " + this.datestamp);
this.datestamp = OAIPMHUtilities.convertDateFormat(this.datestamp).toXMLFormat();
this.logger.info(" ## datestamp converted --> " + this.datestamp);
log.info(" ## datestamp converted --> " + this.datestamp);
} catch (ParseException e) {
this.logger.error(e.getMessage());
log.error(e.getMessage());
// FIXME Go to ERROR state!
} catch (DatatypeConfigurationException e) {
this.logger.error(e.getMessage());
log.error(e.getMessage());
// FIXME Go to ERROR state!
}
......@@ -278,7 +278,7 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
identifier = hit.getSourceAsMap().get(this.identifierField).toString();
}
this.logger.info(" ## identifier --> " + identifier);
log.info(" ## identifier --> " + identifier);
lit = setListIdentifierHeader(this.datestamp, identifier, lit, set);
}
......
......@@ -74,7 +74,7 @@ import info.textgrid.middleware.common.TextGridMimetypes;
*/
public class OAIPMHUtilities {
private static Log logger = LogFactory.getLog(OAIPMHUtilities.class);
private static Log log = LogFactory.getLog(OAIPMHUtilities.class);
// **
// FINALS
......@@ -327,7 +327,7 @@ public class OAIPMHUtilities {
final String resumptionToken, Map<String, Integer> cursorCollector, final String scrollID,
final int searchResponseSize, final int i) {
logger.debug("Creating a ResumptionToken:\n " +
log.debug("Creating a ResumptionToken:\n " +
"CompleteListSize: " + completeListSize + "\n" +
"ResumptionToken: " + resumptionToken + "\n" +
"CursorCollector: " + cursorCollector + "\n" +
......@@ -500,7 +500,7 @@ public class OAIPMHUtilities {
String fieldResulst = "";
logger.debug("Inside fieldLoader for field: " + field);
log.debug("Inside fieldLoader for field: " + field);
String[] fieldPathForESIndex = field.split("\\.");
JSONObject singlePath = resultFromGetRequestInES;
......
......@@ -3,6 +3,7 @@ package info.textgrid.middleware;
import java.io.IOException;
import java.text.ParseException;
import javax.xml.datatype.DatatypeConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.common.Strings;
......@@ -59,7 +60,7 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
private String[] titleList;
private String[] typeList;
private static org.apache.commons.logging.Log log = LogFactory.getLog(RecordDelivererDC.class);
private static Log log = LogFactory.getLog(RecordDelivererDC.class);
private OAI_ESClient oaiEsClient;
/**
......@@ -109,14 +110,14 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
dublinCoreBuilder = putContentIntoDCFieldLists(esResultObject);
JSONObject json = new JSONObject(esResultObject.getSourceAsMap());
identifier = OAIPMHUtilities.fieldLoader(json, this.identifierField);
//identifier = esResultObject.getSourceAsMap().get(this.identifierField).toString();
// identifier = esResultObject.getSourceAsMap().get(this.identifierField).toString();
String dateOfCreation = "NO_DATE_SET!";
if (OAIPMHUtilities.fieldLoader(json, this.dateOfObjectCreation) != null) {
try {
dateOfCreation = OAIPMHUtilities
.convertDateFormat(
OAIPMHUtilities.fieldLoader(json, this.dateOfObjectCreation).toString())
OAIPMHUtilities.fieldLoader(json, this.dateOfObjectCreation).toString())
.toXMLFormat();
} catch (ParseException e) {
// TODO Auto-generated catch block
......@@ -128,9 +129,9 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
record.setMetadata(dublinCoreBuilder.getDC());
}
String setSpec = OAIPMHUtilities.fieldLoader(json, this.identifierField);
//String setSpec =
//DublinCoreFieldLoader.fillList(esResultObject, DARIAHConstants.IDENTIFIER_LIST).get(0);
// String setSpec =
// DublinCoreFieldLoader.fillList(esResultObject, DARIAHConstants.IDENTIFIER_LIST).get(0);
setRecordHeader(dateOfCreation, identifier, record, dublinCoreBuilder, setSpec);
}
......@@ -270,7 +271,7 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
throws ParseException, DatatypeConfigurationException {
DublinCoreBuilder result = new DublinCoreBuilder();
// Set DublinCore lists with content from elastic search results due to configuration.
result.setContributor(
DublinCoreFieldLoader.fillList(responseWorkValues, this.contributorList));
......@@ -281,8 +282,9 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
DublinCoreFieldLoader.fillList(responseWorkValues, this.descriptionList));
result.setFormat(DublinCoreFieldLoader.fillList(responseWorkValues, this.formatList));
result.setIdentifier(
OAIPMHUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.identifierList));
OAIPMHUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()),
this.identifierList));
result.setLanguage(DublinCoreFieldLoader.fillList(responseWorkValues, this.languageList));
result.setPublisher(DublinCoreFieldLoader.fillList(responseWorkValues, this.publisherList));
result.setRelation(
......
......@@ -27,7 +27,7 @@ import info.textgrid.middleware.oaipmh.SetType;
*/
public class SetDeliverer {
private static Log logger = LogFactory.getLog(SetDeliverer.class);
private static Log log = LogFactory.getLog(SetDeliverer.class);
private static final int DH_SIZE = 100000;
......@@ -138,19 +138,18 @@ public class SetDeliverer {
request.source(searchSourceBuilder);
logger.info(" ## SetDeliverer() request --> " + request);
log.info(" ## SetDeliverer() request --> " + request);
// Get items with TG or DH request.
SearchResponse getRecordListItems = null;
try {
getRecordListItems = OAI_ESClient.getEsClient().search(request, RequestOptions.DEFAULT);
logger
.info(" ## SetDeliverer() list item count --> " + getRecordListItems.getHits().totalHits);
log.info(" ## SetDeliverer() list item count --> " + getRecordListItems.getHits().totalHits);
} catch (IOException e) {
// TODO Auto-generated catch block
logger.error(e.getMessage());
log.error(e.getMessage());
e.printStackTrace();
}
......@@ -192,7 +191,7 @@ public class SetDeliverer {
String name = entry.getKey();
logger.info(" ## entry key --> " + entry.getKey());
log.info(" ## entry key --> " + entry.getKey());
if (name.equals(DH_COLLECTION_FILTER_NAME)) {
Filter filterCollection =
......@@ -203,16 +202,16 @@ public class SetDeliverer {
// Divide ID and title.
String combined = b.getKeyAsString();
logger.info(" ## combined --> " + combined);
log.info(" ## combined --> " + combined);
int indexOf = combined.indexOf(DH_FIELD_DIVIDER);
String id = combined.substring(0, indexOf);
logger.info(" ## id --> " + id);
log.info(" ## id --> " + id);
String title = combined.substring(indexOf + 1);
logger.info(" ## title --> " + title);
log.info(" ## title --> " + title);
// Set set.
SetType newSet = new SetType();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment