Class DefaultConfiguration
- java.lang.Object
-
- org.gcube.spatial.data.geonetwork.configuration.DefaultConfiguration
-
- All Implemented Interfaces:
Configuration
- Direct Known Subclasses:
LocalResourceConfiguration
public class DefaultConfiguration extends Object implements Configuration
-
-
Field Summary
Fields Modifier and Type Field Description protected static PropertiespropsProperties loaded at startup.
-
Constructor Summary
Constructors Constructor Description DefaultConfiguration()Constructs a new DefaultConfiguration instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ScopeConfigurationacquireConfiguration()Assigns an available configuration to the current scope and returns it.voidcreateScopeConfiguration(ScopeConfiguration toCreate)Store the passed configurationprotected List<org.gcube.common.resources.gcore.ServiceEndpoint>doTheQuery(String geonetworkCategory, String geonetworkPlatformName)Executes a query to find service endpoints.AccountgetAdminAccount()Gets the admin account.Set<ScopeConfiguration>getExistingConfigurations()Gets all existing configurations.StringgetGeoNetworkEndpoint()Gets the GeoNetwork endpoint URL.ServerAccess.VersiongetGeoNetworkVersion()Gets the GeoNetwork version.protected org.gcube.common.resources.gcore.ServiceEndpoint.AccessPointgetIsAccessPoint()Gets the access point from Information System.protected org.gcube.common.resources.gcore.ServiceEndpointgetISServiceEndpoint()Gets the service endpoint from Information System.Set<ScopeConfiguration>getParentScopesConfiguration()Gets configurations from parent scopes.ScopeConfigurationgetScopeConfiguration()Gets the current scope configuration.protected static org.gcube.common.resources.gcore.ServiceEndpoint.AccessPointgetTheRightAccessPoint(org.gcube.common.resources.gcore.ServiceEndpoint... resources)Looks for the access point compliant with configured endpointName and max priority (1).protected static org.gcube.common.resources.gcore.ServiceEndpointgetTheRightServiceEndpoint(org.gcube.common.resources.gcore.ServiceEndpoint... resources)Looks for the service endpoint compliant with configured endpointName and max priority (1).protected voidloadFromIs()Loads configuration from Information System (IS).protected voidstoreAndReload(ScopeConfiguration toStore)UPDATE existing values and store new onesprotected org.gcube.common.resources.gcore.ServiceEndpointupdate(org.gcube.common.resources.gcore.ServiceEndpoint toStore)Updates a service endpoint in the registry.
-
-
-
Field Detail
-
props
protected static Properties props
Properties loaded at startup.
-
-
Constructor Detail
-
DefaultConfiguration
public DefaultConfiguration() throws EncryptionException, MissingConfigurationExceptionConstructs a new DefaultConfiguration instance.- Throws:
EncryptionException- if an encryption error occursMissingConfigurationException- if the configuration is missing
-
-
Method Detail
-
getGeoNetworkVersion
public ServerAccess.Version getGeoNetworkVersion() throws MissingServiceEndpointException
Description copied from interface:ConfigurationGets the GeoNetwork version.- Specified by:
getGeoNetworkVersionin interfaceConfiguration- Returns:
- the GeoNetwork version
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
getAdminAccount
public Account getAdminAccount() throws MissingServiceEndpointException
Description copied from interface:ConfigurationGets the admin account.- Specified by:
getAdminAccountin interfaceConfiguration- Returns:
- the admin account
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
getGeoNetworkEndpoint
public String getGeoNetworkEndpoint() throws MissingServiceEndpointException
Description copied from interface:ConfigurationGets the GeoNetwork endpoint URL.- Specified by:
getGeoNetworkEndpointin interfaceConfiguration- Returns:
- the GeoNetwork endpoint URL
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
getScopeConfiguration
public ScopeConfiguration getScopeConfiguration() throws MissingConfigurationException, MissingServiceEndpointException
Description copied from interface:ConfigurationGets the current scope configuration.- Specified by:
getScopeConfigurationin interfaceConfiguration- Returns:
- current scope configuration
- Throws:
MissingConfigurationException- if the configuration is missingMissingServiceEndpointException- if the service endpoint cannot be found
-
createScopeConfiguration
public void createScopeConfiguration(ScopeConfiguration toCreate) throws MissingServiceEndpointException
Description copied from interface:ConfigurationStore the passed configuration- Specified by:
createScopeConfigurationin interfaceConfiguration- Parameters:
toCreate- the configuration to create and store- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
acquireConfiguration
public ScopeConfiguration acquireConfiguration() throws MissingServiceEndpointException, MissingConfigurationException
Description copied from interface:ConfigurationAssigns an available configuration to the current scope and returns it.- Specified by:
acquireConfigurationin interfaceConfiguration- Returns:
- the acquired scope configuration
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be foundMissingConfigurationException- if no available configuration is found
-
getExistingConfigurations
public Set<ScopeConfiguration> getExistingConfigurations() throws MissingServiceEndpointException
Description copied from interface:ConfigurationGets all existing configurations.- Specified by:
getExistingConfigurationsin interfaceConfiguration- Returns:
- set of existing scope configurations
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
getParentScopesConfiguration
public Set<ScopeConfiguration> getParentScopesConfiguration() throws MissingServiceEndpointException
Description copied from interface:ConfigurationGets configurations from parent scopes.- Specified by:
getParentScopesConfigurationin interfaceConfiguration- Returns:
- set of parent scope configurations
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
loadFromIs
protected void loadFromIs() throws MissingServiceEndpointExceptionLoads configuration from Information System (IS).- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
getIsAccessPoint
protected org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint getIsAccessPoint() throws MissingServiceEndpointExceptionGets the access point from Information System.- Returns:
- the access point
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
getISServiceEndpoint
protected org.gcube.common.resources.gcore.ServiceEndpoint getISServiceEndpoint() throws MissingServiceEndpointExceptionGets the service endpoint from Information System.- Returns:
- the service endpoint
- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
getTheRightAccessPoint
protected static final org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint getTheRightAccessPoint(org.gcube.common.resources.gcore.ServiceEndpoint... resources)
Looks for the access point compliant with configured endpointName and max priority (1).- Parameters:
resources- service endpoints to search- Returns:
- the access point with highest priority, or null if not present
-
getTheRightServiceEndpoint
protected static final org.gcube.common.resources.gcore.ServiceEndpoint getTheRightServiceEndpoint(org.gcube.common.resources.gcore.ServiceEndpoint... resources)
Looks for the service endpoint compliant with configured endpointName and max priority (1).- Parameters:
resources- service endpoints to search- Returns:
- the service endpoint with highest priority, or null if not present
-
doTheQuery
protected List<org.gcube.common.resources.gcore.ServiceEndpoint> doTheQuery(String geonetworkCategory, String geonetworkPlatformName)
Executes a query to find service endpoints.- Parameters:
geonetworkCategory- the GeoNetwork category to search forgeonetworkPlatformName- the GeoNetwork platform name to search for- Returns:
- list of matching service endpoints
-
storeAndReload
protected void storeAndReload(ScopeConfiguration toStore) throws MissingServiceEndpointException
UPDATE existing values and store new ones- Parameters:
toStore- the scope configuration to store and reload- Throws:
MissingServiceEndpointException- if the service endpoint cannot be found
-
update
protected org.gcube.common.resources.gcore.ServiceEndpoint update(org.gcube.common.resources.gcore.ServiceEndpoint toStore)
Updates a service endpoint in the registry.- Parameters:
toStore- the service endpoint to update- Returns:
- the updated service endpoint
-
-