當前位置: 首頁>>代碼示例>>Java>>正文


Java ReplicationOptions類代碼示例

本文整理匯總了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 = "/";
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:24,代碼來源:PageRelocator.java

示例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);
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:19,代碼來源:ReplicatorQueue.java

示例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);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:20,代碼來源:DispatcherFlusherImplTest.java

示例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);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:23,代碼來源:DispatcherFlusherImplTest.java

示例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;
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:37,代碼來源:DispatcherFlushRulesImpl.java

示例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();
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:33,代碼來源:DispatcherFlusherImpl.java

示例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());
    };
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:17,代碼來源:ReplicationActions.java

示例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);
    };
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:13,代碼來源:ReplicationActions.java

示例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);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:10,代碼來源:DispatcherFlushRulesImplTest.java

示例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);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:13,代碼來源:DispatcherFlushRulesImplTest.java

示例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);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:13,代碼來源:DispatcherFlushRulesImplTest.java

示例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);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:13,代碼來源:DispatcherFlushRulesImplTest.java

示例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);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:14,代碼來源:DispatcherFlushRulesImplTest.java


注:本文中的com.day.cq.replication.ReplicationOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。