mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

boli
24.14.2007 14809a0c5e44468632e3ddf56000c88bacaec0aa
opends/src/server/org/opends/server/backends/jeb/DataConfig.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.backends.jeb;
import org.opends.server.types.EntryEncodeConfig;
/**
 * Configuration class to indicate desired compression and cryptographic options
 * for the data stored in the database.
@@ -37,7 +39,24 @@
   */
  private boolean compressed = false;
  /**
   * The configuration to use when encoding entries in the database.
   */
  private EntryEncodeConfig encodeConfig = new EntryEncodeConfig();
  /**
   * Constrct a new DataConfig object with the specified settings.
   *
   * @param compressed true if data should be compressed, false if not.
   * @param compactEncoding true if data should be encoded in compact form,
   * false if not.
   */
  public DataConfig(boolean compressed, boolean compactEncoding)
  {
    this.compressed = compressed;
    this.encodeConfig = new EntryEncodeConfig(false, compactEncoding,
                                              compactEncoding);
  }
  /**
   * Determine whether data should be compressed before writing to the database.
@@ -48,6 +67,16 @@
    return compressed;
  }
  /**
   * Determine whether entries should be encoded with the compact form before
   * writing to the database.
   * @return true if data should be encoded in the compact form.
   */
  public boolean isCompactEncoding()
  {
    return encodeConfig.compressAttributeDescriptions();
  }
  /**
@@ -60,16 +89,38 @@
  }
  /**
   * Configure whether data should be encoded with the compact form before
   * writing to the database.
   * @param compactEncoding true if data should be encoded in compact form,
   * false if not.
   */
  public void setCompactEncoding(boolean compactEncoding)
  {
    this.encodeConfig = new EntryEncodeConfig(false, compactEncoding,
                                              compactEncoding);
  }
  /**
   * Get the EntryEncodeConfig object in use by this configuration.
   * @return the EntryEncodeConfig object in use by this configuration.
   */
  public EntryEncodeConfig getEntryEncodeConfig()
  {
    return this.encodeConfig;
  }
  /**
   * Get a string representation of this object.
   * @return A string representation of this object.
   */
  public String toString()
  {
    StringBuilder builder = new StringBuilder();
    if (compressed)
    {
      builder.append("[compressed]");
    }
    builder.append("DataConfig(compressed=");
    builder.append(compressed);
    builder.append(", ");
    encodeConfig.toString(builder);
    builder.append(")");
    return builder.toString();
  }
}