Skip to content
Snippets Groups Projects
Commit bddbab2b authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- fixed maven stuff

- fixed Makefile targets
- added debugging stuff
parent 5bf99ddb
No related branches found
No related tags found
No related merge requests found
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: root
Build-Jdk: 1.6.0_30
Hudson-Build-Number: 367
Hudson-Project: Rosetta-3.2.1_Nightly
Hudson-Version: 1.500
Jenkins-Build-Number: 367
Jenkins-Project: Rosetta-3.2.1_Nightly
Jenkins-Version: 1.500
#Generated by Maven
#Tue Oct 22 15:44:06 IST 2013
version=3.2.1
groupId=com.exlibris.dps
artifactId=dps-plugins
This diff is collapsed.
groupId=org.slub.rosetta.dps.repository.plugin.storage.nfs
artifactId=SLUBStoragePlugin
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.slub.rosetta.dps.repository.plugin.storage.nfs</groupId>
<artifactId>SLUBStoragePlugin</artifactId>
<name>SLUB Storage Plugin</name>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>com.exlibris.dps</groupId>
<artifactId>dps-plugins</artifactId>
<version>${dps.version}</version>
</dependency>
</dependencies>
</project>
......@@ -7,7 +7,7 @@
JAVAPATH=$(wildcard /usr/lib/jvm/java-1.6.0-openjdk-*/bin/)
# Verwendete Rosetta-Version
ROSETTAVERSION=3.2.0
ROSETTAVERSION=3.2.1
# Pfad zum Rosetta-SDK
ROSETTASDK=/exlibris/dps/d4_1/system.dir/dps-sdk-${ROSETTAVERSION}/lib/
......@@ -23,8 +23,9 @@ CLASSPATH=./java:${ROSETTASDKDEPOSIT}/../src/:${ROSETTASDKDEPOSIT}/xmlbeans-2.3.
# sources
SOURCES=java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java\
java/org/slub/rosetta/dps/repository/plugin/storage/nfs/testSLUBStoragePlugin.java
#SOURCES=java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java\
# java/org/slub/rosetta/dps/repository/plugin/storage/nfs/testSLUBStoragePlugin.java
SOURCES=java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java
OBJS=$(SOURCES:.java=.class)
......@@ -45,41 +46,21 @@ test: $(OBJS)
clean: jarclean
@rm -Rf doc/
find ./ -name "*.class" -exec rm -f \{\} \;
find ./java/org/ -name "*.class" -exec rm -f \{\} \;
@rm -Rf SLUBStoragePlugin.jar
distclean: clean
find ./ -name "*~" -exec rm -f \{\} \;
@rm -Rf null
.PRECIOUS: %.sh %.jar
%.jar: %.class
# setze temporären Link zu kompilierten Files des Rosetta-SDK, Deposit-Module
@${JAVAPATH}/jar xf ${ROSETTASDKDEPOSIT}/xmlbeans-2.3.0.jar
@${JAVAPATH}/jar xf ${ROSETTASDKDEPOSIT}/dps-sdk-${ROSETTAVERSION}.jar
@${JAVAPATH}/jar xf ${ROSETTASDKDEPOSIT}/log4j-1.2.14.jar
@cp -a ${ROSETTASDKDEPOSIT}/../src/com .
@echo "Main-Class: $(basename $@)" > manifest.txt
# Komprimiere alle class-Files zusammen
@${JAVAPATH}/jar cfm $@ manifest.txt \
com/ *.class \
org/ gov/ srw/ uk/ nbnDe11112004033116 PLUGIN_INF repackage \
schemaorg_apache_xmlbeans META-INF \
dnx_profile.xls ExLibMessageFile.properties LICENSE.txt
# Lösche temporären Link
@rm -Rf \
com/ \
org/ gov/ srw/ uk/ nbnDe11112004033116 PLUGIN_INF repackage \
schemaorg_apache_xmlbeans META-INF NOTICE.txt \
dnx_profile.xls ExLibMessageFile.properties LICENSE.txt manifest.txt
SLUBStoragePlugin.jar: $(OBJS)
@mkdir build;
@cp -r PLUGIN-INF/ build/
@cp -r META-INF/ build/
@cd java; find ./ -name "*.class" -print -exec cp --parents -r \{\} $(PWD)/build \; ; cd ..
@cd build; ${JAVAPATH}/jar cfv ../$@ ./* ; cd ..
@cp /exlibris/dps/d4_1/system.dir/bundled_plugins/NFSStoragePlugin.jar build/
#cd build; ${JAVAPATH}/jar xfz /exlibris/dps/d4_1/system.dir/bundled_plugins/NFSStoragePlugin.jar
@cd build; ${JAVAPATH}/jar cfvM ../$@ ./* ; cd ..
%.class: %.java
${JAVAPATH}/javac -classpath ${CLASSPATH}:${JUNITCLASSPATH} -Xlint:deprecation $<
......
//package com.exlibris.dps.repository.plugin.storage.nfs;
package org.slub.rosetta.dps.repository.plugin.storage.nfs;
import java.io.File;
......@@ -8,12 +7,12 @@ import java.util.Calendar;
import java.text.SimpleDateFormat;
import com.exlibris.core.infra.common.exceptions.logging.ExLogger;
import com.exlibris.digitool.common.dnx.DnxDocument;
import com.exlibris.dps.repository.plugin.storage.nfs.NFSStoragePlugin;
import com.exlibris.core.infra.common.util.IOUtil;
import com.exlibris.core.sdk.storage.containers.StoredEntityMetaData;
import com.exlibris.digitool.common.dnx.DnxDocument;
import com.exlibris.digitool.common.storage.Fixity;
import com.exlibris.digitool.infrastructure.utils.Checksummer;
import com.exlibris.dps.repository.plugin.storage.nfs.NFSStoragePlugin;
/**
* SLUBStoragePlugin
......@@ -26,13 +25,18 @@ public class SLUBStoragePlugin extends NFSStoragePlugin {
private static final ExLogger log = ExLogger.getExLogger(SLUBStoragePlugin.class);
public SLUBStoragePlugin() {
super();
log.info("SLUBStoragePlugin instantiated");
}
@Override
public String storeEntity(InputStream is, StoredEntityMetaData storedEntityMetadata) throws Exception {
log.info("SLUBStoragePlugin.storeEntity() called");
String fileName = createFileName(storedEntityMetadata);
log.info("SLUBStoragePlugin.storeEntity() fileName="+fileName);
String relativeDirectoryPath = getStreamRelativePath(storedEntityMetadata);
log.info("SLUBStoragePlugin.storeEntity() relativeDirectoryPath="+relativeDirectoryPath);
File destFile = getStreamDirectory(relativeDirectoryPath, fileName);
log.info("SLUBStoragePlugin.storeEntity() destfile.getAbsolutePath()="+destFile.getAbsolutePath());
// better move/link
if (canHandleSourcePath(storedEntityMetadata.getCurrentFilePath())) {
is.close(); // close input stream so that 'move' can work, we don't use it anyway
......@@ -43,6 +47,7 @@ public class SLUBStoragePlugin extends NFSStoragePlugin {
IOUtil.copy(is, new FileOutputStream(destFile));
}
String storedEntityIdentifier = relativeDirectoryPath + File.separator + fileName;
log.info("SLUBStoragePlugin.storeEntity() storedEntityIdentifier="+storedEntityIdentifier);
if(!checkFixity(storedEntityMetadata.getFixities(), storedEntityIdentifier)) {
deleteEntity(storedEntityIdentifier); // delete corrupt files
return null;
......@@ -57,13 +62,13 @@ public class SLUBStoragePlugin extends NFSStoragePlugin {
// get IE PID by calling IE-DNX record and search for ""internalIdentifierType" == "PID"
DnxDocument iedoc = storedEntityMetaData.getIeDnx();
String iepid = iedoc.getSectionKeyValue("internalIdentifierType", "PID");
log.error("SLUBStoragePlugin iepid=" + iepid);
log.info("SLUBStoragePlugin.getStreamRelativePath iepid=" + iepid);
String datestring = iedoc.getSectionKeyValue("objectCharacteristics", "creationDate");
Calendar date = Calendar.getInstance();
// date: 2014-01-15 14:28:01
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
date.setTime(sdf.parse(datestring));
log.error("SLUBStoragePlugin creation Date read=" + datestring + " parsed=" + date.toString());
log.info("SLUBStoragePlugin.getStreamRelativePath creation Date read=" + datestring + " parsed=" + date.toString());
relativeDirectoryPath = relativeDirectoryPath + new SimpleDateFormat("yyyy").format(date);
relativeDirectoryPath = relativeDirectoryPath + File.separator;
relativeDirectoryPath = relativeDirectoryPath + new SimpleDateFormat("MM").format(date);
......@@ -72,12 +77,15 @@ public class SLUBStoragePlugin extends NFSStoragePlugin {
relativeDirectoryPath = relativeDirectoryPath + File.separator;
relativeDirectoryPath = relativeDirectoryPath + iepid;
relativeDirectoryPath = relativeDirectoryPath + File.separator;
log.error("SLUBStoragePlugin relativeDirectoryPath=" + relativeDirectoryPath);
log.info("SLUBStoragePlugin.getStreamRelativePath relativeDirectoryPath=" + relativeDirectoryPath);
return relativeDirectoryPath;
}
protected File getStreamDirectory(String path, String fileName) {
File newDir = new File(parameters.get(DIR_ROOT) + File.separator + path);
log.info("SLUBStoragePlugin.getStreamDirectory path=" + path);
log.info("SLUBStoragePlugin.getStreamDirectory fileName=" + fileName);
log.info("SLUBStoragePlugin.getStreamDirectory newDir.getAbsolutePath()=" + newDir.getAbsolutePath());
newDir.mkdirs();
return new File(newDir.getAbsolutePath() + File.separator + fileName);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment