Search in sources :

Example 1 with CacheConfiguration

use of org.apache.archiva.configuration.model.CacheConfiguration in project archiva by apache.

the class ConfigurationRegistryReader method readRedbackRuntimeConfiguration.

private RedbackRuntimeConfiguration readRedbackRuntimeConfiguration(String prefix, Registry registry) {
    RedbackRuntimeConfiguration value = new RedbackRuntimeConfiguration();
    boolean migratedFromRedbackConfiguration = registry.getBoolean(prefix + "migratedFromRedbackConfiguration", value.isMigratedFromRedbackConfiguration());
    value.setMigratedFromRedbackConfiguration(migratedFromRedbackConfiguration);
    java.util.List userManagerImpls = new java.util.ArrayList();
    userManagerImpls.addAll(registry.getList(prefix + "userManagerImpls.userManagerImpl"));
    value.setUserManagerImpls(userManagerImpls);
    java.util.List rbacManagerImpls = new java.util.ArrayList();
    rbacManagerImpls.addAll(registry.getList(prefix + "rbacManagerImpls.rbacManagerImpl"));
    value.setRbacManagerImpls(rbacManagerImpls);
    LdapConfiguration ldapConfiguration = readLdapConfiguration(prefix + "ldapConfiguration.", registry);
    value.setLdapConfiguration(ldapConfiguration);
    java.util.List ldapGroupMappings = new java.util.ArrayList();
    List ldapGroupMappingsSubsets = registry.getSubsetList(prefix + "ldapGroupMappings.ldapGroupMapping");
    for (Iterator i = ldapGroupMappingsSubsets.iterator(); i.hasNext(); ) {
        LdapGroupMapping v = readLdapGroupMapping("", (Registry) i.next());
        ldapGroupMappings.add(v);
    }
    value.setLdapGroupMappings(ldapGroupMappings);
    java.util.Map configurationProperties = registry.getProperties(prefix + "configurationProperties");
    value.setConfigurationProperties(configurationProperties);
    boolean useUsersCache = registry.getBoolean(prefix + "useUsersCache", value.isUseUsersCache());
    value.setUseUsersCache(useUsersCache);
    CacheConfiguration usersCacheConfiguration = readCacheConfiguration(prefix + "usersCacheConfiguration.", registry);
    value.setUsersCacheConfiguration(usersCacheConfiguration);
    return value;
}
Also used : List(java.util.List) LdapGroupMapping(org.apache.archiva.configuration.model.LdapGroupMapping) Iterator(java.util.Iterator) LdapConfiguration(org.apache.archiva.configuration.model.LdapConfiguration) List(java.util.List) RedbackRuntimeConfiguration(org.apache.archiva.configuration.model.RedbackRuntimeConfiguration) CacheConfiguration(org.apache.archiva.configuration.model.CacheConfiguration)

Example 2 with CacheConfiguration

use of org.apache.archiva.configuration.model.CacheConfiguration in project archiva by apache.

the class ConfigurationRegistryReader method readArchivaRuntimeConfiguration.

private ArchivaRuntimeConfiguration readArchivaRuntimeConfiguration(String prefix, Registry registry) {
    ArchivaRuntimeConfiguration value = new ArchivaRuntimeConfiguration();
    CacheConfiguration urlFailureCacheConfiguration = readCacheConfiguration(prefix + "urlFailureCacheConfiguration.", registry);
    value.setUrlFailureCacheConfiguration(urlFailureCacheConfiguration);
    FileLockConfiguration fileLockConfiguration = readFileLockConfiguration(prefix + "fileLockConfiguration.", registry);
    value.setFileLockConfiguration(fileLockConfiguration);
    // String dataDirectory = registry.getString( prefix + "dataDirectory", value.getDataDirectory() );
    List<String> dataDirectoryList = registry.getList(prefix + "dataDirectory");
    String dataDirectory = value.getDataDirectory();
    if (dataDirectoryList != null && !dataDirectoryList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = dataDirectoryList.size(); i < size; i++) {
            sb.append(dataDirectoryList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        dataDirectory = sb.toString();
    }
    value.setDataDirectory(dataDirectory);
    // String repositoryBaseDirectory = registry.getString( prefix + "repositoryBaseDirectory", value.getRepositoryBaseDirectory() );
    List<String> repositoryBaseDirectoryList = registry.getList(prefix + "repositoryBaseDirectory");
    String repositoryBaseDirectory = value.getRepositoryBaseDirectory();
    if (repositoryBaseDirectoryList != null && !repositoryBaseDirectoryList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = repositoryBaseDirectoryList.size(); i < size; i++) {
            sb.append(repositoryBaseDirectoryList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        repositoryBaseDirectory = sb.toString();
    }
    value.setRepositoryBaseDirectory(repositoryBaseDirectory);
    // String remoteRepositoryBaseDirectory = registry.getString( prefix + "remoteRepositoryBaseDirectory", value.getRemoteRepositoryBaseDirectory() );
    List<String> remoteRepositoryBaseDirectoryList = registry.getList(prefix + "remoteRepositoryBaseDirectory");
    String remoteRepositoryBaseDirectory = value.getRemoteRepositoryBaseDirectory();
    if (remoteRepositoryBaseDirectoryList != null && !remoteRepositoryBaseDirectoryList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = remoteRepositoryBaseDirectoryList.size(); i < size; i++) {
            sb.append(remoteRepositoryBaseDirectoryList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        remoteRepositoryBaseDirectory = sb.toString();
    }
    value.setRemoteRepositoryBaseDirectory(remoteRepositoryBaseDirectory);
    // String defaultLanguage = registry.getString( prefix + "defaultLanguage", value.getDefaultLanguage() );
    List<String> repositoryGroupBaseDirectoryList = registry.getList(prefix + "repositoryGroupBaseDirectory");
    String repositoryGroupBaseDirectory = value.getRepositoryGroupBaseDirectory();
    if (repositoryGroupBaseDirectoryList != null && !repositoryGroupBaseDirectoryList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = repositoryGroupBaseDirectoryList.size(); i < size; i++) {
            sb.append(repositoryGroupBaseDirectoryList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        repositoryGroupBaseDirectory = sb.toString();
    }
    value.setRepositoryGroupBaseDirectory(repositoryGroupBaseDirectory);
    List<String> defaultLanguageList = registry.getList(prefix + "defaultLanguage");
    String defaultLanguage = value.getDefaultLanguage();
    if (defaultLanguageList != null && !defaultLanguageList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = defaultLanguageList.size(); i < size; i++) {
            sb.append(defaultLanguageList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        defaultLanguage = sb.toString();
    }
    value.setDefaultLanguage(defaultLanguage);
    // String languageRange = registry.getString( prefix + "languageRange", value.getLanguageRange() );
    List<String> languageRangeList = registry.getList(prefix + "languageRange");
    String languageRange = value.getLanguageRange();
    if (languageRangeList != null && !languageRangeList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = languageRangeList.size(); i < size; i++) {
            sb.append(languageRangeList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        languageRange = sb.toString();
    }
    value.setLanguageRange(languageRange);
    List<String> checksumTypeList = registry.getList(prefix + "checksumTypes.type");
    value.setChecksumTypes(checksumTypeList);
    return value;
}
Also used : ArchivaRuntimeConfiguration(org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration) CacheConfiguration(org.apache.archiva.configuration.model.CacheConfiguration) FileLockConfiguration(org.apache.archiva.configuration.model.FileLockConfiguration)

Example 3 with CacheConfiguration

use of org.apache.archiva.configuration.model.CacheConfiguration in project archiva by apache.

the class ConfigurationRegistryReader method readCacheConfiguration.

private CacheConfiguration readCacheConfiguration(String prefix, Registry registry) {
    CacheConfiguration value = new CacheConfiguration();
    int timeToIdleSeconds = registry.getInt(prefix + "timeToIdleSeconds", value.getTimeToIdleSeconds());
    value.setTimeToIdleSeconds(timeToIdleSeconds);
    int timeToLiveSeconds = registry.getInt(prefix + "timeToLiveSeconds", value.getTimeToLiveSeconds());
    value.setTimeToLiveSeconds(timeToLiveSeconds);
    int maxElementsInMemory = registry.getInt(prefix + "maxElementsInMemory", value.getMaxElementsInMemory());
    value.setMaxElementsInMemory(maxElementsInMemory);
    int maxElementsOnDisk = registry.getInt(prefix + "maxElementsOnDisk", value.getMaxElementsOnDisk());
    value.setMaxElementsOnDisk(maxElementsOnDisk);
    return value;
}
Also used : CacheConfiguration(org.apache.archiva.configuration.model.CacheConfiguration)

Aggregations

CacheConfiguration (org.apache.archiva.configuration.model.CacheConfiguration)3 Iterator (java.util.Iterator)1 List (java.util.List)1 ArchivaRuntimeConfiguration (org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration)1 FileLockConfiguration (org.apache.archiva.configuration.model.FileLockConfiguration)1 LdapConfiguration (org.apache.archiva.configuration.model.LdapConfiguration)1 LdapGroupMapping (org.apache.archiva.configuration.model.LdapGroupMapping)1 RedbackRuntimeConfiguration (org.apache.archiva.configuration.model.RedbackRuntimeConfiguration)1