[Registry-dev] svn commit r14478 - in
trunk/registry/modules/core/src/main: java/org/wso2/registry/users
java/org/wso2/registry/users/accesscontrol
java/org/wso2/registry/users/def
java/org/wso2/registry/users/def/util
java/org/wso2/registry/users/verifier
resources/org/wso2/registry/i18n
svn at wso2.org
svn at wso2.org
Mon Mar 3 21:29:45 PST 2008
Author: dimuthul
Date: Mon Mar 3 21:29:27 2008
New Revision: 14478
Log:
Adding message internationalization.
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/users/UserStoreException.java
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/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/UnauthorizedException.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/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/DefaultDataSupplierImpl.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/users/verifier/EmailVerifier.java
trunk/registry/modules/core/src/main/resources/org/wso2/registry/i18n/resource.properties
Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/UserStoreException.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/UserStoreException.java (original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/UserStoreException.java Mon Mar 3 21:29:27 2008
@@ -1,35 +1,31 @@
package org.wso2.registry.users;
+/**
+ * The exception to throw when a problem with Users go wrong
+ *
+ */
public class UserStoreException extends Exception{
-
+
public UserStoreException() {
super();
- // TODO Auto-generated constructor stub
}
public UserStoreException(String message, Throwable cause) {
super(message, cause);
- // TODO Auto-generated constructor stub
}
public UserStoreException(String message, boolean convertMessage) {
super(message);
- // TODO Auto-generated constructor stub
}
public UserStoreException(String message) {
super(message);
- // TODO Auto-generated constructor stub
}
public UserStoreException(Throwable cause) {
super(cause);
- // TODO Auto-generated constructor stub
}
-
-
-
-
+
}
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 Mon Mar 3 21:29:27 2008
@@ -15,6 +15,7 @@
*/
package org.wso2.registry.users.accesscontrol;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.AccessControlAdmin;
import org.wso2.registry.users.Authorizer;
import org.wso2.registry.users.UserStoreException;
@@ -121,9 +122,9 @@
} else if (!authorizer.isUserAuthorized(config
.getAuthenticatedUserName(),
AccessControlConstants.USER_RESOURCE, AccessControlConstants.READ)) {
- throw new UnauthorizedException("unAuthorized", new String[] {
+ throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
AccessControlConstants.USER_RESOURCE,
- AccessControlConstants.READ });
+ AccessControlConstants.READ }));
}
}
}
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 Mon Mar 3 21:29:27 2008
@@ -17,6 +17,7 @@
import java.util.Map;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.Authorizer;
import org.wso2.registry.users.UserStoreAdmin;
import org.wso2.registry.users.UserStoreException;
@@ -53,9 +54,9 @@
.getAuthenticatedUserName(),
AccessControlConstants.USER_RESOURCE, AccessControlConstants.ADD)) {
- throw new UnauthorizedException("unAuthorized", new String[] {
+ throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[] {
AccessControlConstants.USER_RESOURCE,
- AccessControlConstants.ADD });
+ AccessControlConstants.ADD }));
}
usAdmin.addUser(userName, credential);
}
@@ -72,9 +73,8 @@
.getAuthenticatedUserName(),
AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT)) {
- throw new UnauthorizedException("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);
}
@@ -87,9 +87,8 @@
.getAuthenticatedUserName(),
AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT)) {
- throw new UnauthorizedException("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);
}
@@ -112,9 +111,8 @@
.isUserAuthorized(config.getAuthenticatedUserName(),
AccessControlConstants.USER_RESOURCE,
AccessControlConstants.DELETE)) {
- throw new UnauthorizedException("unAuthorized", new String[] {
- AccessControlConstants.USER_RESOURCE,
- AccessControlConstants.DELETE });
+ throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{AccessControlConstants.USER_RESOURCE,
+ AccessControlConstants.DELETE} ));
}
usAdmin.deleteUser(userName);
}
@@ -133,9 +131,8 @@
.getAuthenticatedUserName(),
AccessControlConstants.USER_RESOURCE, AccessControlConstants.EDIT)) {
- throw new UnauthorizedException("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);
}
@@ -149,10 +146,8 @@
} else if (!authorizer.isUserAuthorized(config
.getAuthenticatedUserName(),
AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD)) {
-
- throw new UnauthorizedException("unAuthorized", new String[] {
- AccessControlConstants.ROLE_RESOURCE,
- AccessControlConstants.ADD });
+ throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
+ AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD} ));
}
usAdmin.addRole(roleName);
}
@@ -171,9 +166,9 @@
AccessControlConstants.ROLE_RESOURCE,
AccessControlConstants.DELETE)) {
- throw new UnauthorizedException("unAuthorized", new String[] {
+ throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
AccessControlConstants.ROLE_RESOURCE,
- AccessControlConstants.DELETE });
+ AccessControlConstants.DELETE} ));
}
usAdmin.deleteRole(roleName);
}
@@ -192,9 +187,8 @@
.getAuthenticatedUserName(),
AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.EDIT)) {
- throw new UnauthorizedException("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);
}
@@ -217,9 +211,8 @@
.getAuthenticatedUserName(),
AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.ADD)) {
- throw new UnauthorizedException("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);
}
@@ -243,9 +236,9 @@
AccessControlConstants.ROLE_RESOURCE,
AccessControlConstants.DELETE)) {
- throw new UnauthorizedException("unAuthorized", new String[] {
+ throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
AccessControlConstants.ROLE_RESOURCE,
- AccessControlConstants.DELETE });
+ 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 Mon Mar 3 21:29:27 2008
@@ -17,6 +17,7 @@
import java.util.Map;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.Authorizer;
import org.wso2.registry.users.UserStoreException;
import org.wso2.registry.users.UserStoreReader;
@@ -116,9 +117,8 @@
} else if (!authorizer.isUserAuthorized(config
.getAuthenticatedUserName(),
AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.READ)) {
- throw new UnauthorizedException("unAuthorized", new String[] {
- AccessControlConstants.ROLE_RESOURCE,
- AccessControlConstants.READ });
+ throw new UnauthorizedException(Messages.getMessage("unAuthorized", new String[]{
+ AccessControlConstants.ROLE_RESOURCE, AccessControlConstants.READ} ));
}
}
@@ -129,9 +129,8 @@
} else if (!authorizer.isUserAuthorized(config
.getAuthenticatedUserName(),
AccessControlConstants.USER_RESOURCE, AccessControlConstants.READ)) {
- throw new UnauthorizedException("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/UnauthorizedException.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/UnauthorizedException.java (original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/accesscontrol/UnauthorizedException.java Mon Mar 3 21:29:27 2008
@@ -34,7 +34,5 @@
super(message, cause);
}
- public UnauthorizedException(String key, Object[] args) {
- //super(key, args); TODO xxxx
- }
+
}
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 Mon Mar 3 21:29:27 2008
@@ -25,6 +25,7 @@
import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.AccessControlAdmin;
import org.wso2.registry.users.UserStoreException;
@@ -57,7 +58,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getPermission = dbConnection
@@ -72,7 +73,7 @@
pid = rs.getString(data
.getColumnName(DefaultRealmConstants.COLUMN_ID_ID));
} else {
- throw new UserStoreException("nullData");
+ throw new UserStoreException(Messages.getMessage("nullData"));
}
String uid = data.getUserId(userName);
@@ -87,14 +88,14 @@
clearUPStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -106,7 +107,7 @@
String userId = data.getUserId(userName);
if (userId == null) {
- throw new UserStoreException("nullUser");
+ throw new UserStoreException(Messages.getMessage("nullUser"));
}
Connection dbConnection = null;
@@ -115,7 +116,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement clearUPStmt = dbConnection
@@ -138,14 +139,14 @@
clearUPStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
@@ -156,7 +157,7 @@
String roleId = data.getRoleId(roleName);
if (roleId == null) {
- throw new UserStoreException("nullRole");
+ throw new UserStoreException(Messages.getMessage("nullRole"));
}
String permissionId = this.getOrAddPermissionId(resourceId, action);
@@ -166,7 +167,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement deleteRolesStmt = dbConnection
@@ -189,14 +190,14 @@
deleteRolesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -207,7 +208,7 @@
String roleId = data.getRoleId(roleName);
if (roleId == null) {
- throw new UserStoreException("nullRole");
+ throw new UserStoreException(Messages.getMessage("nullRole"));
}
String permissionId = this.getOrAddPermissionId(resourceId, action);
@@ -217,7 +218,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
// There can be only one permission for a role and a permission
@@ -241,14 +242,14 @@
deleteRolesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -259,7 +260,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getPermission = dbConnection
@@ -274,7 +275,7 @@
pid = rs.getString(data
.getColumnName(DefaultRealmConstants.COLUMN_ID_ID));
} else {
- throw new UserStoreException("nullData");
+ throw new UserStoreException(Messages.getMessage("nullData"));
}
String rid = data.getRoleId(roleName);
@@ -291,14 +292,14 @@
deleteRolesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
@@ -310,7 +311,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement clearResourceAuthorizationsStmt = dbConnection
@@ -322,14 +323,14 @@
clearResourceAuthorizationsStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -340,7 +341,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getResourcePermissionStmt = dbConnection
@@ -349,8 +350,8 @@
getResourcePermissionStmt.setString(1, toResourceId);
ResultSet rs = getResourcePermissionStmt.executeQuery();
if (rs.next()) {
- throw new UserStoreException(
- "copyAuthorizationFailedPermissionExist");
+ throw new UserStoreException(Messages.getMessage(
+ "copyAuthorizationFailedPermissionExist"));
}
getResourcePermissionStmt.setString(1, fromResourceId);
@@ -436,14 +437,14 @@
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorCopyingAuthorizations", e);
+ throw new UserStoreException(Messages.getMessage("errorCopyingAuthorizations"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
@@ -455,7 +456,7 @@
String userId = data.getUserId(userName);
if (userId == null) {
- throw new UserStoreException("nullUser");
+ throw new UserStoreException(Messages.getMessage("nullUser"));
}
String permissionId = this.getOrAddPermissionId(resourceId, action);
@@ -465,7 +466,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement clearUPStmt = dbConnection
@@ -488,14 +489,14 @@
clearUPStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
@@ -514,7 +515,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getPermissionStmt = dbConnection
@@ -547,14 +548,14 @@
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("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 Mon Mar 3 21:29:27 2008
@@ -30,6 +30,7 @@
import org.wso2.authenticator.Authenticator;
import org.wso2.authenticator.AuthenticatorException;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.def.util.DefaultDataSupplierImpl;
@@ -70,7 +71,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new AuthenticatorException("null_connection");
+ throw new AuthenticatorException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getUserStmt = dbConnection.prepareStatement(data
@@ -90,17 +91,17 @@
getUserStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new AuthenticatorException("errorReadingFromUserStore", e);
+ throw new AuthenticatorException(Messages.getMessage("errorReadingFromUserStore"), e);
} catch (NoSuchAlgorithmException e) {
log.debug(e);
- throw new AuthenticatorException("errorCreatingPasswordDigest", e);
+ throw new AuthenticatorException(Messages.getMessage("errorCreatingPasswordDigest"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new AuthenticatorException("errorClosingConnection", e);
+ throw new AuthenticatorException(Messages.getMessage("errorClosingConnection"), e);
}
}
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 Mon Mar 3 21:29:27 2008
@@ -26,6 +26,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.Authorizer;
import org.wso2.registry.users.UserStoreException;
import org.wso2.registry.users.def.util.DefaultDataSupplierImpl;
@@ -101,7 +102,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getAuthorizedUsersForResourceStmt = dbConnection
@@ -122,14 +123,14 @@
getAuthorizedUsersForResourceStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
@@ -142,7 +143,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getAuthorizedUsersForResourceStmt = dbConnection
@@ -163,14 +164,14 @@
getAuthorizedUsersForResourceStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
@@ -183,7 +184,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getAuthorizedRolesForResourceStmt = dbConnection
@@ -204,14 +205,14 @@
getAuthorizedRolesForResourceStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
@@ -225,7 +226,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getAuthorizedRolesForResourceStmt = dbConnection
@@ -246,14 +247,14 @@
getAuthorizedRolesForResourceStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
@@ -297,7 +298,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement isRoleAuthorizedStmt = dbConnection
@@ -316,14 +317,14 @@
isRoleAuthorizedStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return isAuthorized;
@@ -336,7 +337,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement isUserAuthorizedStmt = dbConnection
@@ -355,14 +356,14 @@
isUserAuthorizedStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return result;
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 Mon Mar 3 21:29:27 2008
@@ -31,6 +31,7 @@
import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.UserStoreAdmin;
import org.wso2.registry.users.UserStoreException;
@@ -57,22 +58,22 @@
throws UserStoreException {
if (userName == null || credential == null) {
- throw new UserStoreException("nullData");
+ throw new UserStoreException(Messages.getMessage("nullData"));
}
if (!(credential instanceof String)) {
- throw new UserStoreException("credentialTypeNotSupport");
+ throw new UserStoreException(Messages.getMessage("credentialTypeNotSupport"));
}
if (userName.trim().length() == 0) {
- throw new UserStoreException("nullUser");
+ throw new UserStoreException(Messages.getMessage("nullUser"));
}
Connection dbConnection = null;
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement addUserStmt = dbConnection.prepareStatement(data
@@ -89,17 +90,17 @@
addUserStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} catch (NoSuchAlgorithmException e) {
log.debug(e);
- throw new UserStoreException("errorCreatingPasswordDigest", e);
+ throw new UserStoreException(Messages.getMessage("errorCreatingPasswordDigest"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
@@ -111,7 +112,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getUserStmt = dbConnection.prepareStatement(data
@@ -127,11 +128,11 @@
.getString(data
.getColumnName(DefaultRealmConstants.COLUMN_ID_CREDENTIAL));
if (!Base64.encode(dgst.digest()).equals(dbCred)) {
- throw new UserStoreException("oldPasswordIncorrect");
+ throw new UserStoreException(Messages.getMessage("oldPasswordIncorrect"));
}
}
} else {
- throw new UserStoreException("oldPasswordIncorrect");
+ throw new UserStoreException(Messages.getMessage("oldPasswordIncorrect"));
}
PreparedStatement updateUserStmt = dbConnection
@@ -146,17 +147,17 @@
updateUserStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} catch (NoSuchAlgorithmException e) {
log.debug(e);
- throw new UserStoreException("errorCreatingPasswordDigest", e);
+ throw new UserStoreException(Messages.getMessage("errorCreatingPasswordDigest"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -167,7 +168,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement updateUserStmt = dbConnection
@@ -182,17 +183,17 @@
updateUserStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} catch (NoSuchAlgorithmException e) {
log.debug(e);
- throw new UserStoreException("errorCreatingPasswordDigest", e);
+ throw new UserStoreException(Messages.getMessage("errorCreatingPasswordDigest"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -202,7 +203,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement deleteUserStmt = dbConnection
@@ -214,14 +215,14 @@
deleteUserStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -231,14 +232,14 @@
String userid = data.getUserId(userName);
if (userid == null) {
- throw new UserStoreException("nullUser");
+ throw new UserStoreException(Messages.getMessage("nullUser"));
}
Connection dbConnection = null;
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement deleteUserPropsStmt = dbConnection
@@ -271,14 +272,14 @@
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
@@ -289,13 +290,13 @@
String roleid = data.getRoleId(roleName);
if (roleid == null) {
- throw new UserStoreException("nullRole");
+ throw new UserStoreException(Messages.getMessage("nullRole"));
}
Connection dbConnection = null;
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement deleteRolePropsStmt = dbConnection
@@ -329,14 +330,14 @@
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -346,7 +347,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement addRoleStmt = dbConnection.prepareStatement(data
@@ -359,14 +360,14 @@
addRoleStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -376,7 +377,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement deleteRoleStmt = dbConnection
@@ -388,14 +389,14 @@
deleteRoleStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -407,13 +408,13 @@
String roleid = data.getRoleId(roleName);
if (roleid == null || userid == null) {
- throw new UserStoreException("nullData");
+ throw new UserStoreException(Messages.getMessage("nullData"));
}
Connection dbConnection = null;
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement addUserToRoleStmt = dbConnection
@@ -428,14 +429,14 @@
addUserToRoleStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorAddingUserToRole", e);
+ throw new UserStoreException(Messages.getMessage("errorAddingUserToRole"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
@@ -446,7 +447,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement removeUserFromRoleStmt = dbConnection
@@ -459,14 +460,14 @@
removeUserFromRoleStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorModifyingUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorModifyingUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
}
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 Mon Mar 3 21:29:27 2008
@@ -29,6 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.UserStoreException;
import org.wso2.registry.users.UserStoreReader;
import org.wso2.registry.users.def.util.DefaultDataSupplierImpl;
@@ -67,7 +68,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getAllRoleNamesStmt = dbConnection
@@ -86,14 +87,14 @@
getAllRoleNamesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
@@ -105,7 +106,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getAllUserNamesStmt = dbConnection
@@ -125,14 +126,14 @@
getAllUserNamesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
@@ -145,7 +146,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getRolePropertiesStmt = dbConnection
@@ -165,14 +166,14 @@
getRolePropertiesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return props;
@@ -185,7 +186,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getUserPropertiesStmt = dbConnection
@@ -205,14 +206,14 @@
getUserPropertiesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return props;
@@ -225,7 +226,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getUserAttributeNamesStmt = dbConnection
@@ -242,14 +243,14 @@
getUserAttributeNamesStmt.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return propNames;
@@ -282,7 +283,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getPropValue = null;
@@ -311,14 +312,14 @@
getPropValue.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
@@ -331,7 +332,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getUserInRole = dbConnection
@@ -349,14 +350,14 @@
getUserInRole.close();
} catch (SQLException e) {
log.debug(e);
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("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/DefaultDataSupplierImpl.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/util/DefaultDataSupplierImpl.java (original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/def/util/DefaultDataSupplierImpl.java Mon Mar 3 21:29:27 2008
@@ -24,6 +24,7 @@
import javax.sql.DataSource;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.UserStoreException;
import org.wso2.registry.users.def.DefaultRealmConstants;
import org.wso2.registry.users.def.DefaultDataSupplier;
@@ -256,7 +257,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getUserIdStmt = dbConnection
@@ -269,14 +270,14 @@
}
getUserIdStmt.close();
} catch (SQLException e) {
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return id;
@@ -288,7 +289,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getRolIdStmt = dbConnection.prepareStatement(DefaultRealmConstants.GET_ROLE_ID_SQL);
@@ -301,14 +302,14 @@
getRolIdStmt.close();
} catch (SQLException e) {
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return id;
@@ -320,7 +321,7 @@
try {
dbConnection = dataSource.getConnection();
if (dbConnection == null) {
- throw new UserStoreException("null_connection");
+ throw new UserStoreException(Messages.getMessage("null_connection"));
}
dbConnection.setAutoCommit(false);
PreparedStatement getUserRolesStmt = dbConnection
@@ -338,14 +339,14 @@
}
getUserRolesStmt.close();
} catch (SQLException e) {
- throw new UserStoreException("errorReadingFromUserStore", e);
+ throw new UserStoreException(Messages.getMessage("errorReadingFromUserStore"), e);
} finally {
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException e) {
- throw new UserStoreException("errorClosingConnection", e);
+ throw new UserStoreException(Messages.getMessage("errorClosingConnection"), e);
}
}
return names;
Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/users/verifier/EmailVerifier.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/users/verifier/EmailVerifier.java (original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/users/verifier/EmailVerifier.java Mon Mar 3 21:29:27 2008
@@ -25,6 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.users.UserRealm;
import org.wso2.registry.users.UserStoreAdmin;
import org.wso2.registry.users.UserStoreException;
@@ -95,7 +96,7 @@
return username;
}
} catch (SQLException e) {
- throw new UserStoreException("error", e);
+ throw new UserStoreException(Messages.getMessage("error"), e);
}
return null;
@@ -103,7 +104,7 @@
public boolean confirmUser(String confString) throws UserStoreException {
if (realm == null) {
- throw new UserStoreException("initVerifier");
+ throw new UserStoreException(Messages.getMessage("initVerifier"));
}
boolean isConfirmed = false;
@@ -151,7 +152,7 @@
deleteUserPropertyStmt.close();
}
} catch (SQLException e) {
- throw new UserStoreException("error", e);
+ throw new UserStoreException(Messages.getMessage("error"), e);
}
return isConfirmed;
@@ -160,11 +161,11 @@
public void requestUserVerification(String username, String emailAddress,
String password, Map properties) throws UserStoreException {
if (config == null) {
- throw new UserStoreException("initVerifier");
+ throw new UserStoreException(Messages.getMessage("initVerifier"));
}
if (username == null || emailAddress == null || password == null) {
- throw new UserStoreException("invalidData");
+ throw new UserStoreException(Messages.getMessage("invalidData"));
}
username = username.trim();
@@ -173,11 +174,11 @@
if (username.length() == 0 || emailAddress.length() == 0
|| password.length() == 0) {
- throw new UserStoreException("invalidData");
+ throw new UserStoreException(Messages.getMessage("invalidData"));
}
if (realm.getUserStoreReader().isExistingUser(username)) {
- throw new UserStoreException("duplicateUser");
+ throw new UserStoreException(Messages.getMessage("duplicateUser"));
}
try {
@@ -187,7 +188,7 @@
getUser.setString(1, username);
ResultSet rs = getUser.executeQuery();
if (rs.next()) {
- throw new UserStoreException("duplicateUser");
+ throw new UserStoreException(Messages.getMessage("duplicateUser"));
}
PreparedStatement addUserStmt = dbConnection
@@ -231,7 +232,7 @@
addUserPropertyStmt.close();
}
} catch (SQLException e) {
- throw new UserStoreException("pendingAdd", e);
+ throw new UserStoreException(Messages.getMessage("pendingAdd"), e);
}
}
@@ -271,9 +272,9 @@
Transport.send(msg);
log.debug("Sending confirmation mail to " + emailAddr + "DONE");
} catch (AddressException e) {
- throw new UserStoreException("sendingMailProblems", e);
+ throw new UserStoreException(Messages.getMessage("sendingMailProblems"), e);
} catch (MessagingException e) {
- throw new UserStoreException("sendingMailProblems", e);
+ throw new UserStoreException(Messages.getMessage("sendingMailProblems"), e);
}
}
@@ -316,7 +317,7 @@
}
dbConnection.commit();
} catch (Exception e) {
- throw new UserStoreException("verifierUserDatabaseInit", e);
+ throw new UserStoreException(Messages.getMessage("verifierUserDatabaseInit"), e);
}
}
Modified: trunk/registry/modules/core/src/main/resources/org/wso2/registry/i18n/resource.properties
==============================================================================
--- trunk/registry/modules/core/src/main/resources/org/wso2/registry/i18n/resource.properties (original)
+++ trunk/registry/modules/core/src/main/resources/org/wso2/registry/i18n/resource.properties Mon Mar 3 21:29:27 2008
@@ -100,4 +100,43 @@
could.not.found.versionpath=Could not get the version paths of the resource {0} . Caused by: {1}
unable.to.open.db=Couldn't open db connection
not.a.valid.verion.path=Given path is not a path of a versioned resource.
-unable.to.restore=Could not restore the version {0} . Caused by: {1}
+unable.to.restore=Could not restore the version {0} . Caused by: {1}
+######################## Error Messages Regarding Users ################
+errorAddingUserToRole = Error adding user to role. {0}
+duplicateUser = User name already exists. Please select another user name!
+exceptionOnConnectionOpen = Error occuered while connecting to Userstore
+sqlFileNotFound = SQL file not found for Default Realm
+errorModifyingUserStore = Error modifying the database
+errorReadingFromUserStore = Error reading users from database
+nullData = Invalid or Null data provided
+nullUser = Invalid user name provided
+nullRole = Invalid role name provided
+beanMappingNotfound = AuthenticationProvider Bean Mapping must be provided in file
+nullAuthProvider = AuthenticationProvider id must be present
+unsupportedCredential = Credential type unsupported
+initVerifier = Please call init() method in the verifier
+sendingMailProblems = Problems encountered while trying to send mail
+error= Error
+pendingAdd = Error occured while adding you. Please try again.
+invalidOrExpired = Invalid or expired
+exceptionOnAuthenticate = Exception on Authenticate
+getProperties = Getting properties of user
+unknownUserNameFormatInLDAP= Unknown format of Users in LDAP. We expect boo=username : object.class
+errorOpeningLDAP = Error opening connection to the LDAP directory. Please check connection name, password and url.
+bindFailedBecauseAuthenticationException = Failed to Authenticate because of bind failure
+errorInitializingConnection = Error Initializing Connection.
+copyAuthorizationFailedPermissionExist = Copying Authorizations failed, because permissions exist for the destination Resource
+errorCopyingAuthorizations = Error copying authorizations
+errorCreatingPasswordDigest = Error creating password digest
+unAuthorized = User is unauthorized to perform the action. Resource {0} action {1}
+authorizerNullatAuthorizer = Authorizer is null at AuthorizingRealm. This cannot be
+errorClosingConnection = Error closing connection!
+oldPasswordIncorrect = Cannot update password of user. Invalid user name password!
+nullRealm = Null Realm not permitted.
+verifierUserDatabaseInit = Cannot create the Email Verifier Database
+######### Users - only log messages
+getGenericUserByPattern = Searching user by generic pattern
+validatingCredentials = Validating users
+dbCreationNotSupported = Database creation not supported for this driver
+nullConnection = Cannot get connection. Contact Administrator
+unableToResetPool = Unable to reset realm. There are people holding instances of PoolManager
More information about the Registry-dev
mailing list