serge       2003/06/24 12:40:53

  Modified:    src/java/org/apache/james/core MailetConfigImpl.java
  Log:
  Applied patch from Soeren Hilmer to implement getInitParameterNames()
  
  Also slight code formatting fixes.
  
  Revision  Changes    Path
  1.9       +25 -8     
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MailetConfigImpl.java     17 Jun 2003 16:03:14 -0000      1.8
  +++ MailetConfigImpl.java     24 Jun 2003 19:40:53 -0000      1.9
  @@ -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
  @@ -108,9 +109,8 @@
           try {
               String result = null;
   
  -            final Configuration[] values = configuration.getChildren( name );
  -            for ( int i = 0; i < values.length; i++ )
  -            {
  +            final Configuration[] values = configuration.getChildren(name);
  +            for ( int i = 0; i < values.length; i++ ) {
                   if (result == null) {
                       result = "";
                   } else {
  @@ -130,11 +130,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