Added gcube-bom

Removed slf4j-log4j

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/uri-resolver-manager@146952 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-04-19 10:13:02 +00:00
parent 5cb51f91ba
commit d176690d36
4 changed files with 34 additions and 39 deletions

29
pom.xml
View File

@ -48,6 +48,18 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
@ -55,7 +67,6 @@
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- END FWS -->
@ -77,7 +88,6 @@
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-encryption</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
@ -103,23 +113,10 @@
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
<!-- JUNIT -->

View File

@ -7,7 +7,8 @@ import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@ -18,41 +19,41 @@ import org.apache.log4j.Logger;
public class HttpRequestUtil {
private static final int CONNECTION_TIMEOUT = 1000;
public static Logger logger = Logger.getLogger(HttpRequestUtil.class);
public static final Logger logger = LoggerFactory.getLogger(HttpRequestUtil.class);
public static boolean urlExists(String urlConn) throws Exception {
if(urlConn==null || urlConn.isEmpty())
return false;
URL url;
try {
url = new URL(urlConn);
URLConnection connection = url.openConnection();
connection.setConnectTimeout(CONNECTION_TIMEOUT);
connection.setReadTimeout(CONNECTION_TIMEOUT+CONNECTION_TIMEOUT);
logger.trace("open connection on: " + url);
// Cast to a HttpURLConnection
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnection) connection;
httpConnection.setRequestMethod("GET");
int code = httpConnection.getResponseCode();
httpConnection.disconnect();
if (code == 200) {
logger.trace("status code is "+code+" - on url connection: "+urlConn);
return true;
}else
logger.warn("status code is "+code+" - on url connection: "+urlConn);
// logger.trace("result: "+result);
} else {
@ -75,9 +76,9 @@ public class HttpRequestUtil {
throw new Exception("Error Exception");
}
}
public static void main(String[] args) throws Exception {
System.out.println(HttpRequestUtil.urlExists("http://geoserver2.d4science.research-infrastructures.eu/geoserver/wms"));
}

View File

@ -1,6 +1,3 @@
import java.util.HashMap;
import java.util.Map;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
import org.gcube.portlets.user.uriresolvermanager.exception.UriResolverMapException;
@ -24,11 +21,11 @@ public class UriResolverManagerMain {
System.out.println(resolver.getApplicationTypes());
// System.out.println(resolver.discoveryServiceParameters(resolver.getResolver("SMP-ID")));
Map<String, String> params = new HashMap<String, String>();
params.put("gis-UUID", "5ac49f44-999f-4efe-a32b-af71da2b39ac");
params.put("scope", "/gcube/devsec/devVRE");
String shortLink = resolver.getLink(params, true);
System.out.println(shortLink); //true, link is shorted otherwise none
// Map<String, String> params = new HashMap<String, String>();
// params.put("gis-UUID", "5ac49f44-999f-4efe-a32b-af71da2b39ac");
// params.put("scope", "/gcube/devsec/devVRE");
// String shortLink = resolver.getLink(params, true);
// System.out.println(shortLink); //true, link is shorted otherwise none
} catch (UriResolverMapException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {

View File

@ -89,9 +89,9 @@ public class UriResolverManagerTest {
UriResolverManager resolver;
resolver = new UriResolverManager("SMP-ID");
Map<String, String> params = new HashMap<String, String>();
params.put("smp-id","553f9265e4b0567b75021fce");
params.put("fileName", "dog");
params.put("contentType", "image/jpg");
params.put("geo-exp","553f9265e4b0567b75021fce");
// params.put("fileName", "dog");
// params.put("contentType", "image/jpg");
String shortLink = resolver.getLink(params, true); //true, link is shorted otherwise none
System.out.println(shortLink);
} catch (UriResolverMapException e) {