Author: deepal
Date: Thu Jan 31 22:18:01 2008
New Revision: 13213
Log:
adding i18n support
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfigurationProcessor.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryContext.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.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/app/RemoteRegistry.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
Thu Jan 31 22:18:01 2008
@@ -189,8 +189,8 @@
resource.setContent(out.toByteArray());
return resource;
} catch (IOException e) {
- e.printStackTrace();
- throw new RegistryException("Unable to get the resource
for " + link);
+ throw new
RegistryException(Messages.getMessage("unable.to.receive" ,
+ link.getHref().toString()));
}
}
String content1 = entry.getContent();
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfigurationProcessor.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfigurationProcessor.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfigurationProcessor.java
Thu Jan 31 22:18:01 2008
@@ -108,8 +108,7 @@
OMElement currentConfigElement =
configElement.getFirstChildWithName(new
QName("currentConfig"));
if (currentConfigElement == null) {
- String msg = "Current database configuration is not
defined.";
- throw new RegistryException(msg);
+ throw new
RegistryException(Messages.getMessage("db.not.defined"));
}
String currentConfigName = currentConfigElement.getText();
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryContext.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryContext.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryContext.java
Thu Jan 31 22:18:01 2008
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.registry.RegistryException;
+import org.wso2.registry.i18n.Messages;
import org.wso2.registry.jdbc.hsql.DBUtils;
import org.wso2.registry.jdbc.utils.RegistryDataSource;
import org.wso2.registry.secure.HSQLDBInitializer;
@@ -88,7 +89,7 @@
dbInitializer.createHSQLTables(dataSource);
} catch (SQLException e) {
dataBaseConfiguration.setConfigName("in-memory");
- log.info("Unable to create the sample DB, so created
in-memory");
+ log.info(Messages.getMessage("unable.to.creat.inmemory"));
} catch (RegistryException e) {
dataBaseConfiguration = null;
}
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/JDBCRegistry.java
Thu Jan 31 22:18:01 2008
@@ -218,7 +218,7 @@
try {
exists = resourceDAO.resourceExist(path, conn);
} catch (SQLException e) {
- String msg = "Failed to check the exsitence of a resource at path
" + path;
+ String msg = Messages.getMessage("faild.to.check",path);
log.error(msg, e);
throw new RegistryException(msg, e);
@@ -282,7 +282,7 @@
try {
conn.close();
} catch (SQLException ignore) {
- log.info("Exception while closing the DB connection in put
method of JDBCRegistry");
+ log.info(Messages.getMessage("exception.closing.db"));
}
}
@@ -324,7 +324,7 @@
try {
conn.close();
} catch (SQLException ignore) {
- log.info("Exception while closing the DB connection in put
method of JDBCRegistry");
+ log.info(Messages.getMessage("exception.closing.db"));
}
}
@@ -428,8 +428,7 @@
try {
conn.close();
} catch (SQLException ignore) {
- log.info(
- "Exception while closing the DB connection in delete
method of JDBCRegistry");
+ log.info(Messages.getMessage("exception.closing.db"));
}
}
}
@@ -456,9 +455,7 @@
} catch (SQLException e1) {
e1.printStackTrace();
}
-
- String msg = "Could not get the version paths of the resource " +
- path + ". Caused by: " + e.getMessage();
+ String msg =
Messages.getMessage("could.not.found.versionpath",path,e.getMessage());
log.error(msg, e);
throw new RegistryException(msg, e);
@@ -478,7 +475,7 @@
try {
conn = dataSource.getConnection();
} catch (SQLException e) {
- throw new RegistryException("Couldn't open db connection", e);
+ throw new
RegistryException(Messages.getMessage("unable.to.open.db"), e);
}
return conn;
}
@@ -491,7 +488,7 @@
plainPath = parts[0];
versionNumber = Long.parseLong(parts[1]);
} else {
- String msg = "Given path is not a path of a versioned resource.";
+ String msg = Messages.getMessage("not.a.valid.verion.path");
log.error(msg);
throw new RegistryException(msg);
}
@@ -513,9 +510,7 @@
conn.commit();
} catch (SQLException e) {
-
- String msg = "Could not restore the version " +
- versionPath + ". Caused by: " + e.getMessage();
+ String msg = Messages.getMessage("unable.to.restore",versionPath
,e.getMessage());
log.error(msg, e);
try {
@@ -530,8 +525,7 @@
try {
conn.close();
} catch (SQLException ignore) {
- log.info("Exception while closing the DB connection in " +
- "restoreVersion method of JDBCRegistry");
+ log.info(Messages.getMessage("exception.closing.db"));
}
}
}
@@ -737,8 +731,7 @@
try {
conn.close();
} catch (SQLException ignore) {
- log.info(
- "Exception while closing the DB connection in
removeTag method of JDBCRegistry");
+ log.info(Messages.getMessage("exception.closing.db"));
}
}
}
@@ -1063,8 +1056,7 @@
try {
conn.close();
} catch (SQLException ignore) {
- log.info(
- "Exception while closing the DB connection in
executeQuery method of JDBCRegistry");
+ log.info(Messages.getMessage("exception.closing.db"));
}
}
}
@@ -1118,8 +1110,7 @@
try {
conn.close();
} catch (SQLException ignore) {
- log.info(
- "Exception while closing the DB connection in getLogs
method of JDBCRegistry");
+ log.info(Messages.getMessage("exception.closing.db"));
}
}
LogEntry[] logEntries = new LogEntry[logEntryList.size()];
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
Thu Jan 31 22:18:01 2008
@@ -92,3 +92,12 @@
tag.removed.fails=Failed to remove the tag : {0}
resource.comment.fails=Failed to comment the resource to the path : {0}
resource.rate.fail=Failed to rate the resource {0}
+unable.to.receive=Unable to get the resource for {0}
+db.not.defined=Current database configuration is not defined.
+unable.to.creat.inmemory=Unable to create the sample DB, so created in-memory
+faild.to.check=Failed to check the exsitence of a resource at path
+exception.closing.db=Exception while closing the DB connection in put method
of JDBCRegistry
+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}
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev