You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dj...@apache.org on 2007/03/17 03:10:38 UTC
svn commit: r519215 - in /directory/apacheds/trunk: ./ bootstrap-extract/
bootstrap-extract/src/ bootstrap-extract/src/main/
bootstrap-extract/src/main/java/ bootstrap-extract/src/main/java/org/
bootstrap-extract/src/main/java/org/apache/ bootstrap-ext...
Author: djencks
Date: Fri Mar 16 19:10:36 2007
New Revision: 519215
URL: http://svn.apache.org/viewvc?view=rev&rev=519215
Log:
DIRSERVER-834 Separate the bootstrap extraction code from the schemas it extracts, so you can easily set up different collections of bootstrap schemas. Unfortunately svn got confused and I lost history.
Added:
directory/apacheds/trunk/bootstrap-extract/
directory/apacheds/trunk/bootstrap-extract/pom.xml (with props)
directory/apacheds/trunk/bootstrap-extract/src/
directory/apacheds/trunk/bootstrap-extract/src/main/
directory/apacheds/trunk/bootstrap-extract/src/main/java/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java (with props)
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java (with props)
directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java (with props)
directory/apacheds/trunk/bootstrap-extract/src/main/resources/
directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/
directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt (with props)
directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt (with props)
directory/apacheds/trunk/bootstrap-extract/src/test/
directory/apacheds/trunk/bootstrap-extract/src/test/java/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/
directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java (with props)
Removed:
directory/apacheds/trunk/bootstrap-partition/src/main/java/
Modified:
directory/apacheds/trunk/bootstrap-partition/pom.xml
directory/apacheds/trunk/bootstrap-plugin/pom.xml
directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
directory/apacheds/trunk/pom.xml
directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java
directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java
Added: directory/apacheds/trunk/bootstrap-extract/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-extract/pom.xml?view=auto&rev=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-extract/pom.xml (added)
+++ directory/apacheds/trunk/bootstrap-extract/pom.xml Fri Mar 16 19:10:36 2007
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>build</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>apacheds-bootstrap-extract</artifactId>
+ <name>ApacheDS Bootstrap Partition File Extractor</name>
+ <packaging>jar</packaging>
+ <description>
+ This artifact contains the classes needed to extract db files into the proper position
+ for the schema partition.
+ </description>
+ <dependencies>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>nlog4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-jdbm-store</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>jarFilePath</name>
+ <value>${basedir}/src/test/resources/test.jar</value>
+ </property>
+ <property>
+ <name>destDirPath</name>
+ <value>${basedir}/target/extracted</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: directory/apacheds/trunk/bootstrap-extract/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/trunk/bootstrap-extract/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/trunk/bootstrap-extract/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java?view=auto&rev=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java (added)
+++ directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java Fri Mar 16 19:10:36 2007
@@ -0,0 +1,165 @@
+/*
+ * 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.server.schema.bootstrap.partition;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Enumeration;
+import java.net.URL;
+
+
+/**
+ * Parses the dbfile listing file within this jar.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DbFileListing
+{
+ Map<String, DbFileType> name2type = new HashMap<String, DbFileType>();
+ private static final String BASE_PATH = DbFileListing.class.getName().substring( 0, DbFileListing.class.getName().lastIndexOf( "." ) + 1 ).replace( '.', '/' );
+
+
+ public DbFileListing() throws IOException
+ {
+ init();
+ }
+
+
+ private void init() throws IOException
+ {
+
+ boolean userIndexMode = false;
+ String line;
+ BufferedReader in = new BufferedReader( new InputStreamReader( getUniqueResourceAsStream( "DBFILES" ) ) );
+ try
+ {
+ while ( ( line = in.readLine() ) != null )
+ {
+ if ( line.indexOf( "master.db" ) != -1 )
+ {
+ name2type.put( line.trim(), DbFileType.MASTER_FILE );
+ continue;
+ }
+
+ if ( line.indexOf( "USER INDICES" ) != -1 )
+ {
+ userIndexMode = true;
+ continue;
+ }
+
+ if ( userIndexMode )
+ {
+ name2type.put( line.trim(), DbFileType.USER_INDEX );
+ } else
+ {
+ name2type.put( line.trim(), DbFileType.SYSTEM_INDEX );
+ }
+ }
+ }
+ finally
+ {
+ in.close();
+ }
+ }
+
+ public static InputStream getUniqueResourceAsStream( String resourceName ) throws IOException
+ {
+ resourceName = BASE_PATH + resourceName;
+ URL result = getUniqueResource( resourceName );
+ return result.openStream();
+ }
+
+ static URL getUniqueResource( String resourceName )
+ throws IOException
+ {
+ Enumeration<URL> resources = DbFileListing.class.getClassLoader().getResources( resourceName );
+ if ( !resources.hasMoreElements() )
+ {
+ throw new IllegalStateException( "No resource named " + resourceName );
+ }
+ URL result = resources.nextElement();
+ if ( resources.hasMoreElements() )
+ {
+ StringBuffer buffer = new StringBuffer( "More than one resource named: " ).append( resourceName );
+ buffer.append( result ).append( "\n" );
+ while ( resources.hasMoreElements() )
+ {
+ buffer.append( resources.nextElement() ).append( "\n" );
+ }
+ throw new IllegalStateException( buffer.toString() );
+ }
+ return result;
+ }
+
+
+ public DbFileType getType( String dbfile )
+ {
+ return name2type.get( dbfile );
+ }
+
+
+ public Iterator<String> iterator()
+ {
+ return name2type.keySet().iterator();
+ }
+
+
+ public String getIndexAttributeName( String dbfile )
+ {
+ if ( dbfile.length() < 10 )
+ {
+ throw new IllegalArgumentException( "db file must have a relative jar path name of over 10 characters" );
+ }
+
+ // remove 'schema/'
+ String dbfileName = dbfile.substring( 7 );
+ return dbfileName.substring( 0, dbfileName.length() - 3 );
+ }
+
+
+ /**
+ * Gets the user indices WITHOUT the system indices.
+ *
+ * @return set of user index names
+ */
+ public Set<Object> getIndexedAttributes()
+ {
+ Set<Object> attributes = new HashSet<Object>();
+ Iterator<String> ii = iterator();
+ while( ii.hasNext() )
+ {
+ String name = ii.next();
+ if ( name2type.get( name ) == DbFileType.USER_INDEX )
+ {
+ attributes.add( getIndexAttributeName( name ) );
+ }
+ }
+ return attributes;
+ }
+}
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java?view=auto&rev=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java (added)
+++ directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java Fri Mar 16 19:10:36 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.server.schema.bootstrap.partition;
+
+
+/**
+ * The type of the dbfile.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public enum DbFileType
+{
+ MASTER_FILE,
+ SYSTEM_INDEX,
+ USER_INDEX
+}
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java?view=auto&rev=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java (added)
+++ directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java Fri Mar 16 19:10:36 2007
@@ -0,0 +1,100 @@
+/*
+ * 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.server.schema.bootstrap.partition;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+/**
+ * Extracts dbfiles for the schema partition onto a destination directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SchemaPartitionExtractor
+{
+ private DbFileListing listing;
+ private File outputDirectory;
+
+
+ public SchemaPartitionExtractor( File outputDirectory ) throws IOException
+ {
+ this.outputDirectory = outputDirectory;
+ this.listing = new DbFileListing();
+ }
+
+
+ public void extract() throws IOException
+ {
+ if ( ! outputDirectory.exists() )
+ {
+ outputDirectory.mkdirs();
+ }
+
+ File schemaDirectory = new File( outputDirectory, "schema" );
+ if ( ! schemaDirectory.exists() )
+ {
+ schemaDirectory.mkdirs();
+ }
+
+ Iterator<String> ii = listing.iterator();
+ while ( ii.hasNext() )
+ {
+ extract( ii.next() );
+ }
+ }
+
+
+ public DbFileListing getDbFileListing()
+ {
+ return listing;
+ }
+
+
+ private void extract( String resource ) throws IOException
+ {
+ byte[] buf = new byte[512];
+ InputStream in = DbFileListing.getUniqueResourceAsStream( resource );
+
+ try
+ {
+ FileOutputStream out = new FileOutputStream( new File( outputDirectory, resource ) );
+ try
+ {
+ while ( in.available() > 0 )
+ {
+ int readCount = in.read( buf );
+ out.write( buf, 0, readCount );
+ }
+ out.flush();
+ } finally
+ {
+ out.close();
+ }
+ }
+ finally
+ {
+ in.close();
+ }
+ }
+}
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/SchemaPartitionExtractor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt?view=auto&rev=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt (added)
+++ directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt Fri Mar 16 19:10:36 2007
@@ -0,0 +1,202 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt?view=auto&rev=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt (added)
+++ directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt Fri Mar 16 19:10:36 2007
@@ -0,0 +1,5 @@
+Apache Directory Server
+Copyright 2003-2006 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/trunk/bootstrap-extract/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java?view=auto&rev=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java (added)
+++ directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java Fri Mar 16 19:10:36 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.server.schema.bootstrap.partition;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class UniqueResourceTest extends TestCase
+{
+
+ public void testUniqueResource() throws Exception
+ {
+ //look for META-INF/LICENSE.txt which should be in at least two jars
+ try
+ {
+ DbFileListing.getUniqueResource( "META-INF/LICENSE.txt" );
+ fail( "There are at least 2 license files on the classpath, this should have failed" );
+ } catch ( IllegalStateException e )
+ {
+ //ignore
+ }
+
+ }
+}
Propchange: directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/trunk/bootstrap-extract/src/test/java/org/apache/directory/server/schema/bootstrap/partition/UniqueResourceTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: directory/apacheds/trunk/bootstrap-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-partition/pom.xml?view=diff&rev=519215&r1=519214&r2=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-partition/pom.xml (original)
+++ directory/apacheds/trunk/bootstrap-partition/pom.xml Fri Mar 16 19:10:36 2007
@@ -12,8 +12,9 @@
<description>
A special jar file that contains a pre-loaded partition with schema
information. This schema partition will mount off of the ou=schema
- namingContext. This artifact contains the db files for this partition
- as well as classes needed to extract them into the proper position.
+ namingContext. This artifact contains the db files for this partition.
+ It must be used with the apacheds-bootstrap-extract jar which contains
+ the classes to install these files.
</description>
<dependencies>
<dependency>
@@ -29,6 +30,16 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-jdbm-store</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-bootstrap-extract</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-schema-extras</artifactId>
<version>${pom.version}</version>
</dependency>
</dependencies>
Modified: directory/apacheds/trunk/bootstrap-plugin/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-plugin/pom.xml?view=diff&rev=519215&r1=519214&r2=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-plugin/pom.xml (original)
+++ directory/apacheds/trunk/bootstrap-plugin/pom.xml Fri Mar 16 19:10:36 2007
@@ -42,14 +42,19 @@
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-utils</artifactId>
+ <artifactId>apacheds-schema-bootstrap</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-schema-extras</artifactId>
+ <artifactId>apacheds-utils</artifactId>
<version>${pom.version}</version>
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.directory.server</groupId>-->
+ <!--<artifactId>apacheds-schema-extras</artifactId>-->
+ <!--<version>${pom.version}</version>-->
+ <!--</dependency>-->
</dependencies>
<build>
Modified: directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?view=diff&rev=519215&r1=519214&r2=519215
==============================================================================
--- directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java (original)
+++ directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java Fri Mar 16 19:10:36 2007
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.server.core.bootstrap.plugin;
+package org.apache.directory.server.core.bootstrap.plugin;
import java.io.File;
@@ -29,6 +29,11 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.Arrays;
+import java.util.List;
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.MalformedURLException;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
@@ -82,86 +87,104 @@
/**
* A plugin used to pre-load meta schema entries into the schema partition.
*
- * @goal load
- * @description creates and pre-loads ApacheDS schema partition
- * @phase compile
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
+ * @goal load
+ * @description creates and pre-loads ApacheDS schema partition
+ * @phase compile
+ * @requiresDependencyResolution compile
*/
public class BootstrapPlugin extends AbstractMojo
{
private static final String ADMIN_NORM_NAME = "0.9.2342.19200300.100.1.1=admin,2.5.4.11=system";
/**
+ * The classpath elements of the project being tested.
+ *
+ * @parameter expression="${project.compileClasspathElements}"
+ * @required
+ * @readonly
+ */
+ private List classpathElements;
+
+ /**
* The package to put the db file entry listing info as well as the partition.
- *
+ *
* @parameter expression="org.apache.directory.server.schema.bootstrap.partition"
*/
private String outputPackage;
-
+
/**
* The file name to use for the package listing.
- *
+ *
* @parameter expression="DBFILES"
*/
private String listingFileName;
-
+
/**
* The target directory into which the plugin generates schema partion files
* within the specified outputPackage.
- *
+ *
* @parameter expression="target/classes"
*/
private File outputDirectory;
-
+
/**
* The name of the set of bootstrap schemas to load into the registries
* and ultimately into the schema partition being built.
- *
- * @parameter
+ *
+ * @parameter
*/
private String[] bootstrapSchemaClasses;
-
+
/**
* The set of disabled schema names.
- *
- * @parameter
+ *
+ * @parameter
*/
private String[] disabledSchemas;
-
+
/**
* The names of Attributes to index.
- *
- * @parameter
+ *
+ * @parameter
*/
private String[] indexedAttributes;
-
- /** Facotry used to create attributes objects from schema entities. */
+
+ /**
+ * Facotry used to create attributes objects from schema entities.
+ */
private AttributesFactory attributesFactory = new AttributesFactory();
-
- /** Registries of objects used to load the schema partition. */
+
+ /**
+ * Registries of objects used to load the schema partition.
+ */
private Registries registries;
- /** The store to load schema entities into. */
+ /**
+ * The store to load schema entities into.
+ */
private JdbmStore store = new JdbmStore();
-
- /** Map of schemas by name */
+
+ /**
+ * Map of schemas by name
+ */
private Map schemas = new HashMap();
-
-
+
+
/**
- * Loads a bunch of bootstrap classes into memory then adds them to a new
+ * Loads a bunch of bootstrap classes into memory then adds them to a new
* schema partition within the target area. The db files for this partition
* are then packaged into the jar by the jar plugin.
*/
public void execute() throws MojoExecutionException, MojoFailureException
{
File packageDirectory = new File( outputDirectory, outputPackage.replace( '.', File.separatorChar ) );
- if ( ! packageDirectory.exists() )
+ if ( !packageDirectory.exists() )
{
packageDirectory.mkdirs();
}
-
+
// delete output directory if it exists
File schemaDirectory = new File( packageDirectory, "schema" );
if ( schemaDirectory.exists() )
@@ -172,20 +195,20 @@
}
catch ( IOException e )
{
- throw new MojoFailureException( "Failed to delete old schema partition folder "
- + schemaDirectory.getAbsolutePath() + ": " + e.getMessage() );
+ throw new MojoFailureException( "Failed to delete old schema partition folder "
+ + schemaDirectory.getAbsolutePath() + ": " + e.getMessage() );
}
}
-
+
initializeSchemas();
initializePartition( schemaDirectory );
-
+
try
{
LdapDN dn = new LdapDN( CoreSchemaConstants.OU_AT + "=schema" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
-
- if ( ! hasEntry( dn ) )
+
+ if ( !hasEntry( dn ) )
{
Attributes entry = new AttributesImpl();
entry.put( SchemaConstants.OBJECT_CLASS_AT, "top" );
@@ -195,7 +218,7 @@
}
createSchemasAndContainers();
-
+
addSyntaxCheckers();
addSyntaxes();
addNormalizers();
@@ -216,7 +239,7 @@
disableSchema( disabledSchemas[ii] );
getLog().info( "\t\t o " + disabledSchemas[ii] );
}
-
+
getLog().info( "" );
getLog().info( "------------------------------------------------------------------------" );
}
@@ -228,7 +251,7 @@
e.printStackTrace();
throw new MojoFailureException( "Failed to add syntaxCheckers to partition: " + e.getMessage() );
}
-
+
try
{
store.sync();
@@ -237,12 +260,12 @@
{
e.printStackTrace();
}
-
+
// ------------------------------------------------------------------
// Create db file listing and place it into the right package on disk
// ------------------------------------------------------------------
-
-
+
+
File listingFile = new File( packageDirectory, listingFileName );
PrintWriter out = null;
try
@@ -571,12 +594,12 @@
}
getLog().info( "" );
}
-
-
+
+
/**
* Creates the configuration and initializes the partition so we can start
* adding entries into it.
- *
+ *
* @throws MojoFailureException
*/
private void initializePartition( File workingDirectory ) throws MojoFailureException
@@ -602,7 +625,7 @@
Attributes rootEntry = new AttributesImpl( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit", true );
rootEntry.put( CoreSchemaConstants.OU_AT, "schema" );
storeConfig.setContextEntry( rootEntry );
-
+
try
{
store.init( storeConfig );
@@ -613,8 +636,8 @@
throw new MojoFailureException( "Failed to initialize parition: " + e.getMessage() );
}
}
-
-
+
+
/**
* Creates the special schemaModificationsAttribute entry used to
* store the modification attributes for the schema. The current
@@ -651,7 +674,7 @@
/**
* Loads all the bootstrap schemas into the registries in preparation for
* loading them into the schema partition.
- *
+ *
* @throws MojoFailureException
*/
private void initializeSchemas() throws MojoFailureException
@@ -663,54 +686,70 @@
// always include these core bootstrap schemas
BootstrapSchema schema = new SystemSchema();
schemas.put( schema.getSchemaName(), schema );
-
+
schema = new ApacheSchema();
schemas.put( schema.getSchemaName(), schema );
schema = new ApachemetaSchema();
schemas.put( schema.getSchemaName(), schema );
-
+
schema = new CoreSchema();
schemas.put( schema.getSchemaName(), schema );
-
+
getLog().info( "------------------------------------------------------------------------" );
getLog().info( "Found bootstrap schemas: " );
getLog().info( "------------------------------------------------------------------------" );
getLog().info( "" );
// start loading other schemas from the plugin's configuration section
+ ClassLoader parent = getClass().getClassLoader();
+ URL[] urls = new URL[classpathElements.size()];
+ int i = 0;
+ for ( Iterator it = classpathElements.iterator(); it.hasNext(); )
+ {
+ try
+ {
+ urls[i++] = new File( ( String ) it.next() ).toURL();
+ } catch ( MalformedURLException e )
+ {
+ throw ( MojoFailureException ) new MojoFailureException( "Could not construct classloader: " ).initCause( e );
+ }
+ }
+ ClassLoader cl = new URLClassLoader( urls, parent );
for ( int ii = 0; ii < bootstrapSchemaClasses.length; ii++ )
{
try
{
- Class schemaClass = Class.forName( bootstrapSchemaClasses[ii] );
+ Class schemaClass = cl.loadClass( bootstrapSchemaClasses[ii] );
schema = ( BootstrapSchema ) schemaClass.newInstance();
schemas.put( schema.getSchemaName(), schema );
}
catch ( ClassNotFoundException e )
{
+ getLog().info( "ClassLoader " + getClass().getClassLoader() );
+ getLog().info( "ClassLoader URLs: " + Arrays.asList( ( ( URLClassLoader ) getClass().getClassLoader() ).getURLs() ) );
e.printStackTrace();
- throw new MojoFailureException( "Could not find BootstrapSchema class: "
- + bootstrapSchemaClasses[ii] );
+ throw new MojoFailureException( "Could not find BootstrapSchema class: "
+ + bootstrapSchemaClasses[ii] );
}
catch ( InstantiationException e )
{
e.printStackTrace();
- throw new MojoFailureException( "Could not instantiate BootstrapSchema class: "
- + bootstrapSchemaClasses[ii] );
+ throw new MojoFailureException( "Could not instantiate BootstrapSchema class: "
+ + bootstrapSchemaClasses[ii] );
}
catch ( IllegalAccessException e )
{
e.printStackTrace();
throw new MojoFailureException( "Could not instantiate BootstrapSchema class due to security: "
- + bootstrapSchemaClasses[ii] );
+ + bootstrapSchemaClasses[ii] );
}
-
+
getLog().info( "\t" + bootstrapSchemaClasses[ii] );
}
getLog().info( "" );
-
- BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
+
+ BootstrapSchemaLoader loader = new BootstrapSchemaLoader( cl );
registries = new DefaultRegistries( "bootstrap", loader, new DefaultOidRegistry() );
try
{
@@ -721,10 +760,10 @@
e.printStackTrace();
throw new MojoFailureException( "Failed to load bootstrap registries with schemas: " + e.getMessage() );
}
-
+
SerializableComparator.setRegistry( registries.getComparatorRegistry() );
}
-
+
private void checkCreateContainer( LdapDN dn ) throws NamingException
{
@@ -732,41 +771,41 @@
{
return;
}
-
+
Attributes entry = new AttributesImpl();
entry.put( SchemaConstants.OBJECT_CLASS_AT, "top" );
entry.get( SchemaConstants.OBJECT_CLASS_AT ).add( "organizationalUnit" );
entry.put( CoreSchemaConstants.OU_AT, dn.getRdn().getValue() );
store.add( dn, entry );
}
-
-
+
+
private LdapDN checkCreateSchema( String schemaName ) throws NamingException
{
Schema schema = ( Schema ) schemas.get( schemaName );
- LdapDN dn = new LdapDN( SystemSchemaConstants.CN_AT + "="
- + schemaName + "," + CoreSchemaConstants.OU_AT + "=schema" );
+ LdapDN dn = new LdapDN( SystemSchemaConstants.CN_AT + "="
+ + schemaName + "," + CoreSchemaConstants.OU_AT + "=schema" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
if ( hasEntry( dn ) )
{
return dn;
}
-
+
Attributes entry = attributesFactory.getAttributes( schema );
store.add( dn, entry );
return dn;
}
-
-
+
+
private void disableSchema( String schemaName ) throws NamingException
{
- LdapDN dn = new LdapDN( SystemSchemaConstants.CN_AT + "=" + schemaName
- + "," + CoreSchemaConstants.OU_AT + "=schema" );
+ LdapDN dn = new LdapDN( SystemSchemaConstants.CN_AT + "=" + schemaName
+ + "," + CoreSchemaConstants.OU_AT + "=schema" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
- ModificationItemImpl mod = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
- new AttributeImpl( MetaSchemaConstants.M_DISABLED_AT, "TRUE" ) );
- ModificationItemImpl[] mods = new ModificationItemImpl[] { mod };
+ ModificationItemImpl mod = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
+ new AttributeImpl( MetaSchemaConstants.M_DISABLED_AT, "TRUE" ) );
+ ModificationItemImpl[] mods = new ModificationItemImpl[] {mod};
store.modify( dn, mods );
}
@@ -778,11 +817,11 @@
{
return object.getName();
}
-
+
return object.getOid();
}
-
-
+
+
private final boolean hasEntry( LdapDN dn ) throws NamingException
{
Long id = store.getEntryId( dn.toNormName() );
@@ -792,15 +831,15 @@
}
return true;
}
-
-
+
+
private final StringBuffer getDbFileListing() throws IndexNotFoundException
{
StringBuffer buf = new StringBuffer();
buf.append( "schema/master.db\n" );
-
+
Iterator systemIndices = store.getSystemIndices();
- while( systemIndices.hasNext() )
+ while ( systemIndices.hasNext() )
{
Index index = store.getSystemIndex( ( String ) systemIndices.next() );
buf.append( "schema/" );
@@ -815,7 +854,7 @@
buf.append( indexedAttributes[ii] );
buf.append( ".db\n" );
}
-
+
return buf;
}
}
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?view=diff&rev=519215&r1=519214&r2=519215
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Fri Mar 16 19:10:36 2007
@@ -74,7 +74,7 @@
super.setUp();
// setup working directory
- File workingDirectory = new File( System.getProperty( "workingDirectory" ) );
+ File workingDirectory = new File( System.getProperty( "workingDirectory", System.getProperty( "user.dir" ) ) );
if ( ! workingDirectory.exists() )
{
workingDirectory.mkdirs();
Modified: directory/apacheds/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/pom.xml?view=diff&rev=519215&r1=519214&r2=519215
==============================================================================
--- directory/apacheds/trunk/pom.xml (original)
+++ directory/apacheds/trunk/pom.xml Fri Mar 16 19:10:36 2007
@@ -219,6 +219,7 @@
<modules>
<!-- module>maven-osgi-plugin</module-->
+ <module>bootstrap-extract</module>
<module>bootstrap-partition</module>
<module>bootstrap-plugin</module>
<module>schema-extras</module>
@@ -356,7 +357,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.3-SNAPSHOT</version>
+ <version>2.3</version>
<configuration>
<argLine>-Xmx1024m</argLine>
</configuration>
Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java?view=diff&rev=519215&r1=519214&r2=519215
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java Fri Mar 16 19:10:36 2007
@@ -109,7 +109,7 @@
final SyntaxCheckerRegistry registry;
- protected BootstrapSyntax(String oid, SyntaxCheckerRegistry registry)
+ public BootstrapSyntax(String oid, SyntaxCheckerRegistry registry)
{
super( oid );
this.registry = registry;
@@ -161,7 +161,7 @@
String syntaxOid;
- protected BootstrapMatchingRule(String oid, Registries registries)
+ public BootstrapMatchingRule(String oid, Registries registries)
{
super( oid );
this.syntaxRegistry = registries.getSyntaxRegistry();
@@ -238,7 +238,7 @@
private String syntaxId;
- protected BootstrapAttributeType(String oid, Registries registries)
+ public BootstrapAttributeType(String oid, Registries registries)
{
super( oid );
@@ -434,7 +434,7 @@
* @param oid the OID of the new objectClass
* @param registries the bootstrap registries to use for resolving dependent objects
*/
- protected BootstrapObjectClass(String oid, Registries registries)
+ public BootstrapObjectClass(String oid, Registries registries)
{
super( oid );
Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java?view=diff&rev=519215&r1=519214&r2=519215
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java Fri Mar 16 19:10:36 2007
@@ -74,6 +74,8 @@
{
private static final Logger log = LoggerFactory.getLogger( BootstrapSchemaLoader.class );
+ private ClassLoader cl = getClass().getClassLoader();
+
/** stores schemas of producers for callback access */
private ThreadLocal<BootstrapSchema> schemas;
/** stores registries associated with producers for callback access */
@@ -98,7 +100,13 @@
registries = new ThreadLocal<Registries>();
}
-
+
+ public BootstrapSchemaLoader( ClassLoader cl )
+ {
+ this();
+ this.cl = cl;
+ }
+
public final void loadWithDependencies( Schema schema, Registries registries ) throws NamingException
{
if ( ! ( schema instanceof BootstrapSchema ) )
@@ -322,7 +330,7 @@
try
{
- clazz = Class.forName( targetClassName );
+ clazz = Class.forName( targetClassName, true, cl );
}
catch ( ClassNotFoundException e )
{
@@ -336,7 +344,7 @@
try
{
- clazz = Class.forName( defaultClassName );
+ clazz = Class.forName( defaultClassName, true, cl );
}
catch ( ClassNotFoundException e )
{
@@ -407,7 +415,7 @@
Schema schema = null;
try
{
- schema = ( Schema ) Class.forName( schemaName ).newInstance();
+ schema = ( Schema ) Class.forName( schemaName, true, cl ).newInstance();
}
catch ( InstantiationException e )
{