From 975c043fb68244888e4f4b08583b4704dc3c9076 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 21 Jun 2011 20:52:08 +0000
Subject: [PATCH] Partial fix for OPENDJ-205: Add support for rejecting and skipping records to the LDIF readers

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java |   50 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
index 1759a1e..f64b02e 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
@@ -2446,12 +2446,16 @@
 
 
   /**
-   * Indicates whether or not this schema is strict. Attribute type queries in
-   * non-strict schema always succeed: if the requested attribute type is not
-   * found then a temporary attribute type is created automatically having the
-   * Octet String syntax and associated matching rules. Strict schema, on the
-   * other hand, throw an {@link UnknownSchemaElementException} whenever an
-   * attempt is made to retrieve a non-existent attribute type.
+   * Indicates whether or not this schema is strict.
+   * <p>
+   * Attribute type queries against non-strict schema always succeed: if the
+   * requested attribute type is not found then a temporary attribute type is
+   * created automatically having the Octet String syntax and associated
+   * matching rules.
+   * <p>
+   * Strict schema, on the other hand, throw an
+   * {@link UnknownSchemaElementException} whenever an attempt is made to
+   * retrieve a non-existent attribute type.
    *
    * @return {@code true} if this schema is strict.
    */
@@ -2463,16 +2467,14 @@
 
 
   /**
-   * Returns a non-strict view of this schema. Attribute type queries in
-   * non-strict schema always succeed: if the requested attribute type is not
-   * found then a temporary attribute type is created automatically having the
-   * Octet String syntax and associated matching rules. Strict schema, on the
-   * other hand, throw an {@link UnknownSchemaElementException} whenever an
-   * attempt is made to retrieve a non-existent attribute type.
+   * Returns a non-strict view of this schema.
+   * <p>
+   * See the description of {@link #isStrict()} for more details.
    *
    * @return A non-strict view of this schema.
+   * @see Schema#isStrict()
    */
-  public Schema nonStrict()
+  public Schema asNonStrictSchema()
   {
     if (impl.isStrict())
     {
@@ -2487,6 +2489,28 @@
 
 
   /**
+   * Returns a strict view of this schema.
+   * <p>
+   * See the description of {@link #isStrict()} for more details.
+   *
+   * @return A strict view of this schema.
+   * @see Schema#isStrict()
+   */
+  public Schema asStrictSchema()
+  {
+    if (impl.isStrict())
+    {
+      return this;
+    }
+    else
+    {
+      return new Schema(((NonStrictImpl) impl).strictImpl);
+    }
+  }
+
+
+
+  /**
    * Adds the definitions of all the schema elements contained in this schema to
    * the provided subschema subentry. Any existing attributes (including schema
    * definitions) contained in the provided entry will be preserved.

--
Gitblit v1.10.0