001package com.pingidentity.sync.destination;
002
003import com.unboundid.directory.sdk.sync.api.SyncDestination;
004import com.unboundid.directory.sdk.sync.types.SyncOperation;
005import com.unboundid.ldap.sdk.Entry;
006import com.unboundid.ldap.sdk.Modification;
007
008import java.util.List;
009
010/**
011 * This extension is useful when investigating performance
012 * with Sync. It will actually not do anything
013 * and return as quickly as possible to the sync core
014 * to help find bottlenecks and rule out the performance
015 * of the destination system.
016 * <p>
017 * It may also be used to terminate sync pipe in which custom processing is
018 * done as part of a plugin but no actual synchronization is required
019 */
020public class DevNull extends SyncDestination
021{
022    
023    @Override
024    public String getExtensionName()
025    {
026        return "DevNull Sync Destination";
027    }
028    
029    @Override
030    public String[] getExtensionDescription()
031    {
032        return new String[]{"A sync destination that is as fast as it gets. "
033                + "Use this sync destination if you need to test performance of a sync pipe, "
034                + "a sync instance or a sync source that you suspect is a bottleneck in a"
035                + "deployment. This sync destination is stripped of almost all processing"
036                + " so as to be a less likely contention point in a test."};
037    }
038    
039    /**
040     * Performs the necessary processing to compute the end point URL of this instance of the extension
041     *
042     * @return
043     */
044    @Override
045    public String getCurrentEndpointURL()
046    {
047        return "/dev/null";
048    }
049    
050    /**
051     * Performs no processing whatsoever
052     * That's precisely the point
053     *
054     * @param entryToCreate the entry to create
055     * @param operation     the sync operation
056     */
057    @Override
058    public void createEntry(Entry entryToCreate, SyncOperation operation)
059    {
060    }
061    
062    /**
063     * Performs no processing whatsoever
064     * That's precisely the point
065     *
066     * @param entryToModify the entry to modify
067     * @param modsToApply   the list of modifications to apply to the entry at the destination
068     * @param operation     the sync operation
069     */
070    @Override
071    public void modifyEntry(Entry entryToModify, List<Modification> modsToApply, SyncOperation operation)
072    {
073    }
074    
075    
076    /**
077     * Performs no processing whatsoever
078     * That's precisely the point
079     *
080     * @param entryToDelete the entry to delete
081     * @param operation     the sync operation
082     */
083    @Override
084    public void deleteEntry(Entry entryToDelete, SyncOperation operation)
085    {
086    }
087    
088    /**
089     * Performs no processing whatsoever
090     * That's precisely the point
091     *
092     * @param destEntryMappedFromSrc the destination entry to fetch
093     * @param operation              the sync operation
094     * @return a list of matching entries at the destination
095     */
096    public List<Entry> fetchEntry(Entry destEntryMappedFromSrc, SyncOperation operation)
097    {
098        return null;
099    }
100}