amyroh 2004/04/16 19:50:26 Modified: catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java mbeans-descriptors.xml catalina/src/share/org/apache/catalina/realm mbeans-descriptors.xml Log: Add DataSourceRealm support in admin webapp. Revision Changes Path 1.24 +36 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java Index: MBeanFactory.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- MBeanFactory.java 24 Mar 2004 20:00:22 -0000 1.23 +++ MBeanFactory.java 17 Apr 2004 02:50:26 -0000 1.24 @@ -45,6 +45,7 @@ import org.apache.catalina.logger.FileLogger; import org.apache.catalina.logger.SystemErrLogger; import org.apache.catalina.logger.SystemOutLogger; +import org.apache.catalina.realm.DataSourceRealm; import org.apache.catalina.realm.JDBCRealm; import org.apache.catalina.realm.JNDIRealm; import org.apache.catalina.realm.MemoryRealm; @@ -340,6 +341,40 @@ } + /** + * Create a new DataSource Realm. + * + * @param parent MBean Name of the associated parent component + * + * @exception Exception if an MBean cannot be created or registered + */ + public String createDataSourceRealm(String parent, String dataSourceName, + String roleNameCol, String userCredCol, String userNameCol, + String userRoleTable, String userTable) throws Exception { + + // Create a new DataSourceRealm instance + DataSourceRealm realm = new DataSourceRealm(); + realm.setDataSourceName(dataSourceName); + realm.setRoleNameCol(roleNameCol); + realm.setUserCredCol(userCredCol); + realm.setUserNameCol(userNameCol); + realm.setUserRoleTable(userRoleTable); + realm.setUserTable(userTable); + + // Add the new instance to its parent component + ObjectName pname = new ObjectName(parent); + ContainerBase containerBase = getParentContainerFromParent(pname); + // Add the new instance to its parent component + containerBase.setRealm(realm); + // Return the corresponding MBean name + ObjectName oname = realm.getObjectName(); + if (oname != null) { + return (oname.toString()); + } else { + return null; + } + + } /** * Create a new DefaultContext. 1.25 +30 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/mbeans-descriptors.xml Index: mbeans-descriptors.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/mbeans-descriptors.xml,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- mbeans-descriptors.xml 19 Aug 2003 16:13:37 -0000 1.24 +++ mbeans-descriptors.xml 17 Apr 2004 02:50:26 -0000 1.25 @@ -35,6 +35,36 @@ type="int"/> </operation> + <operation name="createDataSourceRealm" + description="Create a new DataSource Realm" + impact="ACTION" + returnType="java.lang.String"> + <parameter name="parent" + description="MBean Name of the associated parent component" + type="java.lang.String"/> + <parameter name="dataSourceName" + description="The JNDI named JDBC DataSource" + type="java.lang.String"/> + <parameter name="roleNameCol" + description="The column in the user role table that names a role" + type="java.lang.String"/> + <parameter name="userCredCol" + description="The column in the user table that holds the user's + credentials" + type="java.lang.String"/> + <parameter name="userNameCol" + description="The column in the user table that holds the user's + username" + type="java.lang.String"/> + <parameter name="userRoleTable" + description="The table that holds the relation between user's and + roles" + type="java.lang.String"/> + <parameter name="userTable" + description="The table that holds user data" + type="java.lang.String"/> + </operation> + <operation name="createDefaultContext" description="Create a new DefaultContext" impact="ACTION" 1.4 +5 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/mbeans-descriptors.xml Index: mbeans-descriptors.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/mbeans-descriptors.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mbeans-descriptors.xml 29 Jan 2004 10:47:39 -0000 1.3 +++ mbeans-descriptors.xml 17 Apr 2004 02:50:26 -0000 1.4 @@ -8,6 +8,11 @@ group="Realm" type="org.apache.catalina.realm.DataSourceRealm"> + <attribute name="className" + description="Fully qualified class name of the managed object" + type="java.lang.String" + writeable="false"/> + <attribute name="dataSourceName" description="The JNDI named JDBC DataSource for your database" type="java.lang.String"/>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]