Class ServiceInstance
- java.lang.Object
-
- org.gcube.informationsystem.resourceregistry.api.rest.ServiceInstance
-
public abstract class ServiceInstance extends Object
Derives the public base URL of the D4Science URL-shortening/redirect service for a given infrastructure Context scope, following theurl.<root>.d4science.orgper-infrastructure naming convention (the production root infrastructure uses the bareBASE_URLwith no root-specific subdomain segment), and the Resource Registry address reached through it.The Resource Registry address can be overridden, for every Context, by setting the Java system property "resource-registry.url", meant for testing and development only.
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description static StringBASE_URLBase URL of the D4Science URL-shortening/redirect service for the production infrastructure.static StringRESOURCE_REGISTRY_URL_PROPERTYJava system property holding the complete Resource Registry address (e.g.
-
Constructor Summary
Constructors Constructor Description ServiceInstance()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetCurrentContextPath()Gets the path of the Context of the caller's current security token, as resolved by the SmartGears 3 platform (ContextUtility): the scope set in the current thread, or the Context of the legacy gCube token or of the UMA token held by the token providers.static StringgetResourceRegistryURL()Gets the Resource Registry address for the Context scope of the caller's current security token, as provided byContextUtility.static StringgetResourceRegistryURL(String context)Gets the Resource Registry address for the given Context scope.static StringgetServiceURL()Gets the service URL for the Context scope of the caller's current security token, as provided byContextUtility.static StringgetServiceURL(String context)Gets the service URL for the infrastructure that owns the given Context scope.
-
-
-
Field Detail
-
BASE_URL
public static final String BASE_URL
Base URL of the D4Science URL-shortening/redirect service for the production infrastructure.- See Also:
- Constant Field Values
-
RESOURCE_REGISTRY_URL_PROPERTY
public static final String RESOURCE_REGISTRY_URL_PROPERTY
Java system property holding the complete Resource Registry address (e.g.http://localhost:8080/resource-registry) to use instead of the one derived from the Context scope.- See Also:
- Constant Field Values
-
-
Method Detail
-
getCurrentContextPath
public static String getCurrentContextPath()
Gets the path of the Context of the caller's current security token, as resolved by the SmartGears 3 platform (ContextUtility): the scope set in the current thread, or the Context of the legacy gCube token or of the UMA token held by the token providers.- Returns:
- the path of the caller's current Context (e.g.
/root-infrastructure/vo)
-
getServiceURL
public static String getServiceURL()
Gets the service URL for the Context scope of the caller's current security token, as provided byContextUtility.- Returns:
- the service URL for the caller's current Context scope
-
getServiceURL
public static String getServiceURL(String context)
Gets the service URL for the infrastructure that owns the given Context scope.- Parameters:
context- the fully qualified Context scope (e.g./root-infrastructure/vo)- Returns:
BASE_URLfor the production root infrastructure, or the equivalent URL for the root infrastructure identified bycontext
-
getResourceRegistryURL
public static String getResourceRegistryURL()
Gets the Resource Registry address for the Context scope of the caller's current security token, as provided byContextUtility.- Returns:
- the value of "resource-registry.url" when set, otherwise the Resource Registry address for the caller's current Context scope
-
getResourceRegistryURL
public static String getResourceRegistryURL(String context)
Gets the Resource Registry address for the given Context scope.- Parameters:
context- the fully qualified Context scope (e.g./root-infrastructure/vo)- Returns:
- the value of "resource-registry.url" when set, otherwise the
Resource Registry address under
getServiceURL(String)
-
-