[mashup-dev] svn commit r12127 - trunk/mashup/java/modules/core/src/org/wso2/mashup/realm/wsas

svn at wso2.org svn at wso2.org
Thu Jan 10 21:06:44 PST 2008


Author: dimuthul
Date: Thu Jan 10 21:06:41 2008
New Revision: 12127

Log:

Fixing user delete problem


Modified:
   trunk/mashup/java/modules/core/src/org/wso2/mashup/realm/wsas/HybridUserStoreAdmin.java

Modified: trunk/mashup/java/modules/core/src/org/wso2/mashup/realm/wsas/HybridUserStoreAdmin.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/realm/wsas/HybridUserStoreAdmin.java	(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/realm/wsas/HybridUserStoreAdmin.java	Thu Jan 10 21:06:41 2008
@@ -1,5 +1,6 @@
 package org.wso2.mashup.realm.wsas;
 
+import java.rmi.ServerException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -9,25 +10,25 @@
 import javax.sql.DataSource;
 
 import org.apache.axis2.AxisFault;
+import org.wso2.mashup.MashupConstants;
 import org.wso2.usermanager.UserManagerException;
 import org.wso2.usermanager.UserStoreAdmin;
 import org.wso2.usermanager.readwrite.DefaultUserStoreAdmin;
-import org.wso2.utils.ServerException;
 import org.wso2.wsas.admin.service.UserAdmin;
-import org.wso2.mashup.MashupConstants;
 
-public class HybridUserStoreAdmin extends HybridUserStoreReader implements UserStoreAdmin {
-    
+public class HybridUserStoreAdmin
+        extends HybridUserStoreReader implements UserStoreAdmin {
+
     private UserStoreAdmin defaultAdmin = null;
-    
+
     protected DataSource dataSource = null;
-    
-    public HybridUserStoreAdmin(DataSource dSource) throws UserManagerException{
+
+    public HybridUserStoreAdmin(DataSource dSource) throws UserManagerException {
         super(dSource);
         HybridSQLStorage store = new HybridSQLStorage();
         defaultAdmin = new DefaultUserStoreAdmin(dSource, store);
     }
-    
+
     public void addRole(String roleName) throws UserManagerException {
         try {
             UserAdmin admin = new UserAdmin();
@@ -42,7 +43,8 @@
             throws UserManagerException {
         try {
             UserAdmin admin = new UserAdmin();
-            admin.addUser(userName, (String) credential, MashupConstants.MASHUP_USER_ROLE, "");
+            admin.addUser(userName, (String) credential,
+                    MashupConstants.MASHUP_USER_ROLE, "");
         } catch (AxisFault e) {
             throw new UserManagerException(e.getMessage());
         }
@@ -66,7 +68,7 @@
             UserAdmin admin = new UserAdmin();
             admin.deleteRoleCompletely(roleName);
             defaultAdmin.setRoleProperties(roleName, new HashMap());
-            
+
             try {
                 dbConnection = dataSource.getConnection();
                 PreparedStatement deleteUserStmt = dbConnection
@@ -77,18 +79,17 @@
                 deleteUserStmt.close();
             } catch (SQLException e) {
                 throw new UserManagerException("errorModifyingUserStore", e);
-            } 
-            
-            
+            }
+
         } catch (AxisFault e) {
             throw new UserManagerException(e.getMessage());
         } finally {
             try {
-                if(dbConnection != null){
+                if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserManagerException("errorClosingConnection",e);
+                throw new UserManagerException("errorClosingConnection", e);
             }
         }
 
@@ -100,28 +101,24 @@
             UserAdmin admin = new UserAdmin();
             admin.deleteUser(userName);
             defaultAdmin.setUserProperties(userName, new HashMap());
-                     
-            try {
-                dbConnection = dataSource.getConnection();
-                PreparedStatement deleteUserStmt = dbConnection
-                        .prepareStatement(HybridSQLStorage.DELETE_USER_PERMISSION);
-                deleteUserStmt.setString(1, userName);
-                deleteUserStmt.executeUpdate();
-                dbConnection.commit();
-                deleteUserStmt.close();
-            } catch (SQLException e) {
-                throw new UserManagerException("errorModifyingUserStore", e);
-            }  
-            
+            dbConnection = dataSource.getConnection();
+            PreparedStatement deleteUserStmt = dbConnection
+                    .prepareStatement(HybridSQLStorage.DELETE_USER_PERMISSION);
+            deleteUserStmt.setString(1, userName);
+            deleteUserStmt.executeUpdate();
+            dbConnection.commit();
+            deleteUserStmt.close();
+        } catch (SQLException e) {
+            throw new UserManagerException("errorModifyingUserStore", e);
         } catch (AxisFault e) {
             throw new UserManagerException(e.getMessage());
         } finally {
             try {
-                if(dbConnection != null){
+                if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserManagerException("errorClosingConnection",e);
+                throw new UserManagerException("errorClosingConnection", e);
             }
         }
     }
@@ -163,9 +160,9 @@
         }
 
     }
-    
+
     public void updateUser(String userName, Object newCredential)
-            throws UserManagerException{
+            throws UserManagerException {
         throw new UserManagerException("Unsupported Operation for WSAS Realm");
     }
 



More information about the Mashup-dev mailing list