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 2006/01/17 23:35:28 UTC
svn commit: r369946 - in /directory/trunks/apacheds:
core/src/main/java/org/apache/ldap/server/
core/src/main/java/org/apache/ldap/server/partition/ dumptool/
dumptool/src/ dumptool/src/main/ dumptool/src/main/java/
dumptool/src/main/java/org/ dumptool...
Author: akarasulu
Date: Tue Jan 17 14:35:22 2006
New Revision: 369946
URL: http://svn.apache.org/viewcvs?rev=369946&view=rev
Log:
initally checking of dumptool - needs serious work
Added:
directory/trunks/apacheds/dumptool/ (with props)
directory/trunks/apacheds/dumptool/pom.xml
directory/trunks/apacheds/dumptool/src/
directory/trunks/apacheds/dumptool/src/main/
directory/trunks/apacheds/dumptool/src/main/java/
directory/trunks/apacheds/dumptool/src/main/java/org/
directory/trunks/apacheds/dumptool/src/main/java/org/apache/
directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/
directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/server/
directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/server/dumptool/
directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/server/dumptool/DumpTool.java
directory/trunks/apacheds/dumptool/src/test/
directory/trunks/apacheds/dumptool/src/test/java/
Modified:
directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/DefaultDirectoryPartitionNexus.java
directory/trunks/apacheds/shared/pom.xml
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java?rev=369946&r1=369945&r2=369946&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java Tue Jan 17 14:35:22 2006
@@ -735,11 +735,8 @@
// --------------------------------------------------------------------
BootstrapRegistries bootstrapRegistries = new BootstrapRegistries();
-
BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-
loader.load( startupConfiguration.getBootstrapSchemas(), bootstrapRegistries );
-
setupOidsMap( bootstrapRegistries );
java.util.List errors = bootstrapRegistries.checkRefInteg();
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/DefaultDirectoryPartitionNexus.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/DefaultDirectoryPartitionNexus.java?rev=369946&r1=369945&r2=369946&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/DefaultDirectoryPartitionNexus.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/DefaultDirectoryPartitionNexus.java Tue Jan 17 14:35:22 2006
@@ -36,8 +36,6 @@
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
@@ -243,8 +241,8 @@
systemCfg.setIndexedAttributes( indexedSystemAttrs );
// Add context entry for system partition
- Attributes systemEntry = new BasicAttributes( true );
- Attribute objectClassAttr = new BasicAttribute( "objectClass" );
+ Attributes systemEntry = new LockableAttributesImpl();
+ Attribute objectClassAttr = new LockableAttributeImpl( "objectClass" );
objectClassAttr.add( "top" );
objectClassAttr.add( "organizationalUnit" );
systemEntry.put( objectClassAttr );
Propchange: directory/trunks/apacheds/dumptool/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 17 14:35:22 2006
@@ -0,0 +1,10 @@
+.classpath
+.wtpmodules
+.deployables
+.project
+target
+.settings
+*.ipr
+*.iwl
+*.iws
+*.iml
Added: directory/trunks/apacheds/dumptool/pom.xml
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/dumptool/pom.xml?rev=369946&view=auto
==============================================================================
--- directory/trunks/apacheds/dumptool/pom.xml (added)
+++ directory/trunks/apacheds/dumptool/pom.xml Tue Jan 17 14:35:22 2006
@@ -0,0 +1,25 @@
+<?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>0.9.4-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.apache.ldap.server.dumptool</artifactId>
+ <name>apacheds-dumptool</name>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>org.apache.ldap.server.core</artifactId>
+ <version>0.9.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>nlog4j</artifactId>
+ <version>1.2.19</version>
+ </dependency>
+ </dependencies>
+</project>
+
Added: directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/server/dumptool/DumpTool.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/server/dumptool/DumpTool.java?rev=369946&view=auto
==============================================================================
--- directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/server/dumptool/DumpTool.java (added)
+++ directory/trunks/apacheds/dumptool/src/main/java/org/apache/ldap/server/dumptool/DumpTool.java Tue Jan 17 14:35:22 2006
@@ -0,0 +1,112 @@
+package org.apache.ldap.server.dumptool;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigInteger;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+
+import jdbm.helper.MRU;
+import jdbm.recman.BaseRecordManager;
+import jdbm.recman.CacheRecordManager;
+
+
+import org.apache.ldap.common.message.LockableAttributeImpl;
+import org.apache.ldap.common.message.LockableAttributesImpl;
+import org.apache.ldap.common.schema.AttributeType;
+import org.apache.ldap.server.configuration.StartupConfiguration;
+import org.apache.ldap.server.partition.impl.btree.Tuple;
+import org.apache.ldap.server.partition.impl.btree.jdbm.JdbmIndex;
+import org.apache.ldap.server.partition.impl.btree.jdbm.JdbmMasterTable;
+import org.apache.ldap.server.schema.bootstrap.BootstrapRegistries;
+import org.apache.ldap.server.schema.bootstrap.BootstrapSchemaLoader;
+
+
+/**
+ * Simple tool used to dump the contents of a jdbm based partition.
+ */
+public class DumpTool
+{
+ /**
+ * Just give it the path to the working directory where all the db files
+ * are for a partition like the system partition. Right now this will print
+ * stuff out to the console.
+ *
+ * @param args
+ * @throws Exception
+ */
+ public static void main( String[] args ) throws Exception
+ {
+ File workingDirectory = new File( args[0] );
+ System.out.println( "# ========================================================================");
+ System.out.println( "# Dumptool Version: 0.1" );
+ System.out.println( "# Partition Working Directory: " + workingDirectory );
+ System.out.println( "# ========================================================================\n\n");
+ CacheRecordManager recMan;
+ JdbmMasterTable master;
+
+ try
+ {
+ String path = workingDirectory.getPath() + File.separator + "master";
+ BaseRecordManager base = new BaseRecordManager( path );
+ base.disableTransactions();
+ recMan = new CacheRecordManager( base, new MRU( 1000 ) );
+ }
+ catch ( IOException e )
+ {
+ NamingException ne = new NamingException(
+ "Could not initialize RecordManager" );
+ ne.setRootCause( e );
+ throw ne;
+ }
+
+ master = new JdbmMasterTable( recMan );
+ BootstrapRegistries bootstrapRegistries = new BootstrapRegistries();
+ BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
+ StartupConfiguration startupConfiguration = new StartupConfiguration();
+ loader.load( startupConfiguration.getBootstrapSchemas(), bootstrapRegistries );
+ AttributeType attributeType = bootstrapRegistries.getAttributeTypeRegistry().lookup( "apacheUpdn" );
+ JdbmIndex idIndex = new JdbmIndex( attributeType, workingDirectory );
+
+ System.out.println( "#---------------------" );
+ NamingEnumeration list = master.listTuples();
+ while ( list.hasMore() )
+ {
+ Tuple tuple = ( Tuple ) list.next();
+ BigInteger id = ( BigInteger ) tuple.getKey();
+ Attributes entry = ( Attributes ) tuple.getValue();
+
+ if ( ! ( entry instanceof LockableAttributesImpl ) )
+ {
+ Attributes tmp = entry;
+ entry = new LockableAttributesImpl();
+ NamingEnumeration attrs = tmp.getAll();
+ while ( attrs.hasMore() )
+ {
+ Attribute attr = ( Attribute ) attrs.next();
+ LockableAttributeImpl myattr = new LockableAttributeImpl( attr.getID() );
+ entry.put( myattr );
+ for ( int ii = 0; ii < attr.size(); ii++ )
+ {
+ myattr.add( attr.get( ii ) );
+ }
+ }
+ }
+
+ String dn = ( String ) idIndex.reverseLookup( id );
+ if ( list.hasMore() )
+ {
+ System.out.println( "# Entry: " + id + "\n#---------------------\n\n" + "dn: " + dn + "\n" + entry
+ + "\n\n#---------------------" );
+ }
+ else
+ {
+ System.out.println( "# Entry: " + id + "\n#---------------------\n\n" + "dn: " + dn + "\n" + entry );
+ }
+ }
+ }
+}
Modified: directory/trunks/apacheds/shared/pom.xml
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/shared/pom.xml?rev=369946&r1=369945&r2=369946&view=diff
==============================================================================
--- directory/trunks/apacheds/shared/pom.xml (original)
+++ directory/trunks/apacheds/shared/pom.xml Tue Jan 17 14:35:22 2006
@@ -9,20 +9,5 @@
<artifactId>org.apache.ldap.server.shared</artifactId>
<name>apacheds-shared</name>
<packaging>jar</packaging>
- <dependencies>
-
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>