diff --git a/.classpath b/.classpath
index 187b5ad..66261fe 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
+
@@ -23,5 +23,5 @@
-
+
diff --git a/pom.xml b/pom.xml
index 1034cab..de1de10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
4.0.0
org.gcube.portlets.user
uri-resolver-manager
- 1.2.0-SNAPSHOT
+ 1.3.0-SNAPSHOT
jar
uri-resolver-manager
The URI Resolver Manager
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/UriResolverManager.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/UriResolverManager.java
index 2325a2d..5dded87 100644
--- a/src/main/java/org/gcube/portlets/user/uriresolvermanager/UriResolverManager.java
+++ b/src/main/java/org/gcube/portlets/user/uriresolvermanager/UriResolverManager.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.gcube.portlets.user.uriresolvermanager;
@@ -22,32 +22,30 @@ import org.gcube.portlets.user.urlshortener.UrlShortener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-
/**
* The Class UriResolverManager.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
- * May 4, 2015
+ * Sep 6, 2016
*/
public class UriResolverManager {
-
+
/**
* Time to reload Runtime Resource Configuration
*/
public static int RESET_DELAY = 15*60*1000; //15 MINUTES
-
+
/**
* Time to reload Runtime Resource Configuration
*/
public static int RESET_TIME = RESET_DELAY; //15 MINUTES
-
+
private UriResolverMapReader uriResolverMapReader;
private Map applicationTypes;
private String scope;
private String applicationType;
private RuntimeResourceReader reader;
-
+
/**
* A lock to prevent reader = null;
*/
@@ -56,7 +54,7 @@ public class UriResolverManager {
private ServiceAccessPoint serviceAccessPoint;
private Timer timer;
-
+
/**
* Lock reader.
*/
@@ -79,27 +77,28 @@ public class UriResolverManager {
public synchronized int countReaders() {
return usingReader;
}
-
+
public static final Logger logger = LoggerFactory.getLogger(UriResolverManager.class);
-
-
+
+
/**
* Instantiates a new uri resolver manager.
- * Precondition: set the scope provider {@link ScopeProvider.instance.get()}
- * The scope is used to look up the generic resource {@link UriResolverMapReader#URI_RESOLVER_MAP} available in the infrastructure to map ApplicationType with its Resolver
+ * Precondition: set the scope into ScopeProvider {@link ScopeProvider#get()}
+ * The scope is used to look up the generic resource with name: {@link UriResolverMapReader#URI_RESOLVER_MAP_RESOURCE_NAME}, secondary type: {@link UriResolverMapReader#URIRESOLVERMAP_SECONDARY_TYPE} from IS to map ApplicationType with its Resolver
*
* @throws UriResolverMapException the uri resolver map exception
* @throws IllegalArgumentException the illegal argument exception
*/
public UriResolverManager() throws UriResolverMapException, IllegalArgumentException{
try {
-
+
this.scope = ScopeProvider.instance.get();
-
+ logger.info("UriResolverManager is using scope: "+scope+", read from ScopeProvider");
+
if(this.scope == null)
- throw new UriResolverMapException("Scope is null, set scope provider!");
-
- this.uriResolverMapReader = new UriResolverMapReader(this.scope);
+ throw new UriResolverMapException("Scope is null, set scope into ScopeProvider!");
+
+ this.uriResolverMapReader = new UriResolverMapReader();
this.applicationTypes = uriResolverMapReader.getApplicationTypes();
this.setTimerUriResolverReader(RESET_DELAY, RESET_TIME);
} catch (UriResolverMapException e){
@@ -110,22 +109,24 @@ public class UriResolverManager {
throw new UriResolverMapException("Map Application Type - Resources not found in IS");
}
}
-
+
/**
+ * Sets the application type.
+ *
* @param applicationType the applicationType to set
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException the illegal argument exception
*/
public void setApplicationType(String applicationType) throws IllegalArgumentException {
if(!this.applicationTypes.containsKey(applicationType)){
throw new IllegalArgumentException("Application type '"+applicationType +"' not found in Application Types: "+getApplicationTypes());
-
+
}
this.applicationType = applicationType;
}
-
+
/**
* Instance a UriResolverManager
- * Precondition: set the scope provider {@link ScopeProvider.instance.get()}
+ * Precondition: set the scope provider {@link ScopeProvider.instance.get()}
* The scope is used to look up the generic resource {@link UriResolverMapReader#URI_RESOLVER_MAP} available in the infrastructure to map ApplicationType with its Resolver
*
* @param applicationType a (valid) key Application Type {@link UriResolverManager#getApplicationTypes()}
@@ -136,9 +137,9 @@ public class UriResolverManager {
this();
setApplicationType(applicationType);
}
-
-
+
+
/**
* Gets the link.
*
@@ -153,7 +154,7 @@ public class UriResolverManager {
this.applicationType = applicationType;
return getLink(parameters, shortLink);
}
-
+
/**
* Gets the link.
*
@@ -164,26 +165,25 @@ public class UriResolverManager {
* @throws UriResolverMapException the uri resolver map exception
*/
public String getLink(Map parameters, boolean shortLink) throws IllegalArgumentException, UriResolverMapException{
-
+
if(applicationType==null)
throw new IllegalArgumentException("Application type is null");
-
+
Resolver resolver = this.applicationTypes.get(applicationType);
String link;
-
+
if(parameters==null)
throw new IllegalArgumentException("Input Map parameters is null");
-
+
try {
-
+
lockReader();
-
+
if(reader==null){
logger.info("Runtime Resource Reader is null, istancing...");
- ScopeProvider.instance.set(this.scope);
- reader = new RuntimeResourceReader(this.scope, resolver.getResourceName());
+ reader = new RuntimeResourceReader(resolver.getResourceName());
}
-
+
if(resolver.getEntryName()==null || resolver.getEntryName().isEmpty()){
logger.warn("The entryname to "+resolver.getResourceName() +" is null or empty, reading first Access Point!!");
serviceAccessPoint = reader.getServiceAccessPoints().get(0);
@@ -195,24 +195,24 @@ public class UriResolverManager {
}
List resourceParameters = serviceAccessPoint.getServiceParameters();
-
+
//CHECK PARAMETERS
- for (ServiceParameter serviceParameter : resourceParameters) {
+ for (ServiceParameter serviceParameter : resourceParameters) {
if(serviceParameter.isMandatory()){
if(!parameters.containsKey(serviceParameter.getKey())){
throw new IllegalArgumentException("Mandatory service key (parameter) '"+serviceParameter.getKey() +"' not found into input map");
}
}
}
-
+
String baseURI = serviceAccessPoint.getServiceUrl();
-
+
releaseReader();
-
+
String params = UrlEncoderUtil.encodeQuery(parameters);
link = baseURI+"?"+params;
logger.info("Created HTTP URI request (link): "+link);
-
+
if(shortLink){
try{
logger.info("Shortner start..");
@@ -229,10 +229,10 @@ public class UriResolverManager {
} catch (Exception e) {
logger.error("Uri Resolver Exception: ", e);
throw new UriResolverMapException("Uri Resolver error: " +e.getMessage());
- }
+ }
return link;
}
-
+
/**
* Gets the application types.
*
@@ -241,7 +241,7 @@ public class UriResolverManager {
public Set getApplicationTypes(){
return this.applicationTypes.keySet();
}
-
+
/**
* Discovery service parameters.
*
@@ -252,15 +252,15 @@ public class UriResolverManager {
*/
public List discoveryServiceParameters(Resolver resolver) throws IllegalArgumentException, Exception{
try {
-
+
if(this.scope == null)
throw new IllegalArgumentException("Scope is null, set ScopeProvider");
-
+
if(resolver == null)
throw new IllegalArgumentException("Resolver is null, set Resolver");
-
- RuntimeResourceReader reader = new RuntimeResourceReader(this.scope, resolver.getResourceName());
-
+
+ RuntimeResourceReader reader = new RuntimeResourceReader(resolver.getResourceName());
+
ServiceAccessPoint serviceAccessPoint = null;
if(resolver.getEntryName()==null || resolver.getEntryName().isEmpty()){
logger.warn("The entryname to "+resolver.getResourceName() +" is null or empty, reading first Access Point!!");
@@ -271,14 +271,14 @@ public class UriResolverManager {
if(serviceAccessPoint==null)
throw new UriResolverMapException("Entry Name "+resolver.getEntryName() +" not found in Resource name: "+resolver.getResourceName());
}
-
+
return serviceAccessPoint.getServiceParameters();
} catch (Exception e) {
logger.error("Uri Resolver error: ", e);
throw new UriResolverMapException("Uri Resolver error: " +e.getMessage());
- }
+ }
}
-
+
/**
* Gets the resolver.
*
@@ -288,7 +288,7 @@ public class UriResolverManager {
public Resolver getResolver(String applicationType){
return this.applicationTypes.get(applicationType);
}
-
+
/**
* Gets the capabilities.
*
@@ -305,11 +305,11 @@ public class UriResolverManager {
* @param period the period
*/
public void setTimerUriResolverReader(long delay, long period) {
-
+
cancelTimerUriResolverReader();
-
+
timer = new Timer(true);
-
+
timer.schedule(new TimerTask() {
@Override
public void run() {
@@ -320,12 +320,12 @@ public class UriResolverManager {
reader = null;
}else
logger.info("Reader locked, counters is/are:"+counters+", skipping");
-
+
}
}, delay, period);
}
-
-
+
+
/**
* Cancel timer uri resolver reader.
@@ -334,7 +334,7 @@ public class UriResolverManager {
if(timer!=null)
timer.cancel();
}
-
+
/**
* Invalid uri resolver reader.
@@ -342,7 +342,7 @@ public class UriResolverManager {
public void invalidUriResolverReader(){
reader = null;
}
-
+
/*
public static void main(String[] args) {
try {
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/ApplicationProfileException.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/ApplicationProfileException.java
index ea65017..c759b9d 100644
--- a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/ApplicationProfileException.java
+++ b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/ApplicationProfileException.java
@@ -1,8 +1,20 @@
package org.gcube.portlets.user.uriresolvermanager.readers;
+/**
+ * The Class ApplicationProfileException.
+ *
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ * Sep 6, 2016
+ */
@SuppressWarnings("serial")
public class ApplicationProfileException extends Exception {
- public ApplicationProfileException(String message) {
+
+ /**
+ * Instantiates a new application profile exception.
+ *
+ * @param message the message
+ */
+ public ApplicationProfileException(String message) {
super(message);
}
}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceException.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceException.java
index cabe800..65a92cf 100644
--- a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceException.java
+++ b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/RuntimeResourceException.java
@@ -1,8 +1,20 @@
package org.gcube.portlets.user.uriresolvermanager.readers;
+/**
+ * The Class RuntimeResourceException.
+ *
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
+ * Sep 6, 2016
+ */
@SuppressWarnings("serial")
public class RuntimeResourceException extends Exception {
- public RuntimeResourceException(String message) {
+
+ /**
+ * Instantiates a new runtime resource exception.
+ *
+ * @param message the message
+ */
+ public RuntimeResourceException(String message) {
super(message);
}
}
\ No newline at end of file
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 459aa29..f90013d 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
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.gcube.portlets.user.uriresolvermanager.readers;
@@ -17,7 +17,6 @@ import org.gcube.common.resources.gcore.utils.Group;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.uriresolvermanager.entity.ServiceAccessPoint;
import org.gcube.portlets.user.uriresolvermanager.entity.ServiceParameter;
-import org.gcube.portlets.user.uriresolvermanager.util.ScopeUtil;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger;
@@ -31,30 +30,27 @@ import org.slf4j.LoggerFactory;
* Apr 30, 2015
*/
public class RuntimeResourceReader {
-
+
public static final Logger logger = LoggerFactory.getLogger(RuntimeResourceReader.class);
-
+
public List serviceAccessPoints;
private String resourceName;
- private String scope;
-
private String entryName;
+
/**
* Instantiates a new runtime resource reader.
*
- * @param scope the scope
* @param resourceName the resource name
* @throws Exception the exception
*/
- public RuntimeResourceReader(String scope, String resourceName) throws Exception {
- this.scope = scope;
+ public RuntimeResourceReader(String resourceName) throws Exception {
this.resourceName = resourceName;
- readResource(scope, resourceName);
+ readResource(resourceName);
}
-
+
/**
* Read resource.
*
@@ -63,81 +59,80 @@ public class RuntimeResourceReader {
* @return the application URI
* @throws Exception the exception
*/
- private void readResource(String scope, String resourceName) throws Exception {
-
+ private void readResource(String resourceName) throws Exception {
+
try{
+ String scope = ScopeProvider.instance.get();
logger.info("Tentative read resource: "+resourceName+", scope: "+scope);
-
+
this.resourceName = resourceName;
- this.scope = scope;
-
- String infraName = ScopeUtil.getInfrastructureNameFromScope(scope);
-
- logger.info("Instancing root scope: "+infraName);
- ScopeProvider.instance.set(infraName);
-
+
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Name/string() eq '"+resourceName+"'");
-
+
DiscoveryClient client = clientFor(ServiceEndpoint.class);
-
+
List r = client.submit(query);
- if (r == null || r.isEmpty()) throw new Exception("Cannot retrieve the runtime resource: "+resourceName);
-
+ if (r == null || r.isEmpty()) throw new Exception("Cannot retrieve the runtime resource with name: "+resourceName +" in the scope: "+scope);
+
ServiceEndpoint se = r.get(0);
- if(se.profile()==null)
- throw new Exception("IS profile is null for resource: "+resourceName);
-
+ if(se.profile()==null){
+ String msg = "Runtime reosource with resource name: "+resourceName +" is null in the scope: "+scope;
+ logger.error(msg);
+ throw new Exception(msg);
+ }
+
Group accessPoints = se.profile().accessPoints();
if(accessPoints.size()==0) throw new Exception("Accesspoint in resource "+resourceName+" not found");
-
+
Iterator acIt = accessPoints.iterator();
serviceAccessPoints = new ArrayList(accessPoints.size());
-
+
while(acIt.hasNext()){
-
+
AccessPoint ap = acIt.next();
-
+
Group properties = ap.properties();
-
+
if(properties.size()==0){
logger.warn("Properties in resource "+resourceName+" not found");
}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));
}
-
+
serviceAccessPoints.add(new ServiceAccessPoint(ap.name(), ap.address(), serviceParameters));
}
}
// parameters.setUser(ap.username()); //username
- //
+ //
// String decryptedPassword = StringEncrypter.getEncrypter().decrypt(ap.password());
- //
+ //
// parameters.setPassword(decryptedPassword); //password
// Group properties = ap.properties();
-
+
}catch (Exception e) {
- logger.error("Sorry, an error occurred on reading the resource "+resourceName+ " Runtime Reosurce",e);
+ logger.error("Sorry, an error occurred on reading the resource "+resourceName+ " Runtime Resource",e);
throw new Exception("Sorry, an error occurred on reading the resource "+resourceName+ " Runtime Reosurce");
}
}
/**
- *
- * @param entryName
- * @return
+ * Gets the service access point for entry name.
+ *
+ * @param entryName the entry name
+ * @return the service access point for entry name
*/
public ServiceAccessPoint getServiceAccessPointForEntryName(String entryName){
-
+
for (ServiceAccessPoint serviceAccessPoint : serviceAccessPoints) {
if(serviceAccessPoint.getEntryName().equals(entryName))
return serviceAccessPoint;
@@ -162,26 +157,40 @@ public class RuntimeResourceReader {
public String getEntryName() {
return entryName;
}
-
- /**
- * @return the scope
- */
- public String getScope() {
- return scope;
- }
-
+
/**
+ * Gets the service access points.
+ *
* @return the serviceAccessPoints
*/
public List getServiceAccessPoints() {
return serviceAccessPoints;
}
-
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("RuntimeResourceReader [serviceAccessPoints=");
+ builder.append(serviceAccessPoints);
+ builder.append(", resourceName=");
+ builder.append(resourceName);
+ builder.append(", entryName=");
+ builder.append(entryName);
+ builder.append("]");
+ return builder.toString();
+ }
+
+
+
// public static void main(String[] args) {
// try {
// RuntimeResourceReader rr = new RuntimeResourceReader("/gcube", "Gis-Resolver");
// System.out.println(rr);
-//
+//
// System.out.println(rr.getServiceAccessPointForEntryName("gis"));
// } catch (Exception e) {
// // TODO Auto-generated catch block
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/UriResolverMapReader.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/UriResolverMapReader.java
index 5f3d304..3bdd0cd 100644
--- a/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/UriResolverMapReader.java
+++ b/src/main/java/org/gcube/portlets/user/uriresolvermanager/readers/UriResolverMapReader.java
@@ -13,7 +13,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.uriresolvermanager.entity.Resolver;
-import org.gcube.portlets.user.uriresolvermanager.util.ScopeUtil;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
@@ -49,15 +48,9 @@ public class UriResolverMapReader {
/**
* Instantiates a new uri resolver map reader.
*
- * @param scope - the scope to be searched
* @throws Exception the exception
*/
- public UriResolverMapReader(String scope) throws Exception {
- this.scope = scope;
-
- if(scope==null){
- throw new Exception("Scope is null, set scope provider!");
- }
+ public UriResolverMapReader() throws Exception {
this.resourceName = URI_RESOLVER_MAP_RESOURCE_NAME;
this.secondaryType = URIRESOLVERMAP_SECONDARY_TYPE;
@@ -76,37 +69,31 @@ public class UriResolverMapReader {
String queryString = getGcubeGenericQueryString(secondaryType, resourceName);
- logger.info("Trying to fetch applicationProfile profile from the infrastructure for " + secondaryType + " scope: " + scope);
+ logger.info("Trying to fetch in the scope: "+ScopeProvider.instance.get()+" the Generic Resouce with name: "+resourceName + " secondary type: "+secondaryType);
logger.info(queryString);
try {
- logger.info("Getting Infrastructure Name...: ");
- String infra = ScopeUtil.getInfrastructureNameFromScope(this.scope);
- logger.info("Infrastructure Name returned: "+infra);
-
- ScopeProvider.instance.set(infra);
- logger.info("scope provider set instance: "+infra);
-
Query q = new QueryBox(queryString);
- logger.info("new query box works");
+ logger.debug("new query box works");
DiscoveryClient client = client();
logger.info("submitting query is: "+queryString);
List appUriResolverMap = client.submit(q);
- logger.info("submit query works");
+ logger.debug("submit query works");
if (appUriResolverMap == null || appUriResolverMap.size() == 0){
- logger.error("Your applicationProfile with secondaryType: "+secondaryType+" and name "+resourceName+" is not registered in the infrastructure, scope: "+ScopeProvider.instance.get());
- throw new ApplicationProfileException("Your applicationProfile with secondaryType: "+secondaryType+" and name "+resourceName+" is not registered in the infrastructure");
+ logger.error("ApplicationProfile with secondaryType: "+secondaryType+" and name: "+resourceName+" is not registered in the infrastructure, scope: "+ScopeProvider.instance.get());
+ throw new ApplicationProfileException("ApplicationProfile with secondaryType: "+secondaryType+" and name: "+resourceName+" is not registered in the scope: "+ScopeProvider.instance.get());
}else {
- logger.info("Building new DocumentBuilder..");
+ logger.info("Building map applications type - resource");
+ logger.debug("Building new DocumentBuilder..");
String elem = appUriResolverMap.get(0);
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
- logger.info("Building new XPathHelper..");
+ logger.debug("Building new XPathHelper..");
XPathHelper helper = new XPathHelper(node);
List currValue = null;
- logger.info("Evaluating XPath..");
+ logger.debug("Evaluating XPath..");
currValue = helper.evaluate("/Resource/Profile/Body/access_point/application_type/text()");
if (currValue != null && currValue.size() > 0) {
logger.info("Application Types are: "+currValue.size());
@@ -129,11 +116,8 @@ public class UriResolverMapReader {
}
} catch (Exception e) {
- logger.error("Error while trying to fetch applicationProfile with secondaryType: "+secondaryType+" and name "+resourceName+" from the infrastructure", e);
- throw new ApplicationProfileException("Error while trying to fetch applicationProfile with secondaryType: "+secondaryType+" and name "+resourceName+" from the infrastructure");
- }finally{
-
- ScopeProvider.instance.reset();
+ logger.error("Error while trying to fetch Generic Resource with secondaryType: "+secondaryType+" and name "+resourceName+" from the infrastructure", e);
+ throw new ApplicationProfileException("Error while trying to fetch Generic Resourc with secondaryType: "+secondaryType+" and name "+resourceName+" from the infrastructure");
}
}
@@ -208,21 +192,4 @@ public class UriResolverMapReader {
builder.append("]");
return builder.toString();
}
-
-
-// /**
-// * The main method.
-// *
-// * @param args the arguments
-// */
-// public static void main(String[] args) {
-// String scope ="/gcube";
-// try {
-// UriResolverMapReader resolver = new UriResolverMapReader(scope);
-// System.out.println(resolver);
-// } catch (Exception e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
}
diff --git a/src/main/java/org/gcube/portlets/user/uriresolvermanager/util/ScopeUtil.java b/src/main/java/org/gcube/portlets/user/uriresolvermanager/util/ScopeUtil.java
deleted file mode 100644
index d4bdd58..0000000
--- a/src/main/java/org/gcube/portlets/user/uriresolvermanager/util/ScopeUtil.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- */
-package org.gcube.portlets.user.uriresolvermanager.util;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
- * @Oct 13, 2014
- *
- */
-public class ScopeUtil {
-
- private static final String SCOPE_SEPARATOR = "/";
- public static final Logger logger = LoggerFactory.getLogger(ScopeUtil.class);
-
-
- public static String getInfrastructureNameFromScope(String scope) throws Exception{
-
- if(scope==null || scope.isEmpty()){
- throw new Exception("Scope is null or empty");
- }
-
- if(!scope.startsWith(SCOPE_SEPARATOR)){
- logger.warn("Input scope: "+scope+" has not / is a really scope?");
- scope = SCOPE_SEPARATOR+scope;
- logger.warn("Tentative as scope: "+scope);
- }
-
- String[] splitScope = scope.split(SCOPE_SEPARATOR);
-
- String rootScope = SCOPE_SEPARATOR + splitScope[1];
-
- if(rootScope.length()<2){
- throw new Exception("Infrastructure name not found in "+scope);
- }
-
- logger.trace("scope is "+ scope +" infra: "+rootScope);
-
- return rootScope;
-
- }
-}
diff --git a/src/test/java/UriResolverManagerTest.java b/src/test/java/UriResolverManagerTest.java
index 2d1ddc0..005e1c6 100644
--- a/src/test/java/UriResolverManagerTest.java
+++ b/src/test/java/UriResolverManagerTest.java
@@ -5,7 +5,6 @@ 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.junit.Test;
/**
*
@@ -18,7 +17,7 @@ import org.junit.Test;
*/
public class UriResolverManagerTest {
- @Test
+// @Test
public void testUriResolverManger(){
UriResolverManager manager;
try {
@@ -154,6 +153,4 @@ public class UriResolverManagerTest {
}
}
-
-
}