You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by am...@apache.org on 2002/08/16 02:30:45 UTC

cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm JNDIRealmForm.java SaveJNDIRealmAction.java

amyroh      2002/08/15 17:30:45

  Modified:    webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        ApplicationResources_en.properties
                        ApplicationResources_es.properties
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm
                        JNDIRealmForm.java SaveJNDIRealmAction.java
  Log:
  Change the validation of JNDIRealm and also fix to not replace null configuration
  attributes with "".
  
  Revision  Changes    Path
  1.67      +1 -0      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties
  
  Index: ApplicationResources_en.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- ApplicationResources_en.properties	13 Aug 2002 22:35:20 -0000	1.66
  +++ ApplicationResources_en.properties	16 Aug 2002 00:30:45 -0000	1.67
  @@ -260,6 +260,7 @@
   error.userPassword.required=<li>User Password is required.</li>
   error.userPattern.required=<li>User pattern is required.</li>
   error.userSearch.required=<li>User search is required.</li>
  +error.userPattern.userSearch.defined=<li>Either userPattern or userSearch must be specified not both.</li>
   error.contextFactory.required=<li>Context Factory is required.</li>
   error.connPassword.required=<li>Connection password is required.</li>
   error.connURL.required=<li>Connection URL is required.</li>
  
  
  
  1.56      +8 -7      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties
  
  Index: ApplicationResources_es.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- ApplicationResources_es.properties	13 Aug 2002 22:35:20 -0000	1.55
  +++ ApplicationResources_es.properties	16 Aug 2002 00:30:45 -0000	1.56
  @@ -258,8 +258,9 @@
   error.rolePattern.required=<li>Se requiere el modelo de la busqueda del papel.</li>
   error.userBase.required=<li>Se requiere el elemento bajo del usuario.</li>
   error.userPassword.required=<li>Se requiere la palabra de paso del utilizador.</li>
  -error.userPattern.required=<li>Se requiere el patr�n del usuario.</li>
  -error.userSearch.required=<li>Se requiere la b�squeda del usuario.</li>
  +error.userPattern.required=<li>Se requiere el patr=n del usuario.</li>
  +error.userSearch.required=<li>Se requiere la b�squeda del usuario.</li>
  +error.userPattern.userSearch.defined=<li>UserPattern o userSearch se deben especificar no ambos.</li>
   error.contextFactory.required=<li>Se requiere la factory del contexto.</li>
   error.connPassword.required=<li>Se requiere la palabra de paso de la conexion.</li>
   error.connURL.required=<li>Se requiere el URL de la conexion.</li>
  @@ -313,16 +314,16 @@
   resources.error.entryType.notimpl=<li>Validaci=n para este tipo no puesto en ejecucio'n todavfa.</li>
   resources.error.url.required=<li>Se requiere el URL de Datasource.</li>
   resources.error.driverClass.required=<li>Se requiere la clase del conductor de JDBC.</li>
  -resources.error.active.required=<li>Se requieren las conexiones activas m�ximas.</li>
  -resources.error.idle.required=<li>Se requieren las conexiones ociosas m�ximas.</li>
  -resources.error.wait.required=<li>La espera m�xima para una conexi=n se requiere.</li>
  +resources.error.active.required=<li>Se requieren las conexiones activas m�ximas.</li>
  +resources.error.idle.required=<li>Se requieren las conexiones ociosas m�ximas.</li>
  +resources.error.wait.required=<li>La espera m�xima para una conexi=n se requiere.</li>
   resources.error.mailhost.required=<li>mail.smtp.host is required.</li>
  -resources.integer.error=<li>Error inv�lido del n+mero entero.</li>
  +resources.integer.error=<li>Error inv�lido del n+mero entero.</li>
   resources.actions.userdb.create=Cree La Nueva Base de datos Del Usuario
   resources.actions.userdb.edit=Corrija La Base de datos Del Usuario
   resources.actions.userdb.delete=Bases de datos Del Usuario De la Cancelaci=n
   resources.userdb.location=Localizaci=n
  -resources.userdb.factory=F�brica
  +resources.userdb.factory=F�brica
   resources.treeBuilder.userdbs=Bases de datos Del Usuario
   resources.error.path.required=<li>Path requerido</li>
   resources.error.jndiName.required=<li>JNDI Nombre requerido</li>
  
  
  
  1.10      +54 -38    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JNDIRealmForm.java
  
  Index: JNDIRealmForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JNDIRealmForm.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JNDIRealmForm.java	13 Aug 2002 22:35:20 -0000	1.9
  +++ JNDIRealmForm.java	16 Aug 2002 00:30:45 -0000	1.10
  @@ -84,14 +84,24 @@
       // ----------------------------------------------------- Instance Variables
   
       /**
  -     * Should we search the entire subtree for matching roles?
  +     * The text for the connection user name.
        */
  -    private String roleSubtree = "false";
  +    private String connectionName = null;
   
       /**
  -     * Should we search the entire subtree for matching users?
  +     * The text for the connection Password.
        */
  -    private String userSubtree = "false";
  +    private String connectionPassword = null;
  +
  +    /**
  +     * The text for the connection URL.
  +     */
  +    private String connectionURL = null;
  +
  +    /**
  +     * The text for the context Factory.
  +     */
  +    private String contextFactory = null;
   
       /**
        * The text for the digest algorithm.
  @@ -104,11 +114,6 @@
       private String roleBase = null;
   
       /**
  -     * The text for the user role name.
  -     */
  -    private String userRoleName = null;
  -
  -    /**
        * The text for the role name.
        */
       private String roleName = null;
  @@ -119,24 +124,14 @@
       private String rolePattern = null;
   
       /**
  -     * The text for the connection user name.
  -     */
  -    private String connectionName = null;
  -
  -    /**
  -     * The text for the connection Password.
  -     */
  -    private String connectionPassword = null;
  -
  -    /**
  -     * The text for the connection URL.
  +     * Should we search the entire subtree for matching roles?
        */
  -    private String connectionURL = null;
  +    private String roleSubtree = "false";
   
       /**
  -     * The text for the context Factory.
  +     * The text for the user Base.
        */
  -    private String contextFactory = null;
  +    private String userBase = null;
   
       /**
        * The text for the user Password.
  @@ -144,14 +139,14 @@
       private String userPassword = null;
   
       /**
  -     * The text for the user Base.
  +     * The text for the user Pattern.
        */
  -    private String userBase = null;
  +    private String userPattern = null;
   
       /**
  -     * The text for the user Pattern.
  +     * The text for the user role name.
        */
  -    private String userPattern = null;
  +    private String userRoleName = null;
   
       /**
        * The text for the user Search.
  @@ -159,6 +154,11 @@
       private String userSearch = null;
   
       /**
  +     * Should we search the entire subtree for matching users?
  +     */
  +    private String userSubtree = "false";
  +
  +    /**
        * Set of valid values for search subtrees(true/false).
        */
       private List searchVals = null;
  @@ -558,12 +558,33 @@
           if (submit != null) {
               // the following fields are required.
   
  +            if ((connectionURL == null) || (connectionURL.length() < 1)) {
  +                errors.add("connectionURL",
  +                new ActionError("error.connURL.required"));
  +            }
  +
  +            // Either userPattern or userSearch should be specified not both
  +            boolean isUserPatternSpecified = false;
  +            boolean isUserSearchSpecified = false;
  +            if ((userPattern != null) && (userPattern.length() > 0)) {
  +                isUserPatternSpecified = true;
  +            }
  +
  +            if ((userSearch != null) && (userSearch.length() > 0)) {
  +                isUserSearchSpecified = true;
  +            }
  +
  +            if (isUserPatternSpecified && isUserSearchSpecified) {
  +                errors.add("userPattern" ,
  +                new ActionError("error.userPattern.userSearch.defined"));
  +            }
  +
               /*if ((digest == null) || (digest.length() < 1)) {
                   errors.add("digest",
                   new ActionError("error.digest.required"));
               } */
   
  -            if ((roleName == null) || (roleName.length() < 1)) {
  +            /*if ((roleName == null) || (roleName.length() < 1)) {
                   errors.add("roleName",
                   new ActionError("error.roleName.required"));
               }
  @@ -613,12 +634,7 @@
                   new ActionError("error.connPassword.required"));
               }
   
  -            if ((connectionURL == null) || (connectionURL.length() < 1)) {
  -                errors.add("connectionURL",
  -                new ActionError("error.connURL.required"));
  -            }
  -
  -            /*if ((contextFactory == null) || (contextFactory.length() < 1)) {
  +            if ((contextFactory == null) || (contextFactory.length() < 1)) {
                   errors.add("contextFactory",
                   new ActionError("error.contextFactory.required"));
               } */
  
  
  
  1.9       +95 -49    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/SaveJNDIRealmAction.java
  
  Index: SaveJNDIRealmAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/SaveJNDIRealmAction.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SaveJNDIRealmAction.java	13 Aug 2002 22:35:20 -0000	1.8
  +++ SaveJNDIRealmAction.java	16 Aug 2002 00:30:45 -0000	1.9
  @@ -96,6 +96,7 @@
    * <em>Edit Realm</em> transactions for JNDI realm.
    *
    * @author Manveen Kaur
  + * @author Amy Roh
    * @version $Revision$ $Date$
    */
   
  @@ -272,6 +273,34 @@
   
               ObjectName roname = new ObjectName(rObjectName);
   
  +            attribute = "connectionName";
  +            String connectionName = rform.getConnectionName();
  +            if ((connectionName != null) && (connectionName.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("connectionName",  connectionName));
  +            }
  +
  +            attribute = "connectionPassword";
  +            String connectionPassword = rform.getConnectionPassword();
  +            if ((connectionPassword != null) && (connectionPassword.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("connectionPassword",  connectionPassword));
  +            }
  +
  +            attribute = "connectionURL";
  +            String connectionURL = rform.getConnectionURL();
  +            if ((connectionURL != null) && (connectionURL.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("connectionURL",  connectionURL));
  +            }
  +
  +            attribute = "contextFactory";
  +            String contextFactory = rform.getContextFactory();
  +            if ((contextFactory != null) && (contextFactory.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("contextFactory",  contextFactory));
  +            }
  +
               attribute = "debug";
               int debug = 0;
               try {
  @@ -280,67 +309,84 @@
                   debug = 0;
               }
               mBServer.setAttribute(roname,
  -                                  new Attribute("debug", new Integer(debug)));
  +                            new Attribute("debug", new Integer(debug)));
   
               attribute = "digest";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("digest",  rform.getDigest()));
  +            String digest = rform.getDigest();
  +            if ((digest != null) && (digest.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                                        new Attribute("digest", digest));
  +            }
   
  -            attribute = "roleSearch";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("roleSearch",  rform.getRolePattern()));
  +            attribute = "roleBase";
  +            String roleBase = rform.getRoleBase();
  +            if ((roleBase != null) && (roleBase.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("roleBase",  roleBase));
  +            }
   
               attribute = "roleName";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("roleName",  rform.getRoleName()));
  -
  -            attribute = "userRoleName";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("userRoleName",  rform.getUserRoleName()));
  -
  -            attribute = "contextFactory";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("contextFactory",  rform.getContextFactory()));
  +            String roleName = rform.getRoleName();
  +            if ((roleName != null) && (roleName.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("roleName",  roleName));
  +            }
   
  -            attribute = "userSubtree";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("userSubtree",  new Boolean(rform.getUserSubtree())));
  +            attribute = "rolePattern";
  +            String rolePattern = rform.getRolePattern();
  +            if ((rolePattern != null) && (rolePattern.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("rolePattern",  rolePattern));
  +            }
   
               attribute = "roleSubtree";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("roleSubtree",  new Boolean(rform.getRoleSubtree())));
  +            String roleSubtree = rform.getRoleSubtree();
  +            if ((roleSubtree != null) && (roleSubtree.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                    new Attribute("roleSubtree",  new Boolean(roleSubtree)));
  +            }
   
  -            attribute = "roleBase";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("roleBase",  rform.getRoleBase()));
  +            attribute = "userBase";
  +            String userBase = rform.getUserBase();
  +            if ((userBase != null) && (userBase.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("userBase",  userBase));
  +            }
   
               attribute = "userPassword";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("userPassword",  rform.getUserPassword()));
  -
  -            attribute = "userBase";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("userBase",  rform.getUserBase()));
  +            String userPassword = rform.getUserPassword();
  +            if ((userPassword != null) && (userPassword.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("userPassword",  userPassword));
  +            }
   
               attribute = "userPattern";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("userPattern",  rform.getUserPattern()));
  -
  -            attribute = "userSearch";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("userSearch",  rform.getUserSearch()));
  +            String userPattern = rform.getUserPattern();
  +            if ((userPattern != null) && (userPattern.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("userPattern",  userPattern));
  +            }
   
  -            attribute = "connectionName";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("connectionName",  rform.getConnectionName()));
  +            attribute = "userRoleName";
  +            String userRoleName = rform.getUserRoleName();
  +            if ((userRoleName != null) && (userRoleName.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("userRoleName",  userRoleName));
  +            }
   
  -            attribute = "connectionURL";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("connectionURL",  rform.getConnectionURL()));
  +            attribute = "userSearch";
  +            String userSearch = rform.getUserSearch();
  +            if ((userSearch != null) && (userSearch.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                        new Attribute("userSearch",  userSearch));
  +            }
   
  -            attribute = "connectionPassword";
  -            mBServer.setAttribute(roname,
  -                                  new Attribute("connectionPassword",  rform.getConnectionPassword()));
  +            attribute = "userSubtree";
  +            String userSubtree = rform.getUserSubtree();
  +            if ((userSubtree != null) && (userSubtree.length()>0)) {
  +                mBServer.setAttribute(roname,
  +                    new Attribute("userSubtree",  new Boolean(userSubtree)));
  +            }
   
           } catch (Exception e) {
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>