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

- cleanup logging to be more consistent and more helpful in debugging

- use java.nio.file.Files.newInputStream instead of FileInputStream
- use java.nio.file.Files.newOutputStream instead of FileOutputStream
- minor simplifications
parent f8875d9e
Branches
Tags
No related merge requests found
...@@ -50,10 +50,10 @@ import java.text.ParseException; ...@@ -50,10 +50,10 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* SLUBStoragePlugin * SLUBStoragePlugin
...@@ -117,6 +117,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -117,6 +117,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
if (null != blocksizeStr) { if (null != blocksizeStr) {
try { try {
this.blocksize = Integer.parseInt(blocksizeStr); this.blocksize = Integer.parseInt(blocksizeStr);
log.info("Set blocksize to " + this.blocksize);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
log.error("Could not convert BLOCK_SIZE string to int, " + e.getMessage()); log.error("Could not convert BLOCK_SIZE string to int, " + e.getMessage());
} }
...@@ -172,14 +173,18 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -172,14 +173,18 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
private void copyStreamFast(InputStream is, OutputStream os) throws IOException{ private void copyStreamFast(InputStream is, OutputStream os) throws IOException{
if ((is instanceof FileInputStream) && (os instanceof FileOutputStream) ) { if ((is instanceof FileInputStream) && (os instanceof FileOutputStream) ) {
log.info("copyStreamFast, transferFrom() will be used");
/* use very fast java.nio.channels.FileChannel.transferFrom() function if both are Filestreams */ /* use very fast java.nio.channels.FileChannel.transferFrom() function if both are Filestreams */
FileInputStream fis = (FileInputStream) is; FileInputStream fis = (FileInputStream) is;
FileOutputStream fos = (FileOutputStream) os; FileOutputStream fos = (FileOutputStream) os;
FileChannel sourceChannel = fis.getChannel(); FileChannel sourceChannel = fis.getChannel();
FileChannel destChannel = fos.getChannel(); FileChannel destChannel = fos.getChannel();
destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); destChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
sourceChannel.close();
destChannel.close();
} else { } else {
/* otherwise use blockwise copy loop */ /* otherwise use blockwise copy loop */
log.info("copyStreamFast, blockwise copy will be used");
int blocksize = getBlockSize(); int blocksize = getBlockSize();
assert (blocksize > 0); assert (blocksize > 0);
byte[] buffer = new byte[blocksize]; byte[] buffer = new byte[blocksize];
...@@ -233,12 +238,12 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -233,12 +238,12 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
} }
return res; return res;
*/ */
boolean res = Boolean.TRUE; boolean res = true;
try { try {
for (Fixity f : fixities) { for (Fixity f : fixities) {
res &= checkSpecificFixity(absolutePath, f); res &= checkSpecificFixity(absolutePath, f);
} }
} catch (Exception e) { } catch (NoSuchAlgorithmException e) {
return false; return false;
} }
return res; return res;
...@@ -314,6 +319,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -314,6 +319,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
String oldValue = fixity.getValue(); String oldValue = fixity.getValue();
//log.debug("SLUBStoragePlugin.checkFixityByBuiltin() getAlgorithm (2)=" + algorithm); //log.debug("SLUBStoragePlugin.checkFixityByBuiltin() getAlgorithm (2)=" + algorithm);
//log.debug("SLUBStoragePlugin.checkFixityByBuiltin() oldvalue=" + oldValue); //log.debug("SLUBStoragePlugin.checkFixityByBuiltin() oldvalue=" + oldValue);
log.info("SLUBStoragePlugin.checkFixityByBuiltin(), begin checksum calc for pathname='" + absolute_storedEntityIdentifier.filestring() + "'" + " algorithm=" + algorithm);
long starttime = System.currentTimeMillis(); long starttime = System.currentTimeMillis();
String storedEntityIdentifier = relativePath(absolute_storedEntityIdentifier); String storedEntityIdentifier = relativePath(absolute_storedEntityIdentifier);
//log.debug("SLUBStoragePlugin.checkFixityByBuiltin() calculated storedEntityIdentifier=" + storedEntityIdentifier); //log.debug("SLUBStoragePlugin.checkFixityByBuiltin() calculated storedEntityIdentifier=" + storedEntityIdentifier);
...@@ -327,7 +333,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -327,7 +333,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
boolean result = fixity.getResult(); boolean result = fixity.getResult();
is.close(); is.close();
long endtime = System.currentTimeMillis(); long endtime = System.currentTimeMillis();
log.info("SLUBStoragePlugin.checkFixityByBuiltin() pathname='" + absolute_storedEntityIdentifier.filestring() + "'" log.info("SLUBStoragePlugin.checkFixityByBuiltin(), end checksum calc for pathname='" + absolute_storedEntityIdentifier.filestring() + "'"
+ " algorithm=" + algorithm + " algorithm=" + algorithm
+ " oldvalue=" + oldValue + " oldvalue=" + oldValue
+ " newvalue=" + newValue + " newvalue=" + newValue
...@@ -371,8 +377,9 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -371,8 +377,9 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
log.error("SLUBStoragePlugin.checkFixityByPlugin() fallback table has no plugin name entry for algorithm '" + algorithm + "'"); log.error("SLUBStoragePlugin.checkFixityByPlugin() fallback table has no plugin name entry for algorithm '" + algorithm + "'");
} }
} }
String oldValue = fixity.getValue(); String oldValue = fixity.getValue();
log.info("SLUBStoragePlugin.checkFixityByPlugin() oldvalue=" + oldValue); log.info("SLUBStoragePlugin.checkFixityByPlugin(), begin checksum calc for pathname='" + absolute_storedEntityIdentifier.filestring() + "'"+ " plugin=" + pluginname);
long starttime = System.currentTimeMillis(); long starttime = System.currentTimeMillis();
String newValue = "should not occur"; String newValue = "should not occur";
try { try {
...@@ -387,7 +394,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -387,7 +394,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
fixity.setResult((oldValue == null) || (oldValue.equals(newValue))); fixity.setResult((oldValue == null) || (oldValue.equals(newValue)));
boolean result = fixity.getResult(); boolean result = fixity.getResult();
long endtime = System.currentTimeMillis(); long endtime = System.currentTimeMillis();
log.info("SLUBStoragePlugin.checkFixityByPlugin() pathname='" + absolute_storedEntityIdentifier.filestring() + "'" log.info("SLUBStoragePlugin.checkFixityByPlugin(), end checksum calc for pathname='" + absolute_storedEntityIdentifier.filestring() + "'"
+ " plugin=" + pluginname + " plugin=" + pluginname
+ " oldvalue=" + oldValue + " oldvalue=" + oldValue
+ " newvalue=" + newValue + " newvalue=" + newValue
...@@ -461,7 +468,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -461,7 +468,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
contractAssertIsRelativePath(storedEntityIdentifier); contractAssertIsRelativePath(storedEntityIdentifier);
var absolute_filename = getFullFilePath(storedEntityIdentifier); var absolute_filename = getFullFilePath(storedEntityIdentifier);
var absolute_path = Paths.get(absolute_filename); var absolute_path = Paths.get(absolute_filename);
var is = new FileInputStream( absolute_path.toString() ); var is = java.nio.file.Files.newInputStream( absolute_path );
return new BufferedInputStream( is , getBlockSize()); return new BufferedInputStream( is , getBlockSize());
} }
...@@ -478,7 +485,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -478,7 +485,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
log.info("SLUBStoragePlugin.retrieveEntitybyRange() with storedEntityIdentifier='" + storedEntityIdentifier + "' start=" + start + " end=" + end); log.info("SLUBStoragePlugin.retrieveEntitybyRange() with storedEntityIdentifier='" + storedEntityIdentifier + "' start=" + start + " end=" + end);
/* try-with-ressource block, no close if failed needed */ /* try-with-ressource block, no close if failed needed */
var absolute_filename = getFullFilePath(storedEntityIdentifier); var absolute_filename = getFullFilePath(storedEntityIdentifier);
log.info("SLUBStoragePlugin.retrieveEntitybyRange() with absolute filename=" + absolute_filename); log.info("SLUBStoragePlugin.retrieveEntitybyRange() with absolute filename=" + absolute_filename + ", begin…");
try (RandomAccessFile file = new RandomAccessFile(absolute_filename, "r")) { try (RandomAccessFile file = new RandomAccessFile(absolute_filename, "r")) {
long starttime = System.currentTimeMillis(); long starttime = System.currentTimeMillis();
file.seek(start); file.seek(start);
...@@ -535,18 +542,18 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -535,18 +542,18 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
is.close(); is.close();
} }
copyStream(storedEntityMetadata, absoluteDestFilePath); copyStream(storedEntityMetadata, absoluteDestFilePath);
//log.debug("SLUBStoragePlugin.storeEntity() try copy (copyStream(storedEntityMetadata, '" + absolute_destFilePath + "')) was successfull"); //log.debug("SLUBStoragePlugin.storeEntity() try copy (copyStream(storedEntityMetadata, '" + absolute_destFilePath + "')) was successful");
} else { } else {
log.info("SLUBStoragePlugin.storeEntity() Cannot handle source path: " + storedEntityMetadata.getCurrentFilePath()); log.info("SLUBStoragePlugin.storeEntity() Cannot handle source path: " + storedEntityMetadata.getCurrentFilePath());
if (is == null) { if (is == null) {
log.warn("SLUBStoragePlugin.storeEntity() InputStream is null"); log.warn("SLUBStoragePlugin.storeEntity() InputStream is null");
return null; return null;
} }
FileOutputStream output = new FileOutputStream(absoluteDestFilePath.filestring()); OutputStream output = Files.newOutputStream(Path.of(absoluteDestFilePath.filestring()));
long starttime = System.currentTimeMillis(); long starttime = System.currentTimeMillis();
copyStreamFast(is, output); copyStreamFast(is, output);
long endtime = System.currentTimeMillis(); long endtime = System.currentTimeMillis();
log.info("SLUBStoragePlugin.storeEntity() try copy (copyStreamFast(is, '" + absoluteDestFilePath.filestring() + "') was successfull (" + throughput(starttime, endtime, absoluteDestFilePath) + ")"); log.info("SLUBStoragePlugin.storeEntity() copy (copyStreamFast(is, '" + absoluteDestFilePath.filestring() + "') was successful (" + throughput(starttime, endtime, absoluteDestFilePath) + ")");
} }
if (!checkFixityAbs(storedEntityMetadata.getFixities(), absoluteDestFilePath)) { if (!checkFixityAbs(storedEntityMetadata.getFixities(), absoluteDestFilePath)) {
log.warn("SLUBStoragePlugin.storeEntity() called checkFixity(fixities, '"+absoluteDestFilePath+"') failed"); log.warn("SLUBStoragePlugin.storeEntity() called checkFixity(fixities, '"+absoluteDestFilePath+"') failed");
...@@ -555,19 +562,15 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -555,19 +562,15 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
} else { } else {
log.info("SLUBStoragePlugin.storeEntity(), copyfile NOT needed for path=" + absoluteDestFilePath.filestring()); log.info("SLUBStoragePlugin.storeEntity(), copyfile NOT needed for path=" + absoluteDestFilePath.filestring());
} }
String storedEntityIdentifier = relativeFromStoreEntityMetadata(storedEntityMetadata); return relativeFromStoreEntityMetadata(storedEntityMetadata);
//log.debug("SLUBStoragePlugin.storeEntity() storedEntityIdentifier (2)='" + storedEntityIdentifier + "'");
return storedEntityIdentifier;
} }
private AbsolutePath generateAbsoluteDestPath(StoredEntityMetaData storedEntityMetadata) throws IOException { private AbsolutePath generateAbsoluteDestPath(StoredEntityMetaData storedEntityMetadata) throws IOException {
AbsolutePath absoluteDestFilePath;
String relativeDirectoryPath = getStreamRelativePath(storedEntityMetadata); String relativeDirectoryPath = getStreamRelativePath(storedEntityMetadata);
String fileName = createFileName(storedEntityMetadata); String fileName = createFileName(storedEntityMetadata);
File destFile = getStreamDirectory(relativeDirectoryPath, fileName); File destFile = getStreamDirectory(relativeDirectoryPath, fileName);
log.info("generateAbsoluteDestPath, relativeDir=" + relativeDirectoryPath + " filename=" + fileName + " absolute=" + destFile.getAbsolutePath()); log.info("generateAbsoluteDestPath, relativeDir=" + relativeDirectoryPath + " filename=" + fileName + " absolute=" + destFile.getAbsolutePath());
absoluteDestFilePath = new AbsolutePath(destFile.getAbsolutePath()); return new AbsolutePath(destFile.getAbsolutePath());
return absoluteDestFilePath;
} }
/** /**
...@@ -578,23 +581,25 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -578,23 +581,25 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
*/ */
private void copyFile(String source, AbsolutePath destination) throws IOException { private void copyFile(String source, AbsolutePath destination) throws IOException {
long starttime = System.currentTimeMillis(); long starttime = System.currentTimeMillis();
FileOutputStream output = new FileOutputStream(destination.filestring()); log.info("SLUBStoragePlugin.copyFile (" + source + ", " + destination.filestring() + "), begin copying…");
OutputStream output = java.nio.file.Files.newOutputStream(Path.of(destination.filestring()));
InputStream input; InputStream input;
if (source.toLowerCase().trim().startsWith("http")) { if (source.toLowerCase().trim().startsWith("http")) {
log.info("SLUBStoragePlugin.copyFile (\" + source + \", \" + destination.filestring() + \"), using getUrlContent()\");");
input = FileTransferUtil.getUrlContent(source); input = FileTransferUtil.getUrlContent(source);
} else { /* simpleFilecopy, see https://www.digitalocean.com/community/tutorials/java-copy-file */ } else { /* simpleFilecopy, see https://www.digitalocean.com/community/tutorials/java-copy-file */
input = new FileInputStream(source); log.info("SLUBStoragePlugin.copyFile (\" + source + \", \" + destination.filestring() + \"), using FileInputStream()\");");
input = java.nio.file.Files.newInputStream(Path.of(source));
} }
copyStreamFast(input, output); copyStreamFast(input, output);
input.close(); input.close();
output.close(); output.close();
long endtime = System.currentTimeMillis(); long endtime = System.currentTimeMillis();
log.info("SLUBStoragePlugin.copyFile (" + source + ", " + destination.filestring() + ") was successfull (" + throughput(starttime, endtime, destination) + ")"); log.info("SLUBStoragePlugin.copyFile (" + source + ", " + destination.filestring() + "), …finished copying was successful (" + throughput(starttime, endtime, destination) + ")");
} }
protected void copyStream(StoredEntityMetaData storedEntityMetadata, AbsolutePath absoluteDestPath) protected void copyStream(StoredEntityMetaData storedEntityMetadata, AbsolutePath absoluteDestPath)
throws IOException throws IOException
{ {
log.info("SLUBStoragePlugin.copyStream()");
String filesHandlingMethod = getFilesHandlingMethod(); String filesHandlingMethod = getFilesHandlingMethod();
String srcPath = storedEntityMetadata.getCurrentFilePath(); String srcPath = storedEntityMetadata.getCurrentFilePath();
//log.debug("SLUBStoragePlugin.copyStream() destPath='" + destPath + "'"); //log.debug("SLUBStoragePlugin.copyStream() destPath='" + destPath + "'");
...@@ -605,31 +610,29 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -605,31 +610,29 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
//String iePid = storedEntityMetadata.getIePid(); //String iePid = storedEntityMetadata.getIePid();
//log.debug("SLUBStoragePlugin.copyStream() iePid='" + iePid + "'"); //log.debug("SLUBStoragePlugin.copyStream() iePid='" + iePid + "'");
String attr = "('"+srcPath+"','" + absoluteDestPath.filestring() + "')"; String attr = "('"+srcPath+"','" + absoluteDestPath.filestring() + "')";
log.info("SLUBStoragePlugin.copyStream(), begin… " + attr);
if ("copy".equalsIgnoreCase(filesHandlingMethod)) { if ("copy".equalsIgnoreCase(filesHandlingMethod)) {
// FileUtil.copyFile(srcPath, destPath); // FileUtil.copyFile(srcPath, destPath);
copyFile(srcPath, absoluteDestPath); copyFile(srcPath, absoluteDestPath);
saveAbsoluteDestPathsTmpFile(storedEntityMetadata, absoluteDestPath); saveAbsoluteDestPathsTmpFile(storedEntityMetadata, absoluteDestPath);
log.info("SLUBStoragePlugin.copyStream(), copy"+attr + " was successful");
} else if ("move".equalsIgnoreCase(filesHandlingMethod)) { } else if ("move".equalsIgnoreCase(filesHandlingMethod)) {
File canonicalSrcFile = getCanonicalFile(srcPath); File canonicalSrcFile = getCanonicalFile(srcPath);
assert canonicalSrcFile != null; assert canonicalSrcFile != null;
FileUtil.moveFile(canonicalSrcFile, new File(absoluteDestPath.filestring())); FileUtil.moveFile(canonicalSrcFile, new File(absoluteDestPath.filestring()));
saveAbsoluteDestPathsTmpFile(storedEntityMetadata, absoluteDestPath); saveAbsoluteDestPathsTmpFile(storedEntityMetadata, absoluteDestPath);
log.info("SLUBStoragePlugin.copyStream(), move"+attr+" was successful");
} }
else if ("soft_link".equalsIgnoreCase(filesHandlingMethod)) { else if ("soft_link".equalsIgnoreCase(filesHandlingMethod)) {
softLink(srcPath, absoluteDestPath.filestring()); softLink(srcPath, absoluteDestPath.filestring());
log.info("SLUBStoragePlugin.copyStream(), softlink"+attr+" was successful");
} }
else if ("hard_link".equalsIgnoreCase(filesHandlingMethod)) { else if ("hard_link".equalsIgnoreCase(filesHandlingMethod)) {
hardLink(srcPath, absoluteDestPath.filestring()); hardLink(srcPath, absoluteDestPath.filestring());
log.info("SLUBStoragePlugin.copyStream(), hardlink"+attr+" was successful");
} }
else { else {
String msg = "SLUBStoragePlugin.copyStream(), unknown filehandling method detected: " + filesHandlingMethod; String msg = "SLUBStoragePlugin.copyStream(), unknown filehandling method detected: " + filesHandlingMethod;
log.fatal(msg); log.fatal(msg);
throw new IOException(msg); throw new IOException(msg);
} }
log.info("SLUBStoragePlugin.copyStream(), …finished via " + filesHandlingMethod + attr+" was successful");
} }
/** copied from NFS Storage Plugin, enhanced with debugging info, {@inheritDoc} */ /** copied from NFS Storage Plugin, enhanced with debugging info, {@inheritDoc} */
...@@ -660,9 +663,6 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -660,9 +663,6 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
return -1; return -1;
} }
/** copied from NFS Storage Plugin, enhanced with debugging info, {@inheritDoc} */ /** copied from NFS Storage Plugin, enhanced with debugging info, {@inheritDoc} */
private File getCanonicalFile(String srcPath) private File getCanonicalFile(String srcPath)
{ {
...@@ -691,7 +691,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -691,7 +691,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
private Map<String, String> getStoreEntityIdentifier(StoredEntityMetaData storedEntityMetadata, AbsolutePath absoluteDestFilePath) throws IOException { private Map<String, String> getStoreEntityIdentifier(StoredEntityMetaData storedEntityMetadata, AbsolutePath absoluteDestFilePath) throws IOException {
log.info("SLUBStoragePlugin.getStoreEntityIdentifier() destFilePath='" + absoluteDestFilePath.filestring() +"'"); log.info("SLUBStoragePlugin.getStoreEntityIdentifier() destFilePath='" + absoluteDestFilePath.filestring() +"'");
//log.debug("destFilePath (2)='" + destFilePath + "'"); //log.debug("destFilePath (2)='" + destFilePath + "'");
Map<String, String> paths = new HashMap<>(); Map<String, String> paths = new ConcurrentHashMap<>();
paths.put("destFilePath", absoluteDestFilePath.filestring()); paths.put("destFilePath", absoluteDestFilePath.filestring());
String relativePath = relativeFromStoreEntityMetadata(storedEntityMetadata); String relativePath = relativeFromStoreEntityMetadata(storedEntityMetadata);
contractAssertIsRelativePath(relativePath); contractAssertIsRelativePath(relativePath);
...@@ -711,7 +711,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -711,7 +711,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
File newDir = new File(getDirRoot() + File.separator + path); File newDir = new File(getDirRoot() + File.separator + path);
//log.debug("SLUBStoragePlugin.getStreamDirectory newDir.getAbsolutePath()=" + newDir.getAbsolutePath()); //log.debug("SLUBStoragePlugin.getStreamDirectory newDir.getAbsolutePath()=" + newDir.getAbsolutePath());
boolean arecreated = newDir.mkdirs(); boolean arecreated = newDir.mkdirs();
//log.debug("SLUBStoragePlugin.getStreamDirectory newDir.mkdirs(), directories are created:" + arecreated); log.debug("SLUBStoragePlugin.getStreamDirectory newDir.mkdirs(), directories are created:" + arecreated);
return new File(newDir.getAbsolutePath() + File.separator + fileName); return new File(newDir.getAbsolutePath() + File.separator + fileName);
} }
/** prepare right path /** prepare right path
...@@ -809,7 +809,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -809,7 +809,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
private void saveAbsoluteDestPathsTmpFile(StoredEntityMetaData storedEntityMetadata, AbsolutePath absolutePath) { private void saveAbsoluteDestPathsTmpFile(StoredEntityMetaData storedEntityMetadata, AbsolutePath absolutePath) {
log.info("SLUBStoragePlugin.saveAbsoluteDestPathsTmpFile()"); log.info("SLUBStoragePlugin.saveAbsoluteDestPathsTmpFile()");
String tmpFilePath = getTempStorageDirectory(false) + "destPath"; String tmpFilePath = getTempStorageDirectory(false) + "destPath";
log.info("SLUBStoragePlugin.saveAbsoluteDestPathsTmpFile tmpFilePath='" + tmpFilePath + "'"); log.info("SLUBStoragePlugin.saveAbsoluteDestPathsTmpFile tmpFilePath='" + tmpFilePath + "', begin…");
File destPathDir = new File(getTempStorageDirectory(false) + "destPath" + File.separator); File destPathDir = new File(getTempStorageDirectory(false) + "destPath" + File.separator);
//log.debug("SLUBStoragePlugin.saveDestPathsTmpFile destPathDir='" + destPathDir + "'"); //log.debug("SLUBStoragePlugin.saveDestPathsTmpFile destPathDir='" + destPathDir + "'");
if (!destPathDir.exists()) { if (!destPathDir.exists()) {
...@@ -819,6 +819,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -819,6 +819,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
} }
} }
StorageUtil.saveDestPathToTmpFile(storedEntityMetadata.getIePid(), tmpFilePath, storedEntityMetadata.getEntityPid(), absolutePath.filestring()); StorageUtil.saveDestPathToTmpFile(storedEntityMetadata.getIePid(), tmpFilePath, storedEntityMetadata.getEntityPid(), absolutePath.filestring());
log.info("SLUBStoragePlugin.saveAbsoluteDestPathsTmpFile tmpFilePath='" + tmpFilePath + "', …finished");
} }
/** /**
...@@ -828,11 +829,12 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -828,11 +829,12 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
*/ */
private AbsolutePath loadAbsoluteDestPathsTmpFile(StoredEntityMetaData storedEntityMetadata) throws IOException { private AbsolutePath loadAbsoluteDestPathsTmpFile(StoredEntityMetaData storedEntityMetadata) throws IOException {
String tmpFilePath = getTempStorageDirectory(false) + "destPath"; String tmpFilePath = getTempStorageDirectory(false) + "destPath";
log.info("SLUBStoragePlugin.loadAbsoluteDestPathsTmpFile tmpFilePath='" + tmpFilePath + "'"); log.info("SLUBStoragePlugin.loadAbsoluteDestPathsTmpFile tmpFilePath='" + tmpFilePath + "', begin…");
String absolutePath = StorageUtil.readDestPathFromTmpFile(storedEntityMetadata.getIePid(), tmpFilePath, storedEntityMetadata.getEntityPid()); String absolutePath = StorageUtil.readDestPathFromTmpFile(storedEntityMetadata.getIePid(), tmpFilePath, storedEntityMetadata.getEntityPid());
if (null == absolutePath) { if (null == absolutePath) {
throw new IOException("no destpath read from tmpfilePath '"+tmpFilePath+"' and IEPID="+storedEntityMetadata.getIePid() + " and PID="+storedEntityMetadata.getEntityPid() + ", got null"); throw new IOException("no destpath read from tmpfilePath '"+tmpFilePath+"' and IEPID="+storedEntityMetadata.getIePid() + " and PID="+storedEntityMetadata.getEntityPid() + ", got null");
} }
log.info("SLUBStoragePlugin.loadAbsoluteDestPathsTmpFile tmpFilePath='" + tmpFilePath + "', …finished");
return new AbsolutePath(absolutePath); return new AbsolutePath(absolutePath);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment