use of io.arlas.server.core.exceptions.ArlasConfigurationException in project ARLAS-server by gisaia.
the class ArlasServerConfiguration method check.
public void check() throws ArlasConfigurationException {
super.check();
if (arlasBaseUri != null) {
try {
new URI(arlasBaseUri);
} catch (URISyntaxException e) {
throw new ArlasConfigurationException("The arlas-base-uri is invalid.");
}
}
if (StringUtil.isNullOrEmpty(arlasIndex)) {
arlasIndex = ".arlas";
}
if (arlasCacheSize < 0) {
arlasCacheSize = 1000;
}
if (arlasCacheTimeout < 0) {
arlasCacheTimeout = 60;
}
if (arlasServiceCollectionsEnabled == null) {
arlasServiceCollectionsEnabled = true;
}
if (arlasServiceExploreEnabled == null) {
arlasServiceExploreEnabled = true;
}
if (inspireConfiguration == null) {
inspireConfiguration = new InspireConfiguration();
inspireConfiguration.enabled = false;
inspireConfiguration.publicAccessLimitations = "no limitations apply";
inspireConfiguration.accessAndUseConditions = "no conditions apply";
inspireConfiguration.servicesDateOfCreation = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
} else {
if (inspireConfiguration.servicesDateOfCreation == null) {
inspireConfiguration.servicesDateOfCreation = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
}
if (inspireConfiguration.enabled == null) {
inspireConfiguration.enabled = false;
}
if (inspireConfiguration.publicAccessLimitations == null) {
inspireConfiguration.publicAccessLimitations = "no limitations apply";
}
if (inspireConfiguration.accessAndUseConditions == null) {
inspireConfiguration.accessAndUseConditions = "no conditions apply";
}
}
if (arlasServiceWFSEnabled == null) {
arlasServiceWFSEnabled = false;
}
if (arlasServiceOPENSEARCHEnabled == null) {
arlasServiceOPENSEARCHEnabled = true;
}
if (arlasServiceCSWEnabled == null) {
arlasServiceCSWEnabled = false;
}
if (arlasServiceRasterTileEnabled == null) {
arlasServiceRasterTileEnabled = false;
}
if (collectionAutoDiscoverConfiguration == null) {
collectionAutoDiscoverConfiguration = new CollectionAutoDiscoverConfiguration();
collectionAutoDiscoverConfiguration.schedule = 0;
}
}
use of io.arlas.server.core.exceptions.ArlasConfigurationException in project ARLAS-server by gisaia.
the class CollectionAutoDiscover method execute.
@Override
public void execute(Map<String, List<String>> arg0, PrintWriter arg1) throws Exception {
try {
List<CollectionReferenceDescription> discoveredCollections = collectionReferenceService.getAllIndicesAsCollections();
List<CollectionReferenceDescription> existingCollections;
try {
existingCollections = collectionReferenceService.describeAllCollections(collectionReferenceService.getAllCollectionReferences(Optional.empty()), Optional.empty());
} catch (Exception e) {
existingCollections = new ArrayList<>();
}
for (CollectionReferenceDescription collection : discoveredCollections) {
if (!existingCollections.contains(collection)) {
CollectionReferenceDescription collectionToAdd = checkCollectionValidity(collection);
if (collectionToAdd != null) {
collectionReferenceService.putCollectionReference(collectionToAdd);
}
}
}
} catch (ArlasConfigurationException e) {
LOGGER.error(e.getMessage(), e);
}
}
Aggregations