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
|
@ -32,16 +32,15 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class UriResolverManager {
|
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
|
* Time to reload Runtime Resource Configuration
|
||||||
*/
|
*/
|
||||||
public static int RESET_DELAY = 10*60*1000; //10 MINUTES
|
public static int RESET_TIME = RESET_DELAY; //15 MINUTES
|
||||||
|
|
||||||
/**
|
|
||||||
* Time to reload Runtime Resource Configuration
|
|
||||||
*/
|
|
||||||
public static int RESET_TIME = RESET_DELAY; //10 MINUTES
|
|
||||||
|
|
||||||
private UriResolverMapReader uriResolverMapReader;
|
private UriResolverMapReader uriResolverMapReader;
|
||||||
private Map<String, Resolver> applicationTypes;
|
private Map<String, Resolver> applicationTypes;
|
||||||
|
@ -103,11 +102,27 @@ public class UriResolverManager {
|
||||||
this.uriResolverMapReader = new UriResolverMapReader(this.scope);
|
this.uriResolverMapReader = new UriResolverMapReader(this.scope);
|
||||||
this.applicationTypes = uriResolverMapReader.getApplicationTypes();
|
this.applicationTypes = uriResolverMapReader.getApplicationTypes();
|
||||||
this.setTimerUriResolverReader(RESET_DELAY, RESET_TIME);
|
this.setTimerUriResolverReader(RESET_DELAY, RESET_TIME);
|
||||||
|
} catch (UriResolverMapException e){
|
||||||
|
logger.error("UriResolverMapException: ",e);
|
||||||
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
logger.error("UriResolverManager: ",e);
|
||||||
throw new UriResolverMapException("Map Application Type - Resources not found in IS");
|
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
|
* Instance a UriResolverManager
|
||||||
* Precondition: set the scope provider {@link ScopeProvider.instance.get()}
|
* Precondition: set the scope provider {@link ScopeProvider.instance.get()}
|
||||||
|
@ -119,11 +134,7 @@ public class UriResolverManager {
|
||||||
*/
|
*/
|
||||||
public UriResolverManager(String applicationType) throws UriResolverMapException, IllegalArgumentException{
|
public UriResolverManager(String applicationType) throws UriResolverMapException, IllegalArgumentException{
|
||||||
this();
|
this();
|
||||||
|
setApplicationType(applicationType);
|
||||||
if(!this.applicationTypes.containsKey(applicationType)){
|
|
||||||
throw new IllegalArgumentException("Application type '"+applicationType +"' not found in Application Types: "+getApplicationTypes());
|
|
||||||
}
|
|
||||||
this.applicationType = applicationType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,14 +343,15 @@ public class UriResolverManager {
|
||||||
reader = null;
|
reader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
/*
|
||||||
// try {
|
public static void main(String[] args) {
|
||||||
// String scope ="/gcube";
|
try {
|
||||||
// UriResolverMapReader resolver = new UriResolverMapReader(scope);
|
UriResolverManager manager = new UriResolverManager();
|
||||||
// System.out.println(resolver);
|
System.out.println(manager.getCapabilities());
|
||||||
// } catch (Exception e) {
|
System.out.println(manager.getApplicationTypes());
|
||||||
// // TODO Auto-generated catch block
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// TODO Auto-generated catch block
|
||||||
// }
|
e.printStackTrace();
|
||||||
// }
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,25 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public class UriResolverManagerTest {
|
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() {
|
public void testGIS() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -63,7 +81,7 @@ public class UriResolverManagerTest {
|
||||||
/**
|
/**
|
||||||
* Thread safe
|
* Thread safe
|
||||||
*/
|
*/
|
||||||
// @Test
|
@Test
|
||||||
public void testSMPID(){
|
public void testSMPID(){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue