You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by sh...@locus.apache.org on 2000/12/12 16:34:49 UTC

cvs commit: jakarta-taglibs/jndi/src/org/apache/taglibs/jndi ForEachAttributeTEI.java ForEachAttributeTag.java GetAttributeTEI.java GetAttributeTag.java ListTEI.java ListTag.java LookupTEI.java LookupTag.java SearchTEI.java SearchTag.java UseContextTEI.java UseContextTag.java UseDirContextTEI.java UseDirContextTag.java

shemnon     00/12/12 07:34:45

  Modified:    .        build.xml
  Added:       jndi     build.bat build.sh build.xml tags-doc.txt todo.txt
               jndi/conf jndi.tld
               jndi/doc/conf web.xml
               jndi/doc/web index.html
               jndi/examples/conf web.xml
               jndi/examples/web index.html listinitfac.jsp listurl.jsp
                        lookupinitfac.jsp lookupurl.jsp
                        searchByInitFactory.jsp searchBySession.jsp
               jndi/src/org/apache/taglibs/jndi ForEachAttributeTEI.java
                        ForEachAttributeTag.java GetAttributeTEI.java
                        GetAttributeTag.java ListTEI.java ListTag.java
                        LookupTEI.java LookupTag.java SearchTEI.java
                        SearchTag.java UseContextTEI.java
                        UseContextTag.java UseDirContextTEI.java
                        UseDirContextTag.java
  Log:
  Adding first pass at the JNDI tag libraries
  
  Revision  Changes    Path
  1.16      +6 -2      jakarta-taglibs/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/build.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- build.xml	2000/12/08 02:50:01	1.15
  +++ build.xml	2000/12/12 15:34:14	1.16
  @@ -1,5 +1,5 @@
   <!-- ANT Build Script for the JAKARTA-TAGLIBS Project -->
  -<!-- $Id: build.xml,v 1.15 2000/12/08 02:50:01 horwat Exp $ -->
  +<!-- $Id: build.xml,v 1.16 2000/12/12 15:34:14 shemnon Exp $ -->
   <project name="jakarta-taglibs" default="dist" basedir=".">
   
   
  @@ -154,9 +154,13 @@
       <ant dir="./regexp" target="dist"/>
     </target>
   
  +  <target name="jndi">
  +    <ant dir="./jndi" target="dist"/>
  +  </target>
  +
     <!-- *********************** Overall Build Command ********************** -->
   
  -  <target name="dist" depends="prepare,static,compile.documentation,bsf,input,jspspec,sql,utility,xsl,request,session,response,datetime,regexp"/>
  +  <target name="dist" depends="prepare,static,compile.documentation,bsf,input,jspspec,sql,utility,xsl,request,session,response,datetime,regexp,jndi"/>
   
     <!-- *********************** Clean Command ****************************** -->
   
  
  
  
  1.1                  jakarta-taglibs/jndi/build.bat
  
  Index: build.bat
  ===================================================================
  @echo off
  
  if "%SERVLET_JAR%" == "" goto noservletjar
  
  set _ANTHOME=%ANT_HOME%
  if "%ANT_HOME%" == "" set ANT_HOME=..\..\jakarta-ant
  
  if "%CLASSPATH%" == "" goto noclasspath
  
  set _CLASSPATH=%CLASSPATH%
  set CLASSPATH=%CLASSPATH%;%ANT_HOME%\lib\ant.jar;%ANT_HOME%\lib\xml.jar;%JAVA_HOME%\lib\tools.jar
  goto next
  
  :noclasspath
  
  set _CLASSPATH=
  set CLASSPATH=%ANT_HOME%\lib\ant.jar;%ANT_HOME%\lib\xml.jar;%JAVA_HOME%\lib\tools.jar
  goto next
  
  :next
  
  java org.apache.tools.ant.Main -Dant.home=%ANT_HOME% -Dservlet.jar=%SERVLET_JAR% %1 %2 %3 %4 %5 %6 %7 %8 %9
  
  :clean
  set CLASSPATH=%_CLASSPATH%
  set _CLASSPATH=
  set ANT_HOME=%_ANTHOME%
  set _ANTHOME=
  set ARGS=%_ARGS%
  set _ARGS=
  goto done
  
  :noservletjar
  echo You must set SERVLET_JAR to that pathname of your servlet.jar file
  
  :done
  
  
  
  
  1.1                  jakarta-taglibs/jndi/build.sh
  
  Index: build.sh
  ===================================================================
  #! /bin/sh
  
  if [ "$ANT_HOME" = "" ] ; then
    ANT_HOME=../../jakarta-ant
  fi
  
  args=""
  if [ "$SERVLET_JAR" != "" ] ; then
    args="$args -Dservlet.jar=$SERVLET_JAR"
  fi
  args="$args -Dant.home=$ANT_HOME"
  
  cp=$ANT_HOME/lib/ant.jar:$ANT_HOME/lib/xml.jar:$JAVA_HOME/lib/tools.jar
  
  java -classpath $cp:$CLASSPATH org.apache.tools.ant.Main $args "$@"
  
  
  
  1.1                  jakarta-taglibs/jndi/build.xml
  
  Index: build.xml
  ===================================================================
  <!-- ANT Build Script for the "jndi" Custom Tag Library -->
  <!-- $Id: build.xml,v 1.1 2000/12/12 15:34:20 shemnon Exp $ -->
  <project name="jndi" default="main" basedir=".">
  
      <!-- ******************** Adjustable Properties *********************** -->
  
      <!--
  
          The following property values should be examined and customized
          for each custom tag library subproject.
  
          ant.home                    Home directory for the ANT build tool
                                      This is normally defaulted from the
                                      ANT_HOME environment variable in the
                                      build script.
  
          servlet.jar                 Pathname of the servlet API classes
                                      you are using to compile, such as the
                                      one that comes with Tomcat.  This is
                                      normally defaulted from the SERVLET_JAR
                                      environment variable in the build script.
  
          taglib.name                 Base name of this tag library subproject.
  
      -->
  
      <property name="taglib.name"    value="jndi"/> 
          <!-- but the jar will be jndi-taglib so not to collide with the JNDI RI jars -->
      <property name="ant.home"       value="../../jakarta-ant"/>
      <property name="servlet.jar"    value="../../jakarta-servletapi/lib/servlet.jar"/>
  
  
      <!-- ****************** Project Standard Properties ******************* -->
  
      <!--
  
          The following property values reflect the standard directory
          organization for the jakarta-taglibs project, and should not
          be changed or overridden.
  
          build.dir                   Base directory for build targets
          dist.dir                    Base directory for distribution targets
  
      -->
  
      <property name="build.dir"      value="../../build/taglibs"/>
      <property name="dist.dir"       value="../../dist/taglibs"/>
  
      <!-- *********************** Default Properties ********************** -->
  
      <!--
  
          The following property values reflect the recommended directory
          structure for each custom tag library subproject.  You should only
          need to adjust or override them if you use a different organization.
  
          conf.src                    Library configuration source directory
          doc.src                     Documentation app source directory
          examples.src                Examples app source directory
          library.src                 Library Java source directory
  
      -->
  
      <property name="conf.src"       value="conf"/>
      <property name="doc.src"        value="doc"/>
      <property name="examples.src"   value="examples"/>
      <property name="library.src"    value="src"/>
      <property name="lib.src"        value="lib"/>
  
  
      <!-- ********************* Derived Properties ************************* -->
  
      <!--
  
          These property values are derived from the previously defined values,
          and should not normally be overridden from the command line.
  
          build.doc                   Target directory for documentation app
          build.examples              Target directory for examples app
          build.library               Target directory for tag library
          dist.doc                    Destination WAR for documentation app
          dist.examples               Destination WAR for examples app
          dist.library                Destination JAR for tag library
          dist.tld                    Destination TLD file for tag library
  
      -->
  
      <property name="build.doc"      value="${build.dir}/${taglib.name}-doc"/>
      <property name="build.examples" value="${build.dir}/${taglib.name}-examples"/>
      <property name="build.library"  value="${build.dir}/${taglib.name}"/>
      <property name="dist.doc"       value="${dist.dir}/${taglib.name}/${taglib.name}-doc.war"/>
      <property name="dist.examples"  value="${dist.dir}/${taglib.name}/${taglib.name}-examples.war"/>
      <property name="dist.library"   value="${dist.dir}/${taglib.name}/${taglib.name}-taglib.jar"/>
      <property name="dist.tld"       value="${dist.dir}/${taglib.name}/${taglib.name}.tld"/>
  
  
    <!-- ********************** Destination Preparation ********************* -->
  
    <target name="prepare">
      <!-- Set up build directories -->
      <mkdir dir="${build.dir}"/>
      <mkdir dir="${build.doc}"/>
      <mkdir dir="${build.doc}/javadoc"/>
      <mkdir dir="${build.doc}/WEB-INF"/>
      <mkdir dir="${build.doc}/WEB-INF/classes"/>
      <mkdir dir="${build.doc}/WEB-INF/lib"/>
      <mkdir dir="${build.examples}"/>
      <mkdir dir="${build.examples}/WEB-INF"/>
      <mkdir dir="${build.examples}/WEB-INF/classes"/>
      <mkdir dir="${build.examples}/WEB-INF/lib"/>
      <mkdir dir="${build.library}"/>
      <mkdir dir="${build.library}/META-INF"/>
      <!-- Set up distribution directory -->
      <mkdir dir="${dist.dir}"/>
      <mkdir dir="${dist.dir}/${taglib.name}"/>
    </target>
  
  
    <!-- **************** Compile Tag Library Components ******************** -->
  
    <!-- Compile the documentation application -->
    <target name="documentation" depends="prepare">
      <copy todir="${build.doc}/WEB-INF" >
          <fileset dir="${doc.src}/conf" />
      </copy>
      <copy todir="${build.doc}" >
          <fileset dir="${doc.src}/web" />
      </copy>
      <javadoc packagenames="org.apache.taglibs.jndi.*"
  	     classpath="${servlet.jar}"
               sourcepath="src"
               destdir="${build.doc}/javadoc"
               author="true"   
               version="true"
  	     use="true"
               windowtitle="Jakarta JNDI custom tag library API"
               doctitle="Jakarta JNDI custom tag library"
               bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved."
      />
  <!--
      <javac srcdir="${doc.src}/src"   destdir="${build.doc}/WEB-INF/classes"
             classpath="${servlet.jar}" debug="on"/>
  -->
    </target>
  
    <!-- Compile the examples application -->
    <target name="examples" depends="library-dist">
  <!--
      <copydir src="${lib.src}" dest="${build.examples}/WEB-INF/lib"/>
      <copydir src="${library.src}" dest="${build.examples}/WEB-INF/classes"/>
  -->
      <copy  todir="${build.examples}/WEB-INF">
  	<fileset dir="${examples.src}/conf" />
      </copy>
      <copy  todir="${build.examples}" >
  	<fileset dir="${examples.src}/web" />
      </copy>
      <copy file="${dist.tld}"
                tofile="${build.examples}/WEB-INF/${taglib.name}.tld"/>
      <copy file="${dist.library}"
                tofile="${build.examples}/WEB-INF/lib/${taglib.name}-taglib.jar"/>
      <copy file="${examples.src}/web/listinitfac.jsp"
            tofile="${build.examples}/listinitfac.txt"/>
      <copy file="${examples.src}/web/listurl.jsp"
            tofile="${build.examples}/listurl.txt"/>
      <copy file="${examples.src}/web/lookupinitfac.jsp"
            tofile="${build.examples}/lookupinitfac.txt"/>
      <copy file="${examples.src}/web/listurl.jsp"
            tofile="${build.examples}/listurl.txt"/>
      <copy file="${examples.src}/web/searchByInitFactory.jsp"
            tofile="${build.examples}/searchByInitFactory.txt"/>
      <copy file="${examples.src}/web/searchBySession.jsp"
            tofile="${build.examples}/searchBySession.txt"/>
  <!--
      <javac srcdir="${examples.src}/src"
             destdir="${build.examples}/WEB-INF/classes"
             classpath="${servlet.jar}" debug="on"/>
  -->
    </target>
  
    <!-- Compile the tag library itself -->
    <target name="library" depends="prepare">
      <copy file="${conf.src}/jndi.tld"
                tofile="${build.library}/META-INF/taglib.tld"/>
      <javac srcdir="${library.src}" destdir="${build.library}"
             classpath="${servlet.jar}" debug="on"/>
    </target>
  
    <!-- Compile the library as well as the associated applications -->
    <target name="main" depends="library,documentation,examples"/>
  
  
    <!-- ******************* Create Distribution Files ********************** -->
  
    <!-- Create the documentation application WAR file -->
    <target name="documentation-dist" depends="documentation">
      <jar jarfile="${dist.doc}" basedir="${build.doc}"/>
    </target>
  
    <!-- Create the examples application WAR file -->
    <target name="examples-dist" depends="examples">
      <jar jarfile="${dist.examples}" basedir="${build.examples}"/>
    </target>
  
    <!-- Create the library distribution files -->
    <target name="library-dist" depends="library">
      <jar jarfile="${dist.library}" basedir="${build.library}"/>
      <copy file="${conf.src}/${taglib.name}.tld" tofile="${dist.tld}"/>
    </target>
  
    <!-- Create the entire set of distribution files -->
    <target name="dist" depends="library-dist,examples-dist,documentation-dist"/>
  
  
  
    <!-- ************************ Utility Commands ************************** -->
  
    <!-- Delete output directories and files so we can build from scratch -->
    <target name="clean">
      <delete dir="${build.doc}"/>
      <delete dir="${build.examples}"/>
      <delete dir="${build.library}"/>
      <delete dir="${dist.dir}/${taglib.name}"/>
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-taglibs/jndi/tags-doc.txt
  
  Index: tags-doc.txt
  ===================================================================
  Initial documnetation of the tags
  
  tags existing are:
    useContext
    useDirContext
    list
    lookup
    search
    getAttribute
    forEachAttribute
  
  useContext
  This tag creates an instance of a javax.naming.Context based on the values
  of the attributes providing some of the standard values.  In addition to the 
  System properties and the jndi.properties, some standard properties are 
  scanned in the pageContext attributes.  (note: should this be extended to the
  servlet init params as well?)
  (note: as of right now this does not look into the id and scope to see if the 
  context already exists, so it does not behave entirely like useBean)
  Attributes:
    - envRef (optional)
      This is the name of an attribute that will be searched for that provides
      additional environment information.  This info is subordnate to the info
      provuded by the attributes to this tag
    - env (optional, runtime of type java.util.Hashtable)
      Same as envRef, except that the value is the hashtable
    - url (this or one of providerUrl or intialFactory required,
           runtime of type String)
      If provided, the context created by the other attributges is used to
      create a context in which the parameter of this attribute is used to
      preform a lookup(String) operation.  The context returned from the lookup
      will be the context returned by the tag.
    - providerUrl (this or one of url or initialFactory required,
                   runtime of type java.lang.String)    
      Provides the value of the Context.PROVIDER_URL attribute to the 
      InitialContext environment Hashtable.
    - initialFactory (this or one of url or providerUrl required,
                      runtime of type java.lang.String)    
      Provides the value of the Context.INITIAL_CONTEXT_FACTORY attribute to 
      the InitialContext environment Hashtable.
    - dnsUrl (optional, runtime of type java.lang.String)    
      Provides the value of the Context.DNS_URL attribute to the 
      InitialContext environment Hashtable.
    - authoritatibe (optional, runtime of type java.lang.String)    
      Provides the value of the Context.AUTHORITATIVE attribute to the 
      InitialContext environment Hashtable.
    - batchsize (optional, runtime of type java.lang.String)    
      Provides the value of the Context.BATCHSIZE attribute to the 
      InitialContext environment Hashtable.
    - objectFactories (optional, runtime of type java.lang.String)    
      Provides the value of the Context.OBJECT_FACTORIES attribute to 
      the InitialContext environment Hashtable.
    - stateFactories (optional, runtime of type java.lang.String)    
      Provides the value of the Context.STATE_FACTORIES attribute to 
      the InitialContext environment Hashtable.
    - urlPkgPrefixes (optional, runtime of type java.lang.String)    
      Provides the value of the Context.URL_PKG_PREFIXES attribute to 
      the InitialContext environment Hashtable.
    - id (required)
      The name that the context is to be exported as.  
      (A potential future relaxation may make this optional, but it will only
      be available to body content enclosed that asks for an implicit context)
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
  
  useDirContext
      This behaves exactly like useContext except that the object exported
      will be of type javax.naming.directory.DirContext and the 
      InitialDirContext will be used to generate the contexts.
      
  
  list
    This tag itterates through the list returned by Context.list() and
    the body content is evaluated for each itteration.
    - contextRef (this or context required, runtime of type String)
      Attribute name that will be searched for to provide the context.
    - Context (this or contextRef required, runtime of type javax.naming.Context)
      A literal instance of a context to be used.
    - name (optional, runtime of type String)
      The name to preform the list against.
    - nameObj (optional, runtime of type javax.naming.Name)
      Like name, a literal Name object to use to list against.  If both this
      and name are specified and the value is not null, this attribute is 
      the one used.
    - bindings (optional, runtime of type boolean)
      wether or not bound objects are returned
    - nameId (optional, runtime of type String)
      The attribute name of the name listing to be exported
    - nameScope (optional, runtime of type String)
      The scope that the name object will be exported to (page is the default)
    - classId (optional, runtime of type String)
      The attribute name of the class name to be exported
    - classScope (optional, runtime of type String)
      The scope that the class name will be exported to (page is the default)
    - objId (optional, runtime of type String)
      The attribute name of the bound object listing to be exported
    - objScope (optional, runtime of type String)
      The scope that the bound object will be exported to (page is the default)
  
  lookup
    This looks up a particular object and exports it.
    - contextRef (this or context required, runtime of type String)
      Attribute name that will be searched for to provide the context.
    - Context (this or contextRef required, runtime of type javax.naming.Context)
      A literal instance of a context to be used.
    - id (optional)
      Attribute name of the object to be exported
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - name (optional, runtime of type String)
      The name to preform the lookup against.
    - nameObj (optional, runtime of type javax.naming.Name)
      Like name, a literal Name object to use to lookup.  If both this
      and name are specified and the value is not null, this attribute is 
      the one used.
    - type (optional)
      The class to cast the looked up object to.  Right now failure to
      cast results in a null return.  The default is java.lang.Object.
      This also determines the type of the exposed scripting variable.
      [Adding an attribute failure with string values null, exception, or 
       classcast to return null, throw a JSPExceptionm or to re-throw the 
       class-cast is a thought.]
  
  search
    Performs a search against a DirContext according to the semantics
    of the search(Name name, String filter, SearchControls cons) in
    javax.naming.directory.DirContext.  The scripting variable 
    - id (required)
      Attribute name of the SearchResult  to be exported
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - contextRef (this or context required, runtime of type String)
      Attribute name that will be searched for to provide the context.
    - Context (this or contextRef required, runtime of type javax.naming.Context)
      A literal instance of a context to be used.
    - name (optional, runtime of type String)
      The name to preform the lookup against.
    - nameObj (optional, runtime of type javax.naming.Name)
      Like name, a literal Name object to use to lookup.  If both this
      and name are specified and the value is not null, this attribute is 
      the one used.
    - filter (optional, runtime of type String)
      The LDAP-style search filter to use
    - countLimit (option)
      the maximum number of entries to return.  Default is 0 which _should_ 
      mean return all entries found (but behavior has been observerved in some
      provider/server combinations to mean none).
    - derefLink (optional, runtime of type boolean)
      Determines whether links will be dereferenced during the search.
      default is false
    - attributes (optional, runtime of type String)
      A (generally) comma seperated list of attributes to return in the 
      search results.  Default is null which means return all.
    - attributesSeparator (optional, runtime of type String)
      If comma seperated attributes won't do, provides an alternate 
      delimiter string for the attributes attribute.  Default is ","
    - bindings (optional, runtime of type boolean)
      wether or not to return bound objects.  Default is false
    - searchScope (optional, runtime of type String)
      What scope the search is to be preformed against.  One of subtree, 
      subtree_scope, onelevel, onelevel_scope, object, object_scope.  (The
      <foo> variants are treated as the the <foo>_scope variants).
    - timeLimit (optional, runtime of type int)
      The time limit in ms to wait.  0 means wait indefinatly.
  
  
  getAttribute
    This is a flexible tag to get an attribute.  The specified object can be
    a DirContext, SearchResult, Attributes, or an Attribute.  If the object is
    a DirContext an Attributes object is retrieved with just the requested
    attribute, and then futhter processed.  If it is a SearchResult then the
    return of getAttributes is processed further.  For any Attributes object 
    passed in explicitly or derived the get(attribute) method is executed and 
    stored as the attribute.  
    The contents of the attribute are processed in one of three ways depending 
    on the value of the multivalue tag attribute.  If the value is 'one' then 
    the value returned by Attribute.get() is written to the output stream and 
    the body is skipped.  For 'separator' then the body of the tag servers as a 
    separator for the attribute values in the event of multivalue attributes,
    but it is skipped in the event of a singlely valued or non-existant 
    attribute, and the value of the attribute is explicitly written to the
    appropriate output stream.  And for the case of 'itterate' the the 
    contents of the body are itterated over for each value of the attribute, 
    whether singlely valued of multi-valued (and skipped for a non-existant 
    attribute).  In all cases the attribute is exported to the id and scope
    if provided at the beginning of the tag, so it is available both within the
    tag and after it's execution.
    
    - id (optional)
      Page Context attribute name of the actual Attribute value to be exported.  
      For multivalued attributes where the multivalue mode is 'separator' no 
      attribue is exported, while for the value of 'itterator' it is the current
      value inside the body content or the final value outside the tag.  For 
      'one' it is the only value of the attribute.
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - ref (optional, runtime of type String)
      A refrence to a PageContext attribute to be searched for to use as the
      object to preform attribute operations against.
    - object (optional, runtime of type Object)
      A literal instance of an object to have the attribute operations
      applied against.  An invalid object type will result in the body content
      being skipped an no output being written to the output stream.
    - attribute (optional, runtime of type String)
      The name of the attribute to use for objects of type DirContext, 
      SearchResult and Attributes.  Ignored for object of type Attribute.
    - attribute (optional, runtime of type String)
      one of 'one', 'separator', or 'itterate'.  Se tag description for details.
      
  forEachAttribute
    This tag allows you to itterate through all of the attribute names returned
    for a DirContext, SearchResult, or an Attributes object.
    - id (optional)
      Page Context attribute name of the actual Attribute to be exported.  
      This is the name exposed within the tag Body and after.  It is the 
      Attribute object and not the value of the attribute.
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - ref (optional, runtime of type String)
      A refrence to a PageContext attribute to be searched for to use as the
      object to preform attribute operations against.  Valid types are 
      DirContext, SearchResults, and Attributes.
    - object (optional, runtime of type Object)
      A literal instance of an object to have the attribute operations
      applied against.  An invalid object type will result in the body content
      being skipped an no output being written to the output stream.  Valid 
      types are DirContext, SearchResults, and Attributes.
  
  
  That's all folks!
  
  
  
  1.1                  jakarta-taglibs/jndi/todo.txt
  
  Index: todo.txt
  ===================================================================
  known issue
    * Whithout custom coding by someone already knowing JNDI only 
      anonymous access to the various forms of Contexts perfoemed.
  
  potential tags to do ...
    getName
    getClass
    getObject
    getDistinguishedName
    composeName
    MakeEnv
    addEnv
    removeEnv
    write/update/remove tags for Contexts and DirContexts and attributes
  
  Need to decide/figure out how to handle the SECURITY_<FOO> attributes with 
  use[Dir]Context in an integrated J2EE environment with web-application
  authentication (kind of a sinlge sign on solution).
  
  potential features:
   *  make some tags not require 'id', thest tags that look to parent tags
      to provide the needed object
      - addEnv to MakeEnv
      - addEnv to use[Dir]Context
      - anything with a context/contextRef in use[Dir]Context, but it must
        occur after any addEnv tag
   * make attributes of the style fooParam and fooRefParam.  fooParam will 
     get the value of foo from a request param.  fooRefParam will get an
     object from a scoped attribute, but the ref name comes from the ref
     parameter
   * make use[Dir]Context look into the scoped attributes if id is present 
     before making a new tag (i.e. behave more like jsp:useBean)
   * make a set of examples that use no scripting elements, just actions
     and directives.  Possibly will require struts.
  
  
  -------------------------------------------------------------------------------
  
  intended attributes :
  (somewhat incomplete and inaccurate
  
  useNamingContext
      envRef=ref to an attribute of type Hashtable
      env=<%=hashtable%>
      url=<%=String%>              -- performs (new InitialContext()).lookup
      providerUrl=<%=String%>      -- sets environmental property
      initialFactory=<%=String%>
      authoritative=<%=boolean%>
      batchsize=<%=int%>
      objectFactories=<%=String%>
      stateFactories=<%=String%>
      urkPkgPrefixes=<%=String%>
  
  useDirContext
      same as useNamingContext but with a DirContext
  
  useLdapContext (not implemented)
      add to useDirContext/useContext
      controlFactories=<%=String%>
      
  
  lookup
      id - name result is stored in
      type - class to force cast to
      context - an instance of a context
      contextRef - a string to do an attribute lookup
      contextRefScope - the scope to look for the contextref
      name - the String name 
      nameObj - a javax.nameing.Name object
  lookup tei is dynamic to type for variable export    
  
  list
    list encloses an iteration
      contextRef
      context -- as an object
      nameId -- scripting variable to bind to
      classId
      objId
      name
      nameObj
      bindings (true|false)
  
  
  search
      contextRef
      contextRef
      context -- as an object
      filter -- ldap search filter    
  
      countLimit  -- int to searchControls
      derefLink -- boolean to searchControls
      attributes -- [attributeSeperator] seperated list of attribute names (to searchControls)
      attributeSeperator -- char for the seperator (default is comma) (local use only
      bindings -- boolean to return bound objects (to searchControls)
      searchScope -- one of OBJECT, ONELEVEL, SUBTREE. to searchControls
      timeLimit -- int to searchControls
  
  
  getName
    inside a search or list it returns the name of the current enumeration 
  
  getClass
    inside of a search or list it returns the class
  
  getObject
    inside of a search or list it returns the bound object
  
  getAttribute
    inside of a search
      attribute   
      
  
  makeEnv -- creates a hasthable attribute
      id
  
  addEnv -- can be child og makeEnv or use[Dir|Ldap]Context
      name
      value <%=String%>
      valueObject <%=object%>
   
  removeEnv
      name
  
  
  
  1.1                  jakarta-taglibs/jndi/conf/jndi.tld
  
  Index: jndi.tld
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" ?>
  <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
  
  <!-- tag library descriptor for JNDI access tags-->
  
  <taglib>
  
    <tlibversion>1.0</tlibversion>
  
    <jspversion>1.1</jspversion>
  
    <shortname>JNDI</shortname>
  
    <uri>http://jakarta.apache.org/taglibs/jndi</uri>
  
    <info>
          A tag library for using the JNDI apis.
    </info>
  
    <tag>
      <name>useContext</name>
      <tagclass>org.apache.taglibs.jndi.UseContextTag</tagclass>
      <teiclass>org.apache.taglibs.jndi.UseContextTEI</teiclass>
      <bodycontent>JSP</bodycontent>
      <info>Create a javax.naming.Context object for use after tag close.</info>
      <attribute>
        <name>envRef</name>
        <required>false</required> <!-- this or env or url required -->
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>env</name>
        <required>false</required> <!-- this or envRef or url required -->
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>url</name>       
        <required>false</required> <!-- this or envRef or env required -->
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>providerUrl</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>initialFactory</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>dnsUrl</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>authoritative</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>batchsize</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>objectFactories</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>stateFactories</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>urlPkgPrefixes</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>id</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>scope</name>
        <required>false</required> <!-- page presumed if absent -->
        <rtexprvalue>false</rtexprvalue>
      </attribute>
    </tag>
  
  
    <tag>
      <name>list</name>
      <tagclass>org.apache.taglibs.jndi.ListTag</tagclass>
      <teiclass>org.apache.taglibs.jndi.ListTEI</teiclass>
      <bodycontent>JSP</bodycontent>
      <info>Lists the elements in a particular javax.naming.Context</info>
      <attribute>
        <name>contextRef</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>context</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>nameId</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>nameScope</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>classId</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>classScope</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>objId</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>objScope</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>name</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>nameObject</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>bindings</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
  
    <tag>
      <name>lookup</name>
      <tagclass>org.apache.taglibs.jndi.LookupTag</tagclass>
      <teiclass>org.apache.taglibs.jndi.LookupTEI</teiclass>
      <bodycontent>JSP</bodycontent>
      <info>Lookups and exports a particular entry in a javax.naming.Context</info>
      <attribute>
        <name>contextRef</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>context</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>id</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>scope</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>name</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>nameObject</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>type</name>
        <!-- the class to cast the looked up object to.  Right now failure to
             cast results in a null return.  Adding an attribute failure with
             string values null, exception, or classcast to return null, throw a 
             JSPExceptionm or to re-throw the class-cast is a thought. -->
        <required>false</required> 
        <rtexprvalue>false</rtexprvalue>
      </attribute>
    </tag>
  
  
    <tag>
      <name>useDirContext</name>
      <tagclass>org.apache.taglibs.jndi.UseDirContextTag</tagclass>
      <teiclass>org.apache.taglibs.jndi.UseDirContextTEI</teiclass>
      <bodycontent>JSP</bodycontent>
      <info>Create a javax.naming.directory.DirContext object for use after tag close.</info>
      <attribute>
        <name>envRef</name>
        <required>false</required> <!-- this or env or url required -->
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>env</name>
        <required>false</required> <!-- this or envRef or url required -->
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>url</name>       
        <required>false</required> <!-- this or envRef or env required -->
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>providerUrl</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>initialFactory</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>dnsUrl</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>authoritative</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>batchsize</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>objectFactories</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>stateFactories</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>urlPkgPrefixes</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>id</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>scope</name>
        <required>false</required> <!-- page presumed if absent -->
        <rtexprvalue>false</rtexprvalue>
      </attribute>
    </tag>
    
    
    <tag>
      <name>search</name>
      <tagclass>org.apache.taglibs.jndi.SearchTag</tagclass>
      <teiclass>org.apache.taglibs.jndi.SearchTEI</teiclass>
      <bodycontent>JSP</bodycontent>
      <info>Searches a DirContext.</info>
      <attribute>
        <name>id</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>scope</name>
        <required>false</required> <!-- page presumed if absent -->
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>contextRef</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>context</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>name</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>nameObject</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>filter</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>countLimit</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>derefLink</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>attributes</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>attributesSeparator</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>bindings</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>searchScope</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>timeLimit</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
  
    <tag>
      <name>getAttribute</name>
      <tagclass>org.apache.taglibs.jndi.GetAttributeTag</tagclass>
      <teiclass>org.apache.taglibs.jndi.GetAttributeTEI</teiclass>
      <bodycontent>JSP</bodycontent> <!-- and will be the seperator for multi-value resposnes -->
      <info>Extracts an attribute from a DirContext, a SearchResult, or an Attributes.</info>
      <attribute>
        <name>id</name>
        <required>flase</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>scope</name>
        <required>false</required> <!-- page presumed if absent -->
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>ref</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>object</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>attribute</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>multivalue</name> <!-- either one, separator, or itterate -->
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>     
  
    <tag>
      <name>forEachAttribute</name>
      <tagclass>org.apache.taglibs.jndi.ForEachAttributeTag</tagclass>
      <teiclass>org.apache.taglibs.jndi.ForEachAttrtibuteTEI</teiclass>
      <bodycontent>JSP</bodycontent>
      <info>Itterates attributes form a DirContext, Attributes, or SearchResult.</info>
      <attribute>
        <name>id</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>scope</name>
        <required>false</required> <!-- page presumed if absent -->
        <rtexprvalue>false</rtexprvalue>
      </attribute>
      <attribute>
        <name>ref</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>object</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>     
  
  </taglib>
  
  
  
  1.1                  jakarta-taglibs/jndi/doc/conf/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
      "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
  
  <web-app>
  
    <description>
    Documentation for the "response" custom tag library,
    from the JAKARTA-TAGLIBS project.
    </description>
  
  </web-app>
  
  
  
  1.1                  jakarta-taglibs/jndi/doc/web/index.html
  
  Index: index.html
  ===================================================================
  <html><head><title>Preliminary JNDI docs</title></head><body>
  This is just the same thing as tags-doc.txt in the root.  Lame, but functional.
  <pre>
  
  Initial documnetation of the tags
  
  tags existing are:
    useContext
    useDirContext
    list
    lookup
    search
    getAttribute
    forEachAttribute
  
  useContext
  This tag creates an instance of a javax.naming.Context based on the values
  of the attributes providing some of the standard values.  In addition to the 
  System properties and the jndi.properties, some standard properties are 
  scanned in the pageContext attributes.  (note: should this be extended to the
  servlet init params as well?)
  (note: as of right now this does not look into the id and scope to see if the 
  context already exists, so it does not behave entirely like useBean)
  Attributes:
    - envRef (optional)
      This is the name of an attribute that will be searched for that provides
      additional environment information.  This info is subordnate to the info
      provuded by the attributes to this tag
    - env (optional, runtime of type java.util.Hashtable)
      Same as envRef, except that the value is the hashtable
    - url (this or one of providerUrl or intialFactory required,
           runtime of type String)
      If provided, the context created by the other attributges is used to
      create a context in which the parameter of this attribute is used to
      preform a lookup(String) operation.  The context returned from the lookup
      will be the context returned by the tag.
    - providerUrl (this or one of url or initialFactory required,
                   runtime of type java.lang.String)    
      Provides the value of the Context.PROVIDER_URL attribute to the 
      InitialContext environment Hashtable.
    - initialFactory (this or one of url or providerUrl required,
                      runtime of type java.lang.String)    
      Provides the value of the Context.INITIAL_CONTEXT_FACTORY attribute to 
      the InitialContext environment Hashtable.
    - dnsUrl (optional, runtime of type java.lang.String)    
      Provides the value of the Context.DNS_URL attribute to the 
      InitialContext environment Hashtable.
    - authoritatibe (optional, runtime of type java.lang.String)    
      Provides the value of the Context.AUTHORITATIVE attribute to the 
      InitialContext environment Hashtable.
    - batchsize (optional, runtime of type java.lang.String)    
      Provides the value of the Context.BATCHSIZE attribute to the 
      InitialContext environment Hashtable.
    - objectFactories (optional, runtime of type java.lang.String)    
      Provides the value of the Context.OBJECT_FACTORIES attribute to 
      the InitialContext environment Hashtable.
    - stateFactories (optional, runtime of type java.lang.String)    
      Provides the value of the Context.STATE_FACTORIES attribute to 
      the InitialContext environment Hashtable.
    - urlPkgPrefixes (optional, runtime of type java.lang.String)    
      Provides the value of the Context.URL_PKG_PREFIXES attribute to 
      the InitialContext environment Hashtable.
    - id (required)
      The name that the context is to be exported as.  
      (A potential future relaxation may make this optional, but it will only
      be available to body content enclosed that asks for an implicit context)
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
  
  useDirContext
      This behaves exactly like useContext except that the object exported
      will be of type javax.naming.directory.DirContext and the 
      InitialDirContext will be used to generate the contexts.
      
  
  list
    This tag itterates through the list returned by Context.list() and
    the body content is evaluated for each itteration.
    - contextRef (this or context required, runtime of type String)
      Attribute name that will be searched for to provide the context.
    - Context (this or contextRef required, runtime of type javax.naming.Context)
      A literal instance of a context to be used.
    - name (optional, runtime of type String)
      The name to preform the list against.
    - nameObj (optional, runtime of type javax.naming.Name)
      Like name, a literal Name object to use to list against.  If both this
      and name are specified and the value is not null, this attribute is 
      the one used.
    - bindings (optional, runtime of type boolean)
      wether or not bound objects are returned
    - nameId (optional, runtime of type String)
      The attribute name of the name listing to be exported
    - nameScope (optional, runtime of type String)
      The scope that the name object will be exported to (page is the default)
    - classId (optional, runtime of type String)
      The attribute name of the class name to be exported
    - classScope (optional, runtime of type String)
      The scope that the class name will be exported to (page is the default)
    - objId (optional, runtime of type String)
      The attribute name of the bound object listing to be exported
    - objScope (optional, runtime of type String)
      The scope that the bound object will be exported to (page is the default)
  
  lookup
    This looks up a particular object and exports it.
    - contextRef (this or context required, runtime of type String)
      Attribute name that will be searched for to provide the context.
    - Context (this or contextRef required, runtime of type javax.naming.Context)
      A literal instance of a context to be used.
    - id (optional)
      Attribute name of the object to be exported
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - name (optional, runtime of type String)
      The name to preform the lookup against.
    - nameObj (optional, runtime of type javax.naming.Name)
      Like name, a literal Name object to use to lookup.  If both this
      and name are specified and the value is not null, this attribute is 
      the one used.
    - type (optional)
      The class to cast the looked up object to.  Right now failure to
      cast results in a null return.  The default is java.lang.Object.
      This also determines the type of the exposed scripting variable.
      [Adding an attribute failure with string values null, exception, or 
       classcast to return null, throw a JSPExceptionm or to re-throw the 
       class-cast is a thought.]
  
  search
    Performs a search against a DirContext according to the semantics
    of the search(Name name, String filter, SearchControls cons) in
    javax.naming.directory.DirContext.  The scripting variable 
    - id (required)
      Attribute name of the SearchResult  to be exported
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - contextRef (this or context required, runtime of type String)
      Attribute name that will be searched for to provide the context.
    - Context (this or contextRef required, runtime of type javax.naming.Context)
      A literal instance of a context to be used.
    - name (optional, runtime of type String)
      The name to preform the lookup against.
    - nameObj (optional, runtime of type javax.naming.Name)
      Like name, a literal Name object to use to lookup.  If both this
      and name are specified and the value is not null, this attribute is 
      the one used.
    - filter (optional, runtime of type String)
      The LDAP-style search filter to use
    - countLimit (option)
      the maximum number of entries to return.  Default is 0 which _should_ 
      mean return all entries found (but behavior has been observerved in some
      provider/server combinations to mean none).
    - derefLink (optional, runtime of type boolean)
      Determines whether links will be dereferenced during the search.
      default is false
    - attributes (optional, runtime of type String)
      A (generally) comma seperated list of attributes to return in the 
      search results.  Default is null which means return all.
    - attributesSeparator (optional, runtime of type String)
      If comma seperated attributes won't do, provides an alternate 
      delimiter string for the attributes attribute.  Default is ","
    - bindings (optional, runtime of type boolean)
      wether or not to return bound objects.  Default is false
    - searchScope (optional, runtime of type String)
      What scope the search is to be preformed against.  One of subtree, 
      subtree_scope, onelevel, onelevel_scope, object, object_scope.  (The
      <foo> variants are treated as the the <foo>_scope variants).
    - timeLimit (optional, runtime of type int)
      The time limit in ms to wait.  0 means wait indefinatly.
  
  
  getAttribute
    This is a flexible tag to get an attribute.  The specified object can be
    a DirContext, SearchResult, Attributes, or an Attribute.  If the object is
    a DirContext an Attributes object is retrieved with just the requested
    attribute, and then futhter processed.  If it is a SearchResult then the
    return of getAttributes is processed further.  For any Attributes object 
    passed in explicitly or derived the get(attribute) method is executed and 
    stored as the attribute.  
    The contents of the attribute are processed in one of three ways depending 
    on the value of the multivalue tag attribute.  If the value is 'one' then 
    the value returned by Attribute.get() is written to the output stream and 
    the body is skipped.  For 'separator' then the body of the tag servers as a 
    separator for the attribute values in the event of multivalue attributes,
    but it is skipped in the event of a singlely valued or non-existant 
    attribute, and the value of the attribute is explicitly written to the
    appropriate output stream.  And for the case of 'itterate' the the 
    contents of the body are itterated over for each value of the attribute, 
    whether singlely valued of multi-valued (and skipped for a non-existant 
    attribute).  In all cases the attribute is exported to the id and scope
    if provided at the beginning of the tag, so it is available both within the
    tag and after it's execution.
    
    - id (optional)
      Page Context attribute name of the actual Attribute value to be exported.  
      For multivalued attributes where the multivalue mode is 'separator' no 
      attribue is exported, while for the value of 'itterator' it is the current
      value inside the body content or the final value outside the tag.  For 
      'one' it is the only value of the attribute.
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - ref (optional, runtime of type String)
      A refrence to a PageContext attribute to be searched for to use as the
      object to preform attribute operations against.
    - object (optional, runtime of type Object)
      A literal instance of an object to have the attribute operations
      applied against.  An invalid object type will result in the body content
      being skipped an no output being written to the output stream.
    - attribute (optional, runtime of type String)
      The name of the attribute to use for objects of type DirContext, 
      SearchResult and Attributes.  Ignored for object of type Attribute.
    - attribute (optional, runtime of type String)
      one of 'one', 'separator', or 'itterate'.  Se tag description for details.
      
  forEachAttribute
    This tag allows you to itterate through all of the attribute names returned
    for a DirContext, SearchResult, or an Attributes object.
    - id (optional)
      Page Context attribute name of the actual Attribute to be exported.  
      This is the name exposed within the tag Body and after.  It is the 
      Attribute object and not the value of the attribute.
    - scope (optional)
      The scope the object is to be exported as.  Default is 'page'.
      Follows the JSP spec conventions
    - ref (optional, runtime of type String)
      A refrence to a PageContext attribute to be searched for to use as the
      object to preform attribute operations against.  Valid types are 
      DirContext, SearchResults, and Attributes.
    - object (optional, runtime of type Object)
      A literal instance of an object to have the attribute operations
      applied against.  An invalid object type will result in the body content
      being skipped an no output being written to the output stream.  Valid 
      types are DirContext, SearchResults, and Attributes.
  
  
  That's all folks!
  </pre>
  </body>
  </html>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/conf/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
      "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
  
  <web-app>
  
    <description>
    Example web application illustrating the use of tags in the
    "jndi" custom tag library, from the JAKARTA-TAGLIBS project.
    </description>
  
    <taglib>
      <taglib-uri>http://jakarta.apache.org/taglibs/jndi-1.0</taglib-uri>
      <taglib-location>/WEB-INF/jndi.tld</taglib-location>
    </taglib>
  
  
  </web-app>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/web/index.html
  
  Index: index.html
  ===================================================================
  <html>
  <head>
  <title>Jakarta JNDI Taglib Example</title>
  </head>
  <body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
  
  <center>
  <h1>
  Jakarta JNDI Taglib Example</h1></center>
  <br>
  The example jsp pages for the JNDI taglib.
  <br><br>
  <form method="GET" action="listurl.jsp">
  View the List Example<BR>
  <table>
  <tr><td align="right"><B>URL:</B></td><td><input name="url" type="text" size="40" maxlength="256"></td></tr>
  <tr><td align="right"><B>Name:</B></td><td><input name="name" type="text" size="40" maxlength="256"></td></tr>
  <tr><td></td><td><input type="submit" value="List"></td></tr>
  </table>
  </form>
  <form method="GET" action="listinitfac.jsp">
  View the List Example<BR>
  <table>
  <tr><td align="right"><B>Initial Context Factory:</B></td><td>
    <select size="1" name="initfac"  >
      <option value="com.sun.jndi.ldap.LdapCtxFactory">LDAP</option>
      <option value="com.sun.jndi.nis.NISCtxFactory">NIS</option>
      <option value="com.sun.jndi.cosnaming.CNCtxFactory">COS (Corba)</option>
      <option value="com.sun.jndi.fscontext.RefFSContextFactory">File System</option>
      <option value="com.sun.jndi.dsml.DsmlCtxFactory">DSML</option>
    </select>
  </td></tr>
  <tr><td align="right"><B>Provider Url:</B></td><td><input name="provider" type="text" size="40" maxlength="256"></td></tr>
  <tr><td align="right"><B>Name:</B></td><td><input name="name" type="text" size="40" maxlength="256"></td></tr>
  <tr><td></td><td><input type="submit" value="List"></td></tr>
  </table>
  </form>
  
  <form method="GET" action="searchByInitFactory.jsp">
  Search <BR>
  <table>
  <tr><td align="right"><B>Initial Context Factory:</B></td><td>
    <select size="1" name="initfac"  >
      <option value="com.sun.jndi.ldap.LdapCtxFactory">LDAP</option>
      <option value="com.sun.jndi.nis.NISCtxFactory">NIS</option>
      <option value="com.sun.jndi.cosnaming.CNCtxFactory">COS (Corba)</option>
      <option value="com.sun.jndi.fscontext.RefFSContextFactory">File System</option>
      <option value="com.sun.jndi.dsml.DsmlCtxFactory">DSML</option>
    </select>
  </td></tr>
  <tr><td align="right"><B>Provider Url:</B></td><td><input name="provider" type="text" size="40" maxlength="256"></td></tr>
  <tr><td align="right"><B>Name:</B></td><td><input name="name" type="text" size="40" maxlength="256"></td></tr>
  <tr><td align="right"><B>Filter:</B></td><td><input name="filter" type="text" size="40" maxlength="256"></td></tr>
  <tr><td></td><td><input type="submit" value="Search"></td></tr>
  </table>
  </form>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/web/listinitfac.jsp
  
  Index: listinitfac.jsp
  ===================================================================
  <HTML>
  <HEAD><TITLE>List by Init Factory example</TITLE></HEAD>
  <BODY>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jndi-1.0" prefix="jndi" %>
  
  <jndi:useContext 
      id="test" 
      scope="session" 
      initialFactory='<%=request.getParameter("initfac")%>' 
      providerUrl='<%=request.getParameter("provider")%>'
  />
  
  The Context is "<%=test.toString()%>"<BR>
  
  <table border="true">
  <th>name</th><th>full name</th><th>class</th><th>toString of Object</th>
    <jndi:list 
      contextRef='test' 
      name='<%=request.getParameter("name")%>' 
      nameId="aName" 
      classId="aClass" 
      objId="anObj" 
      bindings="true"
    >
  <%
      String nextContext, dn;
      if (anObj instanceof javax.naming.Context) {
          nextContext = ((javax.naming.Context)anObj).composeName(aName, request.getParameter("name"));
          dn = ((javax.naming.Context)anObj).getNameInNamespace();
      } else {
          javax.naming.Name name= test.getNameParser("").parse(request.getParameter("name"));
          name.add(aName);
          nextContext=name.toString();
          dn = "N/A       ";
      }
  %>
      <tr>
        <td><%=aName%><BR>
            <A href='listinitfac.jsp?initfac=<%=request.getParameter("initfac")%>&provider=<%=request.getParameter("provider")%>&name=<%=nextContext%>'>[list]</a>
            <A href='lookupinitfac.jsp?initfac=<%=request.getParameter("initfac")%>&provider=<%=request.getParameter("provider")%>&name=<%=nextContext%>'>[lookup]</a></td>
        <td><%=dn%></td>
        <td><%=aClass%></td>
        <td><%=anObj%></td>
      </tr>
    </jndi:list>
  </table>
  <form method="get" action="searchBySession.jsp"><B>Search this Context : <B><input type="text" name="filter" size=40 maxlength=256></form>
  </BODY>
  </HTML>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/web/listurl.jsp
  
  Index: listurl.jsp
  ===================================================================
  <HTML>
  <HEAD><TITLE>List by URL example</TITLE></HEAD>
  <BODY>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jndi-1.0" prefix="jndi" %>
  
  <jndi:useContext 
      id='test'
      scope='session' 
      url='<%=request.getParameter("url")%>' 
  />
  
  The Context is "<%=test.toString()%>"<BR>
  
  <table border="true">
  <th>name</th><th>full name</th><th>class</th><th>toString of Object</th>
    <jndi:list 
      contextRef='test' 
      name='<%=request.getParameter("name")%>' 
      nameId="aName" 
      classId="aClass" 
      objId="anObj" 
      bindings="<%=true%>"
    >
  <%
      String nextContext, dn;
      if (anObj instanceof javax.naming.Context) {
          nextContext = ((javax.naming.Context)anObj).composeName(aName, request.getParameter("name"));
          dn = ((javax.naming.Context)anObj).getNameInNamespace();
      } else {
          nextContext=test.composeName(aName, request.getParameter("name"));
          dn = "N/A";
      }
  %>
      <tr>
        <td><%=aName%><BR>
            <A href='listurl.jsp?url=<%=request.getParameter("url")%>&name=<%=nextContext%>'>[list]</a> 
            <A href='lookupurl.jsp?url=<%=request.getParameter("url")%>&name=<%=nextContext%>'>[lookup] </a></td>
        <td><%=dn%></td>
        <td><%=aClass%></td>
        <td><%=anObj%></td>
      </tr>
    </jndi:list>
  </table>
  <form method="get" action="searchBySession.jsp"><B>Search this Context : <B><input type="text" name="filter" size=40 maxlength=256></form></BODY>
  </HTML>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/web/lookupinitfac.jsp
  
  Index: lookupinitfac.jsp
  ===================================================================
  <HTML>
  <HEAD><TITLE>Lookup by Init Factory example</TITLE></HEAD>
  <BODY>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jndi-1.0" prefix="jndi" %>
  
  <jndi:useContext 
      id="test" 
      scope="page" 
      initialFactory='<%=request.getParameter("initfac")%>' 
      providerUrl='<%=request.getParameter("provider")%>'
  />
  
  <jndi:lookup 
    contextRef='test' 
    name='<%=request.getParameter("name")%>' 
    id="obj"
  />
  
  <jndi:lookup 
    contextRef='test' 
    name='<%=request.getParameter("name")%>' 
    id="obj2"
    type="java.io.File"
  /> <%-- perhaps re-do lookup so the variable is AT_BEGIN and the body content is
          evaluated if an appropriate lookup succeeds? --%>
  
  <jndi:lookup 
    contextRef='test' 
    name='<%=request.getParameter("name")%>' 
    id="obj3"
    type="javax.naming.directory.DirContext"
  /> 
  
  <table border="true">
  <th>name</th><th>Value</th>
      <tr>
        <td>class</td>
        <td><jsp:getProperty name="obj" property="class" /></td>
      </tr>
  <% if (obj2 != null) { %>
      <tr>
        <td>absolutePath</td>
        <td><jsp:getProperty name="obj" property="absolutePath" /></td>
      </tr>
      <tr>
        <td>canonicalPath</td>
        <td><jsp:getProperty name="obj" property="canonicalPath" /></td>
      </tr>
      <tr>
        <td>name</td>
        <td><jsp:getProperty name="obj" property="name" /></td>
      </tr>
      <tr>
        <td>parent</td>
        <td><jsp:getProperty name="obj" property="parent" /></td>
      </tr>
      <tr>
        <td>path</td>
        <td><jsp:getProperty name="obj" property="path" /></td>
      </tr>
  <% } %> <%
    if (obj3 != null) {
  %>
  <jndi:forEachAttribute ref='obj3' id='attr'>
    <jndi:getAttribute ref='attr' id='val' multivalue='itterate'>
      <tr>
        <td><jsp:getProperty name='attr' property='ID'/></td>
        <td><%=val%></td>
      </tr>
    </jndi:getAttribute>
  </jndi:forEachAttribute>
      <tr>
        <td>Distinguised name</td>
        <td><jsp:getProperty name="obj3" property="nameInNamespace"/></td>
      </tr>
  <% } %>
  </table>
  </BODY>
  </HTML>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/web/lookupurl.jsp
  
  Index: lookupurl.jsp
  ===================================================================
  <HTML>
  <HEAD><TITLE>Lookup by URL example</TITLE></HEAD>
  <BODY>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jndi-1.0" prefix="jndi" %>
  
  <jndi:useContext 
      id='test'
      scope='page' 
      url='<%=request.getParameter("url")%>' 
  />
  
  The attributes of contextroot="<jsp:getProperty name="test" property="nameInNamespace"/>"
  and name="<%=request.getParameter("name")%>"
  
  <jndi:lookup 
    contextRef='test' 
    name='<%=request.getParameter("name")%>' 
    id="obj"
  />
  
  <jndi:lookup 
    contextRef='test' 
    name='<%=request.getParameter("name")%>' 
    id="obj2"
    type="java.io.File"
  /> <%-- perhaps re-do lookup so the variable is AT_BEGIN and the body content is
          evaluated if an appropriate lookup succeeds? --%>
  
  <jndi:lookup 
    contextRef='test' 
    name='<%=request.getParameter("name")%>' 
    id="obj3"
    type="javax.naming.directory.DirContext"
  /> 
  
  <table border="true">
  <th>name</th><th>Value</th>
      <tr>
        <td>class</td>
        <td><jsp:getProperty name="obj" property="class" /></td>
      </tr>
  <% if (obj2 != null) { %>
      <tr>
        <td>absolutePath</td>
        <td><jsp:getProperty name="obj" property="absolutePath" /></td>
      </tr>
      <tr>
        <td>canonicalPath</td>
        <td><jsp:getProperty name="obj" property="canonicalPath" /></td>
      </tr>
      <tr>
        <td>name</td>
        <td><jsp:getProperty name="obj" property="name" /></td>
      </tr>
      <tr>
        <td>parent</td>
        <td><jsp:getProperty name="obj" property="parent" /></td>
      </tr>
      <tr>
        <td>path</td>
        <td><jsp:getProperty name="obj" property="path" /></td>
      </tr>
  <% } %>
  <% 
    if (obj3 != null) {
  %>
  <jndi:forEachAttribute ref='obj3' id='attr'>
    <jndi:getAttribute ref='attr' id='val' multivalue='itterate'>
      <tr>
        <td><jsp:getProperty name='attr' property='ID'/></td>
        <td><%=val%></td>
      </tr>
    </jndi:getAttribute>
  </jndi:forEachAttribute>
      <tr>
        <td>Distinguised name</td>
        <td><jsp:getProperty name="obj3" property="nameInNamespace"/></td>
      </tr>
  <% } %>
  </table>
  </BODY>
  </HTML>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/web/searchByInitFactory.jsp
  
  Index: searchByInitFactory.jsp
  ===================================================================
  <HTML>
  <HEAD><TITLE>Search by Init Factory Context</TITLE></HEAD>
  <BODY>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jndi-1.0" prefix="jndi" %>
  
  <jndi:useDirContext 
      id="test" 
      scope="page" 
      initialFactory='<%=request.getParameter("initfac")%>' 
      providerUrl='<%=request.getParameter("provider")%>'
  />
  
  
  The Context is "<%=test.toString()%>"<BR>
  The filter was "<%=request.getParameter("filter")%>"<br>
  
  <table border="true">
  <th>name</th><th>class</th><th>objectclass</th>
    <jndi:search 
      countLimit='10'
      contextRef='test' 
      filter='<%=request.getParameter("filter")%>' 
      name='<%=request.getParameter("name")%>' 
      id="result"
      searchScope="SUBTREE_SCOPE"
      bindings='true'
    >
      <tr>
        <td><jsp:getProperty name="result" property="name" /></td>
        <td><jsp:getProperty name="result" property="className" /></td>
        <td><jndi:getAttribute ref='result' attribute='objectclass' multivalue='separator'><BR></jndi:getAttribute></tf>
      </tr>
    </jndi:search>
  </table>
  
  First value of each attribute of last result:
  <table border>
  <th>attribute name</th><th>AttributeValue</TH>
  <jndi:forEachAttribute ref='result' id='attr'>
    <jndi:getAttribute ref='attr' id='val' multivalue='itterate'>
      <tr>
        <td><jsp:getProperty name='attr' property='ID'/></td>
        <td><%=val%></td>
      </tr>
    </jndi:getAttribute>
  </jndi:forEachAttribute>
  </table>
  </BODY>
  </HTML>
  
  
  
  1.1                  jakarta-taglibs/jndi/examples/web/searchBySession.jsp
  
  Index: searchBySession.jsp
  ===================================================================
  <HTML>
  <HEAD><TITLE>Search by Session Stored Context</TITLE></HEAD>
  <BODY>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jndi-1.0" prefix="jndi" %>
  
  <jsp:useBean id="test" scope="session" type="javax.naming.Context" />
  
  The Context is "<%=test.lookup("")%>"<BR>
  The filter was "<%=request.getParameter("filter")%>"<br>
  
  <table border="true">
  <th>name</th><th>class</th><th>objectclass</th>
    <jndi:search 
      countLimit='10'
      contextRef='test' 
      filter='<%=request.getParameter("filter")%>' 
      name='<%=request.getParameter("name")%>' 
      id="result"
      bindings="<%=true%>"
      searchScope="SUBTREE_SCOPE"
    >
      <tr>
        <td><jsp:getProperty name="result" property="name" /></td>
        <td><jsp:getProperty name="result" property="className" /></td>
        <td><jndi:getAttribute ref='result' attribute='objectclass' >Aargh!</jndi:getAttribute></td>
      </tr>
    </jndi:search>
  </table>
  First value of each attribute of last result:
  <table border>
  <th>attribute name</th><th>AttributeValue</TH>
  <jndi:forEachAttribute ref='result' id='attr'>
    <jndi:getAttribute ref='attr' id='val' multivalue='itterate'>
      <tr>
        <td><jsp:getProperty name='attr' property='ID'/></td>
        <td><%=val%></td>
      </tr>
    </jndi:getAttribute>
  </jndi:forEachAttribute>
  </table>
  </BODY>
  </HTML>
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ForEachAttributeTEI.java
  
  Index: ForEachAttributeTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ForEachAttributeTEI.java,v 1.1 2000/12/12 15:34:30 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:30 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.tagext.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class ForEachAttributeTEI extends TagExtraInfo {
  
      /** Creates new ForEachAttributeTEI */
      public ForEachAttributeTEI() {
      }
  
      public VariableInfo[] getVariableInfo(TagData data) {
          if (data.getId() != null) {
              return new VariableInfo[]  
                  { new VariableInfo(data.getId(), "java.lang.Object", true, 
                          VariableInfo.NESTED)};
          } else {
              return null;
          }
      }
      
      public boolean isValid(TagData data) {
          if (data.getId() == null) {
              return false;
          }
          if ((data.getAttribute("object") == null) 
           && (data.getAttribute("ref") == null)) {
              return false;
          }
          return true;
      }
      
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ForEachAttributeTag.java
  
  Index: ForEachAttributeTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ForEachAttributeTag.java,v 1.1 2000/12/12 15:34:30 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:30 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  import javax.naming.*;
  import javax.naming.directory.*;
  
  import java.io.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class ForEachAttributeTag extends BodyTagSupport {
  
      protected Object attributeObject;
      protected NamingEnumeration nameEnum;
      protected Attribute currentAttribute;
      protected int scope;
  
      /** Creates new ForEachAttributeTag */
      public ForEachAttributeTag() {
      }
  
      /**
       * Getter for property scope
       * @return Value of property scope.
       */
      public String getScope() {
          return decodeScope(scope);
      }
  
      /**
       * Setter for property scope.
       * @param Scope New value of property scope.
       */
      public void setScope(String scope) {
          this.scope = decodeScope(scope);
      }
  
      /**
       * Getter for property object.
       * @return Value of property object.
       */
      public Object getObject() {
          return attributeObject;
      }
  
      /**
       * Setter for property object.
       * @param object New value of property object.
       */
      public void setObject(DirContext object) {
          attributeObject = object;
      }
  
      /**
       * Setter for property ref.
       * @param ref New value of property ref.
       */
      public void setRef(String ref) {
          attributeObject = pageContext.findAttribute(ref);
      }
      
      public void setPageContext(PageContext pc) {
          scope = PageContext.PAGE_SCOPE;
          nameEnum = null;
          currentAttribute = null;
          attributeObject = null;
          
          super.setPageContext(pc);
      }
      
      public int doStartTag() throws JspException {
          try {
              if ((attributeObject instanceof DirContext) 
               && (attributeObject != null)) {
                  attributeObject = ((DirContext)attributeObject).getAttributes("");
              }
  
              if ((attributeObject instanceof SearchResult) 
               && (attributeObject != null)) {
                  attributeObject = ((SearchResult)attributeObject)
                          .getAttributes(); 
              }
  
              if ((attributeObject instanceof Attributes)
               && (attributeObject != null)) {
                  nameEnum = ((Attributes)attributeObject).getAll();
              } 
          } catch (NamingException ne) {
              //XXX todo determine log mechanism
  
              nameEnum = null;
          }
          
          if ((nameEnum != null) && nameEnum.hasMoreElements()) {
              return EVAL_BODY_TAG;
          } else {
              return SKIP_BODY;
          }
      }
      
      public void doInitBody() {
          currentAttribute = (Attribute) nameEnum.nextElement();
          pageContext.setAttribute(getId(), currentAttribute, scope);
      }
  
      public int doAfterBody() {
          if (!nameEnum.hasMoreElements()) {
              return SKIP_BODY;
          } else {
              currentAttribute = (Attribute) nameEnum.nextElement();
              pageContext.setAttribute(getId(), currentAttribute, scope);
              return EVAL_BODY_TAG;
          }                
      }
      
      public int doEndTag() throws JspException {
          try {
              if (bodyContent != null) {
                  bodyContent.writeOut(pageContext.getOut());
              } 
          } catch (IOException ioe) {
              throw new JspException(ioe.toString());
          }
          return EVAL_PAGE;
      }
      
      public static String decodeScope(int scope) {
          switch (scope) {
              case PageContext.PAGE_SCOPE:
                  return "page";
              case PageContext.REQUEST_SCOPE:
                  return "request";
              case PageContext.SESSION_SCOPE:
                  return "session";
              case PageContext.APPLICATION_SCOPE:
                  return "application";
              default:
                  return null;
          }
      }
      
      public static int decodeScope(String scope) {
          if (scope.equalsIgnoreCase("page")) {
              return PageContext.PAGE_SCOPE;
          } else if (scope.equalsIgnoreCase("request")) {
              return PageContext.REQUEST_SCOPE;
          } else if (scope.equalsIgnoreCase("session")) {
              return PageContext.SESSION_SCOPE;
          } else if (scope.equalsIgnoreCase("applicaiton")) {
              return PageContext.APPLICATION_SCOPE;
          } else {
              return  -1;
          }
      }
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/GetAttributeTEI.java
  
  Index: GetAttributeTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/GetAttributeTEI.java,v 1.1 2000/12/12 15:34:32 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:32 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.tagext.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class GetAttributeTEI extends TagExtraInfo {
  
      /** Creates new GetAttributeTEI */
      public GetAttributeTEI() {
      }
  
      public VariableInfo[] getVariableInfo(TagData data) {
          if (data.getId() != null) {
              return new VariableInfo[]  
                  { new VariableInfo(data.getId(), "java.lang.Object", true, 
                          VariableInfo.AT_BEGIN)};
          } else {
              return null;
          }
      }
      
      public boolean isValid(TagData data) {
          if (
              (data.getAttribute("object") == null) 
           && (data.getAttribute("ref") == null)) {
              return false;
          }
          return true;
      }
      
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/GetAttributeTag.java
  
  Index: GetAttributeTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/GetAttributeTag.java,v 1.1 2000/12/12 15:34:32 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:32 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  import javax.naming.*;
  import javax.naming.directory.*;
  
  import java.io.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class GetAttributeTag extends BodyTagSupport {
  
      protected Object attributeObject;
      protected int scope;
      protected String attribute;
      protected int multivalueMode;
      protected NamingEnumeration nameEnum;
      protected Attribute theAttribute;
      
      /** Only take one value (first value if ordered) */
      public static final int ONE_VALUE = 1;
      /** Body provides a separator for the values */
      public static final int SEPARATE_VALUES = 2;
      /** body should be itterated for each value */
      public static final int ITTERATE_VALUES = 3;
  
      /** Creates new GetAttributeTag */
      public GetAttributeTag() {
      }
  
      /**
       * Getter for property scope
       * @return Value of property scope.
       */
      public String getScope() {
          return decodeScope(scope);
      }
  
      /**
       * Setter for property scope.
       * @param Scope New value of property scope.
       */
      public void setScope(String scope) {
          this.scope = decodeScope(scope);
      }
  
      /**
       * Getter for property object.
       * @return Value of property object.
       */
      public Object getObject() {
          return attributeObject;
      }
  
      /**
       * Setter for property object.
       * @param object New value of property object.
       */
      public void setObject(DirContext object) {
          attributeObject = object;
      }
  
      /**
       * Setter for property ref.
       * @param ref New value of property ref.
       */
      public void setRef(String ref) {
          attributeObject = pageContext.findAttribute(ref);
      }
  
      /**
       * Getter for property attribute.
       * @return Value of property attribute.
       */
      public String getAttribute() {
          return attribute;
      }
  
      /**
       * Setter for property attribute.
       * @param attribute New value of property attribute.
       */
      public void setAttribute(String attribute) {
          this.attribute = attribute;
      }
  
      /**
       * Getter for property multivalue
       * @return Value of property multivalue.
       */
      public String getMultivalue() {
          return decodeMultivalue(multivalueMode);
      }
  
      /**
       * Setter for property multivalue.
       * @param multivalue New value of property multivalue.
       */
      public void setMultivalue(String multivalue) {
          multivalueMode = decodeMultivalue(multivalue);
      }
  
      public void setPageContext(PageContext pc) {
          scope = PageContext.PAGE_SCOPE;
          attribute = null;
          attributeObject = null;
          multivalueMode = ONE_VALUE;
          nameEnum = null;
          theAttribute = null;
          
          super.setPageContext(pc);
      }
      
      public int doStartTag() throws JspException {
          try {
              if ((attributeObject instanceof DirContext) 
               && (attributeObject != null)) {
                  attributeObject = ((DirContext)attributeObject).getAttributes("", 
                          new String[] {attribute});
              }
  
              if ((attributeObject instanceof SearchResult) 
               && (attributeObject != null)) {
                  attributeObject = ((SearchResult)attributeObject)
                          .getAttributes(); 
              }
  
              if ((attributeObject instanceof Attributes)
               && (attributeObject != null)) {
                  attributeObject = ((Attributes)attributeObject).get(attribute);
              }
  
              if (attributeObject instanceof Attribute) {
                  // don't need to worry about nulls, 
                  // it will behave properly since nulls can be cast
                  // to anything
                  theAttribute = (Attribute)attributeObject;
              } 
          } catch (NamingException ne) {
              //XXX todo determine log mechanism
              attributeObject = null;
              theAttribute = null;
          }
          
          if (theAttribute == null) {
              return SKIP_BODY;
          } else {
              if (multivalueMode == ONE_VALUE) {
                  try {
                      pageContext.getOut().print(theAttribute.get());
                      if (getId() != null) {
                          pageContext.setAttribute(getId(), 
                                  theAttribute.get(), scope);
                      }
                  } catch (NamingException ne) {
                      // if it throws this, we just fail to export it
                      // hence we do nothing
                  } catch (IOException ioe) {
                      // however ioexceprtion is worse!
                      throw new JspException(ioe.toString());
                  }
                  return SKIP_BODY;
              } else {
                  try {
                      nameEnum = theAttribute.getAll();
                      if (nameEnum.hasMoreElements()) {
                          if (multivalueMode == SEPARATE_VALUES) {
                              // recycle attributeObject field
                              attributeObject = nameEnum.nextElement();
                              if (nameEnum.hasMoreElements()) {
                                  return EVAL_BODY_TAG;
                              } else {
                                  try {
                                      pageContext.getOut().print(attributeObject);
                                  } catch (IOException ioe) {
                                      throw new JspException(ioe.toString());
                                  }
                                  return SKIP_BODY;
                              }
                          } else {
                              pageContext.setAttribute(getId(), 
                                      nameEnum.nextElement(), scope);
                              return EVAL_BODY_TAG;
                          }
                      } else {
                          return SKIP_BODY;
                      }
                  } catch (NamingException ne) {
                      // if there is no forAll, skip the body
                      return SKIP_BODY;
                  }
              }
          }
      }
  
      public void doInitBody() throws JspException {
          try {
              if (multivalueMode == SEPARATE_VALUES) {
                  bodyContent.print(attributeObject);
              }
          } catch (IOException ioe) {
              throw new JspException(ioe.toString());
          }
      }
          
  
      public int doAfterBody() throws JspException {
          if (multivalueMode == SEPARATE_VALUES) {
              try {
                  bodyContent.print(nameEnum.nextElement());
              } catch (IOException ioe) {
                  throw new JspException(ioe.toString());
              }
              if (nameEnum.hasMoreElements()) {
                  return EVAL_BODY_TAG;
              } else {
                  return SKIP_BODY;
              }
          } else {
              if (nameEnum.hasMoreElements()) {
                  pageContext.setAttribute(getId(), 
                          nameEnum.nextElement(), scope);
                  return EVAL_BODY_TAG;
              } else {
                  return SKIP_BODY;
              }
          }
              
      }
      
      public int doEndTag() throws JspException {
          try {
              if (bodyContent != null) {
                  bodyContent.writeOut(pageContext.getOut());
              } 
          } catch (IOException ioe) {
              throw new JspException(ioe.toString());
          }
          if (nameEnum != null) {
              try {
                  nameEnum.close();
              } catch (NamingException ne) {
                  // we are trying to free the resource.
                  // if it throws fits, hope it gets GCed
                  nameEnum = null;
              }
          }
          return EVAL_PAGE;
      }
      
      public static String decodeMultivalue(int multivalue) {
          switch (multivalue) {
              case ONE_VALUE:
                  return "one";
              case SEPARATE_VALUES:
                  return "separator";
              case ITTERATE_VALUES:
                  return "itterate";
              default:
                  return null;
          }
      }
      
      public static int decodeMultivalue(String multivalue) {
          if (multivalue.equalsIgnoreCase("one")) {
              return ONE_VALUE;
          } else if (multivalue.equalsIgnoreCase("separator")) {
              return SEPARATE_VALUES;
          } else if (multivalue.equalsIgnoreCase("itterate")) {
              return ITTERATE_VALUES;
          } else {
              return  -1;
          }
      }
  
      public static String decodeScope(int scope) {
          switch (scope) {
              case PageContext.PAGE_SCOPE:
                  return "page";
              case PageContext.REQUEST_SCOPE:
                  return "request";
              case PageContext.SESSION_SCOPE:
                  return "session";
              case PageContext.APPLICATION_SCOPE:
                  return "application";
              default:
                  return null;
          }
      }
      
      public static int decodeScope(String scope) {
          if (scope.equalsIgnoreCase("page")) {
              return PageContext.PAGE_SCOPE;
          } else if (scope.equalsIgnoreCase("request")) {
              return PageContext.REQUEST_SCOPE;
          } else if (scope.equalsIgnoreCase("session")) {
              return PageContext.SESSION_SCOPE;
          } else if (scope.equalsIgnoreCase("applicaiton")) {
              return PageContext.APPLICATION_SCOPE;
          } else {
              return  -1;
          }
      }
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ListTEI.java
  
  Index: ListTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ListTEI.java,v 1.1 2000/12/12 15:34:33 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:33 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.tagext.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class ListTEI extends TagExtraInfo {
  
      /** Creates new UseContextTEI */
      public ListTEI() {
      }
  
      public VariableInfo[] getVariableInfo(TagData data) {
          String nameId, classId, objId;
          nameId = data.getAttributeString("nameId");
          classId = data.getAttributeString("classId");
          objId = data.getAttributeString("objId");
          // an unrolled loop will be quicker than a Vector or List
          int size = 
                ((nameId == null)?0:1)
              + ((classId == null)?0:1)
              + ((objId == null)?0:1);
          VariableInfo[] ret = new VariableInfo[size];
          if (objId != null) {
              ret[--size] = new VariableInfo(objId, "java.lang.Object", true, 
                      VariableInfo.NESTED);
          }
          if (classId != null) {
              ret[--size] = new VariableInfo(classId, "java.lang.String", true, 
                      VariableInfo.NESTED);
          }
          if (nameId != null) {
              ret[--size] = new VariableInfo(nameId, "java.lang.String", true, 
                      VariableInfo.NESTED);
          }
          return ret;
      }
      
      public boolean isValid(TagData data) {
          if (
              (data.getAttribute("context") == null) 
           && (data.getAttribute("contextRef") == null)) {
              return false;
          }
          return true;
      }
      
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ListTag.java
  
  Index: ListTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/ListTag.java,v 1.1 2000/12/12 15:34:33 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:33 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  import javax.naming.*;
  import java.io.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class ListTag extends BodyTagSupport {
  
      Context context;
  
      String nameId, classId, objId;
      int nameScope, classScope, objScope;
  
      String name;
      Name nameObject;
      boolean bindings;
      
      NamingEnumeration nameEnum;
      NameClassPair currentListing;
      
      /** Creates new ListTag */
      public ListTag() {
      }
  
      public void setPageContext(PageContext pc) {
          context = null;
          nameId = null;
          nameScope = PageContext.PAGE_SCOPE;
          classId = null;
          classScope = PageContext.PAGE_SCOPE;
          objId = null;
          objScope = PageContext.PAGE_SCOPE;
          name = null;
          nameObject = null;
          bindings = false;
          nameEnum = null;
          super.setPageContext(pc);
      }
      
      /** Getter for property context.
       * @return Value of property context.
       */
      public Context getContext() {
          return context;
      }
  
      /**
       * Setter for property context.
       * @param context New value of property context.
       */
      public void setContext(Context context) {
          this.context = context;
      }
  
      /**
       * Setter for property contextRef.
       * @param contextRef New value of property contextRef.
       */
      public void setContextRef(String contextRef) {
          Object o = pageContext.findAttribute(contextRef);
          if (o instanceof Context) {
              setContext((Context)o);
          }
      }
  
      /**
       * Getter for property nameId.
       * @return Value of property nameId.
       */
      public String getNameId() {
          return nameId;
      }
  
      /**
       * Setter for property nameId.
       * @param nameId New value of property nameId.
       */
      public void setNameId(String nameId) {
          this.nameId = nameId;
      }
  
      /**
       * Getter for property nameScope.
       * @return Value of property nameScope.
       */
      public String getNameScope() {
          return decodeScope(nameScope);
      }
  
      /**
       * Setter for property nameScope.
       * @param nameScope New value of property nameScope.
       */
      public void setNameScope(String nameScope) {
          this.nameScope = decodeScope(nameScope);
      }
  
      /**
       * Getter for property classId.
       * @return Value of property classId.
       */
      public String getClassId() {
          return classId;
      }
  
      /**
       * Setter for property classId.
       * @param classId New value of property classId.
       */
      public void setClassId(String classId) {
          this.classId = classId;
      }
  
      /** 
       * Getter for property classScope.
       * @return Value of property classScope.
       */
      public String getClassScope() {
          return decodeScope(classScope);
      }
  
      /** 
       * Setter for property classScope.
       * @param classScope New value of property classScope.
       */
      public void setClassScope(String classScope) {
          this.classScope = decodeScope(classScope);
      }
  
      /**
       * Getter for property objId.
       * @return Value of property objId.
       */
      public String getObjId() {
          return objId;
      }
  
      /**
       * Setter for property objId.
       * @param objId New value of property objId.
       */
      public void setObjId(String objId) {
          this.objId = objId;
      }
  
      /** Getter for property objScope.
       * @return Value of property objScope.
       */
      public String getObjScope() {
          return decodeScope(objScope);
      }
  
      /** Setter for property objScope.
       * @param objScope New value of property objScope.
       */
      public void setObjScope(String objScope) {
          this.objScope = decodeScope(objScope);
      }
  
      /**
       * Getter for property name.
       * @return Value of property name.
       */
      public String getName() {
          return name;
      }
  
      /**
       * Setter for property name.
       * @param name New value of property name.
       */
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * Getter for property nameObject.
       * @return Value of property nameObject.
       */
      public Name getNameObject() {
          return nameObject;
      }
  
      /**
       * Setter for property nameObject.
       * @param nameObject New value of property nameObject.
       */
      public void setNameObject(Name nameObject) {
          this.nameObject = nameObject;
      }
  
      /**
       * Getter for property bindings.
       * @return Value of property bindings.
       */
      public boolean getBindings() {
          return bindings;
      }
  
      /**
       * Setter for property bindings.
       * @param bindings New value of property bindings.
       */
      public void setBindings(boolean bindings) {
          this.bindings = bindings;
      }
      
      public int doStartTag() throws JspException {
          if (context == null) {
              throw new JspException("Context is not set for list itteration");
          }
          try {
              if (nameObject != null) {
                  if (bindings) {
                      nameEnum = context.listBindings(nameObject);
                  } else {
                      nameEnum = context.list(nameObject);
                  }
              } else {
                  //if (name == null) {
                  //    name = "";
                  //}
                  if (bindings) {
                      nameEnum = context.listBindings(name);
                  } else {
                      nameEnum = context.list(name);
                  }
              } 
              
              if (nameEnum.hasMoreElements()) {
                  return EVAL_BODY_TAG;
              } else {
                  return SKIP_BODY;
              }
          } catch (NamingException ne) {
              //XXX some sort of logging here?
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              PrintStream ps = new PrintStream(baos);
              ne.printStackTrace(ps);
              throw new JspException(baos.toString());
          }
      }
      
      public void doInitBody() {
          currentListing = (NameClassPair) nameEnum.nextElement();
          if (nameId != null) {
              pageContext.setAttribute(nameId,
                      currentListing.getName(), nameScope);
          }
          if (classId != null) {
              pageContext.setAttribute(classId, 
                      currentListing.getClassName(), classScope);
          }
          if (bindings && (objId != null)) {
  	    if (currentListing instanceof Binding) {
                  pageContext.setAttribute(objId,
                      ((Binding)currentListing).getObject(), objScope);
  	    } else {
                  pageContext.setAttribute(objId, "Uh Oh, no Binding!", objScope);
              }
          }
      }
      
      public int doAfterBody() {
          if (nameEnum.hasMoreElements()) {
              currentListing = (NameClassPair) nameEnum.nextElement();
              if (nameId != null) {
                  pageContext.setAttribute(nameId,
                          currentListing.getName(), nameScope);
              }
              if (classId != null) {
                  pageContext.setAttribute(classId, 
                          currentListing.getClassName(), classScope);
              }
              if (bindings && (objId != null)) {
                  if (currentListing instanceof Binding) {
                      pageContext.setAttribute(objId,
                          ((Binding)currentListing).getObject(), objScope);
  	        } else {
                      pageContext.setAttribute(objId, "Uh Oh, no Binding!", objScope);
                  }
              }
              return EVAL_BODY_TAG;
          } else {
              return SKIP_BODY;
          }
      }
      
      public int doEndTag() throws JspException {
          try {
              if (bodyContent != null) {
                  bodyContent.writeOut(pageContext.getOut());
              }
          } catch (IOException ioe) {
              throw new JspException(ioe.toString());
          }
          if (nameId != null && nameScope != PageContext.REQUEST_SCOPE) {
              pageContext.removeAttribute(nameId, nameScope);
          }
          if (classId != null && classScope != PageContext.REQUEST_SCOPE) {
              pageContext.removeAttribute(classId, classScope);
          }
          if (bindings && (objId != null) && objScope != PageContext.REQUEST_SCOPE) {
              pageContext.removeAttribute(objId, objScope);
          }
          try {
               nameEnum.close();
          } catch (NamingException ne) {
              // we got what we wanted, it should be safe to ignore this
          }
          return EVAL_PAGE;
      }
      
      static String decodeScope(int scope) {
          switch (scope) {
              case PageContext.PAGE_SCOPE:
                  return "page";
              case PageContext.REQUEST_SCOPE:
                  return "request";
              case PageContext.SESSION_SCOPE:
                  return "session";
              case PageContext.APPLICATION_SCOPE:
                  return "application";
              default:
                  return null;
          }
      }
      
      static int decodeScope(String scope) {
          if (scope.equalsIgnoreCase("page")) {
              return PageContext.PAGE_SCOPE;
          } else if (scope.equalsIgnoreCase("request")) {
              return PageContext.REQUEST_SCOPE;
          } else if (scope.equalsIgnoreCase("session")) {
              return PageContext.SESSION_SCOPE;
          } else if (scope.equalsIgnoreCase("applicaiton")) {
              return PageContext.APPLICATION_SCOPE;
          } else {
              return  -1;
          }
      }        
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/LookupTEI.java
  
  Index: LookupTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/LookupTEI.java,v 1.1 2000/12/12 15:34:33 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:33 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.tagext.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class LookupTEI extends TagExtraInfo {
  
      /** Creates new UseContextTEI */
      public LookupTEI() {
      }
  
      public VariableInfo[] getVariableInfo(TagData data) {
          String clazz = data.getAttributeString("type");
          if (clazz == null) {
              clazz = "java.lang.Object";
          }
          return new VariableInfo[]  {
              new VariableInfo(data.getId(), clazz, true, VariableInfo.AT_END)};
      }
      
      public boolean isValid(TagData data) {
          if (data.getId() == null) {
              return false;
          }
          if (
              (data.getAttribute("context") == null) 
           && (data.getAttribute("contextRef") == null)) {
              return false;
          }
          // looking up the blank name is ok
          return true;
      }
     
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/LookupTag.java
  
  Index: LookupTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/LookupTag.java,v 1.1 2000/12/12 15:34:33 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:33 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  import javax.naming.*;
  import java.io.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class LookupTag extends TagSupport {
  
      Context context;
  
      String name;
      int scope;
      String type;
      Name nameObject;
      
      
      /** Creates new LookupTag */
      public LookupTag() {
      }
  
      public void setPageContext(PageContext pc) {
          context = null;
          name = null;
          nameObject = null;
          scope = PageContext.PAGE_SCOPE;
          type = "java.lang.Object";
          super.setPageContext(pc);
      }
      
      /** Getter for property context.
       * @return Value of property context.
       */
      public Context getContext() {
          return context;
      }
  
      /**
       * Setter for property context.
       * @param context New value of property context.
       */
      public void setContext(Context context) {
          this.context = context;
      }
  
      /**
       * Setter for property contextRef.
       * @param contextRef New value of property contextRef.
       */
      public void setContextRef(String contextRef) {
          Object o = pageContext.findAttribute(contextRef);
          if (o instanceof Context) {
              setContext((Context)o);
          }
      }
  
      /** 
       * Getter for property scope.
       * @return Value of property scope.
       */
      public String getScope() {
          return decodeScope(scope);
      }
  
      /** 
       * Setter for property scope.
       * @param scope New value of property scope.
       */
      public void setScope(String scope) {
          this.scope = decodeScope(scope);
      }
  
      /** 
       * Getter for property type.
       * @return Value of property type.
       */
      public String getType() {
          return type;
      }
  
      /** 
       * Setter for property type
       * @param type New value of property type.
       */
      public void setType(String type) {
          this.type = type;
      }
  
      /**
       * Getter for property name.
       * @return Value of property name.
       */
      public String getName() {
          return name;
      }
  
      /**
       * Setter for property name.
       * @param name New value of property name.
       */
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * Getter for property nameObject.
       * @return Value of property nameObject.
       */
      public Name getNameObject() {
          return nameObject;
      }
  
      /**
       * Setter for property nameObject.
       * @param nameObject New value of property nameObject.
       */
      public void setNameObject(Name nameObject) {
          this.nameObject = nameObject;
      }
  
      public int doStartTag() throws JspException {
          return SKIP_BODY;
      }
      
      public int doEndTag() throws JspException {
          if (context == null) {
              throw new JspException("context not set in a lookup invocation");
          }
          Object o;
          try {
              if (nameObject != null) {
                  o = context.lookup(nameObject);
              } else {
                  if (name == null) {
                      name = "";
                  }
                  o = context.lookup(name);
              }
              if (Class.forName(type).isInstance(o)) {
                  pageContext.setAttribute(getId(), o, scope);
              }
          } catch (NamingException ne) {
              throw new JspException(ne.toString());
          } catch (ClassNotFoundException cnfe) {
              // no need to handle classNotFound,since the enclosing page
              // compiles the variable with the same class and it wouldn't
              // compile since it wasn't found.
          }
                  
          return EVAL_PAGE;
      }
      
      static String decodeScope(int scope) {
          switch (scope) {
              case PageContext.PAGE_SCOPE:
                  return "page";
              case PageContext.REQUEST_SCOPE:
                  return "request";
              case PageContext.SESSION_SCOPE:
                  return "session";
              case PageContext.APPLICATION_SCOPE:
                  return "application";
              default:
                  return null;
          }
      }
      
      static int decodeScope(String scope) {
          if (scope.equalsIgnoreCase("page")) {
              return PageContext.PAGE_SCOPE;
          } else if (scope.equalsIgnoreCase("request")) {
              return PageContext.REQUEST_SCOPE;
          } else if (scope.equalsIgnoreCase("session")) {
              return PageContext.SESSION_SCOPE;
          } else if (scope.equalsIgnoreCase("applicaiton")) {
              return PageContext.APPLICATION_SCOPE;
          } else {
              return  -1;
          }
      }        
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/SearchTEI.java
  
  Index: SearchTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/SearchTEI.java,v 1.1 2000/12/12 15:34:33 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:33 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.tagext.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class SearchTEI extends TagExtraInfo {
  
      /** Creates new SearchTEI */
      public SearchTEI() {
      }
  
      public VariableInfo[] getVariableInfo(TagData data) {
          return new VariableInfo[]  
              { new VariableInfo(data.getId(), "javax.naming.directory.SearchResult", true, 
                      VariableInfo.AT_END)};
      }
      
      public boolean isValid(TagData data) {
          if (data.getId() == null) {
              return false;
          }
          if (
              (data.getAttribute("context") == null) 
           && (data.getAttribute("contextRef") == null)) {
              return false;
          }
          return true;
      }
      
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/SearchTag.java
  
  Index: SearchTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/SearchTag.java,v 1.1 2000/12/12 15:34:34 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:34 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  import javax.naming.*;
  import javax.naming.directory.*;
  
  import java.io.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class SearchTag extends BodyTagSupport {
  
      protected int scope;
      protected String attributes;
      protected String attributeSeparator;
      protected SearchControls controls;
      protected DirContext context;
      protected String filter;
      protected NamingEnumeration nameEnum;
      protected SearchResult currentResult;
      protected String name;
      protected Name nameObject;
  
      /** Creates new SearchTag */
      public SearchTag() {
      }
  
      /**
       * Getter for property scope
       * @return Value of property scope.
       */
      public String getScope() {
          return decodeScope(scope);
      }
  
      /**
       * Setter for property scope.
       * @param Scope New value of property scope.
       */
      public void setScope(String scope) {
          this.scope = decodeScope(scope);
      }
  
      /**
       * Getter for property context.
       * @return Value of property context.
       */
      public DirContext getContext() {
          return context;
      }
  
      /**
       * Setter for property context.
       * @param context New value of property context.
       */
      public void setContext(DirContext context) {
          this.context = context;
      }
  
      /**
       * Setter for property contextRef.
       * @param contextRef New value of property contextRef.
       */
      public void setContextRef(String contextRef) {
          Object o = pageContext.findAttribute(contextRef);
          if (o instanceof DirContext) {
              context = (DirContext) o;
          } else if (o instanceof Context) {
              try {
                  // attempt a blank lookup
                  o = ((Context)o).lookup("");
                  if (o instanceof DirContext) {
                      context = (DirContext) o;
                  }
              } catch (NamingException ne) {
                  // oh well, it failed, toss it out
              }
          }
      }
  
      /**
       * Getter for property `.
       * @return Value of property name.
       */
      public String getName() {
          return name;
      }
  
      /**
       * Setter for property name.
       * @param name New value of property name.
       */
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * Getter for property nameObject.
       * @return Value of property nameObject.
       */
      public Name getNameObject() {
          return nameObject;
      }
  
      /**
       * Setter for property nameObject.
       * @param nameObject New value of property nameObject.
       */
      public void setNameObject(Name nameObject) {
          this.nameObject = nameObject;
      }
  
      /**
       * Getter for property filter.
       * @return Value of property filter.
       */
      public String getFilter() {
          return filter;
      }
  
      /**
       * Setter for property filter.
       * @param filter New value of property filter.
       */
      public void setFilter(String filter) {
          this.filter = filter;
      }
  
      /**
       * Getter for property countLimit.
       * @return Value of property countLimit.
       */
      public long getCountLimit() {
          return controls.getCountLimit();
      }
  
      /**
       * Setter for property countLimit.
       * @param countLimit New value of property countLimit.
       */
      public void setCountLimit(long countLimit) {
          controls.setCountLimit(countLimit);
      }
  
      /**
       * Getter for property derefLink.
       * @return Value of property derefLink.
       */
      public boolean getDerefLink() {
          return controls.getDerefLinkFlag();
      }
  
      /**
       * Setter for property derefLink.
       * @param derefLink New value of property derefLink.
       */
      public void setDerefLink(boolean derefLink) {
          controls.setDerefLinkFlag(derefLink);
      }
  
      /**
       * Getter for property attributes.
       * @return Value of property attributes.
       */
      public String getAttributes() {
          return attributes;
      }
  
      /**
       * Setter for property attributes.
       * @param attributes New value of property attributes.
       */
      public void setAttributes(String attributes) {
          this.attributes = attributes;
      }
  
      /**
       * Getter for property attrbuteSeparator.
       * @return Value of property attrbuteSeparator.
       */
      public String getAttributeSeparator() {
          return attributeSeparator;
      }
  
      /**
       * Setter for property attrbuteSeparator.
       * @param attrbuteSeparator New value of property attrbuteSeparator.
       */
      public void setAttributeSeparator(String attributeSeparator) {
          this.attributeSeparator = attributeSeparator;
      }
  
      /**
       * Getter for property bindings.
       * @return Value of property bindings.
       */
      public boolean getBindings() {
          return controls.getReturningObjFlag();
      }
  
      /**
       * Setter for property bindings.
       * @param bindings New value of property bindings.
       */
      public void setBindings(boolean bindings) {
          controls.setReturningObjFlag(bindings);
      }
  
      /**
       * Getter for property searchScope.
       * @return Value of property searchScope.
       */
      public String getSearchScope() {
          return decodeSearchScope(controls.getSearchScope());    
      }
  
      /**
       * Setter for property searchScope.
       * @param searchScope New value of property searchScope.
       */
      public void setSearchScope(String searchScope) {
          controls.setSearchScope(decodeSearchScope(searchScope));
      }
  
      /**
       * Getter for property timeLimit.
       * @return Value of property timeLimit.
       */
      public int getTimeLimit() {
          return controls.getTimeLimit();
      }
  
      /**
       * Setter for property timeLimit.
       * @param timeLimit New value of property timeLimit.
       */
      public void setTimeLimit(int timeLimit) {
          controls.setTimeLimit(timeLimit);
      }
      
      public void setPageContext(PageContext pc) {
          scope = PageContext.PAGE_SCOPE;
          attributes = null;
          attributeSeparator = ",";
          controls = new SearchControls();
          context = null;
          filter = null;
          nameEnum = null;
          currentResult = null;
          name = null;
          nameObject = null;
          
          super.setPageContext(pc);
      }
      
      public int doStartTag() throws JspException {
          String[] attrs = null;
          if (attributes != null) {
              if (attributes.length() == 0) {
                  attrs = new String[0];
              } else {
                  int count = 1;
                  int i=0, j=0, size = attributeSeparator.length();
                  while ((j=attributes.indexOf(attributeSeparator, i)) != -1) {
                      count++;
                      i = j + size;
                  }
                  attrs = new String[count];
                  count = 0;
                  while ((j=attributes.indexOf(attributeSeparator, i)) != -1) {
                      attrs[count] = attributes.substring(i, j);
                      count++;
                      i = j + size;
                  }
                  attrs[count] = attributes.substring(i);
              }
          }
          
          controls.setReturningAttributes(attrs);
  
          try {
              if (nameObject != null) {
                  nameEnum = context.search(nameObject, filter, controls);
              } else {
                  if (name == null) {
                      name = "";
                  }
                  nameEnum = context.search(name, filter, controls);
              }
          } catch (NamingException ne) {
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              PrintStream ps = new PrintStream(baos);
              ne.printStackTrace(ps);
              throw new JspException(baos.toString());
          }
          
          if (nameEnum.hasMoreElements()) {
              return EVAL_BODY_TAG;
          } else {
              return SKIP_BODY;
          }
      }
      
      public void doInitBody() {
          currentResult = (SearchResult) nameEnum.nextElement();
          if (getId() != null) {
              pageContext.setAttribute(getId(),
                      currentResult, scope);
          }
      }
          
      public int doAfterBody() {
          if (! nameEnum.hasMoreElements()) {
              return SKIP_BODY;
          } else {
              currentResult = (SearchResult) nameEnum.nextElement();
              if (getId() != null) {
                  pageContext.setAttribute(getId(),
                          currentResult, scope);
              }
              return EVAL_BODY_TAG;
          }
      }
      
      public int doEndTag() throws JspException {
          try {
              if (bodyContent != null) {
                  bodyContent.writeOut(pageContext.getOut());
              }
          } catch (IOException ioe) {
              throw new JspException(ioe.toString());
          }
          try {
              nameEnum.close();
          } catch (NamingException ne) {
              throw new JspException(ne.toString());
          }
          return EVAL_PAGE;
      }
      
      public static int decodeSearchScope(String scope) {
          // a better way would be to pop a hashtable with Integer as value
          if ("object_scope".equalsIgnoreCase(scope) || 
              "object".equalsIgnoreCase(scope)) {
              return SearchControls.OBJECT_SCOPE;
          } else if ("onelevel_scope".equalsIgnoreCase(scope) ||
                     "onelevel".equalsIgnoreCase(scope)) {
              return SearchControls.ONELEVEL_SCOPE;
          } else if ("subtree_scope".equalsIgnoreCase(scope) ||
                     "subtree".equalsIgnoreCase(scope)) {
              return SearchControls.SUBTREE_SCOPE;
          } else {
              return -1;
          }
      }
      
      public static String decodeSearchScope(int scope) {
          switch (scope) {
              case SearchControls.OBJECT_SCOPE:
                  return "OBJECT_SCOPE";
              case SearchControls.ONELEVEL_SCOPE:
                  return "ONELEVEL_SCOPE";
              case SearchControls.SUBTREE_SCOPE:
                  return "SUBTREE_SCOPE";
              default:
                  return null;
          }
      }
  
      public static String decodeScope(int scope) {
          switch (scope) {
              case PageContext.PAGE_SCOPE:
                  return "page";
              case PageContext.REQUEST_SCOPE:
                  return "request";
              case PageContext.SESSION_SCOPE:
                  return "session";
              case PageContext.APPLICATION_SCOPE:
                  return "application";
              default:
                  return null;
          }
      }
      
      public static int decodeScope(String scope) {
          if (scope.equalsIgnoreCase("page")) {
              return PageContext.PAGE_SCOPE;
          } else if (scope.equalsIgnoreCase("request")) {
              return PageContext.REQUEST_SCOPE;
          } else if (scope.equalsIgnoreCase("session")) {
              return PageContext.SESSION_SCOPE;
          } else if (scope.equalsIgnoreCase("applicaiton")) {
              return PageContext.APPLICATION_SCOPE;
          } else {
              return  -1;
          }
      }
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseContextTEI.java
  
  Index: UseContextTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseContextTEI.java,v 1.1 2000/12/12 15:34:34 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:34 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.tagext.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class UseContextTEI extends TagExtraInfo {
  
      /** Creates new UseContextTEI */
      public UseContextTEI() {
      }
  
      public VariableInfo[] getVariableInfo(TagData data) {
          return new VariableInfo[]  
              { new VariableInfo(data.getId(), "javax.naming.Context", true, 
                      VariableInfo.AT_END)};
      }
      
      public boolean isValid(TagData data) {
          if (data.getId() == null) {
              return false;
          }
          if (
              (data.getAttribute("env") == null) 
           && (data.getAttribute("envRef") == null) 
           && (data.getAttribute("url") == null) 
           && (data.getAttribute("initialFactory") == null)) {
              return false;
          }
          return true;
      }
      
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseContextTag.java
  
  Index: UseContextTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseContextTag.java,v 1.1 2000/12/12 15:34:34 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:34 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  
  import java.io.*;
  import java.util.Hashtable;
  import java.util.Enumeration;
  
  import javax.naming.*;
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class UseContextTag extends BodyTagSupport {
   
      Hashtable env;
      //id handled by bodytagsupport
      int scope;
      String url;
      
      /** 
       * Creates new UseDirContextTag 
       */
      public UseContextTag() {
          
      }
      
      public void setPageContext(PageContext pc) {
          env = new Hashtable();
          scope = -1;
          super.setPageContext(pc);
      }
  
      /** 
       * Setter for property envRef.
       * <BR>Bad refs will be silently ignored.
       * @param envRef New value of property envRef.
       */
      public void setEnvRef(String envRef) {
          Object o = pageContext.findAttribute(envRef);
          if ((o != null) && (o instanceof Hashtable)) {
              setEnv((Hashtable)o);
          }
      }
      
      /** 
       * Getter for property env.
       * @return Value of property env.
       */
      public Hashtable getEnv() {
          return env;
      }
  
      /** 
       * Setter for property env.
       * This copies the Hashtable in and does not mutate the hashtable passed in.
       * @param env New value of property env.
       */
      public void setEnv(Hashtable env) {
          Enumeration e = env.keys();
          while (e.hasMoreElements()) {
              String s = (String)e.nextElement();
              //XXX only put stuff not there?  This could be an intersting
              //XXX example of ordered attributes in a custom tag then
              this.env.put(s, env.get(s));
          }
      }
      
      /** 
       * Getter for property providerUrl.
       * @return Value of property providerUrl.
       */
      public String getProviderUrl() {
          try {
              return (String) env.get(Context.PROVIDER_URL);
          } catch (ClassCastException cce) {
              return null;
          }
      }
      
      /**
       * Setter for property providerUrl.
       * @param providerUrl New value of property providerUrl.
       */
      public void setProviderUrl(String providerUrl) {
          env.put(Context.PROVIDER_URL, providerUrl);
      }
  
      /**
       * Getter for property url
       * @return Value of property url.
       */
      public String getUrl() {
          return url;
      }
  
      /**
       * Setter for property url.
       * @param url New value of property url.
       */
      public void setUrl(String url) {
          this.url = url;
      }
  
      /**
       * Getter for property intialFactory.
       * @return Value of property intialFactory.
       */
      public String getInitialFactory() {
          try {
              return (String) env.get(Context.INITIAL_CONTEXT_FACTORY);
          } catch (ClassCastException cce) {
              return null;
          }
      }
  
      /**
       * Setter for property intialFactory.
       * @param intialFactory New value of property intialFactory.
       */
      public void setInitialFactory(String initialFactory) {
          env.put(Context.INITIAL_CONTEXT_FACTORY, initialFactory);
      }
  
      /**
       * Getter for property authoritative.
       * @return Value of property authoritative.
       */
      public String getAuthoritative() {
          try {
              return (String) env.get(Context.AUTHORITATIVE);
          } catch (ClassCastException cce) {
              return null;
          }
      }
  
      /**
       * Setter for property authoritative.
       * @param authoritative New value of property authoritative.
       */
      public void setAuthoritative(String authoritative) {
          env.put(Context.AUTHORITATIVE, authoritative);
      }
  
      /**
       * Getter for property batchsize.
       * @return Value of property batchsize, or -1 if not set
       */
      public int getBatchsize() {
          Object o = env.get(Context.BATCHSIZE);
          if (o instanceof Integer) {
              return ((Integer)o).intValue();
          } else if (o != null) {
              return Integer.parseInt(o.toString());
          } else {
              return -1;
          }
      }
  
      /**
       * Setter for property batchsize.
       * @param batchsize New value of property batchsize.
       */
      public void setBatchsize(int batchsize) {
          env.put(Context.BATCHSIZE, new Integer(batchsize));
      }
  
      /** 
       * Getter for property objectFactories.
       * @return Value of property objectFactories.
       */
      public String getObjectFactories() {
          try {
              return (String) env.get(Context.OBJECT_FACTORIES);
          } catch (ClassCastException cce) {
              return null;
          }
      }
  
      /**
       * Setter for property objectFactories.
       * @param objectFactories New value of property objectFactories.
       */
      public void setObjectFactories(String objectFactories) {
          env.put(Context.OBJECT_FACTORIES, objectFactories);
      }
  
      /**
       * Getter for property stateFactories.
       * @return Value of property stateFactories.
       */
      public String getStateFactories() {
          try {
              return (String) env.get(Context.STATE_FACTORIES);
          } catch (ClassCastException cce) {
              return null;
          }
      }
  
      /**
       * Setter for property stateFactories.
       * @param stateFactories New value of property stateFactories.
       */
      public void setStateFactories(String stateFactories) {
          env.put(Context.STATE_FACTORIES, stateFactories);
      }
  
      /**
       * Getter for property urlPkgPrefixes.
       * @return Value of property urlPkgPrefixes.
       */
      public String getUrlPkgPrefixes() {
          try {
              return (String) env.get(Context.URL_PKG_PREFIXES);
          } catch (ClassCastException cce) {
              return null;
          }
      }
  
      /**
       * Setter for property urlPkgPrefixes.
       * @param urlPkgPrefixes New value of property urlPkgPrefixes.
       */
      public void setUrlPkgPrefixes(String urlPkgPrefixes) {
          env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
      }
      
      /**
       * Getter for property dnsUrl.
       * @return Value of property dnsUrl.
       */
      public String getDnsUrl() {
          try {
              return (String) env.get(Context.DNS_URL);
          } catch (ClassCastException cce) {
              return null;
          }
      }
  
      /**
       * Setter for property urlPkgPrefixes.
       * @param urlPkgPrefixes New value of property urlPkgPrefixes.
       */
      public void setDnsUrl(String dnsUrl) {
          env.put(Context.DNS_URL, dnsUrl);
      }
      
      public void supplementFromAttributes(String entry) {
          if (!env.containsKey(entry)) {
              Object o = pageContext.findAttribute(entry);
              if (o != null) {
                  env.put(entry, o);
              }
          }
      }
      
      /**
       * Getter for property scope.
       * @return Value of property scope.
       */
      public String getScope() {
          switch (scope) {
              case PageContext.PAGE_SCOPE:
                  return "page";
              case PageContext.REQUEST_SCOPE:
                  return "request";
              case PageContext.SESSION_SCOPE:
                  return "session";
              case PageContext.APPLICATION_SCOPE:
                  return "application";
              default:
                  return null;
          }
      }
      
      /**
       * Setter for property scope.
       * @param scope New value of property scope.
       */
      public void setScope(String scope) {
          if (scope.equalsIgnoreCase("page")) {
              this.scope = PageContext.PAGE_SCOPE;
          } else if (scope.equalsIgnoreCase("request")) {
              this.scope = PageContext.REQUEST_SCOPE;
          } else if (scope.equalsIgnoreCase("session")) {
              this.scope = PageContext.SESSION_SCOPE;
          } else if (scope.equalsIgnoreCase("applicaiton")) {
              this.scope = PageContext.APPLICATION_SCOPE;
          } else {
              this.scope = -1;
          }
      }
      
      protected void pullInSupplimentalAttributes() {
          supplementFromAttributes(Context.INITIAL_CONTEXT_FACTORY);
          supplementFromAttributes(Context.OBJECT_FACTORIES);
          supplementFromAttributes(Context.STATE_FACTORIES);
          supplementFromAttributes(Context.URL_PKG_PREFIXES);
          supplementFromAttributes(Context.PROVIDER_URL);
          supplementFromAttributes(Context.DNS_URL);
      }
      
      protected Object getObjectToExport() throws JspException
      {
          try {
              Context ctx = new InitialContext(env);
              if (url != null) {
                  Object o = ctx.lookup(url);
                  if (o instanceof Context) {
                      ctx = (Context) o;
                  }
              } /*else {
                  Object o = ctx.lookup("");
                  if ((o instanceof Context) && (o != null)) {
                      ctx = (Context) o;
                  }
              }*/
              return ctx;
          } catch (NamingException ne) {
              //XXX add some sort of logging hook?
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              PrintStream ps = new PrintStream(baos);
              ne.printStackTrace(ps);
              throw new JspException(baos.toString());
          }
      }    
  
      public Class getClassOfExportedObject() {
          return Context.class;
      }
  
      public int doEndTag() throws JspException {
          Object o = pageContext.getAttribute(getId(), scope);
          if (o != null) {
              if (!getClassOfExportedObject().isInstance(o)) {
                  o = null;
              }
          }
          if (o != null) {
              pullInSupplimentalAttributes();
              o = getObjectToExport();
          }
          pageContext.setAttribute(getId(), o, scope);
          return EVAL_PAGE;
      }
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseDirContextTEI.java
  
  Index: UseDirContextTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseDirContextTEI.java,v 1.1 2000/12/12 15:34:34 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:34 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.tagext.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class UseDirContextTEI extends TagExtraInfo {
  
      /** Creates new UseDirContextTEI */
      public UseDirContextTEI() {
      }
  
      public VariableInfo[] getVariableInfo(TagData data) {
          return new VariableInfo[]  
              { new VariableInfo(data.getId(), "javax.naming.directory.DirContext", true, 
                      VariableInfo.AT_END)};
      }
      
      public boolean isValid(TagData data) {
          if (data.getId() == null) {
              return false;
          }
          if (
              (data.getAttribute("env") == null) 
           && (data.getAttribute("envRef") == null) 
           && (data.getAttribute("url") == null) 
           && (data.getAttribute("initialFactory") == null)) {
              return false;
          }
          return true;
      }
      
  }
  
  
  
  1.1                  jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseDirContextTag.java
  
  Index: UseDirContextTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/jndi/src/org/apache/taglibs/jndi/UseDirContextTag.java,v 1.1 2000/12/12 15:34:35 shemnon Exp $
   * $Revision: 1.1 $
   * $Date: 2000/12/12 15:34:35 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.jndi;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  
  import java.util.Hashtable;
  import java.util.Enumeration;
  
  import javax.naming.*;
  import javax.naming.directory.*;
  
  /**
   *
   * @author  Danno Ferrin <sh...@earthlink.net>
   * @version $Revision: 1.1 $
   */
  public class UseDirContextTag extends UseContextTag {
   
      public Class getClassOfExportedObject() {
          return DirContext.class;
      }
  
      protected Object getObjectToExport() throws JspException
      {
          try {
              Context ctx = new InitialDirContext(env);
              if (url != null) {
                  Object o = ctx.lookup(url);
                  if (o instanceof DirContext) {
                      ctx = (DirContext) o;
                  }
              }
              return ctx;
          } catch (NamingException ne) {
              //XXX add some sort of logging hook?
              throw new JspException(ne.toString());
          }
      }    
      
      //TODO when implicit context scoping w/o ID is implemented also have this listen to 
      //     getAttribute tags and forEachAttribute itteration tags
  
  }