You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2003/12/24 02:04:14 UTC
svn commit: rev 1465 - in incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl: . src src/java src/java/org src/java/org/apache src/java/org/apache/eve src/java/org/apache/eve/schema
Author: akarasulu
Date: Tue Dec 23 17:04:13 2003
New Revision: 1465
Added:
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/maven.xml
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/project.properties
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/project.xml
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxCheckerFactory.java (contents, props changed)
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxFactory.java (contents, props changed)
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxRegistryMonitor.java (contents, props changed)
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/BootstrapSyntaxRegistry.java (contents, props changed)
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.java (contents, props changed)
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.xconfig (contents, props changed)
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.xsd (contents, props changed)
Modified:
incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/ (props changed)
Log:
Added bootstrap syntax loader with schema file for the component.
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/maven.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/maven.xml Tue Dec 23 17:04:13 2003
@@ -0,0 +1,38 @@
+<project default="java:compile"
+ xmlns:j="jelly:core"
+ xmlns:u="jelly:util"
+ xmlns:ant="jelly:ant"
+ xmlns:maven="jelly:maven"
+ xmlns:m="maven"
+ xmlns:deploy="deploy">
+
+ <preGoal name="site">
+ <attainGoal name="docbook:transform"/>
+ </preGoal>
+
+ <postGoal name="site">
+ <attainGoal name="server:copy-images"/>
+ </postGoal>
+
+ <goal name="server:copy-images">
+ <copy toDir="target/docs/images">
+ <fileSet dir="${basedir}/src/images">
+ <include name="*.gif"/>
+ </fileSet>
+ </copy>
+ </goal>
+
+ <goal name="cleanall">
+ <attainGoal name="clean"/>
+ <delete dir="home"/>
+ </goal>
+
+ <postGoal name="java:compile">
+ <attainGoal name="avalon:meta"/>
+ </postGoal>
+
+ <postGoal name="aspectj:compile">
+ <attainGoal name="avalon:meta"/>
+ </postGoal>
+
+</project>
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/project.properties
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/project.properties Tue Dec 23 17:04:13 2003
@@ -0,0 +1,14 @@
+maven.javadoc.private=true
+maven.javadoc.overview=src/java/org/apache/eve/schema/overview.html
+maven.javadoc.customtags=tag1 tag2
+
+tag1.name=todo
+tag1.description=To Do:
+tag1.enabled=true
+tag1.scope=all
+
+tag2.name=task
+tag2.description=Task:
+tag2.enabled=false
+tag2.scope=all
+
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/project.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/project.xml Tue Dec 23 17:04:13 2003
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+ <extend>${basedir}/../../../../project.xml</extend>
+ <groupId>directory</groupId>
+ <id>eve-backend-schema-syntax-bootstrap-impl</id>
+
+ <name>Eve Backend Schema's Bootstrap Schema Registry Implementation</name>
+ <package>org.apache.eve.schema</package>
+ <currentVersion>SNAPSHOT</currentVersion>
+ <inceptionYear>2002</inceptionYear>
+
+ <shortDescription>Eve Backend Schema's Bootstrap Syntax Registry Implementation</shortDescription>
+
+ <description>
+ Eve's backend subsystem contains several components to manage schema
+ objects. One of those components is a OID to Syntax registry for all
+ schema syntaxes. The registry is responsible for adding new syntaxes
+ by OID as well as enabling the lookup of Syntaxs based on OID.
+ This project contains the SyntaxRegistry implementation used at server
+ startup rather than the solid state syntax registry. The reason for
+ the separate services is to reduce cyclic dependency.
+
+ The bootstrap implementation unlike the solid state implementation
+ does not depend on the system backend to store syntax information.
+ So this version of the component allows the system backend which
+ depends on schema information to startup without having a cyclic
+ dependency.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>directory</groupId>
+ <artifactId>eve-backend-schema-common-api</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://directory.apache.org/eve/backend/schema/common/api</url>
+ </dependency>
+
+ <dependency>
+ <groupId>directory</groupId>
+ <artifactId>eve-backend-schema-oid-api</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://directory.apache.org/eve/backend/schema/oid/api</url>
+ </dependency>
+
+ <dependency>
+ <groupId>directory</groupId>
+ <artifactId>eve-backend-schema-syntax-api</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://directory.apache.org/eve/backend/schema/syntax/api</url>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.0</version>
+ <url>http://jakarta.apache.org/commons/lang</url>
+ </dependency>
+
+ <dependency>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework-api</artifactId>
+ <version>4.1.5</version>
+ <url>http://avalon.apache.org/framework</url>
+ </dependency>
+ </dependencies>
+</project>
+
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxCheckerFactory.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxCheckerFactory.java Tue Dec 23 17:04:13 2003
@@ -0,0 +1,197 @@
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve"
+ and "Apache Software Foundation" must not be used to endorse or promote
+ products derived from this software without prior written
+ permission. For written permission, please contact apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.schema ;
+
+
+import org.apache.commons.lang.NotImplementedException ;
+
+import org.apache.avalon.framework.configuration.Configuration ;
+import org.apache.avalon.framework.configuration.ConfigurationException ;
+
+
+/**
+ * Creates SyntaxCheckers using an Avalon Configuration.
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Rev$
+ */
+public class AvalonSyntaxCheckerFactory
+{
+ /** singleton instance of the factory */
+ private static AvalonSyntaxCheckerFactory s_instance = null ;
+
+ /**
+ * Creates a singleton factory that makes SyntaxCheckers using Avalon
+ * configuration nodes.
+ */
+ private AvalonSyntaxCheckerFactory()
+ {
+ if ( s_instance != null )
+ {
+ throw new IllegalStateException( "Singleton create attempted more "
+ + "than once." ) ;
+ }
+ }
+
+
+ /**
+ * Get's a handle on a singleton instance of the factory.
+ *
+ * @return the singleton instance of the factory
+ */
+ public static AvalonSyntaxCheckerFactory getInstance()
+ {
+ if ( s_instance == null )
+ {
+ s_instance = new AvalonSyntaxCheckerFactory() ;
+ }
+
+ return s_instance ;
+ }
+
+
+ /**
+ * Creates a SyntaxChecker using an Avalon Configuration node.
+ *
+ * @param a_oid the oid of the syntax the checker validates
+ * @param a_config the configuration node for the SyntaxChecker
+ * @return the newly created SyntaxChecker
+ * @throws ConfigurationException if their is a problem with the config
+ */
+ public SyntaxChecker create( String a_oid, Configuration a_config )
+ throws ConfigurationException
+ {
+ SyntaxChecker l_checker = null ;
+
+ // complain if the node is not <syntax-checker>
+ if ( ! a_config.getName().equals( "syntax-checker" ) )
+ {
+ throw new ConfigurationException( "Expected a configuration node "
+ + "with the name 'syntax-checker' but got " +
+ a_config.getName(), a_config ) ;
+ }
+
+ Configuration [] l_children = a_config.getChildren() ;
+ if ( l_children[0].getName().equals( "class" ) )
+ {
+ l_checker = create( l_children[0].getValue() ) ;
+ }
+ else if ( l_children[0].getName().equals( "built-in" ) )
+ {
+ String l_builtIn = l_children[0].getValue() ;
+
+ if ( l_builtIn.equals( "unchecked" ) )
+ {
+
+ }
+ else
+ {
+ throw new NotImplementedException(
+ "built-ins not implemented" ) ;
+ }
+
+ /*l_checker = SyntaxCheckerFactory
+ .create( a_oid, l_children[0].getValue() ) ;*/
+ }
+ else if ( l_children[0].getName().equals( "regex" ) )
+ {
+ String [] l_exprs = new String [ l_children.length ] ;
+ for ( int ii = 0; ii < l_children.length; ii++ )
+ {
+ l_exprs[ii] = l_children[ii].getValue() ;
+ }
+
+ l_checker = new RegexSyntaxChecker( a_oid, l_exprs ) ;
+ }
+ else
+ {
+ throw new ConfigurationException(
+ "Undefined syntax-checker configuration", a_config ) ;
+ }
+
+ return l_checker ;
+ }
+
+
+ /**
+ * Creates a SyntaxChecker by loading and instantiating a class.
+ *
+ * @param a_fqcn the fully qualified class name
+ * @return the newly instantiated SyntaxChecker
+ * @throws ConfigurationException if there are problems loading and
+ * instantiating from the class.
+ */
+ public SyntaxChecker create( String a_fqcn )
+ throws ConfigurationException
+ {
+ try
+ {
+ return ( SyntaxChecker ) Class.forName( a_fqcn ).newInstance() ;
+ }
+ catch( ClassNotFoundException e )
+ {
+ throw new ConfigurationException( "Cannot find syntax-checker "
+ + "class: " + a_fqcn, e ) ;
+ }
+ catch( IllegalAccessException e )
+ {
+ throw new ConfigurationException( "syntax-checker "
+ + "class " + a_fqcn + " may not have a public default "
+ + "constructor.", e ) ;
+ }
+ catch( InstantiationException e )
+ {
+ throw new ConfigurationException( "Failed while attempting to "
+ + "instantiate syntax-checker class " + a_fqcn
+ + " using its public default constructor.", e ) ;
+ }
+ }
+}
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxFactory.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxFactory.java Tue Dec 23 17:04:13 2003
@@ -0,0 +1,174 @@
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve"
+ and "Apache Software Foundation" must not be used to endorse or promote
+ products derived from this software without prior written
+ permission. For written permission, please contact apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.schema ;
+
+
+import org.apache.avalon.framework.configuration.Configuration ;
+import org.apache.avalon.framework.configuration.ConfigurationException ;
+
+
+/**
+ * A factory for creating Syntaxes using Avalon Configuration nodes.
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Rev$
+ */
+public class AvalonSyntaxFactory
+{
+ /** singleton factory instance */
+ private static AvalonSyntaxFactory s_instance = null ;
+
+
+ /**
+ * Creates a factory singleton checking to make sure it was not
+ * instantiated before.
+ */
+ private AvalonSyntaxFactory()
+ {
+ if ( s_instance == null )
+ {
+ return ;
+ }
+
+ throw new IllegalStateException( "Attempt to re-instantiate " +
+ "singleton." ) ;
+ }
+
+
+ /**
+ * Gets access to a singleton instance of a syntax generating factory.
+ *
+ * @return the singleton factory
+ */
+ public static AvalonSyntaxFactory getInstance()
+ {
+ if ( s_instance == null )
+ {
+ s_instance = new AvalonSyntaxFactory() ;
+ }
+
+ return s_instance ;
+ }
+
+
+ /**
+ * Creates a Syntax based on an Avalon Configuration node.
+ *
+ * @param a_config the configuration node for the syntax
+ * @return the newly created Syntax
+ * @throws ConfigurationException if there is a configuration error
+ */
+ public Syntax create( Configuration a_config ) throws ConfigurationException
+ {
+ AvalonSyntax l_syntax = null ;
+ SyntaxChecker l_checker = null ;
+ String l_oid = a_config.getChild( "oid" ).getValue() ;
+ AvalonSyntaxCheckerFactory l_checkerFactory = null ;
+
+ l_checkerFactory = AvalonSyntaxCheckerFactory.getInstance() ;
+ l_checker = l_checkerFactory.create( l_oid, a_config
+ .getChild( "syntax-checker" ) ) ;
+
+ l_syntax = new AvalonSyntax( l_oid, l_checker ) ;
+
+ if ( a_config.getChild( "description" ).getValue( null ) != null )
+ {
+ l_syntax.setDescription( a_config.getChild( "description" )
+ .getValue() ) ;
+ }
+
+ if ( a_config.getChild( "human-readable" ).getValue( null ) != null )
+ {
+ l_syntax.setHumanReadable( a_config.getChild( "human-readable" )
+ .getValueAsBoolean() ) ;
+ }
+
+ if ( a_config.getChild( "name" ).getValue( null ) != null )
+ {
+ l_syntax.setName( a_config.getChild( "name" )
+ .getValue() ) ;
+ }
+
+ return l_syntax ;
+ }
+
+
+ /**
+ * Class used to safely expose mutators on the Syntax bean.
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Rev$
+ */
+ private class AvalonSyntax extends DefaultSyntax
+ {
+ AvalonSyntax( String a_oid, SyntaxChecker a_checker )
+ throws ConfigurationException
+ {
+ super( a_oid, a_checker ) ;
+ }
+
+ public void setDescription( String a_description )
+ {
+ super.setDescription( a_description ) ;
+ }
+
+ public void setHumanReadable( boolean a_isHumanReadable )
+ {
+ super.setHumanReadible( a_isHumanReadable ) ;
+ }
+
+ public void setName( String a_name )
+ {
+ super.setName( a_name ) ;
+ }
+ }
+}
\ No newline at end of file
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxRegistryMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/AvalonSyntaxRegistryMonitor.java Tue Dec 23 17:04:13 2003
@@ -0,0 +1,125 @@
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve"
+ and "Apache Software Foundation" must not be used to endorse or promote
+ products derived from this software without prior written
+ permission. For written permission, please contact apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.schema ;
+
+
+import javax.naming.NamingException ;
+
+import org.apache.commons.lang.exception.ExceptionUtils ;
+import org.apache.avalon.framework.logger.AbstractLogEnabled ;
+
+
+/**
+ * A monitor that works with Avalon containers based on framework interfaces.
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Rev$
+ */
+public class AvalonSyntaxRegistryMonitor
+ extends AbstractLogEnabled
+ implements SyntaxRegistryMonitor
+{
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistryMonitor#registered(
+ * org.apache.eve.schema.Syntax)
+ */
+ public void registered( Syntax a_syntax )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "Syntax " + a_syntax.getOid() + " ("
+ + a_syntax.getName() + ") registered" ) ;
+ }
+ }
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistryMonitor#lookedUp(
+ * org.apache.eve.schema.Syntax)
+ */
+ public void lookedUp( Syntax a_syntax )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "Syntax " + a_syntax.getOid() + " ("
+ + a_syntax.getName() + ") looked up" ) ;
+ }
+ }
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistryMonitor#lookupFailed(
+ * java.lang.String, javax.naming.NamingException)
+ */
+ public void lookupFailed( String a_oid, NamingException a_fault )
+ {
+ if( getLogger().isInfoEnabled() )
+ {
+ getLogger().info( "Syntax with OID " + a_oid + " lookup failed:\n"
+ + ExceptionUtils.getStackTrace( a_fault ) ) ;
+ }
+ }
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistryMonitor#registerFailed(
+ * org.apache.eve.schema.Syntax, javax.naming.NamingException)
+ */
+ public void registerFailed( Syntax a_syntax, NamingException a_fault )
+ {
+ if( getLogger().isInfoEnabled() )
+ {
+ getLogger().info( "Syntax " + a_syntax.getOid() + " ("
+ + a_syntax.getName() + ") registration failed: "
+ + ExceptionUtils.getStackTrace( a_fault ) ) ;
+ }
+ }
+}
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/BootstrapSyntaxRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/BootstrapSyntaxRegistry.java Tue Dec 23 17:04:13 2003
@@ -0,0 +1,174 @@
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve"
+ and "Apache Software Foundation" must not be used to endorse or promote
+ products derived from this software without prior written
+ permission. For written permission, please contact apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.schema ;
+
+
+import java.util.Map ;
+import java.util.HashMap ;
+
+import javax.naming.NamingException ;
+import javax.naming.OperationNotSupportedException ;
+
+
+/**
+ * A SyntaxRegistry service available during server startup when other resources
+ * like a syntax backing store is unavailable.
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Rev$
+ */
+public class BootstrapSyntaxRegistry implements SyntaxRegistry
+{
+ /** a map of entries using an OID for the key and a Syntax for the value */
+ private final Map m_syntaxes ;
+ /** the OID registry this registry uses to register new syntax OIDs */
+ private final OidRegistry m_registry ;
+ /** a monitor used to track noteable registry events */
+ private SyntaxRegistryMonitor m_monitor =
+ new SyntaxRegistryMonitorAdapter() ;
+
+
+ // ------------------------------------------------------------------------
+ // C O N S T R U C T O R S
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Creates a BootstrapSyntaxRegistry using existing Syntaxes for lookups.
+ *
+ * @param a_syntaxes a map of OIDs to their respective Syntax objects
+ */
+ public BootstrapSyntaxRegistry( Syntax[] a_syntaxes,
+ OidRegistry a_registry )
+ {
+ m_registry = a_registry ;
+ m_syntaxes = new HashMap() ;
+
+ for ( int ii = 0; ii < a_syntaxes.length; ii++ )
+ {
+ m_syntaxes.put( a_syntaxes[ii].getOid(), a_syntaxes[ii] ) ;
+ }
+ }
+
+
+ // ------------------------------------------------------------------------
+ // SyntaxRegistry interface methods
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistry#lookup(java.lang.String)
+ */
+ public Syntax lookup( String a_oid ) throws NamingException
+ {
+ if ( m_syntaxes.containsKey( a_oid ) )
+ {
+ Syntax l_syntax = ( Syntax ) m_syntaxes.get( a_oid ) ;
+ m_monitor.lookedUp( l_syntax ) ;
+ return l_syntax ;
+ }
+
+ NamingException l_fault = new NamingException( "Unknown syntax OID "
+ + a_oid ) ;
+ m_monitor.lookupFailed( a_oid, l_fault ) ;
+ throw l_fault ;
+ }
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistry#register(
+ * org.apache.eve.schema.Syntax)
+ */
+ public void register( Syntax a_syntax ) throws NamingException
+ {
+ NamingException l_fault = new OperationNotSupportedException(
+ "Syntax registration on read-only bootstrap SyntaxRegistry no"
+ + "supported." ) ;
+ m_monitor.registerFailed( a_syntax, l_fault ) ;
+ throw l_fault ;
+ }
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistry#hasSyntax(java.lang.String)
+ */
+ public boolean hasSyntax( String a_oid )
+ {
+ return m_syntaxes.containsKey( a_oid ) ;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // package friendly monitor methods
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Gets the monitor for this registry.
+ *
+ * @return the monitor
+ */
+ SyntaxRegistryMonitor getMonitor()
+ {
+ return m_monitor ;
+ }
+
+
+ /**
+ * Sets the monitor for this registry.
+ *
+ * @param a_monitor the monitor to set
+ */
+ void setMonitor( SyntaxRegistryMonitor a_monitor )
+ {
+ m_monitor = a_monitor ;
+ }
+}
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.java Tue Dec 23 17:04:13 2003
@@ -0,0 +1,169 @@
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve"
+ and "Apache Software Foundation" must not be used to endorse or promote
+ products derived from this software without prior written
+ permission. For written permission, please contact apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.schema ;
+
+
+import javax.naming.NamingException ;
+
+import org.apache.avalon.framework.service.Serviceable ;
+import org.apache.avalon.framework.service.ServiceManager ;
+import org.apache.avalon.framework.activity.Initializable ;
+import org.apache.avalon.framework.service.ServiceException ;
+import org.apache.avalon.framework.logger.AbstractLogEnabled ;
+import org.apache.avalon.framework.configuration.Configurable ;
+import org.apache.avalon.framework.configuration.Configuration ;
+import org.apache.avalon.framework.configuration.ConfigurationException ;
+
+
+/**
+ * Merlin specific wrapper for the BootstrapSyntaxRegistry.
+ *
+ * @avalon.component name="bootstrap-syntax-registry" lifestyle="singleton"
+ * @avalon.service type="org.apache.eve.schema.SyntaxRegistry" version="1.0"
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Rev$
+ */
+public class MerlinBootstrapSyntaxRegistry
+ extends AbstractLogEnabled
+ implements Configurable, Serviceable, Initializable, SyntaxRegistry
+{
+ /** the OID registry we need to construct the SyntaxRegistry */
+ private OidRegistry m_oidReg ;
+ /** the wrapped delegate bootstrap SyntaxRegistry to use */
+ private SyntaxRegistry m_synReg ;
+ /** the syntaxes to provide lookups on */
+ private Syntax[] m_syntaxes ;
+
+
+ // ------------------------------------------------------------------------
+ // SyntaxRegistry interface methods
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistry#lookup(java.lang.String)
+ */
+ public Syntax lookup( String a_oid ) throws NamingException
+ {
+ return m_synReg.lookup( a_oid ) ;
+ }
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistry#register(
+ * org.apache.eve.schema.Syntax)
+ */
+ public void register( Syntax a_syntax ) throws NamingException
+ {
+ m_synReg.register( a_syntax ) ;
+ }
+
+
+ /**
+ * @see org.apache.eve.schema.SyntaxRegistry#hasSyntax(java.lang.String)
+ */
+ public boolean hasSyntax( String a_oid )
+ {
+ return m_synReg.hasSyntax( a_oid ) ;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Avalon life-cycle methods
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configurable#configure(
+ * org.apache.avalon.framework.configuration.Configuration)
+ */
+ public void configure( Configuration a_conf ) throws ConfigurationException
+ {
+ Configuration [] l_syntaxes = a_conf.getChildren( "syntax" ) ;
+ AvalonSyntaxFactory l_factory = AvalonSyntaxFactory.getInstance() ;
+ m_syntaxes = new Syntax[ l_syntaxes.length ] ;
+
+ for ( int ii = 0 ; ii < l_syntaxes.length ; ii++ )
+ {
+ m_syntaxes[ii] = l_factory.create( l_syntaxes[ii] ) ;
+ }
+ }
+
+
+ /**
+ * @avalon.dependency type="org.apache.eve.schema.OidRegistry"
+ * key="oid-registry" version="1.0"
+ *
+ * @see org.apache.avalon.framework.service.Serviceable#service(
+ * org.apache.avalon.framework.service.ServiceManager)
+ */
+ public void service( ServiceManager a_manager ) throws ServiceException
+ {
+ m_oidReg = ( OidRegistry ) a_manager.lookup( "oid-registry" ) ;
+ }
+
+
+ /**
+ * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ */
+ public void initialize() throws Exception
+ {
+ AvalonSyntaxRegistryMonitor l_monitor =
+ new AvalonSyntaxRegistryMonitor() ;
+ BootstrapSyntaxRegistry l_registry =
+ new BootstrapSyntaxRegistry( m_syntaxes, m_oidReg ) ;
+
+ l_monitor.enableLogging( getLogger() ) ;
+ l_registry.setMonitor( l_monitor ) ;
+ m_synReg = l_registry ;
+ }
+}
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.xconfig
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.xconfig Tue Dec 23 17:04:13 2003
@@ -0,0 +1,128 @@
+<!-- ===================================================================
+
+ The following private IANA number base is reserved for use by
+ SystemBackend Syntaxes within the Apache Eve Directory Server:
+
+ 1.2.6.1.4.1.18060.1.1.1
+
+==================================================================== -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="./MerlinBootstrapSyntaxRegistry.xsd">
+
+
+ <syntax>
+ <oid>1.3.6.1.4.1.1466.115.121.1.12</oid>
+ <name>DN</name>
+ <human-readable>true</human-readable>
+ <description>
+Values in the Distinguished Name syntax are encoded to have the
+representation defined in RFC 2253. Note that this representation
+is not reversible to an ASN.1 encoding used in X.500 for Distinguished
+Names, as the CHOICE of any DirectoryString element in an RDN is no
+longer known.
+ </description>
+ <syntax-checker>
+ <built-in>unchecked</built-in>
+ </syntax-checker>
+ </syntax>
+
+
+ <syntax>
+ <oid>1.3.6.1.4.1.1466.115.121.1.27</oid>
+ <name>INTEGER</name>
+ <human-readable>true</human-readable>
+ <description>
+Values in this syntax are encoded as the decimal representation of
+their values, with each decimal digit represented by the its character
+equivalent. So the number 1321 is represented by the character string
+"1321".
+ </description>
+ <syntax-checker>
+ <built-in>unchecked</built-in>
+ </syntax-checker>
+ </syntax>
+
+
+ <syntax>
+ <oid>1.3.6.1.4.1.1466.115.121.1.15</oid>
+ <name>Directory String</name>
+ <human-readable>true</human-readable>
+ <description>
+A string in this syntax is encoded in the UTF-8 form of ISO 10646
+(a superset of Unicode). Servers and clients MUST be prepared to receive
+encodings of arbitrary Unicode characters, including characters not
+presently assigned to any character set.
+ </description>
+ <syntax-checker>
+ <built-in>unchecked</built-in>
+ </syntax-checker>
+ </syntax>
+
+
+ <syntax>
+ <oid>1.3.6.1.4.1.1466.115.121.1.38</oid>
+ <name>OID</name>
+ <human-readable>true</human-readable>
+ <description>
+Values in the Object Identifier syntax are encoded according to the BNF
+in section 4.1 for "oid".
+ </description>
+ <syntax-checker>
+ <built-in>unchecked</built-in>
+ </syntax-checker>
+ </syntax>
+
+
+ <syntax>
+ <oid>1.3.6.1.4.1.1466.115.121.1.58</oid>
+ <name>Substring Assertion</name>
+ <human-readable>true</human-readable>
+ <description>
+The Substring Assertion syntax is used only as the syntax of assertion
+values in the extensible match. It is not used as the syntax of
+attributes, or in the substring filter.
+
+The Substring Assertion is encoded according to the following BNF:
+
+ substring = [initial] any [final]
+ initial = value
+ any = "*" *(value "*")
+ final = value
+
+The production is UTF-8 encoded string. Should the backslash or asterix
+characters be present in a production of , they are quoted as described in
+section 4.3.
+
+Servers SHOULD be capable of performing the following matching rules,
+which are used in substring filters: caseIgnoreSubstringsMatch,
+telephoneNumberSubstringsMatch, numericStringSubstringsMatch.
+ </description>
+ <syntax-checker>
+ <built-in>unchecked</built-in>
+ </syntax-checker>
+ </syntax>
+
+
+ <syntax>
+ <oid>1.3.6.1.4.1.1466.115.121.1.34</oid>
+ <name>Name And Optional UID</name>
+ <human-readable>true</human-readable>
+ <description>
+Name And Optional UID
+Values in this syntax are encoded according to the following BNF:
+
+ NameAndOptionalUID = DistinguishedName [ "#" bitstring ]
+
+Although the `#` character may occur in a string representation of a
+distinguished name, no additional special quoting is done. This syntax
+has been added subsequent to RFC 1778.
+
+ Example:
+
+ 1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB#`0101`B
+ </description>
+ <syntax-checker>
+ <built-in>unchecked</built-in>
+ </syntax-checker>
+ </syntax>
+</configuration>
Added: incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.xsd
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/backend/schema/syntax/bootstrap-impl/src/java/org/apache/eve/schema/MerlinBootstrapSyntaxRegistry.xsd Tue Dec 23 17:04:13 2003
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:element name="configuration">
+ <xs:annotation>
+ <xs:documentation>A syntax registry configuration node</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="syntax" type="syntax" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="syntax">
+ <xs:annotation>
+ <xs:documentation>An X.500 Syntax Definition</xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="3" maxOccurs="5">
+ <xs:element name="oid" type="xs:string"/>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="human-readable" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="syntax-checker">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="built-in" type="xs:string"/>
+ <xs:element name="regex" type="xs:string" maxOccurs="unbounded"/>
+ <xs:element name="class" type="xs:string"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+</xs:schema>