Class DefaultConfiguration
java.lang.Object
org.gcube.spatial.data.geonetwork.configuration.DefaultConfiguration
- All Implemented Interfaces:
Configuration
- Direct Known Subclasses:
LocalResourceConfiguration
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAssigns 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.Gets the admin account.Gets all existing configurations.Gets the GeoNetwork endpoint URL.Gets the GeoNetwork version.protected org.gcube.common.resources.gcore.ServiceEndpoint.AccessPointGets the access point from Information System.protected org.gcube.common.resources.gcore.ServiceEndpointGets the service endpoint from Information System.Gets configurations from parent scopes.Gets the current scope configuration.protected static final 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 final 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 voidLoads 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 Details
-
props
Properties loaded at startup.
-
-
Constructor Details
-
DefaultConfiguration
Constructs a new DefaultConfiguration instance.- Throws:
EncryptionException- if an encryption error occursMissingConfigurationException- if the configuration is missing
-
-
Method Details
-
getGeoNetworkVersion
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
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
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, MissingServiceEndpointExceptionDescription 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, MissingConfigurationExceptionDescription 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
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 MissingServiceEndpointExceptionDescription 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
Loads 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
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
-