tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm AddRealmAction.java EditRealmAction.java
Date Sat, 17 Apr 2004 02:50:41 GMT
amyroh      2004/04/16 19:50:41

  Modified:    webapps/admin/WEB-INF struts-config.xml
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        ApplicationResources.properties
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm
                        AddRealmAction.java EditRealmAction.java
  Log:
  Add DataSourceRealm support in admin webapp.
  
  Revision  Changes    Path
  1.6       +14 -0     jakarta-tomcat-catalina/webapps/admin/WEB-INF/struts-config.xml
  
  Index: struts-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/struts-config.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- struts-config.xml	31 Jul 2003 15:39:13 -0000	1.5
  +++ struts-config.xml	17 Apr 2004 02:50:41 -0000	1.6
  @@ -56,6 +56,9 @@
   
       <!-- ============= Realm Module ============= -->
   
  +    <form-bean      name="dataSourceRealmForm"
  +                    type="org.apache.webapp.admin.realm.DataSourceRealmForm"/>
  +
       <form-bean      name="jdbcRealmForm"
                       type="org.apache.webapp.admin.realm.JDBCRealmForm"/>
   
  @@ -288,6 +291,10 @@
   
       <!-- ============ Realm Module ============== -->
   
  +    <forward        name="DataSourceRealm"
  +                    path="/realm/dataSourceRealm.jsp"
  +                redirect="false"/>
  +
       <forward        name="JDBCRealm"
                       path="/realm/jdbcRealm.jsp"
                   redirect="false"/>
  @@ -663,6 +670,13 @@
                  type="org.apache.webapp.admin.realm.SaveUserDatabaseRealmAction"
                  name="userDatabaseRealmForm"
                 input="/realm/userDatabaseRealm.jsp"
  +               scope="session"/>
  +
  +   <!-- Perform Save DataSource Realm transaction -->
  +    <action    path="/SaveDataSourceRealm"
  +               type="org.apache.webapp.admin.realm.SaveDataSourceRealmAction"
  +               name="dataSourceRealmForm"
  +              input="/realm/dataSourceRealm.jsp"
                  scope="session"/>
   
      <!-- Perform Save JDBC Realm transaction -->
  
  
  
  1.3       +7 -0      jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources.properties
  
  Index: ApplicationResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ApplicationResources.properties	9 Apr 2004 17:35:33 -0000	1.2
  +++ ApplicationResources.properties	17 Apr 2004 02:50:41 -0000	1.3
  @@ -226,6 +226,7 @@
   error.jdbcrealm=Error occured during setting JDBCRealm.
   error.jndirealm=Error occured during setting JNDIRealm.
   error.userdbrealm=Error occured during setting UserdatabaseRealm.
  +error.datasourcerealm=Error occured during setting DataSourceRealm.
   error.realmName.bad=Invalid realm name {0}
   error.realmName.required=<li>Realm Name required.</li>
   error.realmName.exists=<li>A realm already exists.</li>
  @@ -266,6 +267,9 @@
   realm.userPassword=User Password
   realm.userPattern=User Pattern
   realm.userSearch=User Search
  +realm.dataSourceName=DataSource Name
  +realm.localDataSource=Local DataSource
  +realm.userCredCol=User Credential Column 
   valve.access.properties=Access Logger Properties
   valve.request.properties=Request Filter Properties
   valve.single.properties=Single SignOn Valve Properties
  @@ -310,6 +314,9 @@
   error.connPassword.required=<li>Connection password is required.</li>
   error.connURL.required=<li>Connection URL is required.</li>
   error.connName.required=<li>Connection name is required.</li>
  +error.dataSourceName.required=<li>DataSource name is required.</li>
  +error.userCredCol.required=<li>User credential is required.</li>
  +error.userRoleTable.required=<li>User role table is required.</li>
   
   # ---------- Server Module ----------
   server.service.treeBuilder.subtreeNode=Service
  
  
  
  1.7       +29 -5     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/AddRealmAction.java
  
  Index: AddRealmAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/AddRealmAction.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AddRealmAction.java	27 Feb 2004 14:59:03 -0000	1.6
  +++ AddRealmAction.java	17 Apr 2004 02:50:41 -0000	1.7
  @@ -82,17 +82,18 @@
   
           // Fill in the form values for display and editing
   
  -        String realmTypes[] = new String[4];
  +        String realmTypes[] = new String[5];
           realmTypes[0] = "UserDatabaseRealm";
           realmTypes[1] = "JNDIRealm";
           realmTypes[2] = "MemoryRealm";
           realmTypes[3] = "JDBCRealm";
  +        realmTypes[4] = "DataSourceRealm";
   
           String parent = request.getParameter("parent");
           String type = request.getParameter("type");
           if (type == null)
               type = "UserDatabaseRealm";    // default type is UserDatabaseRealm
  -
  +        
           types = new ArrayList();
           // the first element in the select list should be the type selected
           types.add(new LabelValueBean(type,
  @@ -112,9 +113,10 @@
               createJNDIRealm(session, parent);
           } else if ("MemoryRealm".equalsIgnoreCase(type)) {
               createMemoryRealm(session, parent);
  -        } else {
  -            //JDBC
  +        } else if ("JDBCRealm".equalsIgnoreCase(type)){
               createJDBCRealm(session, parent);
  +        } else if ("DataSourceRealm".equalsIgnoreCase(type)) {
  +            createDataSourceRealm(session, parent);
           }
           // Forward to the realm display page
           return (mapping.findForward(type));
  @@ -207,7 +209,29 @@
           realmFm.setDebugLvlVals(Lists.getDebugLevels());
           realmFm.setRealmTypeVals(types);
       }
  +    
  +    private void createDataSourceRealm(HttpSession session, String parent) {
   
  +        DataSourceRealmForm realmFm = new DataSourceRealmForm();
  +        session.setAttribute("dataSourceRealmForm", realmFm);
  +        realmFm.setAdminAction("Create");
  +        realmFm.setObjectName("");
  +        realmFm.setParentObjectName(parent);
  +        String realmType = "DataSourceRealm";
  +        realmFm.setNodeLabel("Realm (" + realmType + ")");
  +        realmFm.setRealmType(realmType);
  +        realmFm.setDebugLvl("0");
  +        realmFm.setDataSourceName("");
  +        realmFm.setDigest("");
  +        realmFm.setLocalDataSource("false");
  +        realmFm.setRoleNameCol("");
  +        realmFm.setUserCredCol("");
  +        realmFm.setUserNameCol("");
  +        realmFm.setUserRoleTable("");
  +        realmFm.setUserTable("");
  +        realmFm.setDebugLvlVals(Lists.getDebugLevels());
  +        realmFm.setRealmTypeVals(types);
  +    }
   
   
   }
  
  
  
  1.6       +66 -2     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/EditRealmAction.java
  
  Index: EditRealmAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/EditRealmAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EditRealmAction.java	4 Mar 2004 18:44:51 -0000	1.5
  +++ EditRealmAction.java	17 Apr 2004 02:50:41 -0000	1.6
  @@ -151,8 +151,10 @@
                  setUpMemoryRealm(rname, response);
           } else if ("JDBCRealm".equalsIgnoreCase(realmType)) {
                  setUpJDBCRealm(rname, response);
  -        } else {
  +        } else if ("JNDIRealm".equalsIgnoreCase(realmType)) {
                  setUpJNDIRealm(rname, response);
  +        } else if ("DataSourceRealm".equalsIgnoreCase(realmType)) {
  +                setUpDataSourceRealm(rname, response);
           }
   
           return (mapping.findForward(realmType));
  @@ -382,6 +384,68 @@
                   ((String) mBServer.getAttribute(rname, attribute));
               attribute = "connectionURL";
               realmFm.setConnectionURL
  +                ((String) mBServer.getAttribute(rname, attribute));
  +
  +        } catch (Throwable t) {
  +            getServlet().log
  +                (resources.getMessage(locale, "users.error.attribute.get",
  +                                      attribute), t);
  +            response.sendError
  +                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  +                 resources.getMessage(locale, "users.error.attribute.get",
  +                                      attribute));
  +        }
  +    }
  +
  +    private void setUpDataSourceRealm(ObjectName rname,
  +                                        HttpServletResponse response)
  +    throws IOException {
  +        // Fill in the form values for display and editing
  +        DataSourceRealmForm realmFm = new DataSourceRealmForm();
  +        session.setAttribute("dataSourceRealmForm", realmFm);
  +        realmFm.setAdminAction("Edit");
  +        realmFm.setObjectName(rname.toString());
  +        String realmType = "DataSourceRealm";
  +        StringBuffer sb = new StringBuffer();
  +        sb.append(resources.getMessage(locale, "server.service.treeBuilder.realm"));
  +        sb.append(" (");
  +        sb.append(realmType);
  +        sb.append(")");
  +        realmFm.setNodeLabel(sb.toString());
  +        realmFm.setRealmType(realmType);
  +        realmFm.setDebugLvlVals(Lists.getDebugLevels());
  +        realmFm.setAllowDeletion(allowDeletion(rname));
  +
  +        String attribute = null;
  +        try {
  +
  +            // Copy scalar properties
  +            attribute = "dataSourceName";
  +            realmFm.setDataSourceName
  +                ((String) mBServer.getAttribute(rname, attribute));
  +            attribute = "debug";
  +            realmFm.setDebugLvl
  +                (((Integer) mBServer.getAttribute(rname, attribute)).toString());
  +            attribute = "digest";
  +            realmFm.setDigest
  +                ((String) mBServer.getAttribute(rname, attribute));
  +            attribute = "localDataSource";
  +            realmFm.setLocalDataSource
  +                (((Boolean) mBServer.getAttribute(rname, attribute)).toString());
  +            attribute = "roleNameCol";
  +            realmFm.setRoleNameCol
  +                ((String) mBServer.getAttribute(rname, attribute));
  +            attribute = "userCredCol";
  +            realmFm.setUserCredCol
  +                ((String) mBServer.getAttribute(rname, attribute));
  +            attribute = "userNameCol";
  +            realmFm.setUserNameCol
  +                ((String) mBServer.getAttribute(rname, attribute));
  +            attribute = "userRoleTable";
  +            realmFm.setUserRoleTable
  +                ((String) mBServer.getAttribute(rname, attribute));
  +            attribute = "userTable";
  +            realmFm.setUserTable
                   ((String) mBServer.getAttribute(rname, attribute));
   
           } catch (Throwable t) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message