001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2008 Sun Microsystems, Inc.
026     */
027    
028    package org.opends.server.backends.jeb.importLDIF;
029    
030    import org.opends.server.backends.jeb.EntryID;
031    
032    /**
033     * Interface defining and import ID set.
034     */
035    public interface ImportIDSet {
036    
037      /**
038       * Add an entry ID to the set.
039       *
040       * @param entryID The entry ID to add.
041       * @param entryLimit The entry limit.
042       * @param maintainCount Maintain count of IDs if in undefined mode.
043       */
044      public void
045      addEntryID(EntryID entryID, int entryLimit, boolean maintainCount);
046    
047      /**
048       * Return if a  set is defined or not.
049       *
050       * @return <CODE>True</CODE> if a set is defined.
051       */
052      public boolean isDefined();
053    
054      /**
055       * Return the memory size of a set.
056       *
057       * @return The sets current memory size.
058       */
059      public int getMemorySize();
060    
061      /**
062       * Convert a set to a byte array suitable for saving to DB.
063       *
064       * @return A byte array representing the set.
065       */
066      public byte[] toDatabase();
067    
068      /**
069       * Return the size of the set.
070       *
071       * @return The size of the ID set.
072       */
073      public int size();
074    
075      /**
076       * Merge a byte array read from DB with a ID set.
077       *
078       * @param dbBytes The byte array read from DB.
079       * @param bufImportIDSet The import ID set to merge.
080       * @param entryLimit The entry limit.
081       * @param maintainCount Maintain count of iDs if in undefined mode.
082       * @return <CODE>True</CODE> if the merged set is undefined.
083       */
084      public boolean merge(byte[] dbBytes, ImportIDSet bufImportIDSet,
085                           int entryLimit, boolean maintainCount);
086    
087      /**
088       * Merge the specified import ID set with the current import ID set using the
089       * specified entry limit an maintain count values.
090       *
091       * @param bufImportIDSet The import ID set to merge.
092       * @param entryLimit The entry limit to use.
093       * @param maintainCount <CODE>True</CODE> if maintain count is being kept.
094       */
095      public void
096      merge(ImportIDSet bufImportIDSet, int entryLimit, boolean maintainCount);
097    
098      /**
099       * Set the import ID set to the undefined state.
100       */
101      public void setUndefined();
102    
103      /**
104       * Return the undefined size.
105       *
106       * @return The undefined count.
107       */
108      public long getUndefinedSize();
109    
110      /**
111       * Reset set.
112       */
113      public void reset();
114    
115      /**
116       * Set the first entry ID to the specified entry ID.
117       *
118       * @param entryID The entry ID to use.
119       */
120      public void setEntryID(EntryID entryID);
121    }