cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/transformation LDAPTransformer.java
Date Thu, 03 Oct 2002 04:51:47 GMT
vgritsenko    2002/10/02 21:51:47

  Modified:    src/java/org/apache/cocoon/transformation Tag:
                        cocoon_2_0_3_branch LDAPTransformer.java
  Log:
  reformat code
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.1   +441 -444  xml-cocoon2/src/java/org/apache/cocoon/transformation/LDAPTransformer.java
  
  Index: LDAPTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/LDAPTransformer.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- LDAPTransformer.java	22 Feb 2002 07:03:56 -0000	1.6
  +++ LDAPTransformer.java	3 Oct 2002 04:51:47 -0000	1.6.2.1
  @@ -116,7 +116,6 @@
    * @author Felix Knecht
    * @version CVS $Id$
    */
  -
   public class LDAPTransformer extends AbstractTransformer {
   
       /** The LDAP namespace ("http://apache.org/cocoon/LDAP/1.0")**/
  @@ -180,7 +179,7 @@
       protected String current_name;
   
       /** The current state of the event receiving FSM **/
  -    protected int current_state = LDAPTransformer.STATE_OUTSIDE;
  +    protected int current_state = STATE_OUTSIDE;
   
       /** The value of the value element we're currently receiving **/
       protected StringBuffer current_value = new StringBuffer();
  @@ -200,93 +199,93 @@
       public void setup(SourceResolver resolver, Map objectModel,
                         String source, Parameters parameters)
               throws ProcessingException, SAXException, IOException {
  -        current_state = LDAPTransformer.STATE_OUTSIDE;
  +        current_state = STATE_OUTSIDE;
   
  -       // Check the initializer
  -       String parameter = parameters.getParameter(LDAPTransformer.MAGIC_INITIALIZER_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_INITIALIZER_ELEMENT, parameter);
  -       }
  -       // Check the version
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_VERSION_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_VERSION_ELEMENT, parameter);
  -       }
  -       // Check the authentication
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_AUTHENTICATION_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_AUTHENTICATION_ELEMENT, parameter);
  -       }
  -       // Check the scope
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_SCOPE_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_SCOPE_ELEMENT, parameter);
  -       }
  -       // Check the serverurl
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_SERVERURL_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_SERVERURL_ELEMENT, parameter);
  -       }
  -       // Check the ldap-root_dn
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_ROOT_DN_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_ROOT_DN_ELEMENT, parameter);
  -       }
  -       // Check the ldap-pwd
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_PASSWORD_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_PASSWORD_ELEMENT, parameter);
  -       }
  -       // Check the port
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_PORT_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_PORT_ELEMENT, parameter);
  -       }
  -       // Check the searchbase
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_SEARCHBASE_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_SEARCHBASE_ELEMENT, parameter);
  -       }
  -       // Check the doc-element
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_DOC_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_DOC_ELEMENT, parameter);
  -       }
  -       // Check the row-element
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_ROW_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_ROW_ELEMENT, parameter);
  -       }
  -       // Check the error-element
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_ERROR_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_ERROR_ELEMENT, parameter);
  -       }
  -       // Check the sax-error
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_SAX_ERROR,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_SAX_ERROR, parameter);
  -       }
  -       // Check the deref-link-element
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_DEREF_LINK_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_DEREF_LINK_ELEMENT, parameter.toUpperCase());
  -       }
  -       // Check the count-limit-element
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_COUNT_LIMIT_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_COUNT_LIMIT_ELEMENT, parameter);
  -       }
  -       // Check the time-limit-element
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_TIME_LIMIT_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_TIME_LIMIT_ELEMENT, parameter);
  -       }
  -       // Check the debug-element
  -       parameter = parameters.getParameter(LDAPTransformer.MAGIC_DEBUG_ELEMENT,null);
  -       if (parameter != null) {
  -           default_properties.setProperty(MAGIC_DEBUG_ELEMENT, parameter);
  -       }
  +        // Check the initializer
  +        String parameter = parameters.getParameter(MAGIC_INITIALIZER_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_INITIALIZER_ELEMENT, parameter);
  +        }
  +        // Check the version
  +        parameter = parameters.getParameter(MAGIC_VERSION_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_VERSION_ELEMENT, parameter);
  +        }
  +        // Check the authentication
  +        parameter = parameters.getParameter(MAGIC_AUTHENTICATION_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_AUTHENTICATION_ELEMENT, parameter);
  +        }
  +        // Check the scope
  +        parameter = parameters.getParameter(MAGIC_SCOPE_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_SCOPE_ELEMENT, parameter);
  +        }
  +        // Check the serverurl
  +        parameter = parameters.getParameter(MAGIC_SERVERURL_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_SERVERURL_ELEMENT, parameter);
  +        }
  +        // Check the ldap-root_dn
  +        parameter = parameters.getParameter(MAGIC_ROOT_DN_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_ROOT_DN_ELEMENT, parameter);
  +        }
  +        // Check the ldap-pwd
  +        parameter = parameters.getParameter(MAGIC_PASSWORD_ELEMENT,null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_PASSWORD_ELEMENT, parameter);
  +        }
  +        // Check the port
  +        parameter = parameters.getParameter(MAGIC_PORT_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_PORT_ELEMENT, parameter);
  +        }
  +        // Check the searchbase
  +        parameter = parameters.getParameter(MAGIC_SEARCHBASE_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_SEARCHBASE_ELEMENT, parameter);
  +        }
  +        // Check the doc-element
  +        parameter = parameters.getParameter(MAGIC_DOC_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_DOC_ELEMENT, parameter);
  +        }
  +        // Check the row-element
  +        parameter = parameters.getParameter(MAGIC_ROW_ELEMENT,null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_ROW_ELEMENT, parameter);
  +        }
  +        // Check the error-element
  +        parameter = parameters.getParameter(MAGIC_ERROR_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_ERROR_ELEMENT, parameter);
  +        }
  +        // Check the sax-error
  +        parameter = parameters.getParameter(MAGIC_SAX_ERROR, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_SAX_ERROR, parameter);
  +        }
  +        // Check the deref-link-element
  +        parameter = parameters.getParameter(MAGIC_DEREF_LINK_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_DEREF_LINK_ELEMENT, parameter.toUpperCase());
  +        }
  +        // Check the count-limit-element
  +        parameter = parameters.getParameter(MAGIC_COUNT_LIMIT_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_COUNT_LIMIT_ELEMENT, parameter);
  +        }
  +        // Check the time-limit-element
  +        parameter = parameters.getParameter(MAGIC_TIME_LIMIT_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_TIME_LIMIT_ELEMENT, parameter);
  +        }
  +        // Check the debug-element
  +        parameter = parameters.getParameter(MAGIC_DEBUG_ELEMENT, null);
  +        if (parameter != null) {
  +            default_properties.setProperty(MAGIC_DEBUG_ELEMENT, parameter);
  +        }
       }
   
       /** END SitemapComponent methods **/
  @@ -298,15 +297,14 @@
        */
       protected void executeQuery(int index) throws SAXException {
           this.contentHandler.startPrefixMapping("", LDAPTransformer.my_uri);
  -        AttributesImpl attr = new AttributesImpl();
           LDAPQuery query = (LDAPQuery) queries.elementAt(index);
  -    try {
  -        query.execute();
  +        try {
  +            query.execute();
           } catch (NamingException e) {
  -                getLogger().error(e.toString());
  +            getLogger().error(e.toString());
               throw new SAXException (e);
           } catch (Exception e) {
  -                getLogger().error(e.toString());
  +            getLogger().error(e.toString());
               throw new SAXException (e);
           }
   
  @@ -314,7 +312,7 @@
       }
   
       protected static void throwIllegalStateException(String message) {
  -        throw new IllegalStateException(my_name + ": "+message);
  +        throw new IllegalStateException(my_name + ": " + message);
       }
   
       protected void startExecuteQuery(Attributes attributes) {
  @@ -345,7 +343,7 @@
           switch (current_state) {
               case STATE_INSIDE_EXECUTE_QUERY:
                   executeQuery(current_query_index);
  -        queries.remove(current_query_index);
  +                queries.remove(current_query_index);
                   --current_query_index;
                   if (current_query_index > -1) {
                       current_state = getCurrentQuery().toDo;
  @@ -387,12 +385,12 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_EXECUTE_INCREMENT:
                   executeQuery(current_query_index);
  -        queries.remove(current_query_index);
  +                queries.remove(current_query_index);
                   --current_query_index;
                   if (current_query_index > 1) {
                       current_state = getCurrentQuery().toDo;
                   } else {
  -            queries.removeAllElements();
  +                    queries.removeAllElements();
                       current_state = LDAPTransformer.STATE_OUTSIDE;
                   }
                   break;
  @@ -406,12 +404,12 @@
               case STATE_INSIDE_EXECUTE_QUERY:
                   current_value.setLength(0);
                   current_state = LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT;
  -        break;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT;
  +                break;
               case STATE_INSIDE_EXECUTE_INCREMENT:
                   current_value.setLength(0);
                   current_state = LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT;
                   break;
               default:
                   throwIllegalStateException("Not expecting a start initializer element");
  @@ -421,8 +419,8 @@
       protected void endInitializerElement() {
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT:
  -            getCurrentQuery().initializer = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                getCurrentQuery().initializer = current_value.toString();
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end initializer element");
  @@ -434,12 +432,12 @@
               case STATE_INSIDE_EXECUTE_QUERY:
                   current_value.setLength(0);
                   current_state = LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT;
                   break;
               case STATE_INSIDE_EXECUTE_INCREMENT:
                   current_value.setLength(0);
                   current_state = LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT;
                   break;
               default:
                   throwIllegalStateException("Not expecting a start scope element");
  @@ -449,8 +447,8 @@
       protected void endScopeElement() {
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT:
  -            getCurrentQuery().scope = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                getCurrentQuery().scope = current_value.toString();
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end scope element");
  @@ -462,12 +460,12 @@
               case STATE_INSIDE_EXECUTE_QUERY:
                   current_value.setLength(0);
                   current_state = LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT;
                   break;
               case STATE_INSIDE_EXECUTE_INCREMENT:
                   current_value.setLength(0);
                   current_state = LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT;
                   break;
               default:
                   throwIllegalStateException("Not expecting a start authentication element");
  @@ -477,8 +475,8 @@
       protected void endAuthenticationElement() {
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT:
  -            getCurrentQuery().authentication = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                getCurrentQuery().authentication = current_value.toString();
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end authentication element");
  @@ -504,7 +502,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_SERVERURL_ELEMENT:
                   getCurrentQuery().serverurl = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end serverurl element");
  @@ -557,7 +555,7 @@
               case LDAPTransformer.STATE_INSIDE_SHOW_ATTRIBUTE_ELEMENT:
                   if (current_value.toString().toUpperCase().equals("FALSE")) {
                       getCurrentQuery().showAttribute = false;
  -            }
  +                }
                   current_state = getCurrentQuery().toDo;
                   break;
               default:
  @@ -584,7 +582,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_SEARCHBASE_ELEMENT:
                   getCurrentQuery().searchbase = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end searchbase element");
  @@ -610,7 +608,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_DOC_ELEMENT:
                   getCurrentQuery().doc_element = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end doc-element element");
  @@ -636,7 +634,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_ROW_ELEMENT:
                   getCurrentQuery().row_element = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end row-element element");
  @@ -662,7 +660,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_ERROR_ELEMENT:
                   getCurrentQuery().error_element = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end error-element element");
  @@ -689,8 +687,8 @@
               case LDAPTransformer.STATE_INSIDE_SAX_ERROR_ELEMENT:
                   if (current_value.toString().toUpperCase().equals("TRUE")) {
                       getCurrentQuery().sax_error = true;
  -            }
  -                    current_state = getCurrentQuery().toDo;
  +                }
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end sax-error element");
  @@ -716,7 +714,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_ROOT_DN_ELEMENT:
                   getCurrentQuery().root_dn = current_value.toString(	);
  -                    current_state = getCurrentQuery().toDo;
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end root-dn element");
  @@ -741,7 +739,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_PASSWORD_ELEMENT:
                   getCurrentQuery().password = current_value.toString();
  -                    current_state = getCurrentQuery().toDo;
  +                current_state = getCurrentQuery().toDo;
                   break;
               default:
                   throwIllegalStateException("Not expecting a end password element");
  @@ -766,7 +764,7 @@
       protected void endAttributeElement() {
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_ATTRIBUTE_ELEMENT:
  -            getCurrentQuery().addAttrList(current_value.toString());
  +                getCurrentQuery().addAttrList(current_value.toString());
                   current_state = getCurrentQuery().toDo;
                   break;
               default:
  @@ -804,12 +802,12 @@
           switch (current_state) {
               case STATE_INSIDE_EXECUTE_QUERY:
                   current_state = LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT;
                   current_value.setLength(0);
                   break;
               case STATE_INSIDE_EXECUTE_INCREMENT:
                   current_state = LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT;
  -        getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT;
  +                getCurrentQuery().current_state = LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT;
                   current_value.setLength(0);
                   break;
               default:
  @@ -820,7 +818,7 @@
       protected void endFilterElement() {
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT:
  -        getCurrentQuery().filter = current_value.toString();
  +                getCurrentQuery().filter = current_value.toString();
                   current_state = getCurrentQuery().toDo;
                   break;
               default:
  @@ -848,7 +846,7 @@
               case LDAPTransformer.STATE_INSIDE_DEREF_LINK_ELEMENT:
                   if (current_value.toString().toUpperCase().equals("TRUE")) {
                       getCurrentQuery().deref_link = true;
  -            }
  +                }
                   current_state = getCurrentQuery().toDo;
                   break;
               default:
  @@ -874,7 +872,7 @@
       protected void endCountLimitElement() {
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_COUNT_LIMIT_ELEMENT:
  -        getCurrentQuery().count_limit = Integer.parseInt(current_value.toString());
  +                getCurrentQuery().count_limit = Integer.parseInt(current_value.toString());
                   current_state = getCurrentQuery().toDo;
                   break;
               default:
  @@ -900,7 +898,7 @@
       protected void endTimeLimitElement() {
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_TIME_LIMIT_ELEMENT:
  -        getCurrentQuery().time_limit = Integer.parseInt(current_value.toString());
  +                getCurrentQuery().time_limit = Integer.parseInt(current_value.toString());
                   current_state = getCurrentQuery().toDo;
                   break;
               default:
  @@ -928,7 +926,7 @@
               case LDAPTransformer.STATE_INSIDE_DEBUG_ELEMENT:
                   if (current_value.toString().toUpperCase().equals("TRUE")) {
                       getCurrentQuery().debug = true;
  -            }
  +                }
                   current_state = getCurrentQuery().toDo;
                   break;
               default:
  @@ -1069,25 +1067,25 @@
   
       public void characters(char ary[], int start, int length) throws SAXException {
           if (current_state != LDAPTransformer.STATE_INSIDE_INITIALIZER_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_VERSION_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_SERVERURL_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_PORT_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_DOC_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_ROW_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_ERROR_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_SAX_ERROR_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_ROOT_DN_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_PASSWORD_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_ATTRIBUTE_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_SHOW_ATTRIBUTE_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_DEREF_LINK_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_COUNT_LIMIT_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_TIME_LIMIT_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_DEBUG_ELEMENT &&
  -            current_state != LDAPTransformer.STATE_INSIDE_SEARCHBASE_ELEMENT) {
  +                current_state != LDAPTransformer.STATE_INSIDE_AUTHENTICATION_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_SCOPE_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_VERSION_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_SERVERURL_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_PORT_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_DOC_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_ROW_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_ERROR_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_SAX_ERROR_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_ROOT_DN_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_PASSWORD_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_ATTRIBUTE_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_SHOW_ATTRIBUTE_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_DEREF_LINK_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_COUNT_LIMIT_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_TIME_LIMIT_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_DEBUG_ELEMENT &&
  +                current_state != LDAPTransformer.STATE_INSIDE_SEARCHBASE_ELEMENT) {
               super.characters(ary, start, length);
           }
           getLogger().debug("RECEIVED CHARACTERS: " + new String(ary, start, length));
  @@ -1130,329 +1128,328 @@
       }
   
   
  -class LDAPQuery {
  -
  -    /** What index are you in daddy's queries list **/
  -    protected int query_index;
  -
  -    /** The current state of the event receiving FSM **/
  -    protected int current_state;
  -
  -    /** Who's your daddy? **/
  -    protected LDAPTransformer transformer;
  -
  -    /** LDAP configuration information **/
  -    protected String initializer = "com.sun.jndi.ldap.LdapCtxFactory";
  -    protected String serverurl = "";
  -    protected int port = 389;
  -    protected String root_dn = "";
  -    protected String password = "";
  -    protected String version = "2";
  -    protected String scope = "ONELEVEL_SCOPE";
  -    protected String authentication = "simple";
  -
  -    /** LDAP environment information **/
  -    protected Properties env = new Properties();
  -    protected DirContext ctx;
  -
  -    /** LDAP Query **/
  -    protected int toDo;
  -    protected String searchbase = "";
  -    protected List attrListe = new LinkedList();
  -    protected boolean showAttribute = true;
  -    protected String filter = "";
  -    protected String doc_element = "doc-element";
  -    protected String row_element = "row-element";
  -    protected String error_element = "ldap-error";
  -    protected boolean sax_error = false;
  -    protected boolean deref_link = false;	// Dereference: true -> dereference the link during search
  -    protected long count_limit = 0;		// Maximum number of entries to return: 0 -> no limit
  -    protected int time_limit = 0;		// Number of milliseconds to wait before return: 0 -> infinite
  -    protected boolean debug = false;
  -
  -    protected LDAPQuery	(LDAPTransformer transformer) {
  -        this.transformer = transformer;
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_INITIALIZER_ELEMENT)) {
  -            initializer = transformer.default_properties.getProperty(transformer.MAGIC_INITIALIZER_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_SERVERURL_ELEMENT)) {
  -            serverurl = transformer.default_properties.getProperty(transformer.MAGIC_SERVERURL_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_PORT_ELEMENT)) {
  -            port = Integer.parseInt(transformer.default_properties.getProperty(transformer.MAGIC_INITIALIZER_ELEMENT));
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_ROOT_DN_ELEMENT)) {
  -            root_dn = transformer.default_properties.getProperty(transformer.MAGIC_ROOT_DN_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_PASSWORD_ELEMENT)) {
  -            password = transformer.default_properties.getProperty(transformer.MAGIC_PASSWORD_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_VERSION_ELEMENT)) {
  -            version = transformer.default_properties.getProperty(transformer.MAGIC_VERSION_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_SCOPE_ELEMENT)) {
  -            scope = transformer.default_properties.getProperty(transformer.MAGIC_SCOPE_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_AUTHENTICATION_ELEMENT)) {
  -            authentication = transformer.default_properties.getProperty(transformer.MAGIC_AUTHENTICATION_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_SEARCHBASE_ELEMENT)) {
  -            searchbase = transformer.default_properties.getProperty(transformer.MAGIC_SEARCHBASE_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_SHOW_ATTRIBUTE_ELEMENT)) {
  -            showAttribute = transformer.default_properties.getProperty(transformer.MAGIC_SHOW_ATTRIBUTE_ELEMENT).equals("FALSE") ? false : true;
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_DOC_ELEMENT)) {
  -            doc_element = transformer.default_properties.getProperty(transformer.MAGIC_DOC_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_ROW_ELEMENT)) {
  -            row_element = transformer.default_properties.getProperty(transformer.MAGIC_ROW_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_ERROR_ELEMENT)) {
  -            error_element = transformer.default_properties.getProperty(transformer.MAGIC_ERROR_ELEMENT);
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_SAX_ERROR)) {
  -            sax_error = transformer.default_properties.getProperty(transformer.MAGIC_SAX_ERROR).equals("TRUE") ? true : false;
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_DEREF_LINK_ELEMENT)) {
  -            deref_link = transformer.default_properties.getProperty(transformer.MAGIC_DEREF_LINK_ELEMENT).equals("TRUE") ? true : false;
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_COUNT_LIMIT_ELEMENT)) {
  -            count_limit = Long.parseLong(transformer.default_properties.getProperty(transformer.MAGIC_COUNT_LIMIT_ELEMENT));
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_TIME_LIMIT_ELEMENT)) {
  -            time_limit = Integer.parseInt(transformer.default_properties.getProperty(transformer.MAGIC_TIME_LIMIT_ELEMENT));
  -        }
  -        if (null != transformer.default_properties.getProperty(transformer.MAGIC_DEBUG_ELEMENT)) {
  -            debug = transformer.default_properties.getProperty(transformer.MAGIC_DEBUG_ELEMENT).equals("TRUE") ? true : false;
  +    class LDAPQuery {
  +        /** What index are you in daddy's queries list **/
  +        protected int query_index;
  +
  +        /** The current state of the event receiving FSM **/
  +        protected int current_state;
  +
  +        /** Who's your daddy? **/
  +        protected LDAPTransformer transformer;
  +
  +        /** LDAP configuration information **/
  +        protected String initializer = "com.sun.jndi.ldap.LdapCtxFactory";
  +        protected String serverurl = "localhost";
  +        protected int port = 389;
  +        protected String root_dn = "";
  +        protected String password = "";
  +        protected String version = "2";
  +        protected String scope = "ONELEVEL_SCOPE";
  +        protected String authentication = "simple";
  +
  +        /** LDAP environment information **/
  +        protected Properties env = new Properties();
  +        protected DirContext ctx;
  +
  +        /** LDAP Query **/
  +        protected int toDo;
  +        protected String searchbase = "";
  +        protected List attrListe = new LinkedList();
  +        protected boolean showAttribute = true;
  +        protected String filter = "";
  +        protected String doc_element = "doc-element";
  +        protected String row_element = "row-element";
  +        protected String error_element = "ldap-error";
  +        protected boolean sax_error = false;
  +        protected boolean deref_link = false;	// Dereference: true -> dereference the link during search
  +        protected long count_limit = 0;		// Maximum number of entries to return: 0 -> no limit
  +        protected int time_limit = 0;		// Number of milliseconds to wait before return: 0 -> infinite
  +        protected boolean debug = false;
  +
  +        protected LDAPQuery	(LDAPTransformer transformer) {
  +            this.transformer = transformer;
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_INITIALIZER_ELEMENT)) {
  +                initializer = transformer.default_properties.getProperty(transformer.MAGIC_INITIALIZER_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_SERVERURL_ELEMENT)) {
  +                serverurl = transformer.default_properties.getProperty(transformer.MAGIC_SERVERURL_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_PORT_ELEMENT)) {
  +                port = Integer.parseInt(transformer.default_properties.getProperty(transformer.MAGIC_PORT_ELEMENT));
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_ROOT_DN_ELEMENT)) {
  +                root_dn = transformer.default_properties.getProperty(transformer.MAGIC_ROOT_DN_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_PASSWORD_ELEMENT)) {
  +                password = transformer.default_properties.getProperty(transformer.MAGIC_PASSWORD_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_VERSION_ELEMENT)) {
  +                version = transformer.default_properties.getProperty(transformer.MAGIC_VERSION_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_SCOPE_ELEMENT)) {
  +                scope = transformer.default_properties.getProperty(transformer.MAGIC_SCOPE_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_AUTHENTICATION_ELEMENT)) {
  +                authentication = transformer.default_properties.getProperty(transformer.MAGIC_AUTHENTICATION_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_SEARCHBASE_ELEMENT)) {
  +                searchbase = transformer.default_properties.getProperty(transformer.MAGIC_SEARCHBASE_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_SHOW_ATTRIBUTE_ELEMENT)) {
  +                showAttribute = transformer.default_properties.getProperty(transformer.MAGIC_SHOW_ATTRIBUTE_ELEMENT).equals("FALSE") ? false : true;
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_DOC_ELEMENT)) {
  +                doc_element = transformer.default_properties.getProperty(transformer.MAGIC_DOC_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_ROW_ELEMENT)) {
  +                row_element = transformer.default_properties.getProperty(transformer.MAGIC_ROW_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_ERROR_ELEMENT)) {
  +                error_element = transformer.default_properties.getProperty(transformer.MAGIC_ERROR_ELEMENT);
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_SAX_ERROR)) {
  +                sax_error = transformer.default_properties.getProperty(transformer.MAGIC_SAX_ERROR).equals("TRUE") ? true : false;
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_DEREF_LINK_ELEMENT)) {
  +                deref_link = transformer.default_properties.getProperty(transformer.MAGIC_DEREF_LINK_ELEMENT).equals("TRUE") ? true : false;
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_COUNT_LIMIT_ELEMENT)) {
  +                count_limit = Long.parseLong(transformer.default_properties.getProperty(transformer.MAGIC_COUNT_LIMIT_ELEMENT));
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_TIME_LIMIT_ELEMENT)) {
  +                time_limit = Integer.parseInt(transformer.default_properties.getProperty(transformer.MAGIC_TIME_LIMIT_ELEMENT));
  +            }
  +            if (null != transformer.default_properties.getProperty(transformer.MAGIC_DEBUG_ELEMENT)) {
  +                debug = transformer.default_properties.getProperty(transformer.MAGIC_DEBUG_ELEMENT).equals("TRUE") ? true : false;
  +            }
           }
  -    }
   
  -    protected void execute() throws Exception, NamingException {
  -    String[] attrList = new String[attrListe.size()];
  -        AttributesImpl attr = new AttributesImpl();
  -        if (debug) {
  -            debugPrint();
  -        }
  -    SearchControls constraints = new SearchControls();
  -    attrListe.toArray(attrList);
  -    attrListe.clear();
  -        try {
  -        connect();
  -        switch (toDo) {
  -        case LDAPTransformer.STATE_INSIDE_EXECUTE_QUERY:
  +        protected void execute() throws Exception, NamingException {
  +            String[] attrList = new String[attrListe.size()];
  +            AttributesImpl attr = new AttributesImpl();
  +            if (debug) {
  +                debugPrint();
  +            }
  +            SearchControls constraints = new SearchControls();
  +            attrListe.toArray(attrList);
  +            attrListe.clear();
               try {
  -                    if (scope.equals("OBJECT_SCOPE")) {
  -                            constraints.setSearchScope(SearchControls.OBJECT_SCOPE);
  -                    } else if (scope.equals("SUBTREE_SCOPE")) {
  -                            constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
  -                        } else {
  -                            constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
  -                        }
  -                        constraints.setTimeLimit(time_limit);
  -                        constraints.setDerefLinkFlag(deref_link);
  -                        constraints.setCountLimit(count_limit);
  -                    if (attrList.length > 0) {
  -                        constraints.setReturningAttributes(attrList);
  -                    }
  -                    NamingEnumeration ldapresults = ctx.search(searchbase, filter, constraints);
  -
  -                    if (!doc_element.equals("")) {
  -                        transformer.start(doc_element, attr);
  -                    }
  -
  -                    while (ldapresults != null && ldapresults.hasMore()) {
  -                        if (!row_element.equals("")) {
  -                                transformer.start(row_element, attr);
  -                        }
  -                    SearchResult si = (SearchResult)ldapresults.next();
  -                        javax.naming.directory.Attributes attrs = si.getAttributes();
  -                        if (attrs != null) {
  -                                NamingEnumeration ae = attrs.getAll();
  +                connect();
  +                switch (toDo) {
  +                    case LDAPTransformer.STATE_INSIDE_EXECUTE_QUERY:
  +                        try {
  +                            if (scope.equals("OBJECT_SCOPE")) {
  +                                constraints.setSearchScope(SearchControls.OBJECT_SCOPE);
  +                            } else if (scope.equals("SUBTREE_SCOPE")) {
  +                                constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
  +                            } else {
  +                                constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
  +                            }
  +                            constraints.setTimeLimit(time_limit);
  +                            constraints.setDerefLinkFlag(deref_link);
  +                            constraints.setCountLimit(count_limit);
  +                            if (attrList.length > 0) {
  +                                constraints.setReturningAttributes(attrList);
  +                            }
  +                            NamingEnumeration ldapresults = ctx.search(searchbase, filter, constraints);
  +
  +                            if (!doc_element.equals("")) {
  +                                transformer.start(doc_element, attr);
  +                            }
  +
  +                            while (ldapresults != null && ldapresults.hasMore()) {
  +                                if (!row_element.equals("")) {
  +                                    transformer.start(row_element, attr);
  +                                }
  +                                SearchResult si = (SearchResult)ldapresults.next();
  +                                javax.naming.directory.Attributes attrs = si.getAttributes();
  +                                if (attrs != null) {
  +                                    NamingEnumeration ae = attrs.getAll();
                                       while (ae.hasMoreElements()) {
  -                                Attribute at = (Attribute)ae.next();
  +                                        Attribute at = (Attribute)ae.next();
                                           Enumeration vals = at.getAll();
  -                                        String attrID = (String)at.getID();
  -                            if (showAttribute) {
  -                                    transformer.start(attrID, attr);
  -                            }
  -                            String attrVal = (String)vals.nextElement();
  -                            if (query_index > 0) {
  -                                switch (transformer.getQuery(query_index-1).current_state) {
  -                                    case LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT:
  -                                        if (!transformer.getQuery(query_index-1).filter.equals("")) {
  -                                            transformer.getQuery(query_index-1).filter.concat(", ");
  +                                        String attrID = at.getID();
  +                                        if (showAttribute) {
  +                                            transformer.start(attrID, attr);
                                           }
  -                                        transformer.getQuery(query_index-1).filter.concat(attrID).concat("=").concat(attrVal);
  -                                        break;
  -                                    default:
  -                                        transformer.start(attrID, attr);
  +                                        String attrVal = (String)vals.nextElement();
  +                                        if (query_index > 0) {
  +                                            switch (transformer.getQuery(query_index-1).current_state) {
  +                                                case LDAPTransformer.STATE_INSIDE_FILTER_ELEMENT:
  +                                                    if (!transformer.getQuery(query_index-1).filter.equals("")) {
  +                                                        transformer.getQuery(query_index-1).filter.concat(", ");
  +                                                    }
  +                                                    transformer.getQuery(query_index-1).filter.concat(attrID).concat("=").concat(attrVal);
  +                                                    break;
  +                                                default:
  +                                                    transformer.start(attrID, attr);
  +                                            }
  +                                        } else {
  +                                            transformer.data(String.valueOf(attrVal));
  +                                        }
  +                                        if (showAttribute) {
  +                                            transformer.end(attrID);
  +                                        }
  +                                    }
  +                                }
  +                                if (!row_element.equals("")) {
  +                                    transformer.end(row_element);
                                   }
  -                            } else {
  -                                    transformer.data(String.valueOf(attrVal));
                               }
  -                            if (showAttribute) {
  -                                    transformer.end(attrID);
  +                            if (!doc_element.equals("")) {
  +                                transformer.end(doc_element);
  +                            }
  +                        } catch(Exception e) {
  +                            if (sax_error) {
  +                                throw new Exception ("[LDAPTransformer] Error in LDAP-Query: " + e.toString());
  +                            } else {
  +                                transformer.start(error_element, attr);
  +                                transformer.data("[LDAPTransformer] Error in LDAP-Query: " + e);
  +                                transformer.end(error_element);
  +                                transformer.getTheLogger().error("[LDAPTransformer] Exception: " + e.toString());
                               }
  -                                }
  -                        }
  -                        if (!row_element.equals("")) {
  -                            transformer.end(row_element);
  -                        }
  -                    }
  -                    if (!doc_element.equals("")) {
  -                        transformer.end(doc_element);
  -                    }
  -            } catch(Exception e) {
  -                        if (sax_error) {
  -                    throw new Exception ("[LDAPTransformer] Error in LDAP-Query: " + e.toString());
  -                        } else {
  -                transformer.start(error_element, attr);
  -                transformer.data("[LDAPTransformer] Error in LDAP-Query: " + e);
  -                transformer.end(error_element);
  -                transformer.getTheLogger().error("[LDAPTransformer] Exception: " + e.toString());
  -                    }
  -            }
  -                break;
  -        case LDAPTransformer.STATE_INSIDE_EXECUTE_INCREMENT:
  -            try {
  -                    if (scope.equals("OBJECT_SCOPE")) {
  -                            constraints.setSearchScope(SearchControls.OBJECT_SCOPE);
  -                    } else if (scope.equals("SUBTREE_SCOPE")) {
  -                            constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
  -                        } else {
  -                            constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
                           }
  -                        constraints.setTimeLimit(time_limit);
  -                        constraints.setDerefLinkFlag(deref_link);
  -                        constraints.setCountLimit(count_limit);
  -                    if (attrList.length != 1) {
  -                    transformer.start(error_element, attr);
  -                    transformer.data("Increment must reference exactly 1 attribute.");
  -                    transformer.end(error_element);
  -                } else {
  -                        constraints.setReturningAttributes(attrList);
  -                        NamingEnumeration ldapresults = ctx.search(searchbase, filter, constraints);
  -                    int attrVal = 0;
  -                    String attrID = "";
  -                    SearchResult si = null;
  -                        while (ldapresults != null && ldapresults.hasMore()) {
  -                        si = (SearchResult)ldapresults.next();
  -                            javax.naming.directory.Attributes attrs = si.getAttributes();
  -                            if (attrs != null) {
  -                                    NamingEnumeration ae = attrs.getAll();
  +                        break;
  +                    case LDAPTransformer.STATE_INSIDE_EXECUTE_INCREMENT:
  +                        try {
  +                            if (scope.equals("OBJECT_SCOPE")) {
  +                                constraints.setSearchScope(SearchControls.OBJECT_SCOPE);
  +                            } else if (scope.equals("SUBTREE_SCOPE")) {
  +                                constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
  +                            } else {
  +                                constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
  +                            }
  +                            constraints.setTimeLimit(time_limit);
  +                            constraints.setDerefLinkFlag(deref_link);
  +                            constraints.setCountLimit(count_limit);
  +                            if (attrList.length != 1) {
  +                                transformer.start(error_element, attr);
  +                                transformer.data("Increment must reference exactly 1 attribute.");
  +                                transformer.end(error_element);
  +                            } else {
  +                                constraints.setReturningAttributes(attrList);
  +                                NamingEnumeration ldapresults = ctx.search(searchbase, filter, constraints);
  +                                int attrVal = 0;
  +                                String attrID = "";
  +                                SearchResult si = null;
  +                                while (ldapresults != null && ldapresults.hasMore()) {
  +                                    si = (SearchResult)ldapresults.next();
  +                                    javax.naming.directory.Attributes attrs = si.getAttributes();
  +                                    if (attrs != null) {
  +                                        NamingEnumeration ae = attrs.getAll();
                                           while (ae.hasMoreElements()) {
  -                                    Attribute at = (Attribute)ae.next();
  +                                            Attribute at = (Attribute)ae.next();
                                               Enumeration vals = at.getAll();
  -                                attrID = (String)at.getID();
  -                                attrVal = Integer.parseInt((String)vals.nextElement());
  +                                            attrID = at.getID();
  +                                            attrVal = Integer.parseInt((String)vals.nextElement());
  +                                        }
                                       }
  +                                }
  +                                ++attrVal;
  +                                // Specify the changes to make
  +                                ModificationItem[] mods = new ModificationItem[1];
  +                                // Replace the "mail" attribute with a new value
  +                                mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,
  +                                        new BasicAttribute(attrID, Integer.toString(attrVal)));
  +                                // Perform the requested modifications on the named object
  +                                ctx.modifyAttributes(new StringBuffer(si.toString().substring(0,si.toString().indexOf(":")))
  +                                        .append(",").append(searchbase).toString(), mods);
  +                            }
  +                        } catch(Exception e) {
  +                            if (sax_error) {
  +                                throw new Exception ("[LDAPTransformer] Error incrementing an attribute: " + e.toString());
  +                            } else {
  +                                transformer.start(error_element, attr);
  +                                transformer.data("[LDAPTransformer] Error incrementing an attribute: " + e.toString());
  +                                transformer.end(error_element);
  +                                transformer.getTheLogger().error("[LDAPTransformer] Error incrementing an attribute: " + e.toString());
                               }
                           }
  -                        ++attrVal;
  -                    // Specify the changes to make
  -                    ModificationItem[] mods = new ModificationItem[1];
  -                    // Replace the "mail" attribute with a new value
  -                    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,
  -                        new BasicAttribute(attrID, Integer.toString(attrVal)));
  -                    // Perform the requested modifications on the named object
  -                    ctx.modifyAttributes(new StringBuffer(si.toString().substring(0,si.toString().indexOf(":")))
  -                                         .append(",").append(searchbase).toString(), mods);
  -                    }
  -            } catch(Exception e) {
  -                        if (sax_error) {
  -                    throw new Exception ("[LDAPTransformer] Error incrementing an attribute: " + e.toString());
  -                        } else {
  -                transformer.start(error_element, attr);
  -                transformer.data("[LDAPTransformer] Error incrementing an attribute: " + e.toString());
  -                transformer.end(error_element);
  -                transformer.getTheLogger().error("[LDAPTransformer] Error incrementing an attribute: " + e.toString());
  -                    }
  +                        break;
  +                    default:
  +                } //end switch
  +            } catch (NamingException e) {
  +                if (sax_error) {
  +                    throw new NamingException ("[LDAPTransformer] Failed ldap-connection to directory service: " + e.toString());
  +                } else {
  +                    transformer.start(error_element, attr);
  +                    transformer.data("[LDAPTransformer] Failed ldap-connection to directory service.");
  +                    transformer.end(error_element);
  +                    transformer.getTheLogger().error("[LDAPTransformer] Failed to connect to " + serverurl + e.toString());
  +                }
               }
  -                break;
  -            default:
  -        } //end switch
  -    } catch (NamingException e) {
  -            if (sax_error) {
  -                throw new NamingException ("[LDAPTransformer] Failed ldap-connection to directory service: " + e.toString());
  -            } else {
  -            transformer.start(error_element, attr);
  -            transformer.data("[LDAPTransformer] Failed ldap-connection to directory service.");
  -            transformer.end(error_element);
  -                transformer.getTheLogger().error("[LDAPTransformer] Failed to connect to " + serverurl + e.toString());
  +            try {
  +                disconnect();
  +            } catch (NamingException e) {
  +                if (sax_error) {
  +                    throw new NamingException ("[LDAPTransformer] Failed ldap-disconnection from directory service: " + e.toString());
  +                } else {
  +                    transformer.start(error_element, attr);
  +                    transformer.data("[LDAPTransformer] Failed ldap-disconnection to directory service.");
  +                    transformer.end(error_element);
  +                    transformer.getTheLogger().error("[LDAPTransformer] Failed to disconnect from " + serverurl + e.toString());
  +                }
               }
  -    }
  -        try {
  -            disconnect();
  -        } catch (NamingException e) {
  -            if (sax_error) {
  -            throw new NamingException ("[LDAPTransformer] Failed ldap-disconnection from directory service: " + e.toString());
  -            } else {
  -        transformer.start(error_element, attr);
  -        transformer.data("[LDAPTransformer] Failed ldap-disconnection to directory service.");
  -        transformer.end(error_element);
  -            transformer.getTheLogger().error("[LDAPTransformer] Failed to disconnect from " + serverurl + e.toString());
  -        }
           }
  -    }
  -
  -    protected void addAttrList(String attr) {
  -        attrListe.add(attr);
  -    }
   
  -    protected void connect() throws NamingException {
  -        if (root_dn != null && password != null) {
  -        env.put(Context.SECURITY_AUTHENTICATION, authentication);
  -        env.put(Context.SECURITY_PRINCIPAL, root_dn);
  -        env.put(Context.SECURITY_CREDENTIALS, password);
  +        protected void addAttrList(String attr) {
  +            attrListe.add(attr);
           }
   
  -        env.put("java.naming.ldap.version", version );
  -        env.put(Context.INITIAL_CONTEXT_FACTORY, initializer);
  -        env.put( Context.PROVIDER_URL, new StringBuffer( serverurl ).append( ":" ).append( port ).toString() );
  +        protected void connect() throws NamingException {
  +            if (root_dn != null && password != null) {
  +                env.put(Context.SECURITY_AUTHENTICATION, authentication);
  +                env.put(Context.SECURITY_PRINCIPAL, root_dn);
  +                env.put(Context.SECURITY_CREDENTIALS, password);
  +            }
   
  -        try {
  -            ctx = new InitialDirContext(env);
  -        } catch (NamingException e) {
  -        env.clear();
  -        throw new NamingException (e.toString());
  +            env.put("java.naming.ldap.version", version );
  +            env.put(Context.INITIAL_CONTEXT_FACTORY, initializer);
  +            env.put(Context.PROVIDER_URL, serverurl + ":" + port);
  +
  +            try {
  +                ctx = new InitialDirContext(env);
  +            } catch (NamingException e) {
  +                env.clear();
  +                throw new NamingException (e.toString());
  +            }
           }
  -    }
   
  -    protected void disconnect() throws NamingException {
  -        try {
  -            if (ctx != null) ctx.close();
  -        } catch (NamingException e) {
  +        protected void disconnect() throws NamingException {
  +            try {
  +                if (ctx != null) ctx.close();
  +            } catch (NamingException e) {
  +                ctx = null;
  +                env.clear();
  +                throw new NamingException (e.toString());
  +            }
               ctx = null;
               env.clear();
  -        throw new NamingException (e.toString());
           }
  -        ctx = null;
  -        env.clear();
  -    }
   
  -    protected void debugPrint() {
  -    transformer.getTheLogger().debug("[LDAPTransformer] query_index: " + query_index);
  -    transformer.getTheLogger().debug("[LDAPTransformer] current_state: " + current_state);
  -    transformer.getTheLogger().debug("[LDAPTransformer] serverurl: " + serverurl);
  -    transformer.getTheLogger().debug("[LDAPTransformer] port: " + port);
  -    transformer.getTheLogger().debug("[LDAPTransformer] root_dn: " + root_dn);
  -    transformer.getTheLogger().debug("[LDAPTransformer] password: " + password);
  -    transformer.getTheLogger().debug("[LDAPTransformer] version: " + version);
  -    transformer.getTheLogger().debug("[LDAPTransformer] scope: " + scope);
  -    transformer.getTheLogger().debug("[LDAPTransformer] authentication: " + authentication);
  -    transformer.getTheLogger().debug("[LDAPTransformer] toDo: " + toDo);
  -    transformer.getTheLogger().debug("[LDAPTransformer] searchbase: " + searchbase);
  -    transformer.getTheLogger().debug("[LDAPTransformer] showAttribute: " + showAttribute);
  -    transformer.getTheLogger().debug("[LDAPTransformer] attribute: " + attrListe.toString());
  -    transformer.getTheLogger().debug("[LDAPTransformer] filter: " + filter);
  -    transformer.getTheLogger().debug("[LDAPTransformer] doc_element: " + doc_element);
  -    transformer.getTheLogger().debug("[LDAPTransformer] row_element: " + row_element);
  -    transformer.getTheLogger().debug("[LDAPTransformer] error_element: " + error_element);
  -    transformer.getTheLogger().debug("[LDAPTransformer] sax-error: " + sax_error);
  -    transformer.getTheLogger().debug("[LDAPTransformer] deref_link: " + deref_link);
  -    transformer.getTheLogger().debug("[LDAPTransformer] count_limit: " + count_limit);
  -    transformer.getTheLogger().debug("[LDAPTransformer] time_limit: " + time_limit);
  +        protected void debugPrint() {
  +            transformer.getTheLogger().debug("[LDAPTransformer] query_index: " + query_index);
  +            transformer.getTheLogger().debug("[LDAPTransformer] current_state: " + current_state);
  +            transformer.getTheLogger().debug("[LDAPTransformer] serverurl: " + serverurl);
  +            transformer.getTheLogger().debug("[LDAPTransformer] port: " + port);
  +            transformer.getTheLogger().debug("[LDAPTransformer] root_dn: " + root_dn);
  +            transformer.getTheLogger().debug("[LDAPTransformer] password: " + password);
  +            transformer.getTheLogger().debug("[LDAPTransformer] version: " + version);
  +            transformer.getTheLogger().debug("[LDAPTransformer] scope: " + scope);
  +            transformer.getTheLogger().debug("[LDAPTransformer] authentication: " + authentication);
  +            transformer.getTheLogger().debug("[LDAPTransformer] toDo: " + toDo);
  +            transformer.getTheLogger().debug("[LDAPTransformer] searchbase: " + searchbase);
  +            transformer.getTheLogger().debug("[LDAPTransformer] showAttribute: " + showAttribute);
  +            transformer.getTheLogger().debug("[LDAPTransformer] attribute: " + attrListe.toString());
  +            transformer.getTheLogger().debug("[LDAPTransformer] filter: " + filter);
  +            transformer.getTheLogger().debug("[LDAPTransformer] doc_element: " + doc_element);
  +            transformer.getTheLogger().debug("[LDAPTransformer] row_element: " + row_element);
  +            transformer.getTheLogger().debug("[LDAPTransformer] error_element: " + error_element);
  +            transformer.getTheLogger().debug("[LDAPTransformer] sax-error: " + sax_error);
  +            transformer.getTheLogger().debug("[LDAPTransformer] deref_link: " + deref_link);
  +            transformer.getTheLogger().debug("[LDAPTransformer] count_limit: " + count_limit);
  +            transformer.getTheLogger().debug("[LDAPTransformer] time_limit: " + time_limit);
  +        }
       }
  -}
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message