directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r504772 - /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
Date Thu, 08 Feb 2007 02:58:28 GMT
Author: akarasulu
Date: Wed Feb  7 18:58:27 2007
New Revision: 504772

URL: http://svn.apache.org/viewvc?view=rev&rev=504772
Log:
adding rendering capabilities to comparators, normalizers, and syntaxCheckers

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java?view=diff&rev=504772&r1=504771&r2=504772
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
Wed Feb  7 18:58:27 2007
@@ -20,6 +20,8 @@
 package org.apache.directory.shared.ldap.schema;
 
 
+import java.util.List;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -28,6 +30,8 @@
 
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.schema.syntax.AbstractAdsSchemaDescription;
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
 
 
 /**
@@ -795,12 +799,7 @@
 
         buf.append( " X-SCHEMA '" );
         buf.append( dsr.getSchema() );
-        buf.append( "'" );
-
-        // @todo extensions are not presently supported and skipped
-        // the extensions would go here before closing off the description
-
-        buf.append( " )" );
+        buf.append( "' )" );
 
         return buf;
     }
@@ -822,13 +821,46 @@
 
         buf.append( " X-SCHEMA '" );
         buf.append( nf.getSchema() );
-        buf.append( "'" );
+        buf.append( "' )" );
 
-        // @todo extensions are not presently supported and skipped
-        // the extensions would go here before closing off the description
+        return buf;
+    }
 
-        buf.append( " )" );
 
+    public static StringBuffer render( AbstractAdsSchemaDescription description )
+    {
+        StringBuffer buf = new StringBuffer();
+        buf.append( "( " ).append( description.getNumericOid() );
+        
+        if ( description.getDescription() != null )
+        {
+            buf.append( "DESC " ).append( "'" ).append( description.getDescription() ).append(
"' " );
+        }
+
+        buf.append( "FQCN " ).append( description.getFqcn() );
+        
+        if ( description.getBytecode() != null )
+        {
+            buf.append( "BYTECODE " ).append( description.getBytecode() );
+        }
+        
+        buf.append( " X-SCHEMA '" );
+        buf.append( getSchema( description ) );
+        buf.append( "' )" );
+        
         return buf;
+    }
+    
+    
+    private static String getSchema( AbstractSchemaDescription desc )
+    {
+        List<String> values = desc.getExtensions().get( "X-SCHEMA" );
+        
+        if ( values == null || values.size() == 0 )
+        {
+            return "other";
+        }
+        
+        return values.get( 0 );
     }
 }



Mime
View raw message