directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r149496 [2/3] - in incubator/directory/ldap/trunk/clients: ./ src/java/org/apache/ldap/clients/ src/java/org/apache/ldap/clients/embedded/ src/java/org/apache/ldap/clients/ldaptest/ src/java/org/apache/ldap/clients/standalone/
Date Wed, 02 Feb 2005 08:05:28 GMT
Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapSearch.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapSearch.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapSearch.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapSearch.java Wed Feb  2 00:05:21 2005
@@ -203,12 +203,9 @@
  *
  */
 
-package org.apache.ldap.clients ;
+package org.apache.ldap.clients;
 
-
-import java.text.ParseException;
-
-import java.io.IOException ;
+import java.io.IOException;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -218,8 +215,8 @@
 import org.apache.ldap.common.filter.FilterParser;
 import org.apache.ldap.common.filter.FilterParserImpl;
 import org.apache.ldap.common.message.DerefAliasesEnum;
-import org.apache.ldap.common.message.LdapResult ;
-import org.apache.ldap.common.message.BindResponse ;
+import org.apache.ldap.common.message.LdapResult;
+import org.apache.ldap.common.message.BindResponse;
 import org.apache.ldap.common.message.MessageException;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.message.SearchRequest;
@@ -227,257 +224,241 @@
 import org.apache.ldap.common.message.SearchResponseDoneImpl;
 import org.apache.ldap.common.message.SearchResponseEntryImpl;
 
-
 /**
  * Ldap client for the Search operation
- *
- * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
+ * 
+ * @author <a href="mailto:jmachols@comcast.net">Jeff Machols </a>
  * @author $Author: jmachols $
  * @version $Revision$
  */
-public class LdapSearch
-    extends LdapBind
+public class LdapSearch extends LdapBind
 {
 
-    private static LdapSearch m_client ;
+    //private static LdapSearch m_client;
+
     /**
-     * Create an instance of the search client and parse the command
-     * line arguments
+     * Create an instance of the search client and parse the command line
+     * arguments
      * 
-     * @param a_args Command line arguments
+     * @param args
+     *            Command line arguments
      */
-    public LdapSearch( String [] a_args )
+    public LdapSearch( String[] args )
     {
-        super( new SearchOpts(), a_args ) ;
+        super( args );
     }
-    
+
     public String requestToString( SearchRequest a_request )
     {
-         String l_requestString = new String ( 
-           "\t\t\t\tBase DN: " + a_request.getBase() 
-           + "\n\t\t\t\tDereference Alias: " 
-           + a_request.getDerefAliases().getName().toString()
-           + "[" + a_request.getDerefAliases().getValue() + "]"
-           + "\n\t\t\t\tFilter: " + a_request.getFilter()
-           + "\n\t\t\t\tMessage ID: " + a_request.getMessageId()
-           + "\n\t\t\t\tSize Limit: " + a_request.getSizeLimit()
-           + "\n\t\t\t\tTime Limit: " + a_request.getTimeLimit()
-           + "\n\t\t\t\tTypes Only: " + a_request.getTypesOnly()
-           + "\n\t\t\t\tScope: " + a_request.getScope().getName().toString() 
-           + "[" + a_request.getScope().getValue() + "]" ) ;
-        
+        String l_requestString = new String( "\t\t\t\tBase DN: " + a_request.getBase() + "\n\t\t\t\tDereference Alias: "
+                + a_request.getDerefAliases().getName().toString() + "[" + a_request.getDerefAliases().getValue() + "]"
+                + "\n\t\t\t\tFilter: " + a_request.getFilter() + "\n\t\t\t\tMessage ID: " + a_request.getMessageId()
+                + "\n\t\t\t\tSize Limit: " + a_request.getSizeLimit() + "\n\t\t\t\tTime Limit: " + a_request.getTimeLimit()
+                + "\n\t\t\t\tTypes Only: " + a_request.getTypesOnly() + "\n\t\t\t\tScope: "
+                + a_request.getScope().getName().toString() + "[" + a_request.getScope().getValue() + "]" );
+
         return l_requestString;
     }
-    
+
     /**
-     * Print each attribute name only.  This is used when the Types Only
-     * mode is selected from the command line options
+     * Print each attribute name only. This is used when the Types Only mode is
+     * selected from the command line options
      * 
-     * @param a_attributeList NamingEnumeration of Attributes 
+     * @param a_attributeList
+     *            NamingEnumeration of Attributes
      */
-    public void printAttributeNames ( NamingEnumeration a_attributeList )
+    public void printAttributeNames( NamingEnumeration a_attributeList )
     {
         Attribute l_attr;
 
-        while ( a_attributeList.hasMoreElements() )
+        while( a_attributeList.hasMoreElements() )
         {
-            l_attr = ( Attribute ) a_attributeList.nextElement() ;  
-            System.out.println( l_attr.getID() ) ;
+            l_attr = (Attribute) a_attributeList.nextElement();
+            System.out.println( l_attr.getID() );
         }
     }
-    
-    
+
     /**
-     * Print each attribute and the values for each attribute from the
-     * list passed into the method.  Each attribute has an ID, which is 
-     * the name of the attribute and a list of values.  This is the default
-     * method for the search client output.
+     * Print each attribute and the values for each attribute from the list
+     * passed into the method. Each attribute has an ID, which is the name of
+     * the attribute and a list of values. This is the default method for the
+     * search client output.
      * 
-     * Each value of the same attribute will also print the ID, for example an 
+     * Each value of the same attribute will also print the ID, for example an
      * entry with two value for objectclass will look like this:
      * 
-     * ou=unix,ou=People,dc=fl,dc=wellspringres,dc=com
-     * objectClass=top
-     * objectClass=organizationalunit
-     * ou=unix
-     *  
-     * @param a_attributeList NamingEnumeration of Attributes 
+     * ou=unix,ou=People,dc=fl,dc=wellspringres,dc=com objectClass=top
+     * objectClass=organizationalunit ou=unix
+     * 
+     * @param a_attributeList
+     *            NamingEnumeration of Attributes
      */
     public void printAttributeList( NamingEnumeration a_attributeList )
     {
-        
+
         Attribute l_attr;
         NamingEnumeration l_attrValues;
 
-        while ( a_attributeList.hasMoreElements() )
+        while( a_attributeList.hasMoreElements() )
         {
-            l_attr = ( Attribute ) a_attributeList.nextElement() ;  
+            l_attr = (Attribute) a_attributeList.nextElement();
             try
             {
-                l_attrValues = l_attr.getAll() ;
-                while ( l_attrValues.hasMoreElements() )
+                l_attrValues = l_attr.getAll();
+                while( l_attrValues.hasMoreElements() )
                 {
-                    System.out.print( l_attr.getID() + "=" ) ;
-                    System.out.println ( 
-                        l_attrValues.nextElement().toString() ) ;
+                    System.out.print( l_attr.getID() + "=" );
+                    System.out.println( l_attrValues.nextElement().toString() );
                 }
             }
-            catch ( NamingException e )
+            catch( NamingException e )
             {
-                System.out.println( "Naming Exception thrown retreiving" 
-                + " values for attribute " + l_attr.getID() ) ;
+                System.out.println( "Naming Exception thrown retreiving" + " values for attribute " + l_attr.getID() );
             }
         }
     }
-    
-    
+
     /**
-     * Create the Search Request encoded message and send it to the server,
-     * then process each response from the server
+     * Create the Search Request encoded message and send it to the server, then
+     * process each response from the server
      * 
-     * @param id session message id
+     * @param id
+     *            session message id
      */
-    public void search ( int id )
+    public void search( int id )
     {
-        SearchOpts l_opts = ( SearchOpts ) super.getOpts() ;
-        SearchRequest l_request = new SearchRequestImpl( id ) ;
-        Object l_response = new Object () ;
-        SearchResponseDoneImpl l_searchResponseDone = 
-          new SearchResponseDoneImpl ( 1 );
-        SearchResponseEntryImpl l_searchResponseEntry ;
-        FilterParser l_filter = null ;
-        ExprNode l_expr = null ;
+        SearchOpts opts = (SearchOpts) super.getOpts();
+        SearchRequest request = new SearchRequestImpl( id );
+        Object response = new Object();
+        SearchResponseDoneImpl searchResponseDone = new SearchResponseDoneImpl( 1 );
+        SearchResponseEntryImpl searchResponseEntry;
+        FilterParser filter = null;
+        ExprNode expr = null;
 
-        l_filter = new FilterParserImpl () ;
+        filter = new FilterParserImpl();
 
-        try 
+        try
         {
-            l_expr = l_filter.parse( l_opts.getFilter() ) ;
+            expr = filter.parse( opts.getFilter() );
         }
-        catch ( IOException ioe )
+        catch( java.text.ParseException pe )
         {
-            getLog().fatalError( "IO Error while parsing the filter ", ioe ) ;
-            System.exit( 1 ) ;
+            getLog().fatal( "Parsing Exception ", pe );
+            System.exit( 1 );
         }
-        catch ( ParseException pe )
+        catch( IOException ioe )
         {
-            getLog().fatalError( "Parsing Exception ", pe ) ;
-            System.exit( 1 ) ;
+            getLog().fatal( "IO Error while parsing the filter ", ioe );
+            System.exit( 1 );
         }
-        m_client.getLog().debug( "Sucessfully paresed the filter: " 
-          + l_opts.getFilter() ) ;
-        
-        l_request.setFilter( l_expr ) ;
-        l_request.setBase( l_opts.getBase() );
-        l_request.setScope( l_opts.getScope() ) ;
-        l_request.setDerefAliases( DerefAliasesEnum.NEVERDEREFALIASES ) ;
-        l_request.setTimeLimit( l_opts.getMaxTime() ) ;
-        l_request.setSizeLimit( l_opts.getMaxEntries() ) ; 
-        l_request.setTypesOnly( l_opts.isTypesMode() );
-        
-        m_client.getLog().debug( "Sending the following request to the ldap" 
-          + " server " + l_opts.getHost() + ":" + l_opts.getPort() + "\n" 
-          + requestToString( l_request )  ) ;
-         
+
+        getLog().debug( "Sucessfully paresed the filter: " + opts.getFilter() );
+
+        request.setFilter( expr );
+        request.setBase( opts.getBase() );
+        request.setScope( opts.getScope() );
+        request.setDerefAliases( DerefAliasesEnum.NEVERDEREFALIASES );
+        request.setTimeLimit( opts.getMaxTime() );
+        request.setSizeLimit( opts.getMaxEntries() );
+        request.setTypesOnly( opts.isTypesMode() );
+
+        getLog().debug(
+                "Sending the following request to the ldap" + " server " + opts.getHost() + ":" + opts.getPort() + "\n"
+                        + requestToString( request ) );
+
         // Send encoded request to server
-        super.getEncoder().encodeBlocking( null, super.getOut(), l_request ) ;
+        super.getEncoder().encodeBlocking( null, super.getOut(), request );
 
         // Retrieve the response back from server to my last request.
-         l_response = super.getDecoder().decode( null, super.getIn() ) ;
-         while ( !l_response.getClass().isInstance( l_searchResponseDone ) )
-         {
-            l_searchResponseEntry = ( SearchResponseEntryImpl ) l_response ;
-            System.out.println ( l_searchResponseEntry.getObjectName() ) ;
-            if ( l_opts.isTypesMode() )
+        response = super.getDecoder().decode( null, super.getIn() );
+        
+        while( !response.getClass().isInstance( searchResponseDone ) )
+        {
+            searchResponseEntry = (SearchResponseEntryImpl) response;
+            System.out.println( searchResponseEntry.getObjectName() );
+            if( opts.isTypesMode() )
             {
-                printAttributeNames (
-                l_searchResponseEntry.getAttributes().getAll() ) ;
+                printAttributeNames( searchResponseEntry.getAttributes().getAll() );
             }
-            else if ( !l_opts.isQuietMode() )
-            {
-                printAttributeList( 
-                  l_searchResponseEntry.getAttributes().getAll() );
-            }           
-            System.out.println () ;
-            l_response = super.getDecoder().decode( null, super.getIn() ) ;
+            else
+                if( !opts.isQuietMode() )
+                {
+                    printAttributeList( searchResponseEntry.getAttributes().getAll() );
+                }
+            System.out.println();
+            response = super.getDecoder().decode( null, super.getIn() );
         }
-        
+
         // We are done with the responses, the last one contains the status
-        l_searchResponseDone = ( SearchResponseDoneImpl ) l_response ;
-        if ( l_searchResponseDone.getLdapResult().getResultCode()
-             != ResultCodeEnum.SUCCESS )
-        {
-            m_client.getLog().fatalError(
-             "Search failed for the following reasons :\n" + new String( 
-              l_searchResponseDone.getLdapResult().getErrorMessage() ) ) ;
-            System.exit( -1 ) ;
+        searchResponseDone = (SearchResponseDoneImpl) response;
+        if( searchResponseDone.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
+        {
+            System.out.println( "Search failed for the following reasons :\n"
+                    + new String( searchResponseDone.getLdapResult().getErrorMessage() ) );
+            System.exit( -1 );
         }
         else
         {
-            m_client.getLog().debug( "Search with filter " + l_opts.getFilter()
-              + " was successful" ) ;
+            getLog().debug( "Search with filter " + opts.getFilter() + " was successful" );
         }
     }
-        
+
     /**
-     * The main will call trhe bind operation first.  If that is successful,
-     * call the search and write the reponse from the server to the console
+     * The main will call trhe bind operation first. If that is successful, call
+     * the search and write the reponse from the server to the console
      * 
-     * @param a_args Command line string
+     * @param args
+     *            Command line string
      */
-    public static void main( String [] a_args )
+    public static void main( String[] args )
     {
-        m_client = new LdapSearch( a_args ) ;
-        BindResponse l_bindResponse = null ;
+        LdapSearch client = new LdapSearch( args );
+
+        BindResponse bindResponse = null;
 
         try
         {
-            l_bindResponse = m_client.bind( 1 ) ;
+            bindResponse = client.bind( 1 );
         }
-        catch ( MessageException e )
+        catch( MessageException e )
         {
-            m_client.getLog().fatalError(
-                "Failed to bind to server due to message composition failure",
-                e ) ;
-            System.exit( 1 ) ;
+            System.out.println( "Failed to bind to server due to message composition failure" + e.getMessage() );
+            System.exit( 1 );
         }
-        catch ( IOException e )
+        catch( IOException e )
         {
-            m_client.getLog().fatalError( "Failed to bind to server", e ) ;
-            System.exit( 1 ) ;
+            System.out.println( "Failed to bind to server" + e.getMessage() );
+            System.exit( 1 );
         }
 
         // --------------------------------------------------------------------
         // Report the results from the response.
         // --------------------------------------------------------------------
-        m_client.getLog().debug(
-            "Got back BindResponse from the server:\n" ) ;
-        LdapResult l_result = l_bindResponse.getLdapResult() ;
+        client.getLog().debug( "Got back BindResponse from the server:\n" );
+        LdapResult result = bindResponse.getLdapResult();
 
-        if ( l_result.getResultCode() == ResultCodeEnum.SUCCESS )
+        if( result.getResultCode() == ResultCodeEnum.SUCCESS )
         {
-            m_client.getLog().debug( "Authentication for "
-              + m_client.getOpts().getBindDn() + " was successful" ) ;
+            System.out.println( "Authentication for " + client.getOpts().getBindDn() + " was successful" );
         }
         else
         {
-            m_client.getLog().error( "Authentication for "
-                + m_client.getOpts().getBindDn() 
-                + " failed for the following reasons provided by the server:\n"
-                + new String( l_result.getErrorMessage() ) ) ;
-            System.exit( -1 ) ;
+            System.out.println(
+                    "Authentication for " + client.getOpts().getBindDn()
+                            + " failed for the following reasons provided by the server:\n"
+                            + new String( result.getErrorMessage() ) );
+            System.exit( -1 );
         }
 
-        m_client.search( 2 ) ;
-              
+        client.search( 2 );
+
         try
         {
-            m_client.disconnect() ;
+            client.disconnect();
         }
-        catch ( IOException e )
+        catch( IOException e )
         {
-            m_client.getLog().error( "Failed to close client connection!",
-                e ) ;
+            client.getLog().error( "Failed to close client connection!", e );
         }
     }
 }

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapUnbind.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapUnbind.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapUnbind.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/LdapUnbind.java Wed Feb  2 00:05:21 2005
@@ -210,7 +210,7 @@
  *
  * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.3 $
+ * @version $Revision$
  */
 public class LdapUnbind 
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ModifyOpts.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ModifyOpts.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ModifyOpts.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ModifyOpts.java Wed Feb  2 00:05:21 2005
@@ -205,17 +205,15 @@
 
 package org.apache.ldap.clients ;
 
-import java.util.List ;
-
-import org.apache.avalon.excalibur.cli.CLArgsParser ;
-import org.apache.avalon.excalibur.cli.CLOption ;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.ParseException;
 
 /**
  * Add operation command line options bean.
  *
  * @author <a href="mailto:jmachols@attbi.com">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.5 $
+ * @version $Revision$
  */
 
 public class ModifyOpts
@@ -224,12 +222,16 @@
     /**
      * The DN of the entry to be modified
      */
-    private String m_ModifyDn ;
+    private String modifiedDn ;
 
     /**
      * The file name of the LDIF DIT
      */
-    private String m_ldifFile = null ;
+    private String ldifFile = null ;
+
+    // ------------------------------------------------------------------------
+    // Option Accessors
+    // ------------------------------------------------------------------------
 
     /**
      * Get the DN of the entry to be modified
@@ -238,7 +240,7 @@
      */
     public String getModifyDn()
     {
-        return m_ModifyDn ;
+        return modifiedDn ;
     }
 
     /**
@@ -249,7 +251,7 @@
      */
     public boolean usesLdifFile ()
     {
-        return m_ldifFile != null ;
+        return ldifFile != null ;
     }
 
     /**
@@ -259,82 +261,68 @@
      */
     public String getLdifFile ()
     {
-        return m_ldifFile ;
+        return ldifFile ;
     }
 
+    //-------------------------------------------------------------------------
+    // Option Setters
+    //-------------------------------------------------------------------------
+    
+    
     // ------------------------------------------------------------------------
     // Opt Abstract Method Implementations
     // ------------------------------------------------------------------------
 
     /**
-     * Overrides BindOpts.process to be able to get the deleted entry's Dn.
+     * Overrides BindOpts.process to be able to get the modified entry's Dn.
      *
-     * @param an_argv the variable argument list from the command line.
+     * @param argv the variable argument list from the command line.
+     * @throws ParseException if any of the command line options is incorrect
      */
-    public void process( String [] an_argv )
+    public void process( String [] argv ) throws ParseException
     {
         // --------------------------------------------------------------------
         // Process Command Line Arguements
         // --------------------------------------------------------------------
-
-        CLArgsParser l_parser = getParser( an_argv ) ;
+        // Setting the bind options
+        options.addOption(hostOption);
+        options.addOption(portOption);
+        options.addOption(bindDnOption);
+        options.addOption(nothingOption);
+        options.addOption(protocolOption);
+        options.addOption(passwordOption);
+        options.addOption(verboseOption);
+        options.addOption(fileOption);
 
         // Get a list of parsed options
-        List l_argList = l_parser.getArguments() ;
-        int l_size = l_argList.size() ;
-
-        for ( int l_ii = 0 ; l_ii < l_size ; l_ii++ )
+        CommandLine cl = getParser(argv, options);
+        
+        // Commons options
+        host = cl.getOptionValue(HOST_OPT, DEFAULT_HOST);
+        port = Integer.parseInt(cl.getOptionValue(PORT_OPT, DEFAULT_PORT));
+        bindDn = cl.getOptionValue(BINDDN_OPT, "");
+        isDryRun = cl.hasOption(NOTHING_OPT);
+        isVersion3 = Integer.parseInt(cl.getOptionValue(PROTOCOL_OPT, "3")) == 3;
+        password = cl.getOptionValue(PASSWORD_OPT, "");
+        isVerbose = cl.hasOption(VERBOSE_OPT);
+        
+        // LdifFile must not be null
+        ldifFile = cl.getOptionValue(FILE_OPT, null);
+        
+        if (ldifFile == null) 
         {
-            CLOption l_option = ( CLOption ) l_argList.get( l_ii ) ;
-
-            switch ( l_option.getId() )
-            {
-                case CLOption.TEXT_ARGUMENT:
-                    m_ModifyDn = l_option.getArgument() ;
-                    break ;
-
-                case Opts.HOST_OPT:
-                    super.setHost( l_option.getArgument() ) ;
-                    break ;
-
-                case Opts.PORT_OPT:
-                    super.setPort( Integer.parseInt( l_option.getArgument() ) );
-                    break ;
-
-                case Opts.BINDDN_OPT:
-                    super.setBindDn( l_option.getArgument() ) ;
-                    break ;
-
-                case Opts.NOTHING_OPT:
-                    super.setIsDryRun( true ) ;
-                    break ;
-                    
-                case Opts.PROTOCOL_OPT:
-                    super.setIsVersion3( 
-                    Integer.parseInt( l_option.getArgument() ) == 3 ) ;
-                    break ;
-
-                case Opts.PASSWORD_OPT:
-                    String l_pwd = l_option.getArgument() ;
-                    if ( l_pwd == null )
-                    {
-                        super.setPassword( "" )  ;
-                    }
-                    else
-                    {
-                        super.setPassword( l_pwd ) ;
-                    }
-                    break ;
-                                   
-                case Opts.VERBOSE_OPT:
-                    super.setIsVerbose( true ) ;
-                    break ;
-          
-                case Opts.FILE_OPT:
-                    m_ldifFile = l_option.getArgument() ;
-                    break ;    
-            }
+            throw new ParseException("No ldif file given");
         }
+        
+        // Added DN must not be null
+        String[] leftArgs = cl.getArgs();
+        
+        if ((leftArgs == null) || (leftArgs.length == 0)) 
+        {
+            throw new ParseException("A Distinguised Name (DN) must be given");
+        }
+
+        modifiedDn = leftArgs[0];  
 
         super.setProcessed() ;
     }

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/Opts.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/Opts.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/Opts.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/Opts.java Wed Feb  2 00:05:21 2005
@@ -1,418 +1,406 @@
-/*
- *                                 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.
- *
- */
-
-package org.apache.ldap.clients ;
-
-import java.util.ArrayList ;
-
-import org.apache.avalon.excalibur.cli.CLArgsParser ;
-import org.apache.avalon.excalibur.cli.CLOptionDescriptor ;
-
-
-/**
- * Command line option bean 
- *
- * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
- * @author $Author: jmachols $
- * @version $Revision: 1.13 $
- */
-public abstract class Opts
-{
-    
-    /**
-     * Boolean value to determine if the command line has been processed
-     */
-    private boolean m_isProcessed = false ;
-    
-    /**
-     * Array of command line options
-     */
-    private ArrayList m_options = new ArrayList() ;
-
-    /**
-     * Host name option
-     */
-    public static final int HOST_OPT = 'h' ;
-    
-    /**
-     * port number command line option
-     */
-    public static final int PORT_OPT = 'p' ;
-    
-    /**
-     * Bind DN command line option
-     */
-    public static final int BINDDN_OPT = 'D' ;
-    
-    /**
-     * Dry run command line option
-     */
-    public static final int NOTHING_OPT = 'n' ;
-    
-    /**
-     * Protocol version command line option
-     */
-    public static final int PROTOCOL_OPT = 'P' ;
-    
-    /**
-     * Bind DN Password command line option
-     */
-    public static final int PASSWORD_OPT = 'w' ;
-    
-    /**
-     * Verbose mode command line option
-     */
-    public static final int VERBOSE_OPT = 'v' ;
-    
-    /**
-     * File input command line option
-     */
-    public static final int FILE_OPT = 'f' ;
-
-    /**
-     * File input command line option
-     */
-    public static final int BASE_OPT = 'b' ;
-    
-    /**
-      * Search Scope:
-      *  base - only the base DN
-      *  one  - only the current subtree level
-      *  sub  - the entire tree
-      */
-    public static final int SCOPE_OPT = 's' ;
-
-    /**
-     * Mode will only display entry DNs, no attributes
-     */
-    public static final int QUIET_OPT = 'q' ;
-    
-    /**
-     * This mode will only display attribute name, no values
-     *
-     */
-    public static final int TYPES_OPT = 'A' ;
-    
-    /**
-     * Maximum number of entries returned to the client
-     *
-     */
-    public static final int MAX_ENTRIES_OPT = 'z' ;
-    
-    /**
-     * The maximum number of seconds to wait for a response from the server
-     *
-     */
-    public static final int MAX_TIME_OPT = 'l' ;
-    
-    /**
-     * Add each option description to the Command Line Option Descriptor
-     *
-     */    
-    protected Opts()
-    {
-        m_options.add( new CLOptionDescriptor( "host",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            HOST_OPT,
-            "LDAP server" ) ) ;
-        m_options.add( new CLOptionDescriptor( "binddn",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            BINDDN_OPT,
-            "bind DN" ) ) ;
-        m_options.add( new CLOptionDescriptor( "noupdate",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            NOTHING_OPT,
-            "show what would be done but don't actually update" ) ) ;
-        m_options.add( new CLOptionDescriptor( "protocol",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            PROTOCOL_OPT,
-            "procotol version (default: 3)" ) ) ;
-        m_options.add( new CLOptionDescriptor( "passwd",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            PASSWORD_OPT,
-            "bind passwd (for simple authentication)" ) ) ;
-        m_options.add( new CLOptionDescriptor( "verbose",
-            CLOptionDescriptor.ARGUMENT_DISALLOWED,
-            'v',
-            "run in verbose mode (diagnostics to standard output)" ) ) ;
-        m_options.add( new CLOptionDescriptor( "port",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            'p',
-            "port on LDAP server" ) ) ;
-        m_options.add( new CLOptionDescriptor ( "file",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            FILE_OPT,
-            "LDIF file used instead of Standard Input" ) ) ;
-        m_options.add( new CLOptionDescriptor ( "baseDN",
-            CLOptionDescriptor.ARGUMENT_REQUIRED,
-            BASE_OPT,
-            "Base DN to start the search from" ) ) ;
-        m_options.add( new CLOptionDescriptor ( "scope",
-           CLOptionDescriptor.ARGUMENT_REQUIRED,
-           SCOPE_OPT,
-           "Search scope, either base, one or sub" ) ) ;
-        m_options.add( new CLOptionDescriptor ( "quiet",
-           CLOptionDescriptor.ARGUMENT_DISALLOWED,
-           QUIET_OPT,
-           "Quiet mode, only print the entry DN, no attributes" ) ) ;
-        m_options.add( new CLOptionDescriptor ( "types",
-           CLOptionDescriptor.ARGUMENT_DISALLOWED,
-           TYPES_OPT,
-           "Types only, only display attribute name, no values" ) ) ;    
-        m_options.add( new CLOptionDescriptor ( "max entries",
-              CLOptionDescriptor.ARGUMENT_REQUIRED,
-              MAX_ENTRIES_OPT,
-              "Maximum number of entries to be returned from the server" ) ) ;  
-        m_options.add( new CLOptionDescriptor ( "max time",
-              CLOptionDescriptor.ARGUMENT_REQUIRED,
-              MAX_TIME_OPT,
-              "The  number of seconds to wait for a response from the server" ) ) ;                                  
-    }
-
-
-    /**
-     * Matches the command line string into the options of the command 
-     * line parser
-     * 
-     * @param an_argv The actual command line string
-     * @return The parser object
-     */
-    protected CLArgsParser getParser( String [] an_argv )
-    {
-        CLOptionDescriptor [] l_options =
-            new CLOptionDescriptor [ m_options.size() ] ;
-        for ( int l_ii = 0 ; l_ii < l_options.length ; l_ii++ )
-        {
-            l_options[l_ii] = ( CLOptionDescriptor ) m_options.get( l_ii ) ;
-        }
-
-        return new CLArgsParser( an_argv, l_options ) ;
-    }
-
-    /**
-     * Determine if the command line has been processed
-     * 
-     * @return True if the command line arguments have been processed
-     */
-    public boolean isProcessed()
-    {
-        return m_isProcessed ;
-    }
-
-    /**
-     * Sets the processed flag to true
-     *
-     */
-    public void setProcessed( )
-    {
-        m_isProcessed = true ;
-    }
-    /**
-     * Abstract of the command line parsing process method
-     * 
-     * @param an_argv Command line arguments
-     */
-    public abstract void process( String [] an_argv ) ;
-}
+/*
+ *                                 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.
+ *
+ */
+
+package org.apache.ldap.clients;
+
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+
+/**
+ * Command line option bean
+ * 
+ * @author <a href="mailto:jmachols@comcast.net">Jeff Machols </a>
+ * @author $Author: jmachols $
+ * @version $Revision$
+ */
+public abstract class Opts
+{
+    /**
+     * Those constants are used in the <code>new Option()<code> call.
+     */
+    private static final boolean ARGUMENT_REQUIRED = true;
+
+    private static final boolean NO_ARGUMENT = false;
+
+    /**
+     * Boolean value to determine if the command line has been processed
+     */
+    private boolean isProcessed = false;
+
+    /**
+     * Array of command line options
+     */
+    private Options options = new Options();
+
+    /**
+     * Host name option
+     */
+    protected static final String HOST_OPT = "h";
+
+    protected static final Option hostOption = new Option( HOST_OPT, "host",
+            ARGUMENT_REQUIRED, "LDAP server" );
+
+    /**
+     * port number command line option
+     */
+    protected static final String PORT_OPT = "p";
+
+    protected static final Option portOption = new Option( PORT_OPT, "port",
+            ARGUMENT_REQUIRED, "port on LDAP server" );
+
+    /**
+     * Bind DN command line option
+     */
+    protected static final String BINDDN_OPT = "D";
+
+    protected static final Option bindDnOption = new Option( BINDDN_OPT,
+            "binddn", ARGUMENT_REQUIRED, "bind DN" );
+
+    /**
+     * Dry run command line option
+     */
+    protected static final String NOTHING_OPT = "n";
+
+    protected static final Option nothingOption = new Option( NOTHING_OPT,
+            "noupdate", ARGUMENT_REQUIRED,
+            "show what would be done but don't actually update" );
+
+    /**
+     * Protocol version command line option
+     */
+    protected static final String PROTOCOL_OPT = "P";
+
+    protected static final Option protocolOption = new Option( PROTOCOL_OPT,
+            "protocol", ARGUMENT_REQUIRED, "procotol version (default: 3)" );
+
+    /**
+     * Bind DN Password command line option
+     */
+    protected static final String PASSWORD_OPT = "w";
+
+    protected static final Option passwordOption = new Option( PASSWORD_OPT,
+            "passwd", ARGUMENT_REQUIRED,
+            "bind passwd (for simple authentication)" );
+
+    /**
+     * Verbose mode command line option
+     */
+    protected static final String VERBOSE_OPT = "v";
+
+    protected static final Option verboseOption = new Option( VERBOSE_OPT,
+            "verbose", NO_ARGUMENT,
+            "run in verbose mode (diagnostics to standard output)" );
+
+    /**
+     * File input command line option
+     */
+    protected static final String FILE_OPT = "f";
+
+    protected static final Option fileOption = new Option( FILE_OPT, "file",
+            ARGUMENT_REQUIRED, "LDIF file used instead of Standard Input" );
+
+    /**
+     * Base DN command line option
+     */
+    protected static final String BASEDN_OPT = "b";
+
+    protected static final Option baseDnOption = new Option( BASEDN_OPT,
+            "baseDN", ARGUMENT_REQUIRED, "Base DN to start the search from" );
+
+    /**
+     * Search Scope: base - only the base DN one - only the current subtree
+     * level sub - the entire tree
+     */
+    protected static final String SCOPE_OPT = "s";
+
+    protected static final Option scopeOption = new Option( SCOPE_OPT,
+            "scope", ARGUMENT_REQUIRED, "Search scope, either base, one or sub" );
+
+    /**
+     * Mode will only display entry DNs, no attributes
+     */
+    protected static final String QUIET_OPT = "q";
+
+    protected static final Option quietOption = new Option( QUIET_OPT,
+            "quiet", NO_ARGUMENT,
+            "Quiet mode, only print the entry DN, no attributes" );
+
+    /**
+     * This mode will only display attribute name, no values
+     *  
+     */
+    protected static final String TYPES_OPT = "A";
+
+    protected static final Option typesOption = new Option( TYPES_OPT,
+            "types", ARGUMENT_REQUIRED,
+            "Types only, only display attribute name, no values" );
+
+    /**
+     * Maximum number of entries returned to the client
+     *  
+     */
+    protected static final String MAX_ENTRIES_OPT = "z";
+
+    protected static final Option maxEntriesOption = new Option(
+            MAX_ENTRIES_OPT, "max-entries", ARGUMENT_REQUIRED,
+            "Maximum number of entries to be returned from the server" );
+
+    /**
+     * The maximum number of seconds to wait for a response from the server
+     *  
+     */
+    protected static final String MAX_TIME_OPT = "l";
+
+    protected static final Option maxTimeOption = new Option( MAX_TIME_OPT,
+            "max-time", ARGUMENT_REQUIRED,
+            "The  number of seconds to wait for a response from the server" );
+
+    /**
+     * Matches the command line string into the options of the command line
+     * parser
+     * 
+     * @param argv
+     *            The actual command line string
+     * @return The parser object
+     * @throws ParseException if any of the command line option is incorrect
+     */
+    protected CommandLine getParser( String[] argv, Options options )
+            throws ParseException
+    {
+        CommandLineParser parser = new BasicParser();
+        return parser.parse( options, argv );
+    }
+
+    /**
+     * Determine if the command line has been processed
+     * 
+     * @return True if the command line arguments have been processed
+     */
+    public boolean isProcessed()
+    {
+        return isProcessed;
+    }
+
+    /**
+     * Sets the processed flag to true
+     *  
+     */
+    public void setProcessed()
+    {
+        isProcessed = true;
+    }
+
+    /**
+     * Abstract of the command line parsing process method
+     * 
+     * @param argv
+     *            Command line arguments
+     */
+    public abstract void process( String[] argv ) throws ParseException;
+}
\ No newline at end of file

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/SearchOpts.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/SearchOpts.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/SearchOpts.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/SearchOpts.java Wed Feb  2 00:05:21 2005
@@ -205,19 +205,17 @@
 
 package org.apache.ldap.clients ;
 
-import java.util.List ;
-
 import org.apache.ldap.common.message.ScopeEnum;
 
-import org.apache.avalon.excalibur.cli.CLArgsParser ;
-import org.apache.avalon.excalibur.cli.CLOption ;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.ParseException;
 
 /**
  * Delete operation command line options bean.
  *
  * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.5 $
+ * @version $Revision$
  */
 
 public class SearchOpts
@@ -226,12 +224,12 @@
     /**
      * DN of the entry to be deleted
      */
-    private String m_filter ;
+    private String filter ;
     
     /**
      * Base DN to start the search from
      */
-    private String m_base ;
+    private String base ;
 
     /**
      * Search Scope:
@@ -239,16 +237,19 @@
      *  one  - only the current subtree level
      *  sub  - the entire tree
      */
-    private ScopeEnum m_scope = ScopeEnum.SINGLELEVEL ;
+    private ScopeEnum scope = ScopeEnum.SINGLELEVEL ;
 
-    private boolean m_quietMode = false ;
+    private boolean quietMode = false ;
     
-    private boolean m_typesMode = false ;
+    private boolean typesMode = false ;
     
-    private int m_maxEntries = 0 ;
+    private int maxEntries = 0 ;
     
-    private int m_maxTime = 0 ;
+    private int maxTime = 0 ;
     
+    // ------------------------------------------------------------------------
+    // Option Accessors
+    // ------------------------------------------------------------------------
 
     /**
      * Get the base DN to start the search from 
@@ -257,7 +258,7 @@
      */
     public String getBase()
     {
-        return m_base;
+        return base;
     }
 
     /**
@@ -267,29 +268,35 @@
      */
     public String getFilter()
     {
-        return m_filter;
+        return filter;
     }
 
     /**
-     * Get the base DN to start the search from 
      * 
-     * @param a_string DN to start the search from 
+     * @return
      */
-    public void setBase( String a_string )
+    public int getMaxTime()
     {
-        m_base = a_string;
+        return maxTime ;
+    }
+    
+    /**
+     * @return
+     */
+    public boolean isQuietMode()
+    {
+        return quietMode;
     }
 
     /**
-     * Set the search filter
-     * 
-     * @param a_string Search Filter
+     * @return
      */
-    public void setFilter( String a_string )
+    public boolean isTypesMode()
     {
-        m_filter = a_string;
+        return typesMode;
     }
-   
+
+
     /**
      * Get the Scope for the search
      * 
@@ -300,198 +307,191 @@
      */
     public ScopeEnum getScope()
     {
-        return m_scope;
+        return scope;
     }
 
     /**
-     * Set the Scope for the search
      * 
-     * @param a_enum Search Scope:
-     *  BASEOBJECT   - only the base DN
-     *  SINGLELEVEL  - only the current subtree level
-     *  WHOLESUBTREE - the entire tree
+     * @return
      */
-    public void setScope( ScopeEnum a_enum )
+    public int getMaxEntries() 
     {
-        m_scope = a_enum;
+        return maxEntries ;
     }
-    // ------------------------------------------------------------------------
-    // Opt Abstract Method Implementations
-    // ------------------------------------------------------------------------
-
-
+    
+    //-------------------------------------------------------------------------
+    // Option Setters
+    //-------------------------------------------------------------------------
+    
     /**
-     * Overrides BindOpts.process to be able to get the deleted entry's Dn.
-     *
-     * @param an_argv the variable argument list from the command line.
+     * Set the base DN to start the search from 
+     * 
+     * @param base DN to start the search from 
      */
-    public void process( String [] an_argv )
+    public void setBase( String base )
     {
-        // --------------------------------------------------------------------
-        // Process Command Line Arguements
-        // --------------------------------------------------------------------
-
-        CLArgsParser l_parser = getParser( an_argv ) ;
-
-        // Get a list of parsed options
-        List l_argList = l_parser.getArguments() ;
-        
-        /**
-         * @TODO If arglist is 0, print usage and error
-         */
-        int l_size = l_argList.size() ;
-
-        for ( int l_ii = 0; l_ii < l_size; l_ii++ )
-        {
-            CLOption l_option = ( CLOption ) l_argList.get( l_ii ) ;
-
-            switch ( l_option.getId() )
-            {
-                case CLOption.TEXT_ARGUMENT:
-                    m_filter = l_option.getArgument() ;
-                    break ;
-
-                case Opts.HOST_OPT:
-                    super.setHost( l_option.getArgument() ) ;
-                    break ;
-
-                case Opts.PORT_OPT:
-                    super.setPort( Integer.parseInt( l_option.getArgument() ) );
-                    break ;
-
-                case Opts.BINDDN_OPT:
-                    super.setBindDn( l_option.getArgument() ) ;
-                    break ;
-
-                case Opts.BASE_OPT:
-                    setBase( l_option.getArgument() ) ;
-                    break ;
-                    
-                case Opts.NOTHING_OPT:
-                    super.setIsDryRun( true ) ;
-                    break ;
-
-                case Opts.VERBOSE_OPT:
-                    super.setIsVerbose( true ) ;
-                    break ;
-                    
-                case Opts.PROTOCOL_OPT:
-                     super.setIsVersion3( 
-                         Integer.parseInt( l_option.getArgument() ) == 3 ) ;
-                     break ;
-                     
-                case Opts.TYPES_OPT:
-                     if ( isQuietMode() )
-                     {
-                         System.out.println ( "Cannot have quiet mode (-q) and" 
-                           + "Types Only mode (-A) both turned on" ) ;
-                         System.exit( -1 ) ;
-                     }
-                     setTypesMode( true ) ;
-                     break ;
-
-                case Opts.QUIET_OPT:
-                     if ( isTypesMode() )
-                     {
-                         System.out.println ( "Cannot have quiet mode (-q) and" 
-                           + "Types Only mode (-A) both turned on" ) ;
-                     }
-                     setQuietMode( true ) ;
-                     break ;
-                                     
-                case Opts.PASSWORD_OPT:
-                    String l_pwd = l_option.getArgument() ;
-                    if ( l_pwd == null )
-                    {
-                        super.setPassword( "" )  ;
-                    }
-                    else
-                    {
-                        super.setPassword( l_pwd ) ;
-                    }
-                    break ;
-
-                case Opts.SCOPE_OPT:
-                    String l_scopeString = l_option.getArgument() ;
-                    if ( l_scopeString.equalsIgnoreCase( "base" ) )
-                    {
-                        setScope( ScopeEnum.BASEOBJECT ) ;
-                    }
-                    else if ( l_scopeString.equalsIgnoreCase( "one" ) )
-                    {
-                        setScope( ScopeEnum.SINGLELEVEL ) ;
-                    }
-                    else if ( l_scopeString.equalsIgnoreCase( "sub" ) )
-                    {
-                        setScope( ScopeEnum.WHOLESUBTREE ) ;
-                    }
-                    else
-                    {
-                        System.out.println( "Value for scope must be one of " 
                           + "the following: base, one, sub" ) ;
-                        System.exit( -1 ) ;
-                    }
-                    break ;           
-                default:
-                   /**
-                    * @TODO Create the usage string and display on errors
-                    */                  
-                   System.out.println ( "Invalid Argument" ) ;  
-            }
-        }
-        super.setProcessed() ;
+        this.base = base;
     }
-    
 
     /**
-     * @return
+     * Set the search filter
+     * 
+     * @param filter Search Filter
      */
-    public boolean isQuietMode()
+    public void setFilter( String filter )
     {
-        return m_quietMode;
+        this.filter = filter;
     }
-
+   
     /**
      * @param a_b
      */
-    public void setQuietMode(boolean a_b)
+    public void setQuietMode(boolean quietMode)
     {
-        m_quietMode = a_b;
+        this.quietMode = quietMode;
     }
 
     /**
-     * @return
+     * @param 
      */
-    public boolean isTypesMode()
+    public void setTypesMode(boolean typesMode)
     {
-        return m_typesMode;
+        this.typesMode = typesMode;
     }
 
     /**
-     * @param a_b
+     * Set the Scope for the search
+     * 
+     * @param scope Search Scope:
+     *  BASEOBJECT   - only the base DN
+     *  SINGLELEVEL  - only the current subtree level
+     *  WHOLESUBTREE - the entire tree
      */
-    public void setTypesMode(boolean a_b)
+    public void setScope( ScopeEnum scope )
     {
-        m_typesMode = a_b;
-    }
-
-    public void setMaxEntries( int a_maxEntries )
-    {
-        m_maxEntries = a_maxEntries ;
+        this.scope = scope;
     }
     
-    public int getMaxEntries() 
+    /**
+     * Set the maximum of entries to retrieve
+     * @param maxEntries 
+     */
+    public void setMaxEntries( int maxEntries )
     {
-        return m_maxEntries ;
+        this.maxEntries = maxEntries ;
     }
     
-    public void setMaxTime( int a_maxTime )
+    /**
+     * Set the maximum of entries to retrieve
+     * @param maxTime
+     */
+    public void setMaxTime( int maxTime )
     {
-        m_maxTime = a_maxTime ;
+        this.maxTime = maxTime ;
     }
     
-    public int getMaxTime()
+    // ------------------------------------------------------------------------
+    // Opt Abstract Method Implementations
+    // ------------------------------------------------------------------------
+
+    /**
+     * Overrides BindOpts.process to be able to get the deleted entry's Dn.
+     *
+     * @param argv the variable argument list from the command line.
+     * @throws ParseException if any of the command line option is incorrect
+     */
+    public void process( String [] argv ) throws ParseException
     {
-        return m_maxTime ;
+        // --------------------------------------------------------------------
+        // Process Command Line Arguements
+        // --------------------------------------------------------------------
+        // Setting the bind options
+        options.addOption(hostOption);
+        options.addOption(portOption);
+        options.addOption(bindDnOption);
+        options.addOption(nothingOption);
+        options.addOption(protocolOption);
+        options.addOption(passwordOption);
+        options.addOption(verboseOption);
+        options.addOption(fileOption);
+        options.addOption(maxEntriesOption);
+        options.addOption(maxTimeOption);
+
+        // Get a list of parsed options
+        CommandLine cl = getParser(argv, options);
+        
+        // Commons options
+        host = cl.getOptionValue(HOST_OPT, DEFAULT_HOST);
+        port = Integer.parseInt(cl.getOptionValue(PORT_OPT, DEFAULT_PORT));
+        bindDn = cl.getOptionValue(BINDDN_OPT, "");
+        isDryRun = cl.hasOption(NOTHING_OPT);
+        isVersion3 = Integer.parseInt(cl.getOptionValue(PROTOCOL_OPT, "3")) == 3;
+        password = cl.getOptionValue(PASSWORD_OPT, "");
+        isVerbose = cl.hasOption(VERBOSE_OPT);
+        
+        // Base may be null
+        base = cl.getOptionValue(BASEDN_OPT, "");
+
+        // Filter must not be null
+        filter = cl.getOptionValue(FILE_OPT, null);
+        
+        if (filter == null) 
+        {
+            throw new ParseException("No filter given");
+        }
+
+        // Either Quiet or Types may be set, or none.
+        typesMode = cl.hasOption(TYPES_OPT);
+        quietMode = cl.hasOption(QUIET_OPT);
+        
+        if (typesMode & quietMode) 
+        {
+            throw new ParseException("Cannot have quiet mode (-q) and" 
+                    + "Types Only mode (-A) both turned on");
+        }
+
+        // Scope must not be null
+        // @TODO : default to "base" with a warning
+        String scopeString = cl.getOptionValue(SCOPE_OPT, "");
+        
+        if ( scopeString.equalsIgnoreCase( "base" ) )
+        {
+            scope = ScopeEnum.BASEOBJECT;
+        }
+        else if ( scopeString.equalsIgnoreCase( "one" ) )
+        {
+            scope = ScopeEnum.SINGLELEVEL;
+        }
+        else if ( scopeString.equalsIgnoreCase( "sub" ) )
+        {
+            scope = ScopeEnum.WHOLESUBTREE;
+        }
+        else
+        {
+            throw new ParseException( "Value for scope must be one of " 
+               + "the following: base, one, sub" );
+        }
+        
+        // MaxEntries is optionnal, and default to 1000
+        try 
+        {
+            maxEntries = Math.abs(Integer.parseInt(cl.getOptionValue(MAX_ENTRIES_OPT, DEFAULT_MAX_ENTRIES)));
+        }
+        catch (NumberFormatException nfe) 
+        {
+            throw new ParseException("MaxEntries parameter does not contains a valid value");
+        }
+        
+        // MaxTime is optionnal, and default to 1000
+        try 
+        {
+            maxTime = Math.abs(Integer.parseInt(cl.getOptionValue(MAX_TIME_OPT, DEFAULT_MAX_TIME)));
+        }
+        catch (NumberFormatException nfe) 
+        {
+            throw new ParseException("MaxTime parameter does not contains a valid value");
+        }
+        
+        super.setProcessed() ;
     }
-    
 }

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/InputParser.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/InputParser.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/InputParser.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/InputParser.java Wed Feb  2 00:05:21 2005
@@ -217,7 +217,7 @@
  *
  * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.3 $
+ * @version $Revision$
  */
 public class InputParser
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapClient.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapClient.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapClient.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapClient.java Wed Feb  2 00:05:21 2005
@@ -215,7 +215,7 @@
  *
  * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.6 $
+ * @version $Revision$
  */
 
 public interface LdapClient

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapInputParser.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapInputParser.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapInputParser.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapInputParser.java Wed Feb  2 00:05:21 2005
@@ -216,7 +216,7 @@
  *
  * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public class LdapInputParser
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapSearchParameters.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapSearchParameters.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapSearchParameters.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/embedded/LdapSearchParameters.java Wed Feb  2 00:05:21 2005
@@ -212,7 +212,7 @@
  *
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision:  $
+ * @version $Revision$
  */
 public class LdapSearchParameters 
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestCase.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestCase.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestCase.java Wed Feb  2 00:05:21 2005
@@ -213,7 +213,7 @@
  *
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1349 $
+ * @version $Revision$
  */
 public class LdapTestCase
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestSession.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestSession.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestSession.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTestSession.java Wed Feb  2 00:05:21 2005
@@ -213,7 +213,7 @@
  *
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.3 $
+ * @version $Revision$
  */
 public class LdapTestSession
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTester.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTester.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTester.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/LdapTester.java Wed Feb  2 00:05:21 2005
@@ -232,7 +232,7 @@
  * 
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision:  $
+ * @version $Revision$
  */
 public class LdapTester
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionAddUI.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionAddUI.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionAddUI.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionAddUI.java Wed Feb  2 00:05:21 2005
@@ -228,7 +228,7 @@
  * 
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.3 $
+ * @version $Revision$
  */
 public class SessionAddUI extends JPanel
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionListUI.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionListUI.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionListUI.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/SessionListUI.java Wed Feb  2 00:05:21 2005
@@ -227,7 +227,7 @@
  * 
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.4 $
+ * @version $Revision$
  */
 public class SessionListUI extends JPanel
 {                      

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseAddUI.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseAddUI.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseAddUI.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseAddUI.java Wed Feb  2 00:05:21 2005
@@ -215,7 +215,7 @@
  * 
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public class TestCaseAddUI extends JPanel
 {

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseListUI.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseListUI.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseListUI.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestCaseListUI.java Wed Feb  2 00:05:21 2005
@@ -227,7 +227,7 @@
  * 
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public class TestCaseListUI extends JPanel
 {                      

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestConfiguration.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestConfiguration.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/ldaptest/TestConfiguration.java Wed Feb  2 00:05:21 2005
@@ -205,6 +205,7 @@
 
 package org.apache.ldap.clients.ldaptest;
 
+import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.LinkedList;
@@ -212,7 +213,7 @@
 import org.apache.xerces.parsers.DOMParser;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
+import org.xml.sax.SAXException;
 
 
 
@@ -222,7 +223,7 @@
  * 
  * @author <a href="mailto:jmachols@apache.org">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision:  $
+ * @version $Revision$
  */
 public class TestConfiguration
 {
@@ -296,8 +297,9 @@
     
     public void readConfig ( String a_fileName )
         throws FileNotFoundException
-    {
-        String xmlFile = "file://" + a_fileName ;
+    {
+        //String xmlFile = "file://" + a_fileName ;
+        String xmlFile = a_fileName ;
 
         DOMParser parser = new DOMParser();
 

Modified: incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/standalone/AddOpts.java
URL: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/standalone/AddOpts.java?view=diff&r1=149495&r2=149496
==============================================================================
--- incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/standalone/AddOpts.java (original)
+++ incubator/directory/ldap/trunk/clients/src/java/org/apache/ldap/clients/standalone/AddOpts.java Wed Feb  2 00:05:21 2005
@@ -215,7 +215,7 @@
  *
  * @author <a href="mailto:jmachols@comcast.net">Jeff Machols</a>
  * @author $Author: jmachols $
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 
 public class AddOpts



Mime
View raw message