94: Uri-Resolver: must resolve (eventually) several access points for entryname
Task-Url: https://support.d4science.org/issues/94 update UriResolverManager git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/uri-resolver-manager@114803 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6013f079e8
commit
6483327fde
|
@ -31,17 +31,16 @@ import org.slf4j.LoggerFactory;
|
|||
* May 4, 2015
|
||||
*/
|
||||
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_DELAY = 10*60*1000; //10 MINUTES
|
||||
|
||||
/**
|
||||
* Time to reload Runtime Resource Configuration
|
||||
*/
|
||||
public static int RESET_TIME = RESET_DELAY; //10 MINUTES
|
||||
public static int RESET_TIME = RESET_DELAY; //15 MINUTES
|
||||
|
||||
private UriResolverMapReader uriResolverMapReader;
|
||||
private Map<String, Resolver> applicationTypes;
|
||||
|
@ -103,11 +102,27 @@ public class UriResolverManager {
|
|||
this.uriResolverMapReader = new UriResolverMapReader(this.scope);
|
||||
this.applicationTypes = uriResolverMapReader.getApplicationTypes();
|
||||
this.setTimerUriResolverReader(RESET_DELAY, RESET_TIME);
|
||||
} catch (UriResolverMapException e){
|
||||
logger.error("UriResolverMapException: ",e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("UriResolverManager: ",e);
|
||||
throw new UriResolverMapException("Map Application Type - Resources not found in IS");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param applicationType the applicationType to set
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
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()}
|
||||
|
@ -119,11 +134,7 @@ public class UriResolverManager {
|
|||
*/
|
||||
public UriResolverManager(String applicationType) throws UriResolverMapException, IllegalArgumentException{
|
||||
this();
|
||||
|
||||
if(!this.applicationTypes.containsKey(applicationType)){
|
||||
throw new IllegalArgumentException("Application type '"+applicationType +"' not found in Application Types: "+getApplicationTypes());
|
||||
}
|
||||
this.applicationType = applicationType;
|
||||
setApplicationType(applicationType);
|
||||
}
|
||||
|
||||
|
||||
|
@ -331,15 +342,16 @@ public class UriResolverManager {
|
|||
public void invalidUriResolverReader(){
|
||||
reader = null;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// try {
|
||||
// String scope ="/gcube";
|
||||
// UriResolverMapReader resolver = new UriResolverMapReader(scope);
|
||||
// System.out.println(resolver);
|
||||
// } catch (Exception e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
UriResolverManager manager = new UriResolverManager();
|
||||
System.out.println(manager.getCapabilities());
|
||||
System.out.println(manager.getApplicationTypes());
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -18,7 +18,25 @@ import org.junit.Test;
|
|||
*/
|
||||
public class UriResolverManagerTest {
|
||||
|
||||
// @Test
|
||||
@Test
|
||||
public void testUriResolverManger(){
|
||||
UriResolverManager manager;
|
||||
try {
|
||||
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
||||
manager = new UriResolverManager();
|
||||
System.out.println(manager.getCapabilities());
|
||||
System.out.println(manager.getApplicationTypes());
|
||||
} catch (UriResolverMapException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGIS() {
|
||||
|
||||
try {
|
||||
|
@ -63,7 +81,7 @@ public class UriResolverManagerTest {
|
|||
/**
|
||||
* Thread safe
|
||||
*/
|
||||
// @Test
|
||||
@Test
|
||||
public void testSMPID(){
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue