diff --git a/.classpath b/.classpath
index 277f1df..11f9a7f 100644
--- a/.classpath
+++ b/.classpath
@@ -28,7 +28,7 @@
-
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f073649..ee47404 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v1.8.0-SNAPSHOT]
- Enhanced the Geoportal-Resolver. Supported share links to Geoportal Data-Entry app [#27160]
+- Provided the new endpoint: GeoportalExporter [#27308]
## [v1.7.0]
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/geoportal/GeoportalExporterAPI.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/geoportal/GeoportalExporterAPI.java
new file mode 100644
index 0000000..8cd4b15
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/uriresolvermanager/geoportal/GeoportalExporterAPI.java
@@ -0,0 +1,52 @@
+package org.gcube.portlets.user.uriresolvermanager.geoportal;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.gcube.portlets.user.uriresolvermanager.entity.ServiceAccessPoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GeoportalExporterAPI {
+
+ private GeoportalExporterEndpoint endpoint;
+ private ServiceAccessPoint serviceAccessPoint;
+
+ private final String QUERY_PARAMETER_AS_URL = "as-url";
+
+ public static final Logger LOG = LoggerFactory.getLogger(GeoportalExporterAPI.class);
+
+ public static String DEFAULT_TYPE = "pdf";
+
+ public GeoportalExporterAPI() throws Exception {
+ this.endpoint = new GeoportalExporterEndpoint();
+ this.serviceAccessPoint = this.endpoint.getServiceAccessPoint();
+ }
+
+ public URL exportProject(String type, String ucdID, String projectID, boolean asURL) throws MalformedURLException {
+ if (type == null || type.isEmpty())
+ type = DEFAULT_TYPE;
+
+ String api = String.format("%s/export/%s/%s/%s", serviceAccessPoint.getServiceUrl(), type, ucdID, projectID);
+ if(asURL)
+ api+="?"+QUERY_PARAMETER_AS_URL+"="+asURL;
+
+ LOG.info("returning exportProject API: " + api);
+ return new URL(api);
+ }
+
+ public URL viewJob(String jobCode) throws MalformedURLException {
+ String api = String.format("%s/view/%s", serviceAccessPoint.getServiceUrl(), jobCode);
+ LOG.info("returning viewJob API: " + api);
+ return new URL(api);
+ }
+
+ public URL healthcheck(String type) throws MalformedURLException {
+ if (type == null || type.isEmpty())
+ type = DEFAULT_TYPE;
+ String api = String.format("%s/export/%s/healthcheck", serviceAccessPoint.getServiceUrl(), type);
+ LOG.info("returning healthcheck API: " + api);
+ return new URL(api);
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/geoportal/GeoportalExporterEndpoint.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/geoportal/GeoportalExporterEndpoint.java
new file mode 100644
index 0000000..5b56a5e
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/uriresolvermanager/geoportal/GeoportalExporterEndpoint.java
@@ -0,0 +1,20 @@
+package org.gcube.portlets.user.uriresolvermanager.geoportal;
+
+import org.gcube.portlets.user.uriresolvermanager.entity.ServiceAccessPoint;
+import org.gcube.portlets.user.uriresolvermanager.readers.RuntimeResourceReader;
+
+public class GeoportalExporterEndpoint {
+
+ public final String URI_RESOLVER_RESOURCE_NAME = "HTTP-URI-Resolver";
+ public final String ENTRY_POINT_NAME = "geoportal_exp";
+
+
+ public GeoportalExporterEndpoint() {
+ }
+
+ public ServiceAccessPoint getServiceAccessPoint()throws Exception {
+ RuntimeResourceReader runtimeRR = new RuntimeResourceReader(URI_RESOLVER_RESOURCE_NAME);
+ return runtimeRR.getServiceAccessPointForEntryName(ENTRY_POINT_NAME);
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceReader.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceReader.java
index f8ff10e..4846598 100644
--- a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceReader.java
+++ b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceReader.java
@@ -92,21 +92,18 @@ public class RuntimeResourceReader {
while (acIt.hasNext()) {
AccessPoint ap = acIt.next();
-
Group properties = ap.properties();
if (properties.size() == 0) {
- logger.warn("Properties in resource " + resourceName + " not found");
+ logger.warn("Properties in resource " + resourceName + " not found for ap: "+ap.name());
+ serviceAccessPoints.add(new ServiceAccessPoint(ap.name(), ap.address(), null));
} else {
-
+
List serviceParameters = new ArrayList(properties.size());
-
Iterator iter = properties.iterator();
while (iter.hasNext()) {
-
Property prop = iter.next();
-
serviceParameters.add(new ServiceParameter(prop.value(), true));
}
diff --git a/src/test/java/GeoportalExporterTest.java b/src/test/java/GeoportalExporterTest.java
new file mode 100644
index 0000000..412d1e0
--- /dev/null
+++ b/src/test/java/GeoportalExporterTest.java
@@ -0,0 +1,42 @@
+import java.net.URL;
+
+import org.gcube.common.scope.api.ScopeProvider;
+import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
+import org.gcube.portlets.user.uriresolvermanager.exception.IllegalArgumentException;
+import org.gcube.portlets.user.uriresolvermanager.exception.UriResolverMapException;
+import org.gcube.portlets.user.uriresolvermanager.geoportal.GeoportalExporterAPI;
+
+/**
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ * @Oct 20, 2014
+ *
+ */
+public class GeoportalExporterTest {
+
+ //@Test
+ public void testGeoportalExporterEndppoint() {
+ UriResolverManager manager;
+ try {
+ ScopeProvider.instance.set("/gcube/devsec/devVRE");
+ GeoportalExporterAPI geAPI = new GeoportalExporterAPI();
+
+ boolean asURL = true;
+ URL exportProjectURL = geAPI.exportProject("pdf", "profiledConcessioni", "661d2c6f8804530afb90b132", asURL);
+ System.out.println("exportProjectURL: "+exportProjectURL);
+ URL healthcheckURL = geAPI.healthcheck("pdf");
+ System.out.println("healthcheckURL: "+healthcheckURL);
+
+
+ } catch (UriResolverMapException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/src/test/java/UriResolverManagerTest.java b/src/test/java/UriResolverManagerTest.java
index 1d2b0a2..5f9b976 100644
--- a/src/test/java/UriResolverManagerTest.java
+++ b/src/test/java/UriResolverManagerTest.java
@@ -12,7 +12,6 @@ import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResol
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.RESOLVE_AS;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.TARGET_GEOPORTAL_APP;
-import org.junit.Test;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
@@ -27,7 +26,7 @@ public class UriResolverManagerTest {
try {
ScopeProvider.instance.set("/gcube/devsec/devVRE");
manager = new UriResolverManager();
- System.out.println("Capabiities: " + manager.getCapabilities());
+ System.out.println("Capabilities: " + manager.getCapabilities());
System.out.println("ApplicationTypes: " + manager.getApplicationTypes());
for (String applicationType : manager.getApplicationTypes()) {
Resolver resolver = manager.getResolver(applicationType);