[Registry-dev] svn commit r14566 - in trunk/registry/modules/core/src/main/java/org/wso2/registry/users: accesscontrol def def/util

svn at wso2.org svn at wso2.org
Thu Mar 6 22:09:31 PST 2008


Author: dimuthul
Date: Thu Mar  6 22:09:16 2008
New Revision: 14566

Log:

Formatting the code according to the Registry standards

I hope I got it right.



Modified:
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAccessControlAdmin.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAuthorizer.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreAdmin.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreReader.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealm.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealmConfig.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAccessControlAdmin.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthenticator.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthorizer.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultDataSupplier.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealm.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealmConfig.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreAdmin.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreReader.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/util/DefaultDatabaseUtil.java

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAccessControlAdmin.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAccessControlAdmin.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAccessControlAdmin.java	Thu Mar  6 22:09:16 2008
@@ -82,8 +82,8 @@
     /**
      * Removes granted access from user
      */
-    public void clearUserAuthorization(String userName, String resourceId,
-            String action) throws UserStoreException {
+    public void clearUserAuthorization(String userName, String resourceId, String action)
+            throws UserStoreException {
         doAuthorizationToAuthorize();
         admin.clearUserAuthorization(userName, resourceId, action);
     }
@@ -91,8 +91,8 @@
     /**
      * Removes granted access from Role
      */
-    public void clearRoleAuthorization(String roleName, String resourceId,
-            String action) throws UserStoreException {
+    public void clearRoleAuthorization(String roleName, String resourceId, String action)
+            throws UserStoreException {
         doAuthorizationToAuthorize();
         admin.clearRoleAuthorization(roleName, resourceId, action);
     }
@@ -100,8 +100,7 @@
     /**
      * Clears all authorizations on a Role
      */
-    public void clearResourceAuthorizations(String resourceId)
-            throws UserStoreException {
+    public void clearResourceAuthorizations(String resourceId) throws UserStoreException {
         doAuthorizationToAuthorize();
         admin.clearResourceAuthorizations(resourceId);
     }
@@ -119,12 +118,10 @@
 
         if (config.isEnableAdminBehavior() && isAdmin) {
             // do nothing user is authenticated
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.USER_RESOURCE, AccessControlConstants.READ)) {
             throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
-                    AccessControlConstants.USER_RESOURCE,
-                    AccessControlConstants.READ }));
+                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.READ }));
         }
     }
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAuthorizer.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAuthorizer.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLAuthorizer.java	Thu Mar  6 22:09:16 2008
@@ -33,8 +33,7 @@
         this.authorizer = athzr;
         config = authConfig;
         if (config.isEnableAdminBehavior()
-                && ACLAdminChecker.isAdminUser(config
-                        .getAuthenticatedUserName())) {
+                && ACLAdminChecker.isAdminUser(config.getAuthenticatedUserName())) {
             isAdmin = true;
         }
     }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreAdmin.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreAdmin.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreAdmin.java	Thu Mar  6 22:09:16 2008
@@ -22,8 +22,6 @@
 import org.wso2.registry.users.UserStoreAdmin;
 import org.wso2.registry.users.UserStoreException;
 
-
-
 /**
  * Manipulates data in the User Store
  * 
@@ -46,17 +44,14 @@
     /**
      * Add user to the user store
      */
-    public void addUser(String userName, Object credential)
-            throws UserStoreException {
+    public void addUser(String userName, Object credential) throws UserStoreException {
         if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.USER_RESOURCE, AccessControlConstants.ADD)) {
 
             throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
-                    AccessControlConstants.USER_RESOURCE,
-                   AccessControlConstants.ADD }));
+                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.ADD }));
         }
         usAdmin.addUser(userName, credential);
     }
@@ -64,31 +59,28 @@
     /**
      * Update user in the user store
      */
-    public void updateUser(String userName, Object newCredential,
-            Object oldCredential) throws UserStoreException {
+    public void updateUser(String userName, Object newCredential, Object oldCredential)
+            throws UserStoreException {
 
         if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT)) {
 
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized",new String[] {
-                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT}));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT }));
         }
         usAdmin.updateUser(userName, newCredential, oldCredential);
     }
 
-    public void updateUser(String userName, Object newCredential)
-            throws UserStoreException {
+    public void updateUser(String userName, Object newCredential) throws UserStoreException {
         if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT)) {
 
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", 
-                    new String[]{AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT}));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT }));
         }
         usAdmin.updateUser(userName, newCredential);
     }
@@ -107,12 +99,10 @@
             return;
         } else if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer
-                .isUserAuthorized(config.getAuthenticatedUserName(),
-                        AccessControlConstants.USER_RESOURCE,
-                        AccessControlConstants.DELETE)) {
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{AccessControlConstants.USER_RESOURCE,
-                    AccessControlConstants.DELETE} ));
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
+                AccessControlConstants.USER_RESOURCE, AccessControlConstants.DELETE)) {
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.DELETE }));
         }
         usAdmin.deleteUser(userName);
     }
@@ -120,19 +110,17 @@
     /**
      * Set user properties in the user store
      */
-    public void setUserProperties(String userName, Map properties)
-            throws UserStoreException {
+    public void setUserProperties(String userName, Map properties) throws UserStoreException {
         if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
         } else if (config.getAuthenticatedUserName().equals(userName)
                 && config.isCurrentUserEditable()) {
             // do nothing - authorized
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT)) {
 
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT} ));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT }));
         }
         usAdmin.setUserProperties(userName, properties);
     }
@@ -143,11 +131,10 @@
     public void addRole(String roleName) throws UserStoreException {
         if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD)) {
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD} ));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD }));
         }
         usAdmin.addRole(roleName);
     }
@@ -156,19 +143,15 @@
      * Delete role from user store
      */
     public void deleteRole(String roleName) throws UserStoreException {
-        if (config.isEnableAdminBehavior()
-                && config.getAdminRoleName().equals(roleName)) {
+        if (config.isEnableAdminBehavior() && config.getAdminRoleName().equals(roleName)) {
             return;
         } else if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer
-                .isUserAuthorized(config.getAuthenticatedUserName(),
-                        AccessControlConstants.ROLE_RESOURCE,
-                        AccessControlConstants.DELETE)) {
-
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.ROLE_RESOURCE,
-                    AccessControlConstants.DELETE} ));
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
+                AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.DELETE)) {
+
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.DELETE }));
         }
         usAdmin.deleteRole(roleName);
     }
@@ -176,19 +159,16 @@
     /**
      * Set role properties in the user store
      */
-    public void setRoleProperties(String roleName, Map properties)
-            throws UserStoreException {
-        if (config.isEnableAdminBehavior()
-                && config.getAdminRoleName().equals(roleName)) {
+    public void setRoleProperties(String roleName, Map properties) throws UserStoreException {
+        if (config.isEnableAdminBehavior() && config.getAdminRoleName().equals(roleName)) {
             return;
         } else if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.EDIT)) {
 
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.EDIT} ));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.EDIT }));
         }
         usAdmin.setRoleProperties(roleName, properties);
     }
@@ -196,10 +176,8 @@
     /**
      * Add user to role
      */
-    public void addUserToRole(String userName, String roleName)
-            throws UserStoreException {
-        if (config.isEnableAdminBehavior()
-                && config.getAdminRoleName().equals(roleName)) {
+    public void addUserToRole(String userName, String roleName) throws UserStoreException {
+        if (config.isEnableAdminBehavior() && config.getAdminRoleName().equals(roleName)) {
             /*
              * TODO : is there a requirement to perform this action if the
              * caller is a Admin
@@ -207,12 +185,11 @@
             return;
         } else if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD)) {
 
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD} ));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD }));
         }
         usAdmin.addUserToRole(userName, roleName);
     }
@@ -220,10 +197,8 @@
     /**
      * Delete user from role
      */
-    public void removeUserFromRole(String userName, String roleName)
-            throws UserStoreException {
-        if (config.isEnableAdminBehavior()
-                && config.getAdminRoleName().equals(roleName)) {
+    public void removeUserFromRole(String userName, String roleName) throws UserStoreException {
+        if (config.isEnableAdminBehavior() && config.getAdminRoleName().equals(roleName)) {
             /*
              * TODO : is there a requirement to perform this action if the
              * caller is a Admin
@@ -231,19 +206,13 @@
             return;
         } else if (config.isEnableAdminBehavior() && isAdmin) {
             // authorized
-        } else if (!authorizer
-                .isUserAuthorized(config.getAuthenticatedUserName(),
-                        AccessControlConstants.ROLE_RESOURCE,
-                        AccessControlConstants.DELETE)) {
-
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.ROLE_RESOURCE,
-                    AccessControlConstants.DELETE} ));
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
+                AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.DELETE)) {
+
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.DELETE }));
         }
         usAdmin.removeUserFromRole(userName, roleName);
     }
 
-    
-    
-
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreReader.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreReader.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/ACLUserStoreReader.java	Thu Mar  6 22:09:16 2008
@@ -22,8 +22,6 @@
 import org.wso2.registry.users.UserStoreException;
 import org.wso2.registry.users.UserStoreReader;
 
-
-
 /**
  * @see org.wso2.usermanager.UserStoreReader
  */
@@ -44,8 +42,7 @@
         this.usReader = reader;
 
         if (config.isEnableAdminBehavior()
-                && ACLAdminChecker.isAdminUser(config
-                        .getAuthenticatedUserName())) {
+                && ACLAdminChecker.isAdminUser(config.getAuthenticatedUserName())) {
             isAdmin = true;
         }
 
@@ -56,16 +53,14 @@
         return usReader.getAllUserNames();
     }
 
-    public String[] getUserNamesWithPropertyValue(String propertyName,
-            String propetyValue) throws UserStoreException {
+    public String[] getUserNamesWithPropertyValue(String propertyName, String propetyValue)
+            throws UserStoreException {
         doAuthorizationToReadUser();
-        return usReader.getUserNamesWithPropertyValue(propertyName,
-                propetyValue);
+        return usReader.getUserNamesWithPropertyValue(propertyName, propetyValue);
     }
 
     public Map getUserProperties(String userName) throws UserStoreException {
-        if (config.getAuthenticatedUserName().equals(userName)
-                && config.isCurrentUserReadable()) {
+        if (config.getAuthenticatedUserName().equals(userName) && config.isCurrentUserReadable()) {
             // do nothing authorized
         } else {
             doAuthorizationToReadUser();
@@ -82,8 +77,8 @@
         doAuthorizationToReadUser();
         return usReader.isExistingUser(userName);
     }
-    
-    public boolean isExistingRole(String roleName) throws UserStoreException{
+
+    public boolean isExistingRole(String roleName) throws UserStoreException {
         doAuthorizationToReadRole();
         return usReader.isExistingUser(roleName);
     }
@@ -92,7 +87,7 @@
         doAuthorizationToReadRole();
         return usReader.getAllRoleNames();
     }
-    
+
     public Map getRoleProperties(String roleName) throws UserStoreException {
         doAuthorizationToReadRole();
         return usReader.getRoleProperties(roleName);
@@ -107,18 +102,15 @@
         doAuthorizationToReadRole();
         return usReader.getUsersInRole(roleName);
     }
-    
-    
 
     protected void doAuthorizationToReadRole() throws UserStoreException {
 
         if (config.isEnableAdminBehavior() && isAdmin) {
             // do nothing user is authenticated
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.READ)) {
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.READ} ));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.READ }));
         }
     }
 
@@ -126,11 +118,10 @@
 
         if (config.isEnableAdminBehavior() && isAdmin) {
             // do nothing user is authenticated
-        } else if (!authorizer.isUserAuthorized(config
-                .getAuthenticatedUserName(),
+        } else if (!authorizer.isUserAuthorized(config.getAuthenticatedUserName(),
                 AccessControlConstants.USER_RESOURCE, AccessControlConstants.READ)) {
-            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
-                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.READ} ));
+            throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
+                    AccessControlConstants.USER_RESOURCE, AccessControlConstants.READ }));
         }
     }
 

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealm.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealm.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealm.java	Thu Mar  6 22:09:16 2008
@@ -50,8 +50,7 @@
 
     AuthorizingRealmConfig config = null;
 
-    public AccessControlAdmin getAccessControlAdmin()
-            throws UserStoreException {
+    public AccessControlAdmin getAccessControlAdmin() throws UserStoreException {
         if (aclAdmin == null) {
             throw new UserStoreException("actionNotSupportedByRealm");
         }
@@ -114,21 +113,18 @@
         this.authorizer = new ACLAuthorizer(authorizer, config);
 
         if (realm.getAccessControlAdmin() != null) {
-            this.aclAdmin = new ACLAccessControlAdmin(authorizer, realm
-                    .getAccessControlAdmin(), config);
+            this.aclAdmin = new ACLAccessControlAdmin(authorizer, realm.getAccessControlAdmin(),
+                    config);
         }
 
         if (realm.getUserStoreAdmin() != null) {
-            this.usAdmin = new ACLUserStoreAdmin(authorizer, realm
-                    .getUserStoreAdmin(), config);
+            this.usAdmin = new ACLUserStoreAdmin(authorizer, realm.getUserStoreAdmin(), config);
         }
 
         if (realm.getUserStoreReader() != null) {
-            this.usReader = new ACLUserStoreReader(authorizer, realm
-                    .getUserStoreReader(), config);
+            this.usReader = new ACLUserStoreReader(authorizer, realm.getUserStoreReader(), config);
             if (config.isEnableAdminBehavior()) {
-                ACLAdminChecker
-                        .loadAdminUsers(config.getAdminRoleName(), realm);
+                ACLAdminChecker.loadAdminUsers(config.getAdminRoleName(), realm);
             }
 
         }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealmConfig.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealmConfig.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/AuthorizingRealmConfig.java	Thu Mar  6 22:09:16 2008
@@ -45,8 +45,7 @@
     }
 
     public AuthorizingRealmConfig(AuthorizingRealmConfig config) {
-        this.authenticatedUserName = new String(config
-                .getAuthenticatedUserName());
+        this.authenticatedUserName = new String(config.getAuthenticatedUserName());
         this.realm = config.getRealm();
         this.isCurrentUserEditable = config.isCurrentUserEditable();
         this.isCurrentUserReadable = config.isCurrentUserReadable();

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAccessControlAdmin.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAccessControlAdmin.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAccessControlAdmin.java	Thu Mar  6 22:09:16 2008
@@ -41,20 +41,17 @@
         super(dataSource, algo);
     }
 
-  
-
     public DefaultAccessControlAdmin(DataSource dataSource) {
         super(dataSource, DefaultRealmConfig.PERMISSION_BLOCK_FIRST);
     }
 
-    public void clearUserAuthorization(String userName, String resourceId,
-            String action) throws UserStoreException {
+    public void clearUserAuthorization(String userName, String resourceId, String action)
+            throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getPermission = dbConnection
@@ -81,16 +78,14 @@
             clearUPStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorModifyingUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
     }
@@ -105,7 +100,7 @@
             throws UserStoreException {
         short allow = 1;
         addAllowDenyRolePermission(roleName, resourceId, action, allow);
-        
+
     }
 
     public void denyRole(String roleName, String resourceId, String action)
@@ -114,14 +109,13 @@
         addAllowDenyRolePermission(roleName, resourceId, action, deny);
     }
 
-    public void clearRoleAuthorization(String roleName, String resourceId,
-            String action) throws UserStoreException {
+    public void clearRoleAuthorization(String roleName, String resourceId, String action)
+            throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getPermission = dbConnection
@@ -150,29 +144,25 @@
             deleteRolesStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorModifyingUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
 
     }
 
-    public void clearResourceAuthorizations(String resourceId)
-            throws UserStoreException {
+    public void clearResourceAuthorizations(String resourceId) throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement clearResourceAuthorizationsStmt = dbConnection
@@ -183,16 +173,14 @@
             clearResourceAuthorizationsStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorModifyingUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
     }
@@ -203,8 +191,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getResourcePermissionStmt = dbConnection
@@ -252,10 +239,8 @@
 
                 while (rsr.next()) {
 
-                    String roleId = rsr
-                            .getString(DefaultRealmConstants.COLUMN_NAME_ROLE_ID);
-                    short allow = rsr
-                            .getShort(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED);
+                    String roleId = rsr.getString(DefaultRealmConstants.COLUMN_NAME_ROLE_ID);
+                    short allow = rsr.getShort(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED);
 
                     addRolePermissionStmt.setInt(1, idPermission);
                     addRolePermissionStmt.setShort(2, allow);
@@ -273,10 +258,8 @@
                         .prepareStatement(DefaultRealmConstants.ADD_USER_PERMISSION_SQL);
 
                 while (rsu.next()) {
-                    String userId = rsu
-                            .getString(DefaultRealmConstants.COLUMN_NAME_USER_ID);
-                    short allow = rsu
-                            .getShort(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED);
+                    String userId = rsu.getString(DefaultRealmConstants.COLUMN_NAME_USER_ID);
+                    short allow = rsu.getShort(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED);
 
                     addUserPermissionStmt.setInt(1, idPermission);
                     addUserPermissionStmt.setShort(2, allow);
@@ -298,16 +281,14 @@
 
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorCopyingAuthorizations"), e);
+            throw new UserStoreException(Messages.getMessage("errorCopyingAuthorizations"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
 
@@ -318,8 +299,6 @@
         short allow = 1;
         addAllowDenyUserPermission(userName, resourceId, action, allow);
     }
-    
-    
 
     /**
      * Gets the permission if it exists, else create the permission and returns
@@ -369,28 +348,24 @@
 
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorModifyingUserStore"), e);
-        } 
+            throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
+        }
 
         return permissionId;
 
     }
-    
-    
-    protected  void addAllowDenyUserPermission(String userName, String resourceId, String action, short allow)
-        throws UserStoreException{
+
+    protected void addAllowDenyUserPermission(String userName, String resourceId, String action,
+            short allow) throws UserStoreException {
         Connection dbConnection = null;
 
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            
-           
+
             int userId = DefaultDatabaseUtil.getUserId(dbConnection, userName);
 
             if (userId == -1) {
@@ -398,7 +373,7 @@
             }
 
             int permissionId = this.getOrAddPermissionId(dbConnection, resourceId, action);
-            
+
             PreparedStatement clearUPStmt = dbConnection
                     .prepareStatement(DefaultRealmConstants.DELETE_USER_PERMISSION_SQL);
             clearUPStmt.setInt(1, userId);
@@ -416,39 +391,36 @@
             clearUPStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorModifyingUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
 
     }
 
-    protected  void addAllowDenyRolePermission(String roleName, String resourceId, String action, short allow)
-                                        throws UserStoreException{
+    protected void addAllowDenyRolePermission(String roleName, String resourceId, String action,
+            short allow) throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             int roleId = DefaultDatabaseUtil.getRoleId(dbConnection, roleName);
-            
+
             if (roleId == -1) {
                 throw new UserStoreException(Messages.getMessage("nullRole"));
             }
 
             int permissionId = this.getOrAddPermissionId(dbConnection, resourceId, action);
-            
+
             PreparedStatement deleteRolesStmt = dbConnection
                     .prepareStatement(DefaultRealmConstants.DELETE_ROLE_PERMISSION_SQL);
             deleteRolesStmt.setInt(1, roleId);
@@ -466,18 +438,16 @@
             deleteRolesStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorModifyingUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
     }
-    
+
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthenticator.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthenticator.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthenticator.java	Thu Mar  6 22:09:16 2008
@@ -32,7 +32,6 @@
 
 import org.wso2.registry.i18n.Messages;
 
-
 /**
  * @see org.wso2.usermanager.Authenticator
  */
@@ -48,12 +47,10 @@
         this.dataSource = dataSource;
     }
 
-    
     /**
      * @see org.wso2.usermanager.Authenticator#authenticate(String, Object)
      */
-    public boolean authenticate(String userName, Object credentials)
-            throws AuthenticatorException {
+    public boolean authenticate(String userName, Object credentials) throws AuthenticatorException {
         boolean isAuth = false;
         Connection dbConnection = null;
         try {
@@ -62,15 +59,15 @@
                 throw new AuthenticatorException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            PreparedStatement getUserStmt = dbConnection.prepareStatement(DefaultRealmConstants.GET_USER_SQL);
+            PreparedStatement getUserStmt = dbConnection
+                    .prepareStatement(DefaultRealmConstants.GET_USER_SQL);
             getUserStmt.setString(1, userName);
             ResultSet rs = getUserStmt.executeQuery();
             if (rs.next()) {
                 if (credentials != null) {
                     MessageDigest dgst = MessageDigest.getInstance("MD5");
                     dgst.update(((String) credentials).getBytes());
-                    String dbCred = rs
-                            .getString(DefaultRealmConstants.COLUMN_NAME_CREDENTIAL);
+                    String dbCred = rs.getString(DefaultRealmConstants.COLUMN_NAME_CREDENTIAL);
                     isAuth = Base64.encode(dgst.digest()).equals(dbCred);
                 }
             }
@@ -93,6 +90,4 @@
         return isAuth;
     }
 
-   
-
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthorizer.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthorizer.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultAuthorizer.java	Thu Mar  6 22:09:16 2008
@@ -31,7 +31,6 @@
 import org.wso2.registry.users.UserStoreException;
 import org.wso2.registry.users.def.util.DefaultDatabaseUtil;
 
-
 /**
  * @see org.wso2.usermanager.Authorizer
  */
@@ -50,9 +49,9 @@
         this.dataSource = dataSource;
         this.algorithm = algo;
     }
-    
-    public boolean isRoleAuthorized(String roleName, String resourceId,
-            String action) throws UserStoreException {
+
+    public boolean isRoleAuthorized(String roleName, String resourceId, String action)
+            throws UserStoreException {
 
         Boolean isAuthorized = getRoleAuthorized(roleName, resourceId, action);
         if (isAuthorized == null) {
@@ -62,15 +61,14 @@
         }
     }
 
-    public boolean isUserAuthorized(String userName, String resourceId,
-            String action) throws UserStoreException {
+    public boolean isUserAuthorized(String userName, String resourceId, String action)
+            throws UserStoreException {
         Boolean isAuthorized = null;
 
         if (algorithm.equals(DefaultRealmConfig.PERMISSION_USER_ONLY)) {
             isAuthorized = getUserAuthorized(userName, resourceId, action);
         } else if (algorithm.equals(DefaultRealmConfig.PERMISSION_BLOCK_FIRST)) {
-            isAuthorized = getUserAuthorizationConsideringRoles(userName,
-                    resourceId, action);
+            isAuthorized = getUserAuthorizationConsideringRoles(userName, resourceId, action);
         }
 
         if (isAuthorized == null) {
@@ -238,8 +236,8 @@
 
     }
 
-    private Boolean getUserAuthorizationConsideringRoles(String userName,
-            String resourceId, String action) throws UserStoreException {
+    private Boolean getUserAuthorizationConsideringRoles(String userName, String resourceId,
+            String action) throws UserStoreException {
         Boolean isAuthorized = getUserAuthorized(userName, resourceId, action);
 
         boolean onceAllowed = false;
@@ -265,11 +263,10 @@
                     throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
                 }
             }
-            
+
             for (int i = 0; i < roles.length; i++) {
                 String roleName = roles[i];
-                Boolean roleAuth = getRoleAuthorized(roleName, resourceId,
-                        action);
+                Boolean roleAuth = getRoleAuthorized(roleName, resourceId, action);
                 if (roleAuth != null) {
                     if (roleAuth.booleanValue() == false) {
                         isAuthorized = roleAuth;
@@ -288,8 +285,8 @@
         return isAuthorized;
     }
 
-    private Boolean getRoleAuthorized(String roleName, String resourceId,
-            String action) throws UserStoreException {
+    private Boolean getRoleAuthorized(String roleName, String resourceId, String action)
+            throws UserStoreException {
         Boolean isAuthorized = null;
         Connection dbConnection = null;
         try {
@@ -305,8 +302,7 @@
             isRoleAuthorizedStmt.setString(3, roleName);
             ResultSet rs = isRoleAuthorizedStmt.executeQuery();
             if (rs.next()) {
-                boolean isAuth = rs
-                        .getBoolean(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED);
+                boolean isAuth = rs.getBoolean(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED);
                 isAuthorized = Boolean.valueOf(isAuth);
             }
             isRoleAuthorizedStmt.close();
@@ -325,8 +321,8 @@
         return isAuthorized;
     }
 
-    private Boolean getUserAuthorized(String userName, String resourceId,
-            String action) throws UserStoreException {
+    private Boolean getUserAuthorized(String userName, String resourceId, String action)
+            throws UserStoreException {
         Boolean result = null;
         Connection dbConnection = null;
         try {
@@ -342,9 +338,8 @@
             isUserAuthorizedStmt.setString(3, userName);
             ResultSet rs = isUserAuthorizedStmt.executeQuery();
             if (rs.next()) {
-                result = Boolean
-                        .valueOf(rs
-                                .getBoolean(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED));
+                result = Boolean.valueOf(rs
+                        .getBoolean(DefaultRealmConstants.COLUMN_NAME_IS_ALLOWED));
             }
             isUserAuthorizedStmt.close();
         } catch (SQLException e) {
@@ -362,6 +357,4 @@
         return result;
     }
 
-    
-
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultDataSupplier.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultDataSupplier.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultDataSupplier.java	Thu Mar  6 22:09:16 2008
@@ -61,5 +61,4 @@
      */
     public String[] getUserRoles(String userName) throws UserStoreException;
 
-    
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealm.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealm.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealm.java	Thu Mar  6 22:09:16 2008
@@ -31,7 +31,6 @@
 import org.wso2.registry.users.UserStoreException;
 import org.wso2.registry.users.UserStoreReader;
 
-
 /**
  * DefaultRealm is used by developers when the need to maintain
  * users from scratch.
@@ -92,17 +91,14 @@
         }
 
         authenticator = new DefaultAuthenticator(dataSource);
-        authorizer = new DefaultAuthorizer(dataSource, config
-                .getPermissionAlgo());
-        aclAdmin = new DefaultAccessControlAdmin(dataSource, config
-                .getPermissionAlgo());
+        authorizer = new DefaultAuthorizer(dataSource, config.getPermissionAlgo());
+        aclAdmin = new DefaultAccessControlAdmin(dataSource, config.getPermissionAlgo());
         usAdmin = new DefaultUserStoreAdmin(dataSource);
         usReader = new DefaultUserStoreReader(dataSource);
 
     }
 
-    public AccessControlAdmin getAccessControlAdmin()
-            throws UserStoreException {
+    public AccessControlAdmin getAccessControlAdmin() throws UserStoreException {
         return aclAdmin;
     }
 

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealmConfig.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealmConfig.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultRealmConfig.java	Thu Mar  6 22:09:16 2008
@@ -57,7 +57,6 @@
     /**Maximum connection count*/
     private int maxConnectionsCount = 5;
 
-    
     public DefaultRealmConfig() {
 
     }
@@ -126,6 +125,4 @@
         this.maxConnectionsCount = maxConnectionsCount;
     }
 
-  
-
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreAdmin.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreAdmin.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreAdmin.java	Thu Mar  6 22:09:16 2008
@@ -35,7 +35,6 @@
 import org.wso2.registry.users.UserStoreException;
 import org.wso2.registry.users.def.util.DefaultDatabaseUtil;
 
-
 /**
  * Manipulates data in the User Store
  * 
@@ -50,9 +49,7 @@
         super(dataSource);
     }
 
-    
-    public void addUser(String userName, Object credential)
-            throws UserStoreException {
+    public void addUser(String userName, Object credential) throws UserStoreException {
 
         if (userName == null || credential == null) {
             throw new UserStoreException(Messages.getMessage("nullData"));
@@ -73,7 +70,8 @@
                 throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            PreparedStatement addUserStmt = dbConnection.prepareStatement(DefaultRealmConstants.ADD_USER_SQL);
+            PreparedStatement addUserStmt = dbConnection
+                    .prepareStatement(DefaultRealmConstants.ADD_USER_SQL);
 
             addUserStmt.setString(1, userName);
             MessageDigest dgst = MessageDigest.getInstance("MD5");
@@ -100,8 +98,8 @@
 
     }
 
-    public void updateUser(String userName, Object newCredential,
-            Object oldCredential) throws UserStoreException {
+    public void updateUser(String userName, Object newCredential, Object oldCredential)
+            throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
@@ -109,7 +107,8 @@
                 throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            PreparedStatement getUserStmt = dbConnection.prepareStatement(DefaultRealmConstants.GET_USER_SQL);
+            PreparedStatement getUserStmt = dbConnection
+                    .prepareStatement(DefaultRealmConstants.GET_USER_SQL);
             getUserStmt.setString(1, userName);
 
             ResultSet rs = getUserStmt.executeQuery();
@@ -117,8 +116,7 @@
                 if (oldCredential != null) {
                     MessageDigest dgst = MessageDigest.getInstance("MD5");
                     dgst.update(((String) oldCredential).getBytes());
-                    String dbCred = rs
-                            .getString(DefaultRealmConstants.COLUMN_NAME_CREDENTIAL);
+                    String dbCred = rs.getString(DefaultRealmConstants.COLUMN_NAME_CREDENTIAL);
                     if (!Base64.encode(dgst.digest()).equals(dbCred)) {
                         throw new UserStoreException(Messages.getMessage("oldPasswordIncorrect"));
                     }
@@ -153,8 +151,7 @@
         }
     }
 
-    public void updateUser(String userName, Object newCredential)
-            throws UserStoreException {
+    public void updateUser(String userName, Object newCredential) throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
@@ -216,9 +213,7 @@
         }
     }
 
-    public void setUserProperties(String userName, Map properties)
-            throws UserStoreException {
-
+    public void setUserProperties(String userName, Map properties) throws UserStoreException {
 
         Connection dbConnection = null;
         try {
@@ -227,12 +222,12 @@
                 throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            
+
             int userid = DefaultDatabaseUtil.getUserId(dbConnection, userName);
             if (userid == -1) {
                 throw new UserStoreException(Messages.getMessage("nullUser"));
             }
-            
+
             PreparedStatement deleteUserPropsStmt = dbConnection
                     .prepareStatement(DefaultRealmConstants.DELETE_USER_ATTRIBUTE_SQL);
             deleteUserPropsStmt.setInt(1, userid);
@@ -272,8 +267,7 @@
 
     }
 
-    public void setRoleProperties(String roleName, Map properties)
-            throws UserStoreException {
+    public void setRoleProperties(String roleName, Map properties) throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
@@ -281,12 +275,12 @@
                 throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            
+
             int roleid = DefaultDatabaseUtil.getRoleId(dbConnection, roleName);
             if (roleid == -1) {
                 throw new UserStoreException(Messages.getMessage("nullRole"));
             }
-            
+
             PreparedStatement deleteRolePropsStmt = dbConnection
                     .prepareStatement(DefaultRealmConstants.DELETE_ROLE_ATTRIBUTE_SQL);
             deleteRolePropsStmt.setInt(1, roleid);
@@ -334,7 +328,8 @@
                 throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            PreparedStatement addRoleStmt = dbConnection.prepareStatement(DefaultRealmConstants.ADD_ROLE_SQL);
+            PreparedStatement addRoleStmt = dbConnection
+                    .prepareStatement(DefaultRealmConstants.ADD_ROLE_SQL);
             addRoleStmt.setString(1, roleName);
             addRoleStmt.execute();
             dbConnection.commit();
@@ -381,8 +376,7 @@
         }
     }
 
-    public void addUserToRole(String userName, String roleName)
-            throws UserStoreException {
+    public void addUserToRole(String userName, String roleName) throws UserStoreException {
 
         Connection dbConnection = null;
         try {
@@ -391,9 +385,9 @@
                 throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
-            
+
             int userid = DefaultDatabaseUtil.getUserId(dbConnection, userName);
-            int roleid = DefaultDatabaseUtil.getRoleId(dbConnection,roleName);
+            int roleid = DefaultDatabaseUtil.getRoleId(dbConnection, roleName);
 
             if (roleid == -1 || userid == -1) {
                 throw new UserStoreException(Messages.getMessage("nullData"));
@@ -420,8 +414,7 @@
         }
     }
 
-    public void removeUserFromRole(String userName, String roleName)
-            throws UserStoreException {
+    public void removeUserFromRole(String userName, String roleName) throws UserStoreException {
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
@@ -450,25 +443,5 @@
         }
     }
 
-    public void addUserProfile(String username, String profileName,
-            boolean isDefault) throws UserStoreException {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void deleteUserProfile(String username, String profileName)
-            throws UserStoreException {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void setUserProfileProperties(String username, String profileName,
-            Map properties) throws UserStoreException {
-        // TODO Auto-generated method stub
-        
-    }
-    
-    
-    
-
+ 
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreReader.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreReader.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/DefaultUserStoreReader.java	Thu Mar  6 22:09:16 2008
@@ -55,8 +55,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getAllRoleNamesStmt = dbConnection
@@ -73,16 +72,14 @@
             getAllRoleNamesStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return names;
@@ -94,8 +91,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getAllUserNamesStmt = dbConnection
@@ -113,16 +109,14 @@
             getAllUserNamesStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return names;
@@ -135,8 +129,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getRolePropertiesStmt = dbConnection
@@ -153,16 +146,14 @@
             getRolePropertiesStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return props;
@@ -175,8 +166,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getUserPropertiesStmt = dbConnection
@@ -193,16 +183,14 @@
             getUserPropertiesStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return props;
@@ -215,8 +203,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getUserAttributeNamesStmt = dbConnection
@@ -231,16 +218,14 @@
             getUserAttributeNamesStmt.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return propNames;
@@ -252,26 +237,23 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             names = DefaultDatabaseUtil.getUserRoles(dbConnection, userName);
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
-        return names;        
+        return names;
     }
 
     public boolean isExistingUser(String userName) throws UserStoreException {
@@ -280,8 +262,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             if (DefaultDatabaseUtil.getUserId(dbConnection, userName) != -1) {
@@ -289,16 +270,14 @@
             }
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return isExisting;
@@ -310,8 +289,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             if (DefaultDatabaseUtil.getRoleId(dbConnection, roleName) != -1) {
@@ -319,31 +297,28 @@
             }
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
 
         return isExisting;
     }
 
-    public String[] getUserNamesWithPropertyValue(String propertyName,
-            String propetyValue) throws UserStoreException {
+    public String[] getUserNamesWithPropertyValue(String propertyName, String propetyValue)
+            throws UserStoreException {
         String[] names = new String[0];
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getPropValue = null;
@@ -369,16 +344,14 @@
             getPropValue.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return names;
@@ -391,8 +364,7 @@
         try {
             dbConnection = dataSource.getConnection();
             if (dbConnection == null) {
-                throw new UserStoreException(Messages
-                        .getMessage("null_connection"));
+                throw new UserStoreException(Messages.getMessage("null_connection"));
             }
             dbConnection.setAutoCommit(false);
             PreparedStatement getUserInRole = dbConnection
@@ -408,21 +380,17 @@
             getUserInRole.close();
         } catch (SQLException e) {
             log.debug(e);
-            throw new UserStoreException(Messages
-                    .getMessage("errorReadingFromUserStore"), e);
+            throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
         } finally {
             try {
                 if (dbConnection != null) {
                     dbConnection.close();
                 }
             } catch (SQLException e) {
-                throw new UserStoreException(Messages
-                        .getMessage("errorClosingConnection"), e);
+                throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
             }
         }
         return names;
     }
 
-
-
 }

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/util/DefaultDatabaseUtil.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/util/DefaultDatabaseUtil.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/util/DefaultDatabaseUtil.java	Thu Mar  6 22:09:16 2008
@@ -24,80 +24,59 @@
 import java.util.List;
 
 import org.wso2.registry.users.UserStoreException;
-import org.wso2.usermanager.UserManagerException;
 import org.wso2.usermanager.readwrite.DefaultRealmConstants;
 
-
 public class DefaultDatabaseUtil {
-// TODO Start -delete
-   public static String userTable = "CREATE TABLE UM_USERS ("
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY," 
-            +"USER_NAME VARCHAR(255) NOT NULL,"
-            +"PASSWORD VARCHAR(255) NOT NULL, "
-            +"PRIMARY KEY (ID), "
-            +"UNIQUE(USER_NAME))";
-
-   public static String userAttributeTable="CREATE TABLE UM_USER_ATTRIBUTES ("
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY," 
-            +"ATTR_NAME VARCHAR(255) NOT NULL,"
-            +"ATTR_VALUE VARCHAR(255), "
-            +"USER_ID INTEGER, "
-            +"FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE," 
-            +"PRIMARY KEY (ID))";
-
-   public static String roleTable="CREATE TABLE UM_ROLES ("
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY, "
-            +"ROLE_NAME VARCHAR(255) NOT NULL, "
-            +"PRIMARY KEY (ID), "
-            +"UNIQUE(ROLE_NAME))";
-
-   public static String roleAttributeTable="CREATE TABLE UM_ROLE_ATTRIBUTES ("
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY, "
-            +"ATTR_NAME VARCHAR(255) NOT NULL, "
-            +"ATTR_VALUE VARCHAR(255), "
-            +"ROLE_ID INTEGER, "
-            +"FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE," 
-            +"PRIMARY KEY (ID))";
-
-   public static String permissionTable="CREATE TABLE UM_PERMISSIONS ("
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY, "
-            +"RESOURCE_ID VARCHAR(255) NOT NULL, "
-            +"ACTION VARCHAR(255) NOT NULL, "
-            +"PRIMARY KEY (ID))";
-
-   public static String rolePermissionTable="CREATE TABLE UM_ROLE_PERMISSIONS ( "
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY, "
-            +"PERMISSION_ID INTEGER NOT NULL, "
-            +"ROLE_ID INTEGER NOT NULL, "
-            +"IS_ALLOWED SMALLINT NOT NULL, "
-            +"UNIQUE (PERMISSION_ID, ROLE_ID), "
-            +"FOREIGN KEY (PERMISSION_ID) REFERENCES UM_PERMISSIONS(ID) ON DELETE  CASCADE, " 
-            +"FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE, "
-            +"PRIMARY KEY (ID))";
-
-   public static String userPermissionTable="CREATE TABLE UM_USER_PERMISSIONS ("
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY, "
-            +"PERMISSION_ID INTEGER NOT NULL, "
-            +"USER_ID INTEGER NOT NULL, "
-            +"IS_ALLOWED SMALLINT NOT NULL, "
-            +"UNIQUE (PERMISSION_ID, USER_ID), "
-            +"FOREIGN KEY (PERMISSION_ID) REFERENCES UM_PERMISSIONS(ID) ON DELETE CASCADE, " 
-            +"FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE, "
-            +"PRIMARY KEY (ID))";
-
-   public static String userRolesTable="CREATE TABLE UM_USER_ROLES ("
-            +"ID INTEGER GENERATED BY DEFAULT AS IDENTITY, " 
-            +"ROLE_ID INTEGER NOT NULL, "
-            +"USER_ID INTEGER NOT NULL, "
-            +"UNIQUE (USER_ID, ROLE_ID), "
-            +"FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE, " 
-            +"FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE, "
-            +"PRIMARY KEY (ID))";
-
+    // TODO Start -delete
+    public static String userTable = "CREATE TABLE UM_USERS ("
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY," + "USER_NAME VARCHAR(255) NOT NULL,"
+            + "PASSWORD VARCHAR(255) NOT NULL, " + "PRIMARY KEY (ID), " + "UNIQUE(USER_NAME))";
+
+    public static String userAttributeTable = "CREATE TABLE UM_USER_ATTRIBUTES ("
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY," + "ATTR_NAME VARCHAR(255) NOT NULL,"
+            + "ATTR_VALUE VARCHAR(255), " + "USER_ID INTEGER, "
+            + "FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE,"
+            + "PRIMARY KEY (ID))";
+
+    public static String roleTable = "CREATE TABLE UM_ROLES ("
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY, " + "ROLE_NAME VARCHAR(255) NOT NULL, "
+            + "PRIMARY KEY (ID), " + "UNIQUE(ROLE_NAME))";
+
+    public static String roleAttributeTable = "CREATE TABLE UM_ROLE_ATTRIBUTES ("
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY, " + "ATTR_NAME VARCHAR(255) NOT NULL, "
+            + "ATTR_VALUE VARCHAR(255), " + "ROLE_ID INTEGER, "
+            + "FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE,"
+            + "PRIMARY KEY (ID))";
+
+    public static String permissionTable = "CREATE TABLE UM_PERMISSIONS ("
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY, "
+            + "RESOURCE_ID VARCHAR(255) NOT NULL, " + "ACTION VARCHAR(255) NOT NULL, "
+            + "PRIMARY KEY (ID))";
+
+    public static String rolePermissionTable = "CREATE TABLE UM_ROLE_PERMISSIONS ( "
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY, " + "PERMISSION_ID INTEGER NOT NULL, "
+            + "ROLE_ID INTEGER NOT NULL, " + "IS_ALLOWED SMALLINT NOT NULL, "
+            + "UNIQUE (PERMISSION_ID, ROLE_ID), "
+            + "FOREIGN KEY (PERMISSION_ID) REFERENCES UM_PERMISSIONS(ID) ON DELETE  CASCADE, "
+            + "FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE, "
+            + "PRIMARY KEY (ID))";
+
+    public static String userPermissionTable = "CREATE TABLE UM_USER_PERMISSIONS ("
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY, " + "PERMISSION_ID INTEGER NOT NULL, "
+            + "USER_ID INTEGER NOT NULL, " + "IS_ALLOWED SMALLINT NOT NULL, "
+            + "UNIQUE (PERMISSION_ID, USER_ID), "
+            + "FOREIGN KEY (PERMISSION_ID) REFERENCES UM_PERMISSIONS(ID) ON DELETE CASCADE, "
+            + "FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE, "
+            + "PRIMARY KEY (ID))";
+
+    public static String userRolesTable = "CREATE TABLE UM_USER_ROLES ("
+            + "ID INTEGER GENERATED BY DEFAULT AS IDENTITY, " + "ROLE_ID INTEGER NOT NULL, "
+            + "USER_ID INTEGER NOT NULL, " + "UNIQUE (USER_ID, ROLE_ID), "
+            + "FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE, "
+            + "FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE, "
+            + "PRIMARY KEY (ID))";
 
-
-    public static void createDatabase(Connection conn) throws SQLException,
-            UserStoreException {
+    public static void createDatabase(Connection conn) throws SQLException, UserStoreException {
 
         Statement s = conn.createStatement();
         s.executeUpdate(userTable);
@@ -111,64 +90,65 @@
         conn.commit();
 
     }
- // TODO End -delete
-    
-     public static int getRoleId(Connection dbConnection, String roleName) throws UserStoreException {
-            int id = -1;
-            try {
-                PreparedStatement getRolIdStmt = dbConnection.prepareStatement(DefaultRealmConstants.GET_ROLE_ID_SQL);
-                getRolIdStmt.setString(1, roleName);
-                ResultSet rs = getRolIdStmt.executeQuery();
-                if (rs.next()) {
-                    id = rs.getInt(DefaultRealmConstants.COLUMN_NAME_ID);
-                }
-
-                getRolIdStmt.close();
-            } catch (SQLException e) {
-                throw new UserStoreException("errorReadingFromUserStore", e);
-            } 
-            return id;
+
+    // TODO End -delete
+
+    public static int getRoleId(Connection dbConnection, String roleName) throws UserStoreException {
+        int id = -1;
+        try {
+            PreparedStatement getRolIdStmt = dbConnection
+                    .prepareStatement(DefaultRealmConstants.GET_ROLE_ID_SQL);
+            getRolIdStmt.setString(1, roleName);
+            ResultSet rs = getRolIdStmt.executeQuery();
+            if (rs.next()) {
+                id = rs.getInt(DefaultRealmConstants.COLUMN_NAME_ID);
+            }
+
+            getRolIdStmt.close();
+        } catch (SQLException e) {
+            throw new UserStoreException("errorReadingFromUserStore", e);
         }
-     
-     public static int getUserId(Connection dbConnection, String userName) throws UserStoreException {
-         int id = -1;
-         try {
-             PreparedStatement getUserIdStmt = dbConnection
-                     .prepareStatement(DefaultRealmConstants.GET_USER_ID_SQL);
-             getUserIdStmt.setString(1, userName);
-             ResultSet rs = getUserIdStmt.executeQuery();
-             if (rs.next()) {
-                 id = rs.getInt(DefaultRealmConstants.COLUMN_NAME_ID);
-             }
-             getUserIdStmt.close();
-         } catch (SQLException e) {
-             throw new UserStoreException("errorReadingFromUserStore", e);
-         }
-         return id;
-     }
-
-     
-     public static String[] getUserRoles(Connection dbConnection, String userName) throws UserStoreException {
-         String[] names = new String[0];
-         try {
-             PreparedStatement getUserRolesStmt = dbConnection
-                     .prepareStatement(DefaultRealmConstants.GET_USER_ROLES_SQL);
-             getUserRolesStmt.setString(1, userName);
-             ResultSet rs = getUserRolesStmt.executeQuery();
-             List lst = new LinkedList();
-             String colName = DefaultRealmConstants.COLUMN_NAME_ROLE_NAME;
-             while (rs.next()) {
-                 lst.add(rs.getString(colName));
-             }
-             if (lst.size() > 0) {
-                 names = (String[]) lst.toArray(new String[lst.size()]);
-             }
-             getUserRolesStmt.close();
-         } catch (SQLException e) {
-             throw new UserStoreException("errorReadingFromUserStore", e);
-         }
-         return names;
-     }
-    
-    
+        return id;
+    }
+
+    public static int getUserId(Connection dbConnection, String userName) throws UserStoreException {
+        int id = -1;
+        try {
+            PreparedStatement getUserIdStmt = dbConnection
+                    .prepareStatement(DefaultRealmConstants.GET_USER_ID_SQL);
+            getUserIdStmt.setString(1, userName);
+            ResultSet rs = getUserIdStmt.executeQuery();
+            if (rs.next()) {
+                id = rs.getInt(DefaultRealmConstants.COLUMN_NAME_ID);
+            }
+            getUserIdStmt.close();
+        } catch (SQLException e) {
+            throw new UserStoreException("errorReadingFromUserStore", e);
+        }
+        return id;
+    }
+
+    public static String[] getUserRoles(Connection dbConnection, String userName)
+            throws UserStoreException {
+        String[] names = new String[0];
+        try {
+            PreparedStatement getUserRolesStmt = dbConnection
+                    .prepareStatement(DefaultRealmConstants.GET_USER_ROLES_SQL);
+            getUserRolesStmt.setString(1, userName);
+            ResultSet rs = getUserRolesStmt.executeQuery();
+            List lst = new LinkedList();
+            String colName = DefaultRealmConstants.COLUMN_NAME_ROLE_NAME;
+            while (rs.next()) {
+                lst.add(rs.getString(colName));
+            }
+            if (lst.size() > 0) {
+                names = (String[]) lst.toArray(new String[lst.size()]);
+            }
+            getUserRolesStmt.close();
+        } catch (SQLException e) {
+            throw new UserStoreException("errorReadingFromUserStore", e);
+        }
+        return names;
+    }
+
 }



More information about the Registry-dev mailing list