Merge branch 'Bug/18951'
This commit is contained in:
commit
4042ca34d8
|
@ -8,15 +8,15 @@
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
@ -29,5 +29,6 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry kind="var" path="GCUBE_DEV_KEYS"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -3,7 +3,9 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
|
212
changelog.xml
212
changelog.xml
|
@ -1,135 +1,185 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.2-2-0" date="2019-11-12">
|
<Changeset
|
||||||
<Change>[Feature #18038] Catalogue Resolver: resolve a public ITEM URL to the public VRE Catalogue (if available)
|
component="org.gcube.data-transfer.uri-resolver.2-3-1"
|
||||||
|
date="2020-04-06">
|
||||||
|
<Change>[Bug #18951] URI-Resolver: redirect to catalogue public item
|
||||||
|
must manage the case 'catalogue-'
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.2-2-0" date="2019-10-04">
|
<Changeset
|
||||||
<Change>[Feature #17630] Support parametric Content-Disposition
|
component="org.gcube.data-transfer.uri-resolver.2-2-0"
|
||||||
|
date="2019-11-12">
|
||||||
|
<Change>[Feature #18038] Catalogue Resolver: resolve a public ITEM URL
|
||||||
|
to the public VRE Catalogue (if available)
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Bug #17650] Bug #17650: URI-Resolver: HEAD request to
|
</Changeset>
|
||||||
|
<Changeset
|
||||||
|
component="org.gcube.data-transfer.uri-resolver.2-2-0"
|
||||||
|
date="2019-10-04">
|
||||||
|
<Change>[Feature #17630] Support parametric Content-Disposition
|
||||||
|
</Change>
|
||||||
|
<Change>[Bug #17650] Bug #17650: URI-Resolver: HEAD request to
|
||||||
StorageID link does not return the "content-disposition
|
StorageID link does not return the "content-disposition
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.2-1-1" date="2019-07-16">
|
<Changeset
|
||||||
<Change>[Incident #17180] Bug fixes
|
component="org.gcube.data-transfer.uri-resolver.2-1-1"
|
||||||
|
date="2019-07-16">
|
||||||
|
<Change>[Incident #17180] Bug fixes
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.2-1-0" date="2019-03-14">
|
<Changeset
|
||||||
<Change>[Feature #16263] Added new dataminer-invocation-model
|
component="org.gcube.data-transfer.uri-resolver.2-1-0"
|
||||||
|
date="2019-03-14">
|
||||||
|
<Change>[Feature #16263] Added new dataminer-invocation-model
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #16296] Bug fixes
|
<Change>[Task #16296] Bug fixes
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #16471] Tested Catalogue Resolver backward compatibility
|
<Change>[Task #16471] Tested Catalogue Resolver backward compatibility
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Incident #16671] Fixing Catalogue Resolver in case of working
|
<Change>[Incident #16671] Fixing Catalogue Resolver in case of working
|
||||||
with INFRASTRUCTURE and VO scope
|
with INFRASTRUCTURE and VO scope
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Incident #16713] GN harvesting from CKAN does not work
|
<Change>[Incident #16713] GN harvesting from CKAN does not work
|
||||||
properly
|
properly
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.2-0-0" date="2018-10-23">
|
<Changeset
|
||||||
<Change>[Task #12740] Developed as web-service by using jersey
|
component="org.gcube.data-transfer.uri-resolver.2-0-0"
|
||||||
|
date="2018-10-23">
|
||||||
|
<Change>[Task #12740] Developed as web-service by using jersey
|
||||||
framework
|
framework
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #12294] Created the resolver 'parthenosregistry'
|
<Change>[Task #12294] Created the resolver 'parthenosregistry'
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #13006] Fixing issue on resolving public Catalogues
|
<Change>[Task #13006] Fixing issue on resolving public Catalogues
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #12969] Create the new resolvers: "Analitycs" and
|
<Change>[Task #12969] Create the new resolvers: "Analitycs" and
|
||||||
"Knime"
|
"Knime"
|
||||||
</Change>
|
</Change>
|
||||||
<Change>
|
<Change>
|
||||||
[Feature #13072] Provide Metadata of a public link
|
[Feature #13072] Provide Metadata of a public link
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-15-0" date="2018-07-20">
|
<Changeset
|
||||||
<Change>[Task #10070] Catalogue Resolver enhancement: resolve
|
component="org.gcube.data-transfer.uri-resolver.1-15-0"
|
||||||
|
date="2018-07-20">
|
||||||
|
<Change>[Task #10070] Catalogue Resolver enhancement: resolve
|
||||||
public/private items to public/private catalogue
|
public/private items to public/private catalogue
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-14-0" date="2017-09-06">
|
<Changeset
|
||||||
<Change>[Task #9538] Geonetwork-Uri Resolver enhancement: provide new
|
component="org.gcube.data-transfer.uri-resolver.1-14-0"
|
||||||
|
date="2017-09-06">
|
||||||
|
<Change>[Task #9538] Geonetwork-Uri Resolver enhancement: provide new
|
||||||
filters and improve current ones
|
filters and improve current ones
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-13-0" date="2017-07-03">
|
<Changeset
|
||||||
<Change>[Feature #9108] Edit the GenericResource
|
component="org.gcube.data-transfer.uri-resolver.1-13-0"
|
||||||
|
date="2017-07-03">
|
||||||
|
<Change>[Feature #9108] Edit the GenericResource
|
||||||
(ApplicationProfile-Gis Viewer Application)
|
(ApplicationProfile-Gis Viewer Application)
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-12-0" date="2017-05-15">
|
<Changeset
|
||||||
<Change>[Feature #8494] Remove GeoServices query from URI-Resolver
|
component="org.gcube.data-transfer.uri-resolver.1-12-0"
|
||||||
|
date="2017-05-15">
|
||||||
|
<Change>[Feature #8494] Remove GeoServices query from URI-Resolver
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-11-0" date="2017-03-22">
|
<Changeset
|
||||||
<Change>[Feature #7350] GeoExplorer Resolver: resolve a GeoExplorer
|
component="org.gcube.data-transfer.uri-resolver.1-11-0"
|
||||||
|
date="2017-03-22">
|
||||||
|
<Change>[Feature #7350] GeoExplorer Resolver: resolve a GeoExplorer
|
||||||
Link
|
Link
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #7626] Fix issue on set/reset scope
|
<Change>[Task #7626] Fix issue on set/reset scope
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #7807] Provide a check for HAProxy</Change>
|
<Change>[Task #7807] Provide a check for HAProxy</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-10-0" date="2017-02-28">
|
<Changeset
|
||||||
<Change>[Task #6492] Catalogue Resolver: "improve"/"build better"
|
component="org.gcube.data-transfer.uri-resolver.1-10-0"
|
||||||
|
date="2017-02-28">
|
||||||
|
<Change>[Task #6492] Catalogue Resolver: "improve"/"build better"
|
||||||
public URLs to products
|
public URLs to products
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #6952] Catalogue Resolver: update on the fly the
|
<Change>[Task #6952] Catalogue Resolver: update on the fly the
|
||||||
Application Profile for VRE's used to resolve Product URL
|
Application Profile for VRE's used to resolve Product URL
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-9-0" date="2016-12-20">
|
<Changeset
|
||||||
<Change>[Task #6119] Provide CatalogueResolver: get/resolve a link to
|
component="org.gcube.data-transfer.uri-resolver.1-9-0"
|
||||||
|
date="2016-12-20">
|
||||||
|
<Change>[Task #6119] Provide CatalogueResolver: get/resolve a link to
|
||||||
a CKAN Entity
|
a CKAN Entity
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #6262] Catalogue Resolver: get/resolve a direct link
|
<Change>[Task #6262] Catalogue Resolver: get/resolve a direct link
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-8-0" date="2016-10-26">
|
<Changeset
|
||||||
<Change>Removed scope provider from several resolver</Change>
|
component="org.gcube.data-transfer.uri-resolver.1-8-0"
|
||||||
</Changeset>
|
date="2016-10-26">
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-7-0" date="2016-06-09">
|
<Change>Removed scope provider from several resolver</Change>
|
||||||
<Change>[Feature #4207] Uri Resolver upgrade: it must support new
|
</Changeset>
|
||||||
|
<Changeset
|
||||||
|
component="org.gcube.data-transfer.uri-resolver.1-7-0"
|
||||||
|
date="2016-06-09">
|
||||||
|
<Change>[Feature #4207] Uri Resolver upgrade: it must support new
|
||||||
Geonetwork Manager
|
Geonetwork Manager
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Task #4250] Geonetwork Resolver upgrade: it must return only
|
<Change>[Task #4250] Geonetwork Resolver upgrade: it must return only
|
||||||
"private" Metadata Ids for CKAN harversting
|
"private" Metadata Ids for CKAN harversting
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-6-0" date="2016-05-16">
|
<Changeset
|
||||||
<Change>[Task #3135] Uri Resolver enhancements: create a Geonetwork
|
component="org.gcube.data-transfer.uri-resolver.1-6-0"
|
||||||
|
date="2016-05-16">
|
||||||
|
<Change>[Task #3135] Uri Resolver enhancements: create a Geonetwork
|
||||||
Resolver
|
Resolver
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Feature #4000] URI Resolver - must support HEAD request
|
<Change>[Feature #4000] URI Resolver - must support HEAD request
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-5-0" date="2016-03-17">
|
<Changeset
|
||||||
<Change>[Feature #2008] Updated the method to resolve gCube Storage ID
|
component="org.gcube.data-transfer.uri-resolver.1-5-0"
|
||||||
|
date="2016-03-17">
|
||||||
|
<Change>[Feature #2008] Updated the method to resolve gCube Storage ID
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[Feature #1925] Added class UriResolverRewriteFilter to filter
|
<Change>[Feature #1925] Added class UriResolverRewriteFilter to filter
|
||||||
the different public link types, see: #1959
|
the different public link types, see: #1959
|
||||||
</Change>
|
</Change>
|
||||||
<Change>[gCube - Support #2695] Uri Resolver: patch to fix old bug in
|
<Change>[gCube - Support #2695] Uri Resolver: patch to fix old bug in
|
||||||
HL renaming files
|
HL renaming files
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-4-0" date="2015-09-21">
|
<Changeset
|
||||||
<Change>[Feature #416] Added code to read fileName and content-type
|
component="org.gcube.data-transfer.uri-resolver.1-4-0"
|
||||||
|
date="2015-09-21">
|
||||||
|
<Change>[Feature #416] Added code to read fileName and content-type
|
||||||
(mime type) from Storage
|
(mime type) from Storage
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-3-0" date="2015-04-28">
|
<Changeset
|
||||||
<Change>Fixed bug on encoding</Change>
|
component="org.gcube.data-transfer.uri-resolver.1-3-0"
|
||||||
<Change>Added new resolver: Storage ID Resolver</Change>
|
date="2015-04-28">
|
||||||
</Changeset>
|
<Change>Fixed bug on encoding</Change>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-2-0" date="2014-10-20">
|
<Change>Added new resolver: Storage ID Resolver</Change>
|
||||||
<Change>Integrated Gis-Resolver</Change>
|
</Changeset>
|
||||||
</Changeset>
|
<Changeset
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-1-0" date="2013-07-09">
|
component="org.gcube.data-transfer.uri-resolver.1-2-0"
|
||||||
<Change>Added fileName and contentType parameters to SMP URI resolver
|
date="2014-10-20">
|
||||||
|
<Change>Integrated Gis-Resolver</Change>
|
||||||
|
</Changeset>
|
||||||
|
<Changeset
|
||||||
|
component="org.gcube.data-transfer.uri-resolver.1-1-0"
|
||||||
|
date="2013-07-09">
|
||||||
|
<Change>Added fileName and contentType parameters to SMP URI resolver
|
||||||
</Change>
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-transfer.uri-resolver.1-0-0" date="2013-04-19">
|
<Changeset
|
||||||
<Change>first release</Change>
|
component="org.gcube.data-transfer.uri-resolver.1-0-0"
|
||||||
</Changeset>
|
date="2013-04-19">
|
||||||
|
<Change>first release</Change>
|
||||||
|
</Changeset>
|
||||||
</ReleaseNotes>
|
</ReleaseNotes>
|
2
pom.xml
2
pom.xml
|
@ -9,7 +9,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.data.transfer</groupId>
|
<groupId>org.gcube.data.transfer</groupId>
|
||||||
<artifactId>uri-resolver</artifactId>
|
<artifactId>uri-resolver</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.1-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<description>The URI Resolver is an HTTP URI resolver implemented as an REST service which gives access trough HTTP to different gcube Resolvers and gCube Applications.</description>
|
<description>The URI Resolver is an HTTP URI resolver implemented as an REST service which gives access trough HTTP to different gcube Resolvers and gCube Applications.</description>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class ItemCatalogueURLs {
|
||||||
|
|
||||||
private String itemName;
|
private String itemName;
|
||||||
private boolean isPublicItem;
|
private boolean isPublicItem;
|
||||||
|
|
||||||
private String privateVRECataloguePortletURL;
|
private String privateVRECataloguePortletURL;
|
||||||
private String publicVRECataloguePortletURL;
|
private String publicVRECataloguePortletURL;
|
||||||
private String publicGatewayCataloguePortletURL;
|
private String publicGatewayCataloguePortletURL;
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
package org.gcube.datatransfer.resolver.catalogue.resource;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class CatalogueStaticConfigurations.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
||||||
|
* Apr 6, 2020
|
||||||
|
*/
|
||||||
|
public class CatalogueStaticConfigurations{
|
||||||
|
|
||||||
|
/** The Constant LOG. */
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(CatalogueStaticConfigurations.class);
|
||||||
|
|
||||||
|
/** The Constant PREFIX_FOR_PORTAL_RELATIVE_URL_TO_CATALOGUE. */
|
||||||
|
static final String PREFIX_FOR_PORTAL_RELATIVE_URL_TO_CATALOGUE = "PREFIX_FOR_PORTAL_RELATIVE_URL_TO_CATALOGUE";
|
||||||
|
|
||||||
|
/** The Constant BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME. */
|
||||||
|
static final String BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME = "BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME";
|
||||||
|
|
||||||
|
/** The Constant DATACATALOGUE_URLs_CONFIGURATIONS_PROPERTIES. */
|
||||||
|
static final String DATACATALOGUE_URLs_CONFIGURATIONS_PROPERTIES = "datacatalogue_urls_configurations.properties";
|
||||||
|
|
||||||
|
/** The prefix to be used for catalogue URL. */
|
||||||
|
private String prefixToBeUsedForCatalogueURL;
|
||||||
|
|
||||||
|
/** The prefixes used for ckan hostname. */
|
||||||
|
private List<String> prefixesUsedForCkanHostname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new static configurations.
|
||||||
|
*/
|
||||||
|
public CatalogueStaticConfigurations() {
|
||||||
|
loadCataloguePortalURLsConfigurations();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load catalogue portal URLs configurations.
|
||||||
|
*/
|
||||||
|
private void loadCataloguePortalURLsConfigurations(){
|
||||||
|
Properties prop = new Properties();
|
||||||
|
try {
|
||||||
|
|
||||||
|
InputStream in = CkanCatalogueConfigurationsReader.class.getResourceAsStream(DATACATALOGUE_URLs_CONFIGURATIONS_PROPERTIES);
|
||||||
|
// load a properties file
|
||||||
|
prop.load(in);
|
||||||
|
|
||||||
|
// get the property value
|
||||||
|
String property = prop.getProperty(PREFIX_FOR_PORTAL_RELATIVE_URL_TO_CATALOGUE);
|
||||||
|
prefixToBeUsedForCatalogueURL = property;
|
||||||
|
|
||||||
|
// get the property value
|
||||||
|
property = prop.getProperty(BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME);
|
||||||
|
if(property.contains(",")) {
|
||||||
|
String[] values = property.split(",");
|
||||||
|
prefixesUsedForCkanHostname = Arrays.asList(values);
|
||||||
|
}else {
|
||||||
|
prefixesUsedForCkanHostname = Arrays.asList(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.error("An error occurred on read property file: "+DATACATALOGUE_URLs_CONFIGURATIONS_PROPERTIES, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract catalogue name from a ckan or balancer hostname.
|
||||||
|
*
|
||||||
|
* @param privateCKANCatalogueURL the private CKAN catalogue URL
|
||||||
|
* @return the catalogue name
|
||||||
|
*
|
||||||
|
* e.g. Returns "-bb" for "ckan-bb"
|
||||||
|
*/
|
||||||
|
private String extractCatalogueName(String privateCKANCatalogueURL) {
|
||||||
|
|
||||||
|
String toPrivateCKANCatalogueURL = privateCKANCatalogueURL;
|
||||||
|
LOG.debug("Private Catalogue URL is: "+toPrivateCKANCatalogueURL);
|
||||||
|
//removing protocol HTTPs or HTTP
|
||||||
|
toPrivateCKANCatalogueURL = toPrivateCKANCatalogueURL.replaceFirst("https://", "");
|
||||||
|
toPrivateCKANCatalogueURL = toPrivateCKANCatalogueURL.replaceFirst("http://", "");
|
||||||
|
LOG.debug("Removed HTTP[s] protocol, now I have: "+toPrivateCKANCatalogueURL);
|
||||||
|
for (String prefix :prefixesUsedForCkanHostname) {
|
||||||
|
LOG.trace(prefix+ " found as prefix of: "+privateCKANCatalogueURL);
|
||||||
|
if(toPrivateCKANCatalogueURL.startsWith(prefix)) {
|
||||||
|
toPrivateCKANCatalogueURL = toPrivateCKANCatalogueURL.replaceFirst(prefix, ""); //removing prefix
|
||||||
|
String catalogueName = toPrivateCKANCatalogueURL.substring(0,toPrivateCKANCatalogueURL.indexOf(".d4science"));
|
||||||
|
LOG.info("Catalogue Name extration returning value: "+catalogueName);
|
||||||
|
return catalogueName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.info("Catalogue Name extration returning null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the relative URL to public catalogue gateway.
|
||||||
|
*
|
||||||
|
* @param privateCKANCatalogueURL the private CKAN catalogue URL
|
||||||
|
*
|
||||||
|
* @return the relative URL that must be used for Public Catalogue Gateway
|
||||||
|
*/
|
||||||
|
public String buildRelativeURLToPublicCatalogueGateway(String privateCKANCatalogueURL) {
|
||||||
|
LOG.info("Trying to build the Catalogue Gateway URL using the prefix: "+prefixToBeUsedForCatalogueURL);
|
||||||
|
LOG.debug("The prefixes to build the URL for Public Catalogue published at Gateway level are: "+prefixesUsedForCkanHostname);
|
||||||
|
String catalogueName = extractCatalogueName(privateCKANCatalogueURL);
|
||||||
|
catalogueName = catalogueName == null? "":catalogueName;
|
||||||
|
String toNormalizedNameForURL = catalogueName.replaceAll("\\.", "-");
|
||||||
|
String publicCatalogueGatewayURL = String.format("%s%s", prefixToBeUsedForCatalogueURL,toNormalizedNameForURL);
|
||||||
|
LOG.info("The Catalogue Gateway URL built is: "+publicCatalogueGatewayURL);
|
||||||
|
return publicCatalogueGatewayURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the prefixes used for ckan hostname.
|
||||||
|
*
|
||||||
|
* @return the prefixes used for ckan hostname
|
||||||
|
*/
|
||||||
|
public List<String> getPrefixesUsedForCkanHostname() {
|
||||||
|
return prefixesUsedForCkanHostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the prefix to be used for catalogue URL.
|
||||||
|
*
|
||||||
|
* @return the prefix to be used for catalogue URL
|
||||||
|
*/
|
||||||
|
public String getPrefixToBeUsedForCatalogueURL() {
|
||||||
|
return prefixToBeUsedForCatalogueURL;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,13 +8,10 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -38,6 +35,7 @@ import eu.trentorise.opendata.jackan.exceptions.CkanException;
|
||||||
import eu.trentorise.opendata.jackan.model.CkanDataset;
|
import eu.trentorise.opendata.jackan.model.CkanDataset;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class CkanCatalogueConfigurationsReader.
|
* The Class CkanCatalogueConfigurationsReader.
|
||||||
*
|
*
|
||||||
|
@ -46,13 +44,17 @@ import eu.trentorise.opendata.jackan.model.CkanDataset;
|
||||||
*/
|
*/
|
||||||
public class CkanCatalogueConfigurationsReader {
|
public class CkanCatalogueConfigurationsReader {
|
||||||
|
|
||||||
|
//private static final String PREFIX_FOR_PORTAL_RELATIVE_URL_TO_CATALOGUE = "PREFIX_FOR_PORTAL_RELATIVE_URL_TO_CATALOGUE";
|
||||||
|
/** The Constant logger. */
|
||||||
|
//private static final String BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME = "BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME";
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CkanCatalogueConfigurationsReader.class);
|
private static final Logger logger = LoggerFactory.getLogger(CkanCatalogueConfigurationsReader.class);
|
||||||
|
|
||||||
|
/** The Constant APPLICATION_PROFILE_NAME. */
|
||||||
public final static String APPLICATION_PROFILE_NAME = "CkanPortlet";
|
public final static String APPLICATION_PROFILE_NAME = "CkanPortlet";
|
||||||
private static final String DATACATALOGUECONFIGURATION_PROPERTIES = "datacatalogueconfiguration.properties";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load catalogue end points through the ckan-util-library
|
* Load catalogue end points through the ckan-util-library.
|
||||||
*
|
*
|
||||||
* @return the gateway ckan catalogue reference
|
* @return the gateway ckan catalogue reference
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
|
@ -64,13 +66,13 @@ public class CkanCatalogueConfigurationsReader {
|
||||||
DataCatalogueImpl catalogueImpl = CatalogueServiceEndpointReader.getDataCatalogueImpl();
|
DataCatalogueImpl catalogueImpl = CatalogueServiceEndpointReader.getDataCatalogueImpl();
|
||||||
|
|
||||||
Map<ACCESS_LEVEL_TO_CATALOGUE_PORTLET, String> accessLevelMap = catalogueImpl.getMapAccessURLToCatalogue();
|
Map<ACCESS_LEVEL_TO_CATALOGUE_PORTLET, String> accessLevelMap = catalogueImpl.getMapAccessURLToCatalogue();
|
||||||
links.setMapAccessURLToCatalogue(accessLevelMap);
|
for (ACCESS_LEVEL_TO_CATALOGUE_PORTLET accessLevel : accessLevelMap.keySet()) {
|
||||||
|
links.setCatalogueURL(accessLevelMap.get(accessLevel), accessLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
//String publicVREPortletURL = accessLevelMap.get(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_VRE);
|
||||||
String privatePortletURL = accessLevelMap.get(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PRIVATE_VRE);
|
String privatePortletURL = accessLevelMap.get(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PRIVATE_VRE);
|
||||||
links.setPrivateVREPortletURL(privatePortletURL);
|
|
||||||
String publicVREPortletURL = accessLevelMap.get(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_VRE);
|
|
||||||
links.setPublicVREPortletURL(publicVREPortletURL);
|
|
||||||
String publicGatewayPortletURL = accessLevelMap.get(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_GATEWAY);
|
String publicGatewayPortletURL = accessLevelMap.get(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_GATEWAY);
|
||||||
links.setPublicGatewayPortletURL(publicGatewayPortletURL);
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
//If a catalogue gateway portlet URL is not provided/read from GR, building it
|
//If a catalogue gateway portlet URL is not provided/read from GR, building it
|
||||||
|
@ -79,13 +81,14 @@ public class CkanCatalogueConfigurationsReader {
|
||||||
URI toURL = new URI(privatePortletURL);
|
URI toURL = new URI(privatePortletURL);
|
||||||
String publicURL = privatePortletURL.startsWith("https://")?"https://"+toURL.getHost():"http://"+toURL.getHost();
|
String publicURL = privatePortletURL.startsWith("https://")?"https://"+toURL.getHost():"http://"+toURL.getHost();
|
||||||
//It returns the string "catalogue"
|
//It returns the string "catalogue"
|
||||||
String prefixToPublicCtlg = getRelativeURLToCatalogue();
|
CatalogueStaticConfigurations staticConf = new CatalogueStaticConfigurations();
|
||||||
//Replacing for example "ckan-bb" with "catalogue-bb"
|
//Replacing for example "ckan-bb" with "[PREFIXES-TO-CATALOGUE-URL]-bb" (e.g catalogue-bb)
|
||||||
String publicCatalogueName = extractCatalogueName(catalogueImpl.getCatalogueUrl(), prefixToPublicCtlg);
|
String relativeURLWithCatalogueName = staticConf.buildRelativeURLToPublicCatalogueGateway(catalogueImpl.getCatalogueUrl());
|
||||||
links.setPublicGatewayPortletURL(publicURL+"/"+publicCatalogueName);
|
String toGatewayPortletURL = String.format("%s/%s", publicURL, relativeURLWithCatalogueName);
|
||||||
|
links.setCatalogueURL(toGatewayPortletURL, ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_GATEWAY);
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.warn("Erron on generating public catalogue URL from private URL: "+privatePortletURL, e);
|
logger.warn("Erron on creating public catalogue URL from private URL: "+privatePortletURL, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getting the CKAN Portlet URL for current scope
|
//Getting the CKAN Portlet URL for current scope
|
||||||
|
@ -99,22 +102,7 @@ public class CkanCatalogueConfigurationsReader {
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract catalogue name.
|
|
||||||
*
|
|
||||||
* @param privateCKANCatalogueURL the private ckan catalogue url
|
|
||||||
* @param replaceCKANWith the replace ckan with
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public static String extractCatalogueName(String privateCKANCatalogueURL, String replaceCKANWith){
|
|
||||||
|
|
||||||
privateCKANCatalogueURL = privateCKANCatalogueURL.replaceFirst("https://ckan", replaceCKANWith);
|
|
||||||
privateCKANCatalogueURL = privateCKANCatalogueURL.replaceFirst("http://ckan", replaceCKANWith);
|
|
||||||
return privateCKANCatalogueURL.substring(0,privateCKANCatalogueURL.indexOf("."));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a ckan dataset given its id. The CkanClient is used, without api key. The result is null also when the dataset is private.
|
* Retrieve a ckan dataset given its id. The CkanClient is used, without api key. The result is null also when the dataset is private.
|
||||||
*
|
*
|
||||||
|
@ -187,44 +175,20 @@ public class CkanCatalogueConfigurationsReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the relative url to catalogue.
|
* The main method.
|
||||||
*
|
*
|
||||||
* @return the relative url to catalogue
|
* @param args the arguments
|
||||||
*/
|
*/
|
||||||
private static String getRelativeURLToCatalogue(){
|
public static void main(String[] args) {
|
||||||
Properties prop = new Properties();
|
|
||||||
String relativeURLToCatalogue = null;
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
||||||
try {
|
try {
|
||||||
InputStream in = CkanCatalogueConfigurationsReader.class.getResourceAsStream(DATACATALOGUECONFIGURATION_PROPERTIES);
|
GatewayCKANCatalogueReference links = CkanCatalogueConfigurationsReader.loadCatalogueEndPoints();
|
||||||
// load a properties file
|
System.out.println(links);
|
||||||
prop.load(in);
|
}
|
||||||
// get the property value
|
catch (Exception e) {
|
||||||
relativeURLToCatalogue = prop.getProperty("PORTAL_RELATIVE_URL_TO_CATALOGUE");
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
if(relativeURLToCatalogue==null || relativeURLToCatalogue.isEmpty())
|
|
||||||
return "catalogue";
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
logger.error("An error occurred on read property file: "+DATACATALOGUECONFIGURATION_PROPERTIES, e);
|
|
||||||
}
|
}
|
||||||
return relativeURLToCatalogue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * The main method.
|
|
||||||
// *
|
|
||||||
// * @param args the arguments
|
|
||||||
// */
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
//
|
|
||||||
// ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
|
||||||
// try {
|
|
||||||
// GatewayCKANCatalogueReference links = CkanCatalogueConfigurationsReader.loadCatalogueEndPoints();
|
|
||||||
// System.out.println(links);
|
|
||||||
// }
|
|
||||||
// catch (Exception e) {
|
|
||||||
// // TODO Auto-generated catch block
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,17 @@
|
||||||
package org.gcube.datatransfer.resolver.catalogue.resource;
|
package org.gcube.datatransfer.resolver.catalogue.resource;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueRunningCluster.ACCESS_LEVEL_TO_CATALOGUE_PORTLET;
|
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueRunningCluster.ACCESS_LEVEL_TO_CATALOGUE_PORTLET;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class GatewayCKANCatalogueReference.
|
* The Class GatewayCKANCatalogueReference.
|
||||||
*
|
*
|
||||||
|
@ -23,27 +23,65 @@ import lombok.ToString;
|
||||||
* Nov 12, 2019
|
* Nov 12, 2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
@ToString
|
||||||
public class GatewayCKANCatalogueReference implements Serializable{
|
public class GatewayCKANCatalogueReference implements Serializable{
|
||||||
|
|
||||||
/**
|
/** The Constant serialVersionUID. */
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** The scope. */
|
||||||
private String scope;
|
private String scope;
|
||||||
|
|
||||||
private String privateVREPortletURL;
|
/** The ckan URL. */
|
||||||
private String publicVREPortletURL;
|
|
||||||
private String publicGatewayPortletURL;
|
|
||||||
|
|
||||||
private String ckanURL;
|
private String ckanURL;
|
||||||
|
|
||||||
public Map<ACCESS_LEVEL_TO_CATALOGUE_PORTLET, String> mapAccessURLToCatalogue;
|
/** The map access URL to catalogue. */
|
||||||
|
private Map<ACCESS_LEVEL_TO_CATALOGUE_PORTLET, String> mapAccessURLToCatalogue;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the catalogue URL.
|
||||||
|
*
|
||||||
|
* @param accessLevel the access level
|
||||||
|
* @return the catalogue URL
|
||||||
|
*/
|
||||||
|
public String getCatalogueURL(ACCESS_LEVEL_TO_CATALOGUE_PORTLET accessLevel) {
|
||||||
|
|
||||||
|
return mapAccessURLToCatalogue.get(accessLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the catalogue URL.
|
||||||
|
*
|
||||||
|
* @param catalogueURL the catalogue URL
|
||||||
|
* @param accessLevel the access level
|
||||||
|
*/
|
||||||
|
protected void setCatalogueURL(String catalogueURL, ACCESS_LEVEL_TO_CATALOGUE_PORTLET accessLevel) {
|
||||||
|
|
||||||
|
if(mapAccessURLToCatalogue==null)
|
||||||
|
mapAccessURLToCatalogue = new HashMap<ACCESS_LEVEL_TO_CATALOGUE_PORTLET, String>();
|
||||||
|
|
||||||
|
mapAccessURLToCatalogue.put(accessLevel, catalogueURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope(String scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCkanURL() {
|
||||||
|
return ckanURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCkanURL(String ckanURL) {
|
||||||
|
this.ckanURL = ckanURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Property file
|
||||||
|
#
|
||||||
|
# author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
# created 11/2017
|
||||||
|
# updated 03/2020
|
||||||
|
#
|
||||||
|
# BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME
|
||||||
|
# eg. for https://ckan-territoriaperti.d4science.org is ckan
|
||||||
|
# eg. for https://ckan-imarine.d4science.org is ckan
|
||||||
|
# eg. for https://catalogue.d4science.org is catalogue
|
||||||
|
#
|
||||||
|
|
||||||
|
PREFIX_FOR_PORTAL_RELATIVE_URL_TO_CATALOGUE = catalogue
|
||||||
|
BALANCER_AND_CKAN_PREFIXES_USED_FOR_HOSTNAME = ckan,catalogue
|
|
@ -1,7 +0,0 @@
|
||||||
# Property files
|
|
||||||
#
|
|
||||||
# author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
# created 11/2017
|
|
||||||
#
|
|
||||||
|
|
||||||
PORTAL_RELATIVE_URL_TO_CATALOGUE = catalogue
|
|
|
@ -18,6 +18,7 @@ import javax.ws.rs.core.Response;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
|
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueRunningCluster.ACCESS_LEVEL_TO_CATALOGUE_PORTLET;
|
||||||
import org.gcube.datatransfer.resolver.ConstantsResolver;
|
import org.gcube.datatransfer.resolver.ConstantsResolver;
|
||||||
import org.gcube.datatransfer.resolver.caches.LoadingMapOfScopeCache;
|
import org.gcube.datatransfer.resolver.caches.LoadingMapOfScopeCache;
|
||||||
import org.gcube.datatransfer.resolver.catalogue.CatalogueRequest;
|
import org.gcube.datatransfer.resolver.catalogue.CatalogueRequest;
|
||||||
|
@ -223,13 +224,25 @@ public class CatalogueResolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String publicGatewayPorltetURL = String.format("%s?path=/%s/%s",ckanCatalogueReference.getPublicGatewayPortletURL(),entityContextValue, entityName);
|
String publicGatewayPorltetURL = String.format("%s?path=/%s/%s",
|
||||||
String privateVREPortletURL = String.format("%s?path=/%s/%s",ckanCatalogueReference.getPrivateVREPortletURL(),entityContextValue, entityName);
|
ckanCatalogueReference.getCatalogueURL(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_GATEWAY),
|
||||||
|
entityContextValue,
|
||||||
|
entityName);
|
||||||
|
|
||||||
|
String privateVREPortletURL = String.format("%s?path=/%s/%s",
|
||||||
|
ckanCatalogueReference.getCatalogueURL(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PRIVATE_VRE),
|
||||||
|
entityContextValue,
|
||||||
|
entityName);
|
||||||
|
|
||||||
//Checking if the public VRE portlet URL is available (so it was read from GR)
|
//Checking if the public VRE portlet URL is available (so it was read from GR)
|
||||||
String publicVREPortletURL = null;
|
String publicVREPortletURL = null;
|
||||||
if(ckanCatalogueReference.getPublicVREPortletURL()!=null && !ckanCatalogueReference.getPublicVREPortletURL().isEmpty()) {
|
String toCheckPublicVREPortletURL = ckanCatalogueReference.getCatalogueURL(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_VRE);
|
||||||
|
if(toCheckPublicVREPortletURL!=null && !toCheckPublicVREPortletURL.isEmpty()) {
|
||||||
//here the catalogue is available/deployed as public at VRE level
|
//here the catalogue is available/deployed as public at VRE level
|
||||||
publicVREPortletURL = String.format("%s?path=/%s/%s",ckanCatalogueReference.getPublicVREPortletURL(),entityContextValue, entityName);
|
publicVREPortletURL = String.format("%s?path=/%s/%s",
|
||||||
|
toCheckPublicVREPortletURL,
|
||||||
|
entityContextValue,
|
||||||
|
entityName);
|
||||||
}
|
}
|
||||||
return new ItemCatalogueURLs(entityName, isPublicItem, privateVREPortletURL, publicVREPortletURL, publicGatewayPorltetURL);
|
return new ItemCatalogueURLs(entityName, isPublicItem, privateVREPortletURL, publicVREPortletURL, publicGatewayPorltetURL);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import org.gcube.datatransfer.resolver.catalogue.resource.CatalogueStaticConfigurations;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class CatalogueNameExtractor {
|
||||||
|
|
||||||
|
String[] CKANs = new String[] {
|
||||||
|
"https://ckan-grsf-admin2.d4science.org",
|
||||||
|
"https://ckan.pre.d4science.org/",
|
||||||
|
"https://ckan-aginfra.d4science.org",
|
||||||
|
"https://catalogue.d4science.org/",
|
||||||
|
"https://catalogue-imarine.d4science.org/" };
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void extraCatalogueName() {
|
||||||
|
CatalogueStaticConfigurations staticConf = new CatalogueStaticConfigurations();
|
||||||
|
|
||||||
|
for (int i = 0; i < CKANs.length; i++) {
|
||||||
|
System.out.println(CKANs[i]);
|
||||||
|
staticConf.buildRelativeURLToPublicCatalogueGateway(CKANs[i]);
|
||||||
|
System.out.println("\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue