Search in sources :

Example 1 with ArlasConfigurationException

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;
    }
}
Also used : URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) ArlasConfigurationException(io.arlas.server.core.exceptions.ArlasConfigurationException)

Example 2 with ArlasConfigurationException

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);
    }
}
Also used : CollectionReferenceDescription(io.arlas.server.core.model.response.CollectionReferenceDescription) ArlasConfigurationException(io.arlas.server.core.exceptions.ArlasConfigurationException) ArlasConfigurationException(io.arlas.server.core.exceptions.ArlasConfigurationException)

Aggregations

ArlasConfigurationException (io.arlas.server.core.exceptions.ArlasConfigurationException)2 CollectionReferenceDescription (io.arlas.server.core.model.response.CollectionReferenceDescription)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1