本文整理汇总了Java中com.day.cq.replication.ReplicationOptions类的典型用法代码示例。如果您正苦于以下问题:Java ReplicationOptions类的具体用法?Java ReplicationOptions怎么用?Java ReplicationOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReplicationOptions类属于com.day.cq.replication包,在下文中一共展示了ReplicationOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Override
public void activate(String queryLanguage, String queryStatement) {
// Create leanest replication options for activation
ReplicationOptions options = new ReplicationOptions();
// Do not create new versions as this adds to overhead
options.setSuppressVersions(true);
// Avoid sling job overhead by forcing synchronous. Note this will result in serial activation.
options.setSynchronous(true);
// Do NOT suppress status update of resource (set replication properties accordingly)
options.setSuppressStatusUpdate(false);
// Track replication activity for reporting via the MBean get methods
final ReplicationInfo replicationInfo = new ReplicationInfo(queryLanguage, queryStatement, ReplicationActionType.ACTIVATE);
this.replicationInfo.put(replicationInfo.getId(), replicationInfo);
this.replicate(queryLanguage, queryStatement, ReplicationActionType.ACTIVATE, options, replicationInfo);
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:18,代码来源:SampleContentReplicationHarnessImpl.java
示例2: init
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Override
public void init() throws RepositoryException {
if (mode == Mode.MOVE) {
String nodeName = sourcePath.substring(sourcePath.lastIndexOf('/'));
destinationPath += nodeName;
}
replicationOptions = new ReplicationOptions();
switch (publishMethod) {
case SELF_MANAGED:
replicationOptions.setSynchronous(true);
break;
default:
replicationOptions.setSynchronous(false);
break;
}
replicationOptions.setSuppressVersions(!createVerionsOnReplicate);
replicationOptions.setSuppressStatusUpdate(!updateStatus);
if (referenceSearchRoot == null || referenceSearchRoot.trim().isEmpty()) {
referenceSearchRoot = "/";
}
}
示例3: replicate
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Override
public void replicate(Session session, ReplicationActionType actionType, String path, ReplicationOptions replicationOptions) throws ReplicationException {
Map<String, ReplicationOptions> queue;
switch (actionType) {
case ACTIVATE:
queue = activateOperations;
break;
case DEACTIVATE:
case DELETE:
queue = deactivateOperations;
break;
default:
queue = null;
}
if (queue != null) {
queue.put(path, replicationOptions);
}
}
示例4: testFlush
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Test
public void testFlush() throws Exception {
final ResourceResolver resourceResolver = mock(ResourceResolver.class);
final Session session = mock(Session.class);
when(resourceResolver.adaptTo(Session.class)).thenReturn(session);
final String path1 = "/content/foo";
final String path2 = "/content/bar";
dispatcherFlusher.flush(resourceResolver, path1, path2);
verify(replicator, times(1)).replicate(eq(session), eq(ReplicationActionType.ACTIVATE), eq(path1),
any(ReplicationOptions.class));
verify(replicator, times(1)).replicate(eq(session), eq(ReplicationActionType.ACTIVATE), eq(path2),
any(ReplicationOptions.class));
verifyNoMoreInteractions(replicator);
}
示例5: testFlush_2
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Test
public void testFlush_2() throws Exception {
final ResourceResolver resourceResolver = mock(ResourceResolver.class);
final Session session = mock(Session.class);
when(resourceResolver.adaptTo(Session.class)).thenReturn(session);
final ReplicationActionType actionType = ReplicationActionType.DELETE;
final boolean synchronous = false;
final String path1 = "/content/foo";
final String path2 = "/content/bar";
dispatcherFlusher.flush(resourceResolver, actionType, synchronous, path1, path2);
verify(replicator, times(1)).replicate(eq(session), eq(actionType), eq(path1),
any(ReplicationOptions.class));
verify(replicator, times(1)).replicate(eq(session), eq(actionType), eq(path2),
any(ReplicationOptions.class));
verifyNoMoreInteractions(replicator);
}
示例6: accepts
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
/**
* Checks if this service should react to or ignore this replication action.
*
* @param replicationAction The replication action that is initiating this flush request
* @param replicationOptions The replication options that is initiating this flush request
* @return true is this service should attempt to flush associated resources for this replication request
*/
private boolean accepts(final ReplicationAction replicationAction, final ReplicationOptions replicationOptions) {
if (replicationAction == null || replicationOptions == null) {
log.debug("Replication Action or Options are null. Skipping this replication.");
return false;
}
final String path = replicationAction.getPath();
if (replicationOptions.getFilter() instanceof DispatcherFlushRulesFilter) {
log.debug("Ignore applying dispatcher flush rules for [ {} ], as it originated from this "
+ "Service.", path);
return false;
} else if ((this.hierarchicalFlushRules == null || this.hierarchicalFlushRules.size() < 1)
&& (this.resourceOnlyFlushRules == null || this.resourceOnlyFlushRules.size() < 1)) {
log.warn("Ignored due no configured flush rules.");
return false;
} else if (StringUtils.isBlank(path)) {
// Do nothing on blank paths
log.debug("Replication Action path is blank. Skipping this replication.");
return false;
} else if (!ReplicationActionType.ACTIVATE.equals(replicationAction.getType())
&& !ReplicationActionType.DEACTIVATE.equals(replicationAction.getType())
&& !ReplicationActionType.DELETE.equals(replicationAction.getType())) {
// Ignoring non-modifying ReplicationActionTypes
return false;
}
return true;
}
示例7: flush
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final Map<Agent, ReplicationResult> flush(final ResourceResolver resourceResolver,
final ReplicationActionType actionType,
final boolean synchronous,
final AgentFilter agentFilter,
final String... paths) throws ReplicationException {
final ReplicationOptions options = new ReplicationOptions();
final ReplicationResultListener listener = new ReplicationResultListener();
options.setFilter(agentFilter);
options.setSynchronous(synchronous);
options.setSuppressStatusUpdate(true);
options.setSuppressVersions(true);
options.setListener(listener);
for (final String path : paths) {
if (log.isDebugEnabled()) {
log.debug("--------------------------------------------------------------------------------");
log.debug("Issuing Dispatcher Flush (via AEM Replication API) request for: {}", path);
log.debug(" > Synchronous: {}", options.isSynchronous());
log.debug(" > Replication Action Type: {}", actionType.name());
}
replicator.replicate(resourceResolver.adaptTo(Session.class),
actionType, path, options);
}
return listener.getResults();
}
示例8: activateAllWithRoundRobin
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
/**
* Activate all nodes using provided options NOTE: If using large batch
* publishing it is highly recommended to set synchronous to true on the
* replication options
*
* @param options
* @return
*/
public static final CheckedBiConsumer<ResourceResolver, String> activateAllWithRoundRobin(final Replicator replicator, final ReplicationOptions... options) {
final List<ReplicationOptions> allTheOptions = Arrays.asList(options);
final Iterator<ReplicationOptions> roundRobin = new RoundRobin(allTheOptions).iterator();
return (ResourceResolver r, String path) -> {
nameThread(PREFIX_ACTIVATE + path);
replicator.replicate(r.adaptTo(Session.class), ReplicationActionType.ACTIVATE, path, roundRobin.next());
};
}
示例9: deactivateAllWithOptions
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
/**
* Deactivate all nodes using provided options
*
* @param options
* @return
*/
public static final CheckedBiConsumer<ResourceResolver, String> deactivateAllWithOptions(final Replicator replicator, final ReplicationOptions options) {
return (ResourceResolver r, String path) -> {
nameThread(PREFIX_DEACTIVATE + path);
replicator.replicate(r.adaptTo(Session.class), ReplicationActionType.DEACTIVATE, path, options);
};
}
示例10: getReplicationOptions
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
public ReplicationOptions getReplicationOptions(Resource content) {
if (agents.size() == 1 && BRAND_PORTAL_AGENTS.equals(agents.get(0))) {
replicationOptions.setFilter(new BrandPortalAgentFilter(content));
} else {
replicationOptions.setFilter(new AgentIdsAgentFilter(agents));
}
return replicationOptions;
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:10,代码来源:ReplicateWithOptionsWorkflowProcess.java
示例11: testPreprocess_notAccepts_ReplicationActionIsNull
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionIsNull() throws Exception {
when(this.hierarchicalFlushRules.size()).thenReturn(9);
when(this.resourceOnlyFlushRules.size()).thenReturn(9);
dispatcherFlushRules.preprocess(null, new ReplicationOptions());
verifyZeroInteractions(dispatcherFlusher);
}
示例12: testPreprocess_notAccepts_ReplicationActionNoFlushRules
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionNoFlushRules() throws Exception {
when(this.hierarchicalFlushRules.size()).thenReturn(0);
when(this.resourceOnlyFlushRules.size()).thenReturn(0);
final ReplicationAction replicationAction = mock(ReplicationAction.class);
when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons");
dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());
verifyZeroInteractions(dispatcherFlusher);
}
示例13: testPreprocess_notAccepts_ReplicationActionPathEmpty
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionPathEmpty() throws Exception {
when(this.hierarchicalFlushRules.size()).thenReturn(9);
when(this.resourceOnlyFlushRules.size()).thenReturn(9);
final ReplicationAction replicationAction = mock(ReplicationAction.class);
when(replicationAction.getPath()).thenReturn("");
dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());
verifyZeroInteractions(dispatcherFlusher);
}
示例14: testPreprocess_notAccepts_ReplicationActionPathNull
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionPathNull() throws Exception {
when(this.hierarchicalFlushRules.size()).thenReturn(9);
when(this.resourceOnlyFlushRules.size()).thenReturn(9);
final ReplicationAction replicationAction = mock(ReplicationAction.class);
when(replicationAction.getPath()).thenReturn(null);
dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());
verifyZeroInteractions(dispatcherFlusher);
}
示例15: testPreprocess_notAccepts_ReplicationActionTypeInternalPoll
import com.day.cq.replication.ReplicationOptions; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionTypeInternalPoll() throws Exception {
when(this.hierarchicalFlushRules.size()).thenReturn(9);
when(this.resourceOnlyFlushRules.size()).thenReturn(9);
final ReplicationAction replicationAction = mock(ReplicationAction.class);
when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons");
when(replicationAction.getType()).thenReturn(ReplicationActionType.INTERNAL_POLL);
dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());
verifyZeroInteractions(dispatcherFlusher);
}