Search in sources :

Example 1 with SingleQueueDispatchingStrategy

use of org.apache.sling.distribution.queue.impl.SingleQueueDispatchingStrategy in project sling by apache.

the class SimpleDistributionAgentFactory method createAgent.

@Override
protected SimpleDistributionAgent createAgent(String agentName, BundleContext context, Map<String, Object> config, DefaultDistributionLog distributionLog) {
    String serviceName = SettingsUtils.removeEmptyEntry(PropertiesUtil.toString(config.get(SERVICE_NAME), null));
    boolean queueProcessingEnabled = PropertiesUtil.toBoolean(config.get(QUEUE_PROCESSING_ENABLED), true);
    DistributionQueueProvider queueProvider = new JobHandlingDistributionQueueProvider(agentName, jobManager, context);
    DistributionQueueDispatchingStrategy exportQueueStrategy = new SingleQueueDispatchingStrategy();
    DistributionQueueDispatchingStrategy importQueueStrategy = null;
    Set<String> processingQueues = new HashSet<String>();
    processingQueues.addAll(exportQueueStrategy.getQueueNames());
    return new SimpleDistributionAgent(agentName, queueProcessingEnabled, processingQueues, serviceName, packageImporter, packageExporter, requestAuthorizationStrategy, queueProvider, exportQueueStrategy, importQueueStrategy, distributionEventFactory, resourceResolverFactory, slingRepository, distributionLog, null, null, 0);
}
Also used : DistributionQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.DistributionQueueDispatchingStrategy) JobHandlingDistributionQueueProvider(org.apache.sling.distribution.queue.impl.jobhandling.JobHandlingDistributionQueueProvider) DistributionQueueProvider(org.apache.sling.distribution.queue.DistributionQueueProvider) JobHandlingDistributionQueueProvider(org.apache.sling.distribution.queue.impl.jobhandling.JobHandlingDistributionQueueProvider) SingleQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.SingleQueueDispatchingStrategy) HashSet(java.util.HashSet)

Example 2 with SingleQueueDispatchingStrategy

use of org.apache.sling.distribution.queue.impl.SingleQueueDispatchingStrategy in project sling by apache.

the class QueueDistributionAgentFactory method createAgent.

@Override
protected SimpleDistributionAgent createAgent(String agentName, BundleContext context, Map<String, Object> config, DefaultDistributionLog distributionLog) {
    String serviceName = SettingsUtils.removeEmptyEntry(PropertiesUtil.toString(config.get(SERVICE_NAME), null));
    String[] allowedRoots = PropertiesUtil.toStringArray(config.get(ALLOWED_ROOTS), null);
    allowedRoots = SettingsUtils.removeEmptyEntries(allowedRoots);
    Map<String, String> priorityQueues = PropertiesUtil.toMap(config.get(PRIORITY_QUEUES), new String[0]);
    priorityQueues = SettingsUtils.removeEmptyEntries(priorityQueues);
    DistributionQueueProvider queueProvider = new MonitoringDistributionQueueProvider(new JobHandlingDistributionQueueProvider(agentName, jobManager, context), context);
    DistributionQueueDispatchingStrategy exportQueueStrategy = null;
    if (priorityQueues != null) {
        exportQueueStrategy = new PriorityQueueDispatchingStrategy(priorityQueues, new String[] { DistributionQueueDispatchingStrategy.DEFAULT_QUEUE_NAME });
    } else {
        exportQueueStrategy = new SingleQueueDispatchingStrategy();
    }
    DistributionPackageExporter packageExporter = new LocalDistributionPackageExporter(packageBuilder);
    DistributionRequestType[] allowedRequests = new DistributionRequestType[] { DistributionRequestType.ADD, DistributionRequestType.DELETE };
    return new SimpleDistributionAgent(agentName, false, null, serviceName, null, packageExporter, requestAuthorizationStrategy, queueProvider, exportQueueStrategy, null, distributionEventFactory, resourceResolverFactory, slingRepository, distributionLog, allowedRequests, allowedRoots, 0);
}
Also used : DistributionQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.DistributionQueueDispatchingStrategy) JobHandlingDistributionQueueProvider(org.apache.sling.distribution.queue.impl.jobhandling.JobHandlingDistributionQueueProvider) SingleQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.SingleQueueDispatchingStrategy) PriorityQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.PriorityQueueDispatchingStrategy) DistributionPackageExporter(org.apache.sling.distribution.packaging.DistributionPackageExporter) LocalDistributionPackageExporter(org.apache.sling.distribution.packaging.impl.exporter.LocalDistributionPackageExporter) LocalDistributionPackageExporter(org.apache.sling.distribution.packaging.impl.exporter.LocalDistributionPackageExporter) DistributionRequestType(org.apache.sling.distribution.DistributionRequestType) MonitoringDistributionQueueProvider(org.apache.sling.distribution.monitor.impl.MonitoringDistributionQueueProvider) JobHandlingDistributionQueueProvider(org.apache.sling.distribution.queue.impl.jobhandling.JobHandlingDistributionQueueProvider) DistributionQueueProvider(org.apache.sling.distribution.queue.DistributionQueueProvider) MonitoringDistributionQueueProvider(org.apache.sling.distribution.monitor.impl.MonitoringDistributionQueueProvider)

Example 3 with SingleQueueDispatchingStrategy

use of org.apache.sling.distribution.queue.impl.SingleQueueDispatchingStrategy in project sling by apache.

the class ReverseDistributionAgentFactory method createAgent.

@Override
protected SimpleDistributionAgent createAgent(String agentName, BundleContext context, Map<String, Object> config, DefaultDistributionLog distributionLog) {
    String serviceName = SettingsUtils.removeEmptyEntry(PropertiesUtil.toString(config.get(SERVICE_NAME), null));
    boolean queueProcessingEnabled = PropertiesUtil.toBoolean(config.get(QUEUE_PROCESSING_ENABLED), true);
    String[] exporterEndpoints = PropertiesUtil.toStringArray(config.get(EXPORTER_ENDPOINTS), new String[0]);
    exporterEndpoints = SettingsUtils.removeEmptyEntries(exporterEndpoints);
    int pullItems = PropertiesUtil.toInteger(config.get(PULL_ITEMS), Integer.MAX_VALUE);
    Integer timeout = PropertiesUtil.toInteger(HTTP, 10) * 1000;
    HttpConfiguration httpConfiguration = new HttpConfiguration(timeout);
    DistributionPackageExporter packageExporter = new RemoteDistributionPackageExporter(distributionLog, packageBuilder, transportSecretProvider, exporterEndpoints, pullItems, httpConfiguration);
    DistributionPackageImporter packageImporter = new LocalDistributionPackageImporter(agentName, distributionEventFactory, packageBuilder);
    DistributionQueueProvider queueProvider = new MonitoringDistributionQueueProvider(new JobHandlingDistributionQueueProvider(agentName, jobManager, context), context);
    DistributionQueueDispatchingStrategy exportQueueStrategy = new SingleQueueDispatchingStrategy();
    DistributionQueueDispatchingStrategy importQueueStrategy = null;
    DistributionRequestType[] allowedRequests = new DistributionRequestType[] { DistributionRequestType.PULL };
    Set<String> processingQueues = new HashSet<String>();
    processingQueues.addAll(exportQueueStrategy.getQueueNames());
    return new SimpleDistributionAgent(agentName, queueProcessingEnabled, processingQueues, serviceName, packageImporter, packageExporter, requestAuthorizationStrategy, queueProvider, exportQueueStrategy, importQueueStrategy, distributionEventFactory, resourceResolverFactory, slingRepository, distributionLog, allowedRequests, null, 0);
}
Also used : DistributionQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.DistributionQueueDispatchingStrategy) LocalDistributionPackageImporter(org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporter) RemoteDistributionPackageExporter(org.apache.sling.distribution.packaging.impl.exporter.RemoteDistributionPackageExporter) JobHandlingDistributionQueueProvider(org.apache.sling.distribution.queue.impl.jobhandling.JobHandlingDistributionQueueProvider) HttpConfiguration(org.apache.sling.distribution.transport.impl.HttpConfiguration) SingleQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.SingleQueueDispatchingStrategy) RemoteDistributionPackageExporter(org.apache.sling.distribution.packaging.impl.exporter.RemoteDistributionPackageExporter) DistributionPackageExporter(org.apache.sling.distribution.packaging.DistributionPackageExporter) DistributionRequestType(org.apache.sling.distribution.DistributionRequestType) MonitoringDistributionQueueProvider(org.apache.sling.distribution.monitor.impl.MonitoringDistributionQueueProvider) JobHandlingDistributionQueueProvider(org.apache.sling.distribution.queue.impl.jobhandling.JobHandlingDistributionQueueProvider) DistributionQueueProvider(org.apache.sling.distribution.queue.DistributionQueueProvider) LocalDistributionPackageImporter(org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporter) DistributionPackageImporter(org.apache.sling.distribution.packaging.DistributionPackageImporter) MonitoringDistributionQueueProvider(org.apache.sling.distribution.monitor.impl.MonitoringDistributionQueueProvider) HashSet(java.util.HashSet)

Aggregations

DistributionQueueProvider (org.apache.sling.distribution.queue.DistributionQueueProvider)3 DistributionQueueDispatchingStrategy (org.apache.sling.distribution.queue.impl.DistributionQueueDispatchingStrategy)3 SingleQueueDispatchingStrategy (org.apache.sling.distribution.queue.impl.SingleQueueDispatchingStrategy)3 JobHandlingDistributionQueueProvider (org.apache.sling.distribution.queue.impl.jobhandling.JobHandlingDistributionQueueProvider)3 HashSet (java.util.HashSet)2 DistributionRequestType (org.apache.sling.distribution.DistributionRequestType)2 MonitoringDistributionQueueProvider (org.apache.sling.distribution.monitor.impl.MonitoringDistributionQueueProvider)2 DistributionPackageExporter (org.apache.sling.distribution.packaging.DistributionPackageExporter)2 DistributionPackageImporter (org.apache.sling.distribution.packaging.DistributionPackageImporter)1 LocalDistributionPackageExporter (org.apache.sling.distribution.packaging.impl.exporter.LocalDistributionPackageExporter)1 RemoteDistributionPackageExporter (org.apache.sling.distribution.packaging.impl.exporter.RemoteDistributionPackageExporter)1 LocalDistributionPackageImporter (org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporter)1 PriorityQueueDispatchingStrategy (org.apache.sling.distribution.queue.impl.PriorityQueueDispatchingStrategy)1 HttpConfiguration (org.apache.sling.distribution.transport.impl.HttpConfiguration)1