Search in sources :

Example 6 with REPOSITORY_ADMIN_ERROR

use of org.apache.archiva.rest.api.v2.svc.ErrorKeys.REPOSITORY_ADMIN_ERROR in project archiva by apache.

the class DefaultSecurityConfigurationService method updateLdapConfiguration.

@Override
public LdapConfiguration updateLdapConfiguration(LdapConfiguration configuration) throws ArchivaRestServiceException {
    try {
        RedbackRuntimeConfiguration redbackRuntimeConfiguration = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration();
        log.debug("getRedbackRuntimeConfiguration -> {}", redbackRuntimeConfiguration);
        updateConfig(configuration, redbackRuntimeConfiguration);
        redbackRuntimeConfigurationAdmin.updateRedbackRuntimeConfiguration(redbackRuntimeConfiguration);
        ldapConnectionFactory.initialize();
    } catch (RepositoryAdminException e) {
        throw new ArchivaRestServiceException(ErrorMessage.of(REPOSITORY_ADMIN_ERROR));
    }
    try {
        return LdapConfiguration.of(redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getLdapConfiguration());
    } catch (RepositoryAdminException e) {
        log.error("Error while retrieve updated configuration: {}", e.getMessage());
        throw new ArchivaRestServiceException(ErrorMessage.of(REPOSITORY_ADMIN_ERROR, e.getMessage()));
    }
}
Also used : ArchivaRestServiceException(org.apache.archiva.rest.api.v2.svc.ArchivaRestServiceException) RedbackRuntimeConfiguration(org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException)

Example 7 with REPOSITORY_ADMIN_ERROR

use of org.apache.archiva.rest.api.v2.svc.ErrorKeys.REPOSITORY_ADMIN_ERROR in project archiva by apache.

the class DefaultSecurityConfigurationService method updateCacheConfiguration.

@Override
public CacheConfiguration updateCacheConfiguration(CacheConfiguration cacheConfiguration) throws ArchivaRestServiceException {
    if (cacheConfiguration == null) {
        throw new ArchivaRestServiceException(ErrorMessage.of(ErrorKeys.MISSING_DATA), 400);
    }
    try {
        RedbackRuntimeConfiguration redbackRuntimeConfiguration = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration();
        log.debug("getRedbackRuntimeConfiguration -> {}", redbackRuntimeConfiguration);
        updateConfig(cacheConfiguration, redbackRuntimeConfiguration);
        redbackRuntimeConfigurationAdmin.updateRedbackRuntimeConfiguration(redbackRuntimeConfiguration);
        return getCacheConfiguration();
    } catch (RepositoryAdminException e) {
        throw new ArchivaRestServiceException(ErrorMessage.of(REPOSITORY_ADMIN_ERROR));
    }
}
Also used : ArchivaRestServiceException(org.apache.archiva.rest.api.v2.svc.ArchivaRestServiceException) RedbackRuntimeConfiguration(org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException)

Example 8 with REPOSITORY_ADMIN_ERROR

use of org.apache.archiva.rest.api.v2.svc.ErrorKeys.REPOSITORY_ADMIN_ERROR in project archiva by apache.

the class DefaultSecurityConfigurationService method getConfiguration.

@Override
public SecurityConfiguration getConfiguration() throws ArchivaRestServiceException {
    try {
        RedbackRuntimeConfiguration redbackRuntimeConfiguration = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration();
        log.debug("getRedbackRuntimeConfiguration -> {}", redbackRuntimeConfiguration);
        return SecurityConfiguration.ofRedbackConfiguration(redbackRuntimeConfiguration);
    } catch (RepositoryAdminException e) {
        throw new ArchivaRestServiceException(ErrorMessage.of(REPOSITORY_ADMIN_ERROR));
    }
}
Also used : ArchivaRestServiceException(org.apache.archiva.rest.api.v2.svc.ArchivaRestServiceException) RedbackRuntimeConfiguration(org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException)

Aggregations

RepositoryAdminException (org.apache.archiva.admin.model.RepositoryAdminException)8 RedbackRuntimeConfiguration (org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration)8 ArchivaRestServiceException (org.apache.archiva.rest.api.v2.svc.ArchivaRestServiceException)8 LdapConfiguration (org.apache.archiva.rest.api.v2.model.LdapConfiguration)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 List (java.util.List)2 Map (java.util.Map)2 Properties (java.util.Properties)2 ResourceBundle (java.util.ResourceBundle)2 Predicate (java.util.function.Predicate)2 Collectors (java.util.stream.Collectors)2 PostConstruct (javax.annotation.PostConstruct)2 Inject (javax.inject.Inject)2 Named (javax.inject.Named)2 AuthenticationException (javax.naming.AuthenticationException)2 AuthenticationNotSupportedException (javax.naming.AuthenticationNotSupportedException)2 CommunicationException (javax.naming.CommunicationException)2