serge       2003/06/24 12:32:38

  Modified:    src/java/org/apache/james/core Tag: branch_2_1_fcs
                        MailetConfigImpl.java
  Log:
  Applied patch from Soeren Hilmer to implement getInitParameterNames()
  
  Also slight code formatting fixes.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.4.4   +25 -9     
jakarta-james/src/java/org/apache/james/core/MailetConfigImpl.java
  
  Index: MailetConfigImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/core/MailetConfigImpl.java,v
  retrieving revision 1.3.4.3
  retrieving revision 1.3.4.4
  diff -u -r1.3.4.3 -r1.3.4.4
  --- MailetConfigImpl.java     16 Jun 2003 05:25:27 -0000      1.3.4.3
  +++ MailetConfigImpl.java     24 Jun 2003 19:32:37 -0000      1.3.4.4
  @@ -94,7 +94,8 @@
       /**
        * No argument constructor for this object.
        */
  -    public MailetConfigImpl() {}
  +    public MailetConfigImpl() {
  +    }
   
       /**
        * Get the value of an parameter stored in this MailetConfig.  Multi-valued
  @@ -109,8 +110,7 @@
               String result = null;
   
               final Configuration[] values = configuration.getChildren( name );
  -            for ( int i = 0; i < values.length; i++ )
  -            {
  +            for ( int i = 0; i < values.length; i++ ) {
                   if (result == null) {
                       result = "";
                   } else {
  @@ -120,7 +120,6 @@
                   result += conf.getValue();
               }
               return result;
  -            //return params.getProperty(name);
           } catch (ConfigurationException ce) {
               throw new RuntimeException("Embedded configuration exception was: " + 
ce.getMessage());
           }
  @@ -130,11 +129,28 @@
       /**
        * Returns an iterator over the set of configuration parameter names.
        *
  -     * @throws UnsupportedOperationException in all cases, as this is not 
implemented
  -     */ 
  +     * @return an iterator over the set of configuration parameter names.
  +     */
       public Iterator getInitParameterNames() {
  -        throw new UnsupportedOperationException("Not yet implemented");
  -        //return params.keySet().iterator();
  +        return new Iterator () {
  +            Configuration[] children;
  +            int count = 0;
  +            {
  +                children = configuration.getChildren();
  +            }
  +
  +            public boolean hasNext() {
  +                return count < children.length;
  +            }
  +
  +            public Object next() {
  +                return children[count++].getName();
  +            }
  +
  +            public void remove() {
  +                throw new UnsupportedOperationException ("remove not supported");
  +            }
  +        };
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to