[jboss-svn-commits] JBoss Portal SVN: r5531 - in trunk: core/src/resources/portal-core-sar/META-INF identity/src/main/org/jboss/portal/identity/management

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 31 09:49:24 EST 2006


Author: thomas.heute at jboss.com
Date: 2006-10-31 09:49:20 -0500 (Tue, 31 Oct 2006)
New Revision: 5531

Added:
   trunk/identity/src/main/org/jboss/portal/identity/management/Identity.java
   trunk/identity/src/main/org/jboss/portal/identity/management/IdentityMBean.java
Modified:
   trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
Management: Adding User and Roles counts

Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2006-10-31 14:49:15 UTC (rev 5530)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2006-10-31 14:49:20 UTC (rev 5531)
@@ -36,6 +36,20 @@
    </mbean>  
       
    <mbean
+      code="org.jboss.portal.identity.management.Identity"
+      name="portal.management:service=Management,type=Identity,name=Default"
+      >
+      <depends
+         optional-attribute-name="UserModule"
+         proxy-type="attribute">portal:service=Module,type=User</depends>
+      <depends
+         optional-attribute-name="RoleModule"
+         proxy-type="attribute">portal:service=Module,type=Role</depends>
+      <xmbean/>
+   </mbean>  
+
+
+   <mbean
       code="org.jboss.portal.portlet.management.PortletContainerRegistryImpl"
       name="portal:service=Management,type=PortletContainerRegistry,name=Default"
       xmbean-dd=""

Added: trunk/identity/src/main/org/jboss/portal/identity/management/Identity.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/management/Identity.java	2006-10-31 14:49:15 UTC (rev 5530)
+++ trunk/identity/src/main/org/jboss/portal/identity/management/Identity.java	2006-10-31 14:49:20 UTC (rev 5531)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.identity.management;
+
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.UserModule;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class Identity implements IdentityMBean
+{
+   private RoleModule roleModule;
+   
+   private UserModule userModule;
+   
+   public int getUserCount() throws Exception
+   {
+      int nbUsers = 0;
+      InitialContext ctx;
+      ctx = new InitialContext();
+      UserTransaction tx = (UserTransaction)ctx.lookup("UserTransaction");
+      tx.begin();
+      nbUsers = userModule.getUserCount();
+      tx.commit();
+      return nbUsers;
+   }
+
+   public int getRoleCount() throws Exception
+   {
+      int nbRoles = 0;
+      InitialContext ctx;
+      ctx = new InitialContext();
+      UserTransaction tx = (UserTransaction)ctx.lookup("UserTransaction");
+      tx.begin();
+      nbRoles = roleModule.getRolesCount();
+      tx.commit();
+      return nbRoles;
+   }
+   
+   public void setRoleModule(RoleModule roleModule)
+   {
+      this.roleModule = roleModule;
+   }
+
+   public void setUserModule(UserModule userModule)
+   {
+      this.userModule = userModule;
+   }
+}

Added: trunk/identity/src/main/org/jboss/portal/identity/management/IdentityMBean.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/management/IdentityMBean.java	2006-10-31 14:49:15 UTC (rev 5530)
+++ trunk/identity/src/main/org/jboss/portal/identity/management/IdentityMBean.java	2006-10-31 14:49:20 UTC (rev 5531)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.identity.management;
+
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.UserModule;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface IdentityMBean
+{
+   public int getUserCount() throws Exception;
+   
+   public int getRoleCount() throws Exception;
+   
+   public void setRoleModule(RoleModule roleModule);
+   
+   public void setUserModule(UserModule userModule);
+
+}




More information about the jboss-svn-commits mailing list