You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by to...@apache.org on 2014/01/20 18:29:59 UTC
svn commit: r1559786 - in
/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication:
agent/impl/ queue/ queue/impl/jobhandling/
Author: tommaso
Date: Mon Jan 20 17:29:59 2014
New Revision: 1559786
URL: http://svn.apache.org/r1559786
Log:
SLING-3327 - applied Marius Petria's patch, added missing files
Added:
sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueItem.java (with props)
sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueProcessor.java (with props)
sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/ReplicationAgentJobConsumer.java (with props)
Removed:
sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/agent/impl/ReplicationAgentJobConsumer.java
Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueItem.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueItem.java?rev=1559786&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueItem.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueItem.java Mon Jan 20 17:29:59 2014
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.replication.queue;
+
+public class ReplicationQueueItem {
+
+ private final String id;
+
+ private final String[] paths;
+
+ private final String action;
+
+ private final String type;
+
+ public ReplicationQueueItem(String id, String[] paths, String action, String type) {
+ this.id = id;
+ this.paths = paths;
+ this.action = action;
+ this.type = type;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String[] getPaths() {
+ return paths;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+
+
+
+
+}
Propchange: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueItem.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueProcessor.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueProcessor.java?rev=1559786&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueProcessor.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueProcessor.java Mon Jan 20 17:29:59 2014
@@ -0,0 +1,6 @@
+package org.apache.sling.replication.queue;
+
+
+public interface ReplicationQueueProcessor {
+ public boolean process(ReplicationQueueItem packageInfo);
+}
Propchange: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/ReplicationQueueProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/ReplicationAgentJobConsumer.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/ReplicationAgentJobConsumer.java?rev=1559786&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/ReplicationAgentJobConsumer.java (added)
+++ sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/ReplicationAgentJobConsumer.java Mon Jan 20 17:29:59 2014
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.replication.queue.impl.jobhandling;
+
+import org.apache.sling.event.jobs.Job;
+import org.apache.sling.event.jobs.consumer.JobConsumer;
+import org.apache.sling.replication.queue.ReplicationQueueItem;
+import org.apache.sling.replication.queue.ReplicationQueueProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.sling.replication.agent.ReplicationAgent;
+import org.apache.sling.replication.queue.impl.jobhandling.JobHandlingUtils;
+
+/**
+ * {@link JobConsumer}Â for {@link ReplicationAgent}s using {@link org.apache.sling.replication.queue.impl.jobhandling.JobHandlingReplicationQueue}
+ */
+public class ReplicationAgentJobConsumer implements JobConsumer {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private final ReplicationAgent agent;
+ private final ReplicationQueueProcessor queueProcessor;
+
+ public ReplicationAgentJobConsumer(ReplicationAgent agent,
+ ReplicationQueueProcessor queueProcessor) {
+ this.agent = agent;
+ this.queueProcessor = queueProcessor;
+ }
+
+ public JobResult process(Job job) {
+ if (log.isInfoEnabled()) {
+ log.info("processing job {}", job.getId());
+ }
+
+ ReplicationQueueItem info = JobHandlingUtils.getPackage(job);
+ boolean processingResult = queueProcessor.process(info);
+ JobResult jobResult = processingResult ? JobResult.OK : JobResult.FAILED;
+
+ log.info("item {} processed {} ", info, jobResult);
+
+ return jobResult;
+ }
+
+}
Propchange: sling/trunk/contrib/extensions/replication/src/main/java/org/apache/sling/replication/queue/impl/jobhandling/ReplicationAgentJobConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native