directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r495316 - in /directory/trunks/shared/convert: ./ src/ src/main/ src/main/antlr/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/shared/ src/main/java/org/ap...
Date Thu, 11 Jan 2007 18:20:16 GMT
Author: elecharny
Date: Thu Jan 11 10:20:14 2007
New Revision: 495316

URL: http://svn.apache.org/viewvc?view=rev&rev=495316
Log:
Added a first drop of the new project : Schema to ldif converter

Added:
    directory/trunks/shared/convert/
    directory/trunks/shared/convert/pom.xml
    directory/trunks/shared/convert/src/
    directory/trunks/shared/convert/src/main/
    directory/trunks/shared/convert/src/main/antlr/
    directory/trunks/shared/convert/src/main/antlr/schema.g
    directory/trunks/shared/convert/src/main/java/
    directory/trunks/shared/convert/src/main/java/org/
    directory/trunks/shared/convert/src/main/java/org/apache/
    directory/trunks/shared/convert/src/main/java/org/apache/directory/
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java   (with props)
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java   (with props)
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java   (with props)
    directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java
    directory/trunks/shared/convert/src/test/
    directory/trunks/shared/convert/src/test/java/
    directory/trunks/shared/convert/src/test/java/org/
    directory/trunks/shared/convert/src/test/java/org/apache/
    directory/trunks/shared/convert/src/test/java/org/apache/directory/
    directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/
    directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/converter/
    directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/converter/schema/
    directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/converter/schema/TestSchemaToLdif.java
    directory/trunks/shared/convert/src/test/resources/
    directory/trunks/shared/convert/src/test/resources/org/
    directory/trunks/shared/convert/src/test/resources/org/apache/
    directory/trunks/shared/convert/src/test/resources/org/apache/directory/
    directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/
    directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/converter/
    directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/converter/schema/
    directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/converter/schema/test.schema

Added: directory/trunks/shared/convert/pom.xml
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/pom.xml?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/pom.xml (added)
+++ directory/trunks/shared/convert/pom.xml Thu Jan 11 10:20:14 2007
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.shared</groupId>
+    <artifactId>build</artifactId>
+    <version>0.9.6-SNAPSHOT</version>
+  </parent>
+  <artifactId>shared-converter</artifactId>
+  <name>Apache Directory Protocol Ldap Converters</name>
+  <inceptionYear>2007</inceptionYear>
+
+  <issueManagement>
+    <system>jira</system>
+    <url>http://issues.apache.org/jira/browse/DIRSERVER</url>
+  </issueManagement>
+
+  <distributionManagement>
+    <site>
+      <id>apache.websites</id>
+      <url>scp://minotaur.apache.org/www/directory.apache.org/subprojects/ldap/common</url>
+    </site>
+  </distributionManagement>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/directory/trunks/shared/convert</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/directory/trunks/shared/convert</developerConnection>
+  </scm>
+
+  <ciManagement>
+    <notifiers>
+      <notifier>
+        <type>mail</type>
+        <address>dev@directory.apache.org</address>
+      </notifier>
+    </notifiers>
+  </ciManagement>
+
+  <description>
+    Common LDAP converters : LDIF, DSML, CSV, etc
+  </description>
+
+  <mailingLists>
+    <mailingList>
+      <name>Apache Directory Project</name>
+      <subscribe>dev-subscribe@directory.apache.org</subscribe>
+      <unsubscribe>dev-unsubscribe@directory.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/mod_mbox/dev/</archive>
+      <otherArchives>
+        <otherArchive>http://www.archivum.info/dev@directory.apache.org/</otherArchive>
+      </otherArchives>
+    </mailingList>
+  </mailingLists>
+
+  <licenses>
+    <license>
+      <name>Apache 2.0 License</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>nlog4j</artifactId>
+      <version>1.2.25</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.shared</groupId>
+      <artifactId>shared-ldap</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>antlr</groupId>
+      <artifactId>antlr</artifactId>
+      <version>2.7.6</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>generate-sources</phase>
+            <configuration/>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antlr-plugin</artifactId>
+        <configuration>
+          <grammars>schema.g</grammars>
+        </configuration>
+        <executions>
+           <execution>
+              <goals>
+                 <goal>generate</goal>
+              </goals>
+           </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+          <debug>true</debug>
+          <optimize>true</optimize>
+          <showDeprecations>true</showDeprecations>
+          <encoding>ISO-8859-1</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/Abstract*</exclude>
+            <exclude>**/*RegressionTest*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clover-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>taglist-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>jxr-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>surefire-report-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>
+

Added: directory/trunks/shared/convert/src/main/antlr/schema.g
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/main/antlr/schema.g?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/main/antlr/schema.g (added)
+++ directory/trunks/shared/convert/src/main/antlr/schema.g Thu Jan 11 10:20:14 2007
@@ -0,0 +1,509 @@
+// ============================================================================
+//
+//
+//                    OpenLDAP Schema Parser
+//
+//
+// ============================================================================
+// $Rev$
+// ============================================================================
+
+
+header {
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+/*
+ * Keep the semicolon right next to the package name or else there will be a
+ * bug that comes into the foreground in the new antlr release.
+ */
+package org.apache.directory.shared.converter.schema;
+import java.util.List ;
+import java.util.ArrayList ;
+import java.util.Collections;
+import java.io.Writer;
+import java.io.IOException;
+
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.converter.schema.ObjectClassHolder;
+import org.apache.directory.shared.converter.schema.AttributeTypeHolder;
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+}
+
+
+class antlrSchemaLexer extends Lexer ;
+
+options    {
+    k = 7 ;
+    exportVocab=antlrSchema ;
+    charVocabulary = '\3'..'\377' ;
+    caseSensitive = false ;
+    defaultErrorHandler = false ;
+}
+
+
+WS  :   (   '#' (~'\n')* '\n' { newline(); }
+        |    ' '
+        |   '\t'
+        |   '\r' '\n' { newline(); }
+        |   '\n'      { newline(); }
+        |   '\r'      { newline(); }
+        )
+        {$setType(Token.SKIP);} //ignore this token
+    ;
+
+QUOTE              : '\''
+    ;
+
+DIGIT              : '0' .. '9'
+    ;
+
+DOLLAR             : '$'
+    ;
+
+OPEN_PAREN         : '('
+    ;
+
+CLOSE_PAREN        : ')'
+    ;
+
+OPEN_BRACKET       : '{'
+    ;
+
+CLOSE_BRACKET      : '}'
+    ;
+
+protected NUMERIC_STRING : ('0' .. '9')+
+    ;
+
+NUMERICOID         :
+        NUMERIC_STRING ( '.' NUMERIC_STRING )+
+    ;
+
+IDENTIFIER options { testLiterals=true; }
+    : 
+        ( 'a' .. 'z') ( 'a' .. 'z' | '0' .. '9' | '-' | ';' )*
+    ;
+
+DESC
+    :
+        "desc" WS QUOTE ( ~'\'' )+ QUOTE
+    ;
+
+SYNTAX
+    :
+        "syntax" WS NUMERICOID ( OPEN_BRACKET ( DIGIT )+ CLOSE_BRACKET )?
+    ;
+
+class antlrSchemaParser extends Parser ;
+
+options    {
+    k = 5 ;
+    defaultErrorHandler = false ;
+}
+
+
+{
+	
+    public static final String[] EMPTY = new String[0];
+
+    private List<AttributeTypeHolder> attributeTypes = new ArrayList<AttributeTypeHolder>();
+    private List<ObjectClassHolder> objectClasses = new ArrayList<ObjectClassHolder>();
+    private Writer schemaOut;
+
+
+    // ------------------------------------------------------------------------
+    // Public Methods
+    // ------------------------------------------------------------------------
+    public void setOutput( Writer out )
+    {
+        schemaOut = out;
+    }
+
+
+    public void clear()
+    {
+        attributeTypes.clear();
+        objectClasses.clear();
+    }
+
+
+    public List<AttributeTypeHolder> getAttributeTypes()
+    {
+        return Collections.unmodifiableList( attributeTypes );
+    }
+
+
+    public List<ObjectClassHolder> getObjectClasses()
+    {
+        return Collections.unmodifiableList( objectClasses );
+    }
+}
+
+
+// ----------------------------------------------------------------------------
+// Main Entry Point Production
+// ----------------------------------------------------------------------------
+
+
+parseSchema
+    :
+    ( attributeType | objectClass )* "END"
+    ;
+
+
+// ----------------------------------------------------------------------------
+// AttributeType Productions
+// ----------------------------------------------------------------------------
+
+
+objectClass
+{
+    ObjectClassHolder objectClass = null;
+}
+    :
+    "objectclass"
+    OPEN_PAREN oid:NUMERICOID
+    {
+        objectClass = new ObjectClassHolder( oid.getText() );
+    }
+    ( objectClassNames[objectClass] )?
+    ( objectClassDesc[objectClass] )?
+    ( "OBSOLETE" { objectClass.setObsolete( true ); } )?
+    ( objectClassSuperiors[objectClass] )?
+    ( 
+        "ABSTRACT"   { objectClass.setClassType( ObjectClassTypeEnum.ABSTRACT ); } |
+        "STRUCTURAL" { objectClass.setClassType( ObjectClassTypeEnum.STRUCTURAL ); } |
+        "AUXILIARY"  { objectClass.setClassType( ObjectClassTypeEnum.AUXILIARY ); }
+    )?
+    ( must[objectClass] )?
+    ( may[objectClass] )?
+    CLOSE_PAREN
+    {
+        objectClasses.add( objectClass );
+    }
+    ;
+
+
+may [ObjectClassHolder objectClass]
+{
+    ArrayList list = null;
+}
+    : "MAY" list=woidlist
+    {
+        objectClass.setMay( ( String[] ) list.toArray( EMPTY ) );
+    }
+    ;
+
+
+must [ObjectClassHolder objectClass]
+{
+    ArrayList list = null;
+}
+    : "MUST" list=woidlist
+    {
+        objectClass.setMust( ( String[] ) list.toArray( EMPTY ) );
+    }
+    ;
+
+
+objectClassSuperiors [ObjectClassHolder objectClass]
+{
+    ArrayList list = null;
+}
+    : "SUP" list=woidlist
+    {
+        objectClass.setSuperiors( ( String[] ) list.toArray( EMPTY ) );
+    }
+    ;
+
+
+woid returns [String oid]
+{
+    oid = null;
+}
+    :
+    (
+        opt1:NUMERICOID
+        {
+            oid = opt1.getText();
+        }
+        |
+        opt2:IDENTIFIER
+        {
+            oid = opt2.getText();
+        }
+    )
+    ;
+
+
+woidlist returns [ArrayList list]
+{
+    list = new ArrayList( 2 );
+    String oid = null;
+}
+    :
+    (
+        oid=woid { list.add( oid ); } |
+        (
+            OPEN_PAREN
+            oid=woid { list.add( oid ); } ( DOLLAR oid=woid { list.add( oid ); } )*
+            CLOSE_PAREN
+        )
+    )
+    ;
+
+objectClassDesc [ObjectClassHolder objectClass]
+    : d:DESC
+    {
+        String desc = d.getText().split( "'" )[1];
+        String[] quoted = desc.split( "\"" );
+
+        if ( quoted.length == 1 )
+        {
+            objectClass.setDescription( desc );
+        }
+        else
+        {
+            StringBuffer buf = new StringBuffer();
+            for ( int ii = 0; ii < quoted.length; ii++ )
+            {
+                if ( ii < quoted.length - 1 )
+                {
+                    buf.append( quoted[ii] ).append( "\\" ).append( "\"" );
+                }
+                else
+                {
+                    buf.append( quoted[ii] );
+                }
+            }
+
+            objectClass.setDescription( buf.toString() );
+        }
+    }
+    ;
+
+
+objectClassNames [ObjectClassHolder objectClass]
+{
+    ArrayList list = new ArrayList();
+}
+    :
+    (
+        "NAME"
+        ( QUOTE id0:IDENTIFIER QUOTE
+        {
+            list.add( id0.getText() );
+        }
+        |
+        ( OPEN_PAREN QUOTE id1:IDENTIFIER
+        {
+            list.add( id1.getText() );
+        } QUOTE
+        ( QUOTE id2:IDENTIFIER QUOTE
+        {
+            list.add( id2.getText() );
+        } )* CLOSE_PAREN )
+        )
+    )
+    {
+        objectClass.setNames( ( String[] ) list.toArray( EMPTY ) );
+    }
+    ;
+
+
+// ----------------------------------------------------------------------------
+// AttributeType Productions
+// ----------------------------------------------------------------------------
+
+
+attributeType
+{
+    AttributeTypeHolder type = null;
+}
+    :
+    "attributetype"
+    OPEN_PAREN oid:NUMERICOID
+    {
+        type = new AttributeTypeHolder( oid.getText() );
+    }
+        ( names[type] )?
+        ( desc[type] )?
+        ( "OBSOLETE" { type.setObsolete( true ); } )?
+        ( superior[type] )?
+        ( equality[type] )?
+        ( ordering[type] )?
+        ( substr[type] )?
+        ( syntax[type] )?
+        ( "SINGLE-VALUE" { type.setSingleValue( true ); } )?
+        ( "COLLECTIVE" { type.setCollective( true ); } )?
+        ( "NO-USER-MODIFICATION" { type.setNoUserModification( true ); } )?
+        ( usage[type] )?
+
+    CLOSE_PAREN
+    {
+        attributeTypes.add( type );
+    }
+    ;
+
+
+desc [AttributeTypeHolder type]
+    : d:DESC
+    {
+        String desc = d.getText().split( "'" )[1];
+        String[] quoted = desc.split( "\"" );
+
+        if ( quoted.length == 1 )
+        {
+            type.setDescription( desc );
+        }
+        else
+        {
+            StringBuffer buf = new StringBuffer();
+            for ( int ii = 0; ii < quoted.length; ii++ )
+            {
+                if ( ii < quoted.length - 1 )
+                {
+                    buf.append( quoted[ii] ).append( "\\" ).append( "\"" );
+                }
+                else
+                {
+                    buf.append( quoted[ii] );
+                }
+            }
+
+            type.setDescription( buf.toString() );
+        }
+    }
+    ;
+
+
+superior [AttributeTypeHolder type]
+    : "SUP"
+    (
+        oid:NUMERICOID
+        {
+            type.setSuperior( oid.getText() );
+        }
+        |
+        id:IDENTIFIER
+        {
+            type.setSuperior( id.getText() );
+        }
+    );
+
+
+equality [AttributeTypeHolder type]
+    : "EQUALITY"
+    (
+        oid:NUMERICOID
+        {
+            type.setEquality( oid.getText() );
+        }
+        |
+        id:IDENTIFIER
+        {
+            type.setEquality( id.getText() );
+        }
+    );
+
+
+substr [AttributeTypeHolder type]
+    : "SUBSTR"
+    (
+        oid:NUMERICOID
+        {
+            type.setSubstr( oid.getText() );
+        }
+        |
+        id:IDENTIFIER
+        {
+            type.setSubstr( id.getText() );
+        }
+    );
+
+
+ordering [AttributeTypeHolder type]
+    : "ORDERING"
+    (
+        oid:NUMERICOID
+        {
+            type.setOrdering( oid.getText() );
+        }
+        |
+        id:IDENTIFIER
+        {
+            type.setOrdering( id.getText() );
+        }
+    );
+
+
+names [AttributeTypeHolder type]
+{
+    ArrayList list = new ArrayList();
+}
+    :
+        "NAME"
+    (
+        QUOTE id0:IDENTIFIER QUOTE { list.add( id0.getText() ); } |
+        ( OPEN_PAREN
+            ( QUOTE id1:IDENTIFIER
+                {
+                    list.add( id1.getText() );
+                }
+              QUOTE
+            )+
+        CLOSE_PAREN )
+    )
+    {
+        type.setNames( ( String[] ) list.toArray( EMPTY ) );
+    }
+    ;
+
+
+syntax [AttributeTypeHolder type]
+    : token:SYNTAX
+    {
+        String[] comps = token.getText().split( " " );
+
+        int index = comps[1].indexOf( "{" );
+        if ( index == -1 )
+        {
+            type.setSyntax( comps[1] );
+            return;
+        }
+
+        String oid = comps[1].substring( 0, index );
+        String length = comps[1].substring( index + 1, comps[1].length() - 1 );
+
+        type.setSyntax( oid );
+        type.setLength( Integer.parseInt( length ) );
+    }
+    ;
+
+
+usage [AttributeTypeHolder type]
+    :
+    "USAGE"
+    (
+        "userApplications" { type.setUsage( UsageEnum.USER_APPLICATIONS ); } |
+        "directoryOperation" { type.setUsage( UsageEnum.DIRECTORY_OPERATION ); } |
+        "distributedOperation" { type.setUsage( UsageEnum.DISTRIBUTED_OPERATION ); } |
+        "dSAOperation" { type.setUsage( UsageEnum.DSA_OPERATION ); }
+    );

Added: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java (added)
+++ directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java Thu Jan 11 10:20:14 2007
@@ -0,0 +1,263 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.converter.schema;
+
+
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.util.ArrayUtils;
+
+
+/**
+ * A bean used to hold the literal values of an AttributeType parsed out of an
+ * OpenLDAP schema configuration file.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 476875 $
+ */
+public class AttributeTypeHolder
+{
+    private boolean obsolete = false;
+    private boolean singleValue = false;
+    private boolean collective = false;
+    private boolean noUserModification = false;
+
+    private String oid;
+    private String description;
+    private String superior;
+    private String equality;
+    private String ordering;
+    private String substr;
+    private String syntax;
+
+    private UsageEnum usage = UsageEnum.USER_APPLICATIONS;
+
+    private String[] names = ArrayUtils.EMPTY_STRING_ARRAY;
+
+    private int length = -1;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+    public AttributeTypeHolder( String oid )
+    {
+        this.oid = oid;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Accessors and mutators
+    // ------------------------------------------------------------------------
+
+    public boolean isObsolete()
+    {
+        return obsolete;
+    }
+
+
+    public void setObsolete( boolean obsolete )
+    {
+        this.obsolete = obsolete;
+    }
+
+
+    public boolean isSingleValue()
+    {
+        return singleValue;
+    }
+
+
+    public void setSingleValue( boolean singleValue )
+    {
+        this.singleValue = singleValue;
+    }
+
+
+    public boolean isCollective()
+    {
+        return collective;
+    }
+
+
+    public void setCollective( boolean collective )
+    {
+        this.collective = collective;
+    }
+
+
+    public boolean isNoUserModification()
+    {
+        return noUserModification;
+    }
+
+
+    public void setNoUserModification( boolean noUserModification )
+    {
+        this.noUserModification = noUserModification;
+    }
+
+
+    public String getOid()
+    {
+        return oid;
+    }
+
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+
+    public String getSuperior()
+    {
+        return superior;
+    }
+
+
+    public void setSuperior( String superior )
+    {
+        this.superior = superior;
+    }
+
+
+    public String getEquality()
+    {
+        return equality;
+    }
+
+
+    public void setEquality( String equality )
+    {
+        this.equality = equality;
+    }
+
+
+    public String getOrdering()
+    {
+        return ordering;
+    }
+
+
+    public void setOrdering( String ordering )
+    {
+        this.ordering = ordering;
+    }
+
+
+    public String getSubstr()
+    {
+        return substr;
+    }
+
+
+    public void setSubstr( String substr )
+    {
+        this.substr = substr;
+    }
+
+
+    public String getSyntax()
+    {
+        return syntax;
+    }
+
+
+    public void setSyntax( String syntax )
+    {
+        this.syntax = syntax;
+    }
+
+
+    public UsageEnum getUsage()
+    {
+        return usage;
+    }
+
+
+    public void setUsage( UsageEnum usage )
+    {
+        this.usage = usage;
+    }
+
+
+    public String[] getNames()
+    {
+        return names;
+    }
+
+
+    public void setNames( String[] names )
+    {
+        this.names = names;
+    }
+
+
+    public int getLength()
+    {
+        return length;
+    }
+
+
+    public void setLength( int length )
+    {
+        this.length = length;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Object overrides
+    // ------------------------------------------------------------------------
+
+    public int hashCode()
+    {
+        return getOid().hashCode();
+    }
+
+
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+
+        if ( ( obj == null ) || !( obj instanceof AttributeTypeHolder ) )
+        {
+            return false;
+        }
+
+
+        return getOid().equals( ( ( AttributeTypeHolder ) obj ).getOid() );
+    }
+
+
+    public String toString()
+    {
+        return getOid();
+    }
+}

Propchange: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/AttributeTypeHolder.java
------------------------------------------------------------------------------
    svn:executable = *

Added: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java (added)
+++ directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java Thu Jan 11 10:20:14 2007
@@ -0,0 +1,189 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.converter.schema;
+
+
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.util.ArrayUtils;
+
+
+/**
+ * A bean used to encapsulate the literal String values of an ObjectClass
+ * definition found within an OpenLDAP schema configuration file.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 437016 $
+ */
+public class ObjectClassHolder
+{
+    private boolean obsolete = false;
+
+    private String oid;
+    private String description;
+
+    private String[] names = ArrayUtils.EMPTY_STRING_ARRAY;
+    private String[] superiors = ArrayUtils.EMPTY_STRING_ARRAY;
+    private String[] must = ArrayUtils.EMPTY_STRING_ARRAY;
+    private String[] may = ArrayUtils.EMPTY_STRING_ARRAY;
+
+    private ObjectClassTypeEnum classType = ObjectClassTypeEnum.STRUCTURAL;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+    public ObjectClassHolder(String oid)
+    {
+        this.oid = oid;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Accessors and mutators
+    // ------------------------------------------------------------------------
+
+    public boolean isObsolete()
+    {
+        return obsolete;
+    }
+
+
+    public void setObsolete( boolean obsolete )
+    {
+        this.obsolete = obsolete;
+    }
+
+
+    public String getOid()
+    {
+        return oid;
+    }
+
+
+    public void setOid( String oid )
+    {
+        this.oid = oid;
+    }
+
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+
+    public String[] getNames()
+    {
+        return names;
+    }
+
+
+    public void setNames( String[] names )
+    {
+        this.names = names;
+    }
+
+
+    public String[] getSuperiors()
+    {
+        return superiors;
+    }
+
+
+    public void setSuperiors( String[] superiors )
+    {
+        this.superiors = superiors;
+    }
+
+
+    public String[] getMust()
+    {
+        return must;
+    }
+
+
+    public void setMust( String[] must )
+    {
+        this.must = must;
+    }
+
+
+    public String[] getMay()
+    {
+        return may;
+    }
+
+
+    public void setMay( String[] may )
+    {
+        this.may = may;
+    }
+
+
+    public ObjectClassTypeEnum getClassType()
+    {
+        return classType;
+    }
+
+
+    public void setClassType( ObjectClassTypeEnum classType )
+    {
+        this.classType = classType;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Object overrides
+    // ------------------------------------------------------------------------
+
+    public int hashCode()
+    {
+        return getOid().hashCode();
+    }
+
+
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+
+        if ( !( obj instanceof ObjectClassHolder ) )
+        {
+            return false;
+        }
+
+        return getOid().equals( ( ( ObjectClassHolder ) obj ).getOid() );
+    }
+
+
+    public String toString()
+    {
+        return getOid();
+    }
+}

Propchange: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ObjectClassHolder.java
------------------------------------------------------------------------------
    svn:executable = *

Added: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java (added)
+++ directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java Thu Jan 11 10:20:14 2007
@@ -0,0 +1,17 @@
+
+package org.apache.directory.shared.converter.schema;
+
+public class ParserException extends Exception
+{
+    public static final long serialVersionUID = 1L;
+    
+    public ParserException()
+    {
+        super();
+    }
+
+    public ParserException( String msg )
+    {
+        super( msg );
+    }
+}

Added: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java (added)
+++ directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java Thu Jan 11 10:20:14 2007
@@ -0,0 +1,104 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.converter.schema;
+
+import java.io.InputStream;
+import java.io.Writer;
+
+
+public class Schema
+{
+    private String name;
+    private String[] dependencies;
+    private String pkg;
+    private String owner;
+    private InputStream in; 
+    private Writer out;
+
+
+    public void setDependencies( String[] dependencies )
+    {
+        this.dependencies = dependencies;
+    }
+
+
+    public String[] getDependencies()
+    {
+        return dependencies;
+    }
+
+
+    public void setPkg( String pkg )
+    {
+        this.pkg = pkg;
+    }
+
+
+    public String getPkg()
+    {
+        return pkg;
+    }
+
+
+    public void setOwner( String owner )
+    {
+        this.owner = owner;
+    }
+
+
+    public String getOwner()
+    {
+        return owner;
+    }
+
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+    
+    public void setInput( InputStream in )
+    {
+        this.in = in;
+    }
+    
+    public InputStream getInput()
+    {
+        return in;
+    }
+
+
+    public Writer getOutput()
+    {
+        return out;
+    }
+
+
+    public void setOutput( Writer out )
+    {
+        this.out = out;
+    }
+}

Added: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java (added)
+++ directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java Thu Jan 11 10:20:14 2007
@@ -0,0 +1,221 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.converter.schema;
+
+
+import org.apache.directory.shared.converter.schema.antlrSchemaLexer;
+import org.apache.directory.shared.converter.schema.antlrSchemaParser;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
+
+import java.util.List;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.Writer;
+import java.text.ParseException;
+
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+
+
+/**
+ * A reusable wrapper for antlr generated schema parsers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 494164 $
+ */
+public class SchemaParser
+{
+    /** The antlr generated parser */
+    private antlrSchemaParser parser = null;
+    
+    /** A pipe into the parser */
+    private PipedOutputStream parserIn = null;
+
+
+    /**
+     * Creates a reusable instance of an SchemaParser.
+     *
+     * @throws IOException if the pipe cannot be formed
+     */
+    public SchemaParser() throws IOException
+    {
+        init();
+    }
+
+
+    /**
+     * Initializes a parser and its plumbing.
+     *
+     * @throws IOException if a pipe cannot be formed.
+     */
+    public void init() throws IOException
+    {
+        parserIn = new PipedOutputStream();
+        PipedInputStream in = new PipedInputStream();
+        parserIn.connect( in );
+        antlrSchemaLexer lexer = new antlrSchemaLexer( in );
+        parser = new antlrSchemaParser( lexer );
+    }
+
+
+    public synchronized void clear()
+    {
+        parser.clear();
+    }
+
+
+    public List getAttributeTypes()
+    {
+        return parser.getAttributeTypes();
+    }
+
+
+    public List getObjectClassTypes()
+    {
+        return parser.getObjectClasses();
+    }
+
+
+    
+    /**
+     * Thread safe method parses an OpenLDAP schemaObject element/object.
+     *
+     * @param schemaObject the String image of a complete schema object
+     */
+    public synchronized void parse( String schemaObject ) throws IOException, ParseException
+    {
+        if ( schemaObject == null || schemaObject.trim().equals( "" ) )
+        {
+            throw new ParseException( "The schemaObject is either null or is " + "the empty String!", 0 );
+        }
+
+        this.schemaIn = new ByteArrayInputStream( schemaObject.getBytes() );
+
+        if ( producerThread == null )
+        {
+            producerThread = new Thread( new DataProducer() );
+        }
+
+        producerThread.start();
+        invokeParser( schemaObject );
+    }
+
+
+    private void invokeParser( String subject ) throws IOException, ParseException
+    {
+        try
+        {
+            parser.setOutput( schemaOut );
+
+            parser.parseSchema();
+        }
+        catch ( RecognitionException e )
+        {
+            String msg = "Parser failure on:\n\t" + subject;
+            msg += "\nAntlr exception trace:\n" + ExceptionUtils.getFullStackTrace( e );
+            init();
+            throw new ParseException( msg, e.getColumn() );
+        }
+        catch ( TokenStreamException e2 )
+        {
+            String msg = "Parser failure on:\n\t" + subject;
+            msg += "\nAntlr exception trace:\n" + ExceptionUtils.getFullStackTrace( e2 );
+            init();
+            throw new ParseException( msg, 0 );
+        }
+    }
+
+    byte[] buf = new byte[128];
+    private InputStream schemaIn;
+    private Writer schemaOut;
+    private Thread producerThread;
+
+
+    /**
+     * Thread safe method parses a stream of OpenLDAP schemaObject elements/objects.
+     *
+     * @param schemaIn a stream of schema objects
+     */
+    public synchronized void parse( InputStream schemaIn, Writer out ) throws IOException, ParseException
+    {
+        this.schemaIn = schemaIn;
+        this.schemaOut = out;
+
+        if ( producerThread == null )
+        {
+            producerThread = new Thread( new DataProducer() );
+        }
+
+        producerThread.start();
+
+        invokeParser( "schema input stream ==> " + schemaIn.toString() );
+        out.flush();
+    }
+
+
+    /**
+     * Thread safe method parses a file of OpenLDAP schemaObject elements/objects.
+     *
+     * @param schemaFile a file of schema objects
+     */
+    public synchronized void parse( File schemaFile ) throws IOException, ParseException
+    {
+        this.schemaIn = new FileInputStream( schemaFile );
+
+        if ( producerThread == null )
+        {
+            producerThread = new Thread( new DataProducer() );
+        }
+
+        producerThread.start();
+        invokeParser( "schema file ==> " + schemaFile.getAbsolutePath() );
+    }
+
+
+    class DataProducer implements Runnable
+    {
+        public void run()
+        {
+            int count = -1;
+
+            try
+            {
+                while ( ( count = schemaIn.read( buf ) ) != -1 )
+                {
+                    parserIn.write( buf, 0, count );
+                    parserIn.flush();
+                }
+
+                // using an input termination token END - need extra space to return
+                parserIn.write( "END ".getBytes() );
+            }
+            catch ( IOException e )
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+}

Propchange: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java
------------------------------------------------------------------------------
    svn:executable = *

Added: directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java (added)
+++ directory/trunks/shared/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java Thu Jan 11 10:20:14 2007
@@ -0,0 +1,93 @@
+
+package org.apache.directory.shared.converter.schema;
+
+import java.io.InputStream;
+import java.io.Writer;
+import java.util.List;
+
+import org.apache.directory.shared.converter.schema.Schema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SchemaToLdif
+{
+    private static final String HEADER = 
+        "#\n" +
+        "#  Licensed to the Apache Software Foundation (ASF) under one\n" +
+        "#  or more contributor license agreements.  See the NOTICE file\n" +
+        "#  distributed with this work for additional information\n" +
+        "#  regarding copyright ownership.  The ASF licenses this file\n" +
+        "#  to you under the Apache License, Version 2.0 (the\n" +
+        "#  \"License\"); you may not use this file except in compliance\n" +
+        "#  with the License.  You may obtain a copy of the License at\n" +
+        "#  \n" +
+        "#    http://www.apache.org/licenses/LICENSE-2.0\n" +
+        "#  \n" +
+        "#  Unless required by applicable law or agreed to in writing,\n" +
+        "#  software distributed under the License is distributed on an\n" +
+        "#  \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" +
+        "#  KIND, either express or implied.  See the License for the\n" +
+        "#  specific language governing permissions and limitations\n" +
+        "#  under the License. \n" +
+        "#\n" +
+        "version: 1\n" +
+        "\n";  
+
+    /** The logger */
+    private static Logger log = LoggerFactory.getLogger( SchemaToLdif.class );
+
+
+    public void transform( List<Schema> schemas ) throws ParserException
+    {
+        // Bypass if no schemas have yet been defined 
+        if ( schemas == null || schemas.size() == 0 )
+        {
+            log.warn( "No schemas defined!" );
+            return;
+        }
+
+        // Make sure schema configurations have a name field and set defaults
+        // for any other missing properties of the bean: pkg and owner.
+        int i = 1;
+        
+        for ( Schema schema:schemas )
+        {
+            if ( schema.getName() == null )
+            {
+                String msg = i + "th schema configuration element must specify a name.";
+                log.error( msg );
+                throw new ParserException( msg );
+            }
+
+        }
+
+        // Generate for each schema 
+        for ( Schema schema:schemas )
+        {
+            try
+            {
+                log.info( "Generating " + schema.getName() + " schema." );
+                generate( schema );
+            }
+            catch ( Exception e )
+            {
+                throw new ParserException( "Failed while generating sources for " + schema.getName() );
+            }
+        }
+    }
+    
+    private void generate( Schema schema ) throws Exception
+    {
+        if ( schema == null )
+        {
+            log.error( "Can't generate a ldif for a null schema" );
+            throw new NullPointerException( "the schema property must be set" );
+        }
+
+        InputStream in = schema.getInput();
+        Writer out = schema.getOutput();
+        
+        SchemaParser parser = new SchemaParser();
+        parser.parse( in, out );
+    }
+}

Added: directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/converter/schema/TestSchemaToLdif.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/converter/schema/TestSchemaToLdif.java?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/converter/schema/TestSchemaToLdif.java (added)
+++ directory/trunks/shared/convert/src/test/java/org/apache/directory/shared/converter/schema/TestSchemaToLdif.java Thu Jan 11 10:20:14 2007
@@ -0,0 +1,25 @@
+package org.apache.directory.shared.converter.schema;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+
+public class TestSchemaToLdif extends TestCase
+{
+    public void testConvert() throws ParserException
+    {
+        SchemaToLdif converter = new SchemaToLdif();
+        
+        List<Schema> schemas = new ArrayList<Schema>();
+        Schema schema = new Schema();
+        schema.setName( "test.schema" );
+        schema.setInput( getClass().getResourceAsStream( "test.schema" ) );
+        schema.setOutput( new OutputStreamWriter( System.out ) );
+        schemas.add( schema );
+        
+        converter.transform( schemas );
+    }
+}

Added: directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/converter/schema/test.schema
URL: http://svn.apache.org/viewvc/directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/converter/schema/test.schema?view=auto&rev=495316
==============================================================================
--- directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/converter/schema/test.schema (added)
+++ directory/trunks/shared/convert/src/test/resources/org/apache/directory/shared/converter/schema/test.schema Thu Jan 11 10:20:14 2007
@@ -0,0 +1,155 @@
+# =============================================================================
+#                ApacheDS schema for storing DNS zones in LDAP
+# =============================================================================
+#               +---------------------------+-----------------+
+#               |         Apache OID        |   description   |
+#               +---------------------------+-----------------+
+#               +---------------------------+-----------------+
+# =============================================================================
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.1 NAME 'apacheDnsClass'
+	DESC 'The class of a resource record'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.2 NAME 'apacheDnsTtl'
+	DESC 'An integer denoting time to live'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.3 NAME 'apacheDnsDomainName'
+	DESC 'A domain name represented as a sequence of labels'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.4 NAME 'apacheDnsCharacterString'
+	DESC 'A string up to 256 characters in length'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.5 NAME 'apacheDnsIpAddress'
+	DESC 'A 4 octet IP address'
+	EQUALITY caseIgnoreIA5Match
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.6 NAME 'apacheDnsSoaMName'
+	DESC 'The domain name of the name server that was the primary source of data for this zone'
+	SUP apacheDnsDomainName SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.7 NAME 'apacheDnsSoaRName'
+	DESC 'The domain name which specifies the mailbox of the person responsible for this zone'
+	SUP apacheDnsDomainName SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.8 NAME 'apacheDnsSoaSerial'
+	DESC 'The unsigned 32 bit version number of the original copy of the zone'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.9 NAME 'apacheDnsSoaRefresh'
+	DESC 'A 32 bit time interval before the zone should be refreshed'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.10 NAME 'apacheDnsSoaRetry'
+	DESC 'A 32 bit time interval that should elapse before a failed refresh should be retired'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.11 NAME 'apacheDnsSoaExpire'
+	DESC 'A 32 bit time value that specifies the upper limit on the time interval that can elapse before the zone is no longer authoritative'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.12 NAME 'apacheDnsSoaMinimum'
+	DESC 'The unsigned 32 bit minimum TTL field that should be exported with any RR from this zone.'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.13 NAME 'apacheDnsMxPreference'
+	DESC 'An integer denoting the mail exchange preference'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.14 NAME 'apacheDnsServicePriority'
+	DESC 'The unsigned 16 bit priority of this target host'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.15 NAME 'apacheDnsServiceWeight'
+	DESC 'The unsigned 16 bit weight specifying a relative weight for entries with the same priority'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.2.2.16 NAME 'apacheDnsServicePort'
+	DESC 'The unsigned 16 bit port on this target host of this service'
+	EQUALITY integerMatch
+	SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.1
+	NAME 'apacheDnsAbstractRecord'
+	DESC 'An abstract DNS record objectClass used to build other specific structural objectclasses for different record types'
+	SUP top
+	ABSTRACT
+	MUST cn
+	MAY ( apacheDnsTtl $ description ) )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.2 
+	NAME 'apacheDnsAddressRecord'
+	DESC 'An address A record'
+	SUP apacheDnsAbstractRecord 
+	MUST apacheDnsIpAddress )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.3 
+	NAME 'apacheDnsPointerRecord'
+	DESC 'A pointer PTR record'
+	SUP apacheDnsAbstractRecord 
+	MUST apacheDnsDomainName )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.4
+	NAME 'apacheDnsNameServerRecord'
+	DESC 'A name server NS record'
+	SUP apacheDnsAbstractRecord 
+	MUST apacheDnsDomainName )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.5
+	NAME 'apacheDnsStartOfAuthorityRecord'
+	DESC 'A start of authority SOA record'
+	SUP apacheDnsAbstractRecord
+	MUST ( apacheDnsSoaMName $ apacheDnsSoaRName $ apacheDnsSoaMinimum )
+	MAY ( apacheDnsClass $ apacheDnsSoaSerial $ apacheDnsSoaRefresh $ apacheDnsSoaRetry $ apacheDnsSoaExpire ) )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.6
+	NAME 'apacheDnsCanonicalNameRecord'
+	DESC 'A canonical name CNAME record'
+	SUP apacheDnsAbstractRecord 
+	MUST apacheDnsDomainName )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.7
+	NAME 'apacheDnsMailExchangeRecord'
+	DESC 'A mail exchange MX record'
+	SUP apacheDnsAbstractRecord 
+	MUST ( apacheDnsMxPreference $ apacheDnsDomainName ) )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.8
+	NAME 'apacheDnsTextRecord'
+	DESC 'A text TXT record'
+	SUP apacheDnsAbstractRecord 
+	MUST apacheDnsCharacterString )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.9
+	NAME 'apacheDnsServiceRecord'
+	DESC 'A service SRV record'
+	SUP apacheDnsAbstractRecord 
+	MUST ( apacheDnsServicePriority $ apacheDnsServiceWeight $ apacheDnsServicePort $ apacheDnsDomainName ) )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.10
+	NAME 'apacheDnsReferralNameServer'
+	DESC 'A non-authoritative referral or delegation name server'
+	SUP apacheDnsAbstractRecord 
+	MUST apacheDnsDomainName )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.2.3.11
+	NAME 'apacheDnsReferralAddress'
+	DESC 'A non-authoritative referral or glue address record'
+	SUP apacheDnsAbstractRecord 
+	MUST ( apacheDnsDomainName $ apacheDnsIpAddress ) )



Mime
View raw message