Search in sources :

Example 1 with SyncConnectorConfiguration

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

the class ConfigurationRegistryReader method readSyncConnectorConfiguration.

private SyncConnectorConfiguration readSyncConnectorConfiguration(String prefix, Registry registry) {
    SyncConnectorConfiguration value = new SyncConnectorConfiguration();
    // String cronExpression = registry.getString( prefix + "cronExpression", value.getCronExpression() );
    List<String> cronExpressionList = registry.getList(prefix + "cronExpression");
    String cronExpression = value.getCronExpression();
    if (cronExpressionList != null && !cronExpressionList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = cronExpressionList.size(); i < size; i++) {
            sb.append(cronExpressionList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        cronExpression = sb.toString();
    }
    value.setCronExpression(cronExpression);
    // String method = registry.getString( prefix + "method", value.getMethod() );
    List<String> methodList = registry.getList(prefix + "method");
    String method = value.getMethod();
    if (methodList != null && !methodList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = methodList.size(); i < size; i++) {
            sb.append(methodList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        method = sb.toString();
    }
    value.setMethod(method);
    // String sourceRepoId = registry.getString( prefix + "sourceRepoId", value.getSourceRepoId() );
    List<String> sourceRepoIdList = registry.getList(prefix + "sourceRepoId");
    String sourceRepoId = value.getSourceRepoId();
    if (sourceRepoIdList != null && !sourceRepoIdList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = sourceRepoIdList.size(); i < size; i++) {
            sb.append(sourceRepoIdList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        sourceRepoId = sb.toString();
    }
    value.setSourceRepoId(sourceRepoId);
    // String targetRepoId = registry.getString( prefix + "targetRepoId", value.getTargetRepoId() );
    List<String> targetRepoIdList = registry.getList(prefix + "targetRepoId");
    String targetRepoId = value.getTargetRepoId();
    if (targetRepoIdList != null && !targetRepoIdList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = targetRepoIdList.size(); i < size; i++) {
            sb.append(targetRepoIdList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        targetRepoId = sb.toString();
    }
    value.setTargetRepoId(targetRepoId);
    // String proxyId = registry.getString( prefix + "proxyId", value.getProxyId() );
    List<String> proxyIdList = registry.getList(prefix + "proxyId");
    String proxyId = value.getProxyId();
    if (proxyIdList != null && !proxyIdList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = proxyIdList.size(); i < size; i++) {
            sb.append(proxyIdList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        proxyId = sb.toString();
    }
    value.setProxyId(proxyId);
    java.util.List blackListPatterns = new java.util.ArrayList();
    blackListPatterns.addAll(registry.getList(prefix + "blackListPatterns.blackListPattern"));
    value.setBlackListPatterns(blackListPatterns);
    java.util.List whiteListPatterns = new java.util.ArrayList();
    whiteListPatterns.addAll(registry.getList(prefix + "whiteListPatterns.whiteListPattern"));
    value.setWhiteListPatterns(whiteListPatterns);
    java.util.Map policies = registry.getProperties(prefix + "policies");
    value.setPolicies(policies);
    java.util.Map properties = registry.getProperties(prefix + "properties");
    value.setProperties(properties);
    boolean disabled = registry.getBoolean(prefix + "disabled", value.isDisabled());
    value.setDisabled(disabled);
    return value;
}
Also used : List(java.util.List) SyncConnectorConfiguration(org.apache.archiva.configuration.model.SyncConnectorConfiguration)

Aggregations

List (java.util.List)1 SyncConnectorConfiguration (org.apache.archiva.configuration.model.SyncConnectorConfiguration)1