Search in sources :

Example 1 with FileLockConfiguration

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

the class ConfigurationRegistryReader method readFileLockConfiguration.

private FileLockConfiguration readFileLockConfiguration(String prefix, Registry registry) {
    FileLockConfiguration value = new FileLockConfiguration();
    boolean skipLocking = registry.getBoolean(prefix + "skipLocking", value.isSkipLocking());
    value.setSkipLocking(skipLocking);
    int lockingTimeout = registry.getInt(prefix + "lockingTimeout", value.getLockingTimeout());
    value.setLockingTimeout(lockingTimeout);
    return value;
}
Also used : FileLockConfiguration(org.apache.archiva.configuration.model.FileLockConfiguration)

Example 2 with FileLockConfiguration

use of org.apache.archiva.configuration.model.FileLockConfiguration 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)

Aggregations

FileLockConfiguration (org.apache.archiva.configuration.model.FileLockConfiguration)2 ArchivaRuntimeConfiguration (org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration)1 CacheConfiguration (org.apache.archiva.configuration.model.CacheConfiguration)1