Return-Path: Delivered-To: apmail-incubator-directory-cvs-archive@www.apache.org Received: (qmail 37676 invoked from network); 2 Feb 2005 06:04:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Feb 2005 06:04:32 -0000 Received: (qmail 3586 invoked by uid 500); 2 Feb 2005 06:04:31 -0000 Delivered-To: apmail-incubator-directory-cvs-archive@incubator.apache.org Received: (qmail 3530 invoked by uid 500); 2 Feb 2005 06:04:31 -0000 Mailing-List: contact directory-cvs-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: directory-dev@incubator.apache.org Delivered-To: mailing list directory-cvs@incubator.apache.org Received: (qmail 3512 invoked by uid 99); 2 Feb 2005 06:04:30 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 01 Feb 2005 22:04:30 -0800 Received: (qmail 37616 invoked by uid 65534); 2 Feb 2005 06:04:29 -0000 Message-ID: <20050202060429.37615.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Wed, 02 Feb 2005 06:04:29 -0000 Subject: svn commit: r149490 - in incubator/directory: apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractServerTest.java codesize.sh To: directory-cvs@incubator.apache.org From: akarasulu@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: akarasulu Date: Tue Feb 1 22:04:28 2005 New Revision: 149490 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D149490 Log: just to calc the amount of code in trunk and all of directory Added: incubator/directory/codesize.sh (with props) Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/s= erver/AbstractServerTest.java Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/= ldap/server/AbstractServerTest.java URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/= src/main/java/org/apache/ldap/server/AbstractServerTest.java?view=3Ddiff&r1= =3D149489&r2=3D149490 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/s= erver/AbstractServerTest.java (original) +++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/s= erver/AbstractServerTest.java Tue Feb 1 22:04:28 2005 @@ -19,10 +19,13 @@ =20 import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.util.Hashtable; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; +import javax.naming.Name; +import javax.naming.directory.Attributes; import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapContext; =20 @@ -30,6 +33,12 @@ import org.apache.commons.io.FileUtils; import org.apache.apseda.listener.AvailablePortFinder; import org.apache.ldap.server.jndi.EnvKeys; +import org.apache.ldap.common.ldif.LdifParser; +import org.apache.ldap.common.ldif.LdifParserImpl; +import org.apache.ldap.common.ldif.LdifIterator; +import org.apache.ldap.common.message.LockableAttributesImpl; +import org.apache.ldap.common.name.LdapName; +import org.apache.ldap.common.exception.LdapConfigurationException; =20 =20 /** @@ -63,7 +72,14 @@ { super.setUp(); =20 - doDelete( new File( "target" + File.separator + "apacheds" ) ); + if ( overrides.containsKey( EnvKeys.WKDIR ) ) + { + doDelete( new File( ( String ) overrides.get( EnvKeys.WKDIR ) = ) ); + } + else + { + doDelete( new File( "target" + File.separator + "apacheds" ) ); + } =20 int port =3D AvailablePortFinder.getNextAvailable( 1024 ); =20 @@ -171,5 +187,56 @@ try { new InitialContext( env ); } catch( Exception e ) {} =20 sysRoot =3D null; + } + + + /** + * Imports the LDIF entries packaged with the Eve JNDI provider jar in= to + * the newly created system partition to prime it up for operation. N= ote + * that only ou=3Dsystem entries will be added - entries for other par= titions + * cannot be imported and will blow chunks. + * + * @throws NamingException if there are problems reading the ldif file= and + * adding those entries to the system partition + */ + protected void importLdif( InputStream in ) throws NamingException + { + Hashtable env =3D new Hashtable(); + + env.putAll( sysRoot.getEnvironment() ); + + LdapContext ctx =3D new InitialLdapContext( env, null ); + + LdifParser parser =3D new LdifParserImpl(); + + try + { + LdifIterator iterator =3D new LdifIterator( in ); + + while ( iterator.hasNext() ) + { + Attributes attributes =3D new LockableAttributesImpl(); + + String ldif =3D ( String ) iterator.next(); + + parser.parse( attributes, ldif ); + + Name dn =3D new LdapName( ( String ) attributes.remove( "d= n" ).get() ); + + dn.remove( 0 ); + + ctx.createSubcontext( dn, attributes ); + } + } + catch ( Exception e ) + { + String msg =3D "failed while trying to parse system ldif file"; + + NamingException ne =3D new LdapConfigurationException( msg ); + + ne.setRootCause( e ); + + throw ne; + } } } Added: incubator/directory/codesize.sh URL: http://svn.apache.org/viewcvs/incubator/directory/codesize.sh?view=3Da= uto&rev=3D149490 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/directory/codesize.sh (added) +++ incubator/directory/codesize.sh Tue Feb 1 22:04:28 2005 @@ -0,0 +1,22 @@ +#!/bin/bash + +total=3D0; + +for trunk in `find . -type d -regex '.*trunk'`; do=20 + if [ -n "`echo $trunk | grep sitedocs`" ]; then + continue; + fi; + + mkdir temp + for file in `find $trunk -type f -regex '.*\.java'`; do + cp $file temp; + done; + cd temp; + lines=3D`wc -l * | grep total | awk '{print $1}'`; + cd ../ + rm -rf temp; + echo "lines of code in $trunk =3D $lines"; + total=3D$(($lines + $total)); +done; + +echo Total: $total Propchange: incubator/directory/codesize.sh ---------------------------------------------------------------------------= --- svn:executable =3D *