From 342f9c8713bb7785d9210a095ee809a5e6166a55 Mon Sep 17 00:00:00 2001 From: Enrico Vianello Date: Thu, 13 Jul 2023 18:43:41 +0200 Subject: [PATCH 1/2] Allow DAVS protocol for TURLs in StoRM Backend Fix for https://issues.infn.it/jira/browse/STOR-1569 --- etc/namespace-1.5.1.xsd | 346 ++++++++++++++++++ etc/namespace.xml | 2 +- .../storm/common/types/TransferProtocol.java | 26 ++ .../it/grid/storm/config/Configuration.java | 2 +- .../it/grid/storm/namespace/StoRIImpl.java | 9 +- .../grid/storm/namespace/model/Protocol.java | 9 +- 6 files changed, 386 insertions(+), 8 deletions(-) create mode 100644 etc/namespace-1.5.1.xsd diff --git a/etc/namespace-1.5.1.xsd b/etc/namespace-1.5.1.xsd new file mode 100644 index 000000000..214fa635d --- /dev/null +++ b/etc/namespace-1.5.1.xsd @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/etc/namespace.xml b/etc/namespace.xml index 42a2df8ed..8c0ae320f 100644 --- a/etc/namespace.xml +++ b/etc/namespace.xml @@ -1,4 +1,4 @@ - + TEST1 diff --git a/src/main/java/it/grid/storm/common/types/TransferProtocol.java b/src/main/java/it/grid/storm/common/types/TransferProtocol.java index 285380ee8..74d209f3a 100644 --- a/src/main/java/it/grid/storm/common/types/TransferProtocol.java +++ b/src/main/java/it/grid/storm/common/types/TransferProtocol.java @@ -103,6 +103,28 @@ public int hashCode() { } }; + /** + * Static attribute that indicates DAV TransferProtocol. + */ + public static TransferProtocol DAV = new TransferProtocol("dav") { + + public int hashCode() { + + return 7; + } + }; + + /** + * Static attribute that indicates DAV TransferProtocol. + */ + public static TransferProtocol DAVS = new TransferProtocol("davs") { + + public int hashCode() { + + return 9; + } + }; + private TransferProtocol(String protocol) { this.protocol = protocol; @@ -139,6 +161,10 @@ public static TransferProtocol getTransferProtocol(String protocol) { return HTTP; if (protocol.toLowerCase().replaceAll(" ", "").equals(HTTPS.toString())) return HTTPS; + if (protocol.toLowerCase().replaceAll(" ", "").equals(DAV.toString())) + return DAV; + if (protocol.toLowerCase().replaceAll(" ", "").equals(DAVS.toString())) + return DAVS; return EMPTY; } } diff --git a/src/main/java/it/grid/storm/config/Configuration.java b/src/main/java/it/grid/storm/config/Configuration.java index c3d284e5d..5ad93edda 100644 --- a/src/main/java/it/grid/storm/config/Configuration.java +++ b/src/main/java/it/grid/storm/config/Configuration.java @@ -1297,7 +1297,7 @@ public String toString() { } public String getHTTPTURLPrefix() { - return cr.getConfiguration().getString(HTTP_TURL_PREFIX, "/fileTransfer"); + return cr.getConfiguration().getString(HTTP_TURL_PREFIX, ""); } public long getInProgressPutRequestExpirationTime() { diff --git a/src/main/java/it/grid/storm/namespace/StoRIImpl.java b/src/main/java/it/grid/storm/namespace/StoRIImpl.java index 472b30fc1..3507c34e8 100644 --- a/src/main/java/it/grid/storm/namespace/StoRIImpl.java +++ b/src/main/java/it/grid/storm/namespace/StoRIImpl.java @@ -485,8 +485,11 @@ public TTURL getTURL(TURLPrefix desiredProtocols) authority = transProt.getAuthority(); } - if (choosen.equals(Protocol.HTTP) || choosen.equals(Protocol.HTTPS)){ - resultTURL = buildHTTPTURL(choosen,authority); + if (choosen.equals(Protocol.HTTP) + || choosen.equals(Protocol.HTTPS) + || choosen.equals(Protocol.DAV) + || choosen.equals(Protocol.DAVS)) { + resultTURL = buildHTTPTURL(choosen,authority); } else { resultTURL = buildTURL(choosen, authority); } @@ -583,7 +586,7 @@ private TTURL buildHTTPTURL(Protocol p, Authority authority){ sb.append(getStFN().toString()); - log.debug("built http turl: {}", sb.toString()); + log.debug("built {} turl: {}", p.getSchema(), sb.toString()); return TTURL.makeFromString(sb.toString()); diff --git a/src/main/java/it/grid/storm/namespace/model/Protocol.java b/src/main/java/it/grid/storm/namespace/model/Protocol.java index 37075610f..f47c90ba3 100644 --- a/src/main/java/it/grid/storm/namespace/model/Protocol.java +++ b/src/main/java/it/grid/storm/namespace/model/Protocol.java @@ -39,12 +39,15 @@ public class Protocol { public final static Protocol RFIO = new Protocol(3, "RFIO", "rfio", 5001); public final static Protocol SRM = new Protocol(4, "SRM", "srm", 8444); public final static Protocol ROOT = new Protocol(5, "ROOT", "root", 1094); - // TODO HTTPS TURL - public final static Protocol HTTP = new Protocol(6, "HTTP", "http", 8080); - public final static Protocol HTTPS = new Protocol(7, "HTTPS", "https", 443); + + public final static Protocol HTTP = new Protocol(6, "HTTP", "http", 8085); + public final static Protocol HTTPS = new Protocol(7, "HTTPS", "https", 8443); public final static Protocol XROOT = new Protocol(8, "XROOT", "xroot", 1094); + public final static Protocol DAV = new Protocol(9, "DAV", "dav", 8085); + public final static Protocol DAVS = new Protocol(10, "DAV", "davs", 8443); + public final static Protocol EMPTY = new Protocol(0, "EMPTY", "", -1); public final static Protocol UNKNOWN = new Protocol(-1, "UNKNOWN", "", -1); From 10915e9918edb5c13a7b62da25c40d8acec2ae3b Mon Sep 17 00:00:00 2001 From: Enrico Vianello Date: Thu, 13 Jul 2023 20:01:45 +0200 Subject: [PATCH 2/2] Fix assembly file --- src/main/assemblies/assembly.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/assemblies/assembly.xml b/src/main/assemblies/assembly.xml index 48771a721..a7d10605c 100644 --- a/src/main/assemblies/assembly.xml +++ b/src/main/assemblies/assembly.xml @@ -37,7 +37,7 @@ lcmaps.db logging.xml - namespace-1.5.0.xsd + namespace-1.5.1.xsd namespace.xml path-authz.db storm.properties.template