From b1cf60f5c043a6fc42b70112ef6316436d6a714f Mon Sep 17 00:00:00 2001 From: Carlos McGregor Date: Thu, 29 Nov 2018 12:47:46 -0500 Subject: [PATCH] Fixed #5340 Change datafile storage identifier to work with joss Change dataset storage identifier to reflect datafile storage identifier changes --- .../iq/dataverse/dataaccess/SwiftAccessIO.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java index 6bc5d654dba..0e23a0a3505 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java @@ -518,13 +518,17 @@ private StoredObject initializeSwiftFileObject(boolean writeAccess, String auxIt Properties p = getSwiftProperties(); swiftEndPoint = p.getProperty("swift.default.endpoint"); + // Swift uses this to create pseudo-hierarchical folders + String swiftPseudoFolderPathSeparator = "/"; + //swiftFolderPath = dataFile.getOwner().getDisplayName(); String swiftFolderPathSeparator = "-"; String authorityNoSlashes = owner.getAuthority().replace("/", swiftFolderPathSeparator); swiftFolderPath = owner.getProtocolForFileStorage() + swiftFolderPathSeparator - + authorityNoSlashes.replace(".", swiftFolderPathSeparator) - + swiftFolderPathSeparator + owner.getIdentifierForFileStorage(); - swiftFileName = storageIdentifier; + + authorityNoSlashes.replace(".", swiftFolderPathSeparator); + + swiftFileName = owner.getIdentifierForFileStorage() + swiftPseudoFolderPathSeparator + + storageIdentifier; //setSwiftContainerName(swiftFolderPath); //swiftFileName = dataFile.getDisplayName(); //Storage Identifier is now updated after the object is uploaded on Swift. @@ -569,10 +573,14 @@ private StoredObject initializeSwiftFileObject(boolean writeAccess, String auxIt Properties p = getSwiftProperties(); swiftEndPoint = p.getProperty("swift.default.endpoint"); String swiftFolderPathSeparator = "-"; + + // Swift uses this to create pseudo-hierarchical folders + String swiftPseudoFolderPathSeparator = "/"; + String authorityNoSlashes = dataset.getAuthorityForFileStorage().replace("/", swiftFolderPathSeparator); swiftFolderPath = dataset.getProtocolForFileStorage() + swiftFolderPathSeparator + authorityNoSlashes.replace(".", swiftFolderPathSeparator) + - swiftFolderPathSeparator + dataset.getIdentifierForFileStorage(); + swiftPseudoFolderPathSeparator + dataset.getIdentifierForFileStorage(); swiftFileName = auxItemTag; dvObject.setStorageIdentifier("swift://" + swiftEndPoint + ":" + swiftFolderPath);