Author: tmortagne
Date: 2008-02-19 14:46:35 +0100 (Tue, 19 Feb 2008)
New Revision: 7843
Added:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerMessageTool.java
Modified:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManager.java
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPlugin.java
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPluginApi.java
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/doc/XWikiApplicationClass.java
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/resources/applicationmanager/ApplicationResources.properties
Log:
XAAM-55: Improve comment/log/exception messages handling
Modified:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManager.java
===================================================================
---
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManager.java
2008-02-19 13:06:48 UTC (rev 7842)
+++
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManager.java
2008-02-19 13:46:35 UTC (rev 7843)
@@ -39,6 +39,7 @@
import com.xpn.xwiki.notify.XWikiNotificationRule;
import com.xpn.xwiki.objects.BaseObject;
import com.xpn.xwiki.objects.classes.ListClass;
+import
com.xpn.xwiki.plugin.applicationmanager.core.plugin.XWikiPluginMessageTool;
import com.xpn.xwiki.plugin.applicationmanager.doc.XWikiApplication;
import com.xpn.xwiki.plugin.applicationmanager.doc.XWikiApplicationClass;
import com.xpn.xwiki.plugin.packaging.DocumentInfo;
@@ -53,11 +54,6 @@
final class ApplicationManager implements XWikiDocChangeNotificationInterface
{
/**
- * Key to use with [EMAIL PROTECTED] XWikiContext#get(Object)}.
- */
- public static final String MESSAGETOOL_CONTEXT_KEY =
"applicationmanagermessagetool";
-
- /**
* The logging tool.
*/
protected static final Log LOG =
LogFactory.getLog(ApplicationManager.class);
@@ -111,6 +107,17 @@
}
/**
+ * Get the [EMAIL PROTECTED] XWikiPluginMessageTool} to use with
ApplicationManager.
+ *
+ * @param context the XWiki context.
+ * @return a translated strings manager.
+ */
+ public XWikiPluginMessageTool getMessageTool(XWikiContext context)
+ {
+ return ApplicationManagerMessageTool.getDefault(context);
+ }
+
+ /**
* [EMAIL PROTECTED]
*
* @see
com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface#notify(com.xpn.xwiki.notify.XWikiNotificationRule,
@@ -126,13 +133,14 @@
List appList =
XWikiApplicationClass.getInstance(context).newXObjectDocumentList(newdoc,
context);
- updateApplicationsTranslation(appList,
- "Auto update translations informations from applications
in "
- + newdoc.getFullName(), context);
+ updateApplicationsTranslation(appList,
getMessageTool(context).get(
+
ApplicationManagerMessageTool.COMMENT_AUTOUPDATETRANSLATIONS,
+ newdoc.getFullName()), context);
}
} catch (XWikiException e) {
- LOG.error("Error when updating translations informations from
applications in "
- + newdoc.getFullName(), e);
+ LOG.error(getMessageTool(context).get(
+ ApplicationManagerMessageTool.LOG_AUTOUPDATETRANSLATIONS,
newdoc.getFullName()),
+ e);
}
}
@@ -201,16 +209,19 @@
// If we are not allowed to continue if server page already exists
if (failOnExist) {
if (LOG.isErrorEnabled()) {
- LOG.error("Wiki creation (" + userAppSuperDoc
- + ") failed: wiki server page already exists");
+ LOG.error(getMessageTool(context).get(
+
ApplicationManagerMessageTool.ERROR_APPPAGEALREADYEXISTS,
+ userAppSuperDoc.getAppName()));
}
throw new ApplicationManagerException(
- ApplicationManagerException.ERROR_AM_APPDOCALREADYEXISTS,
- "Application \"" + userAppSuperDoc.getAppName() + "\"
document already exist");
+ ApplicationManagerException.ERROR_AM_APPDOCALREADYEXISTS,
getMessageTool(
+
context).get(ApplicationManagerMessageTool.ERROR_APPPAGEALREADYEXISTS,
+ userAppSuperDoc.getAppName()));
} else if (LOG.isWarnEnabled()) {
- LOG.warn("Application creation (" + userAppSuperDoc
- + ") failed: application page already exists");
+ LOG.warn(getMessageTool(context).get(
+ ApplicationManagerMessageTool.ERROR_APPPAGEALREADYEXISTS,
+ userAppSuperDoc.getAppName()));
}
}
@@ -489,8 +500,9 @@
XWikiAttachment packFile = packageDoc.getAttachment(packageName);
if (packFile == null) {
- throw new
ApplicationManagerException(XWikiException.ERROR_XWIKI_UNKNOWN, "Package "
- + packageName + " does not exists.");
+ throw new
ApplicationManagerException(XWikiException.ERROR_XWIKI_UNKNOWN,
+ getMessageTool(context).get(
+
ApplicationManagerMessageTool.ERROR_IMORT_PKGDOESNOTEXISTS, packageName));
}
// Import
@@ -501,13 +513,14 @@
importer.Import(packFile.getContent(context));
} catch (IOException e) {
throw new
ApplicationManagerException(XWikiException.ERROR_XWIKI_UNKNOWN,
- "Fail to import package " + packageName,
- e);
+
getMessageTool(context).get(ApplicationManagerMessageTool.ERROR_IMORT_IMPORT,
+ packageName), e);
}
if (importer.install() == DocumentInfo.INSTALL_IMPOSSIBLE) {
throw new
ApplicationManagerException(XWikiException.ERROR_XWIKI_UNKNOWN,
- "Fail to install package " + packageName);
+
getMessageTool(context).get(ApplicationManagerMessageTool.ERROR_IMORT_INSTALL,
+ packageName));
}
// Apply applications installation
Added:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerMessageTool.java
===================================================================
---
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerMessageTool.java
(rev 0)
+++
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerMessageTool.java
2008-02-19 13:46:35 UTC (rev 7843)
@@ -0,0 +1,227 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.xpn.xwiki.plugin.applicationmanager;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import com.xpn.xwiki.XWikiContext;
+import
com.xpn.xwiki.plugin.applicationmanager.core.plugin.XWikiPluginMessageTool;
+
+/**
+ * Application Manager plugin translation messages manager.
+ * <p>
+ * The main use of this class is construct [EMAIL PROTECTED]
XWikiPluginMessageTool} with the correct
+ * [EMAIL PROTECTED] java.util.ResourceBundle} and to list all the message
keys used internally in the plugin.
+ *
+ * @version $Id: $
+ * @since 1.1
+ */
+public class ApplicationManagerMessageTool extends XWikiPluginMessageTool
+{
+ /**
+ * Key to use with [EMAIL PROTECTED] XWikiContext#get(Object)}.
+ */
+ public static final String MESSAGETOOL_CONTEXT_KEY =
"applicationmanagermessagetool";
+
+ /**
+ * Used as comment when creating a new application.
+ */
+ public static final String COMMENT_CREATEAPPLICATION =
+ "applicationmanager.plugin.comment.createapplication";
+
+ /**
+ * Used as comment when importing a new application.
+ */
+ public static final String COMMENT_IMPORTAPPLICATION =
+ "applicationmanager.plugin.comment.importapplication";
+
+ /**
+ * Used as comment when reloading an application.
+ */
+ public static final String COMMENT_RELOADAPPLICATION =
+ "applicationmanager.plugin.comment.reloadapplication";
+
+ /**
+ * Used as comment when reloading all applications.
+ */
+ public static final String COMMENT_RELOADALLAPPLICATIONS =
+ "applicationmanager.plugin.comment.reloadallapplications";
+
+ /**
+ * Used as comment when automatically update application translations
pages.
+ */
+ public static final String COMMENT_AUTOUPDATETRANSLATIONS =
+ "applicationmanager.plugin.comment.autoupdatetranslations";
+
+ /**
+ * Used as comment when refreshing all applications translations pages.
+ */
+ public static final String COMMENT_REFRESHALLTRANSLATIONS =
+ "applicationmanager.plugin.comment.refreshalltranslations";
+
+ /**
+ * Used as [EMAIL PROTECTED] ApplicationManagerException} message when
application default page name
+ * already exists.
+ */
+ public static final String ERROR_APPPAGEALREADYEXISTS =
+ "applicationmanager.plugin.error.applicationpagealreadyexists";
+
+ /**
+ * Used as [EMAIL PROTECTED] ApplicationManagerException} message when
provided XAR package does not
+ * exists.
+ */
+ public static final String ERROR_IMORT_PKGDOESNOTEXISTS =
+ "applicationmanager.plugin.error.import.packagedoesnotexists";
+
+ /**
+ * Used as [EMAIL PROTECTED] ApplicationManagerException} message when
failed to load XAR package as list
+ * of [EMAIL PROTECTED] com.xpn.xwiki.doc.XWikiDocument}.
+ */
+ public static final String ERROR_IMORT_IMPORT =
+ "applicationmanager.plugin.error.import.import";
+
+ /**
+ * Used as [EMAIL PROTECTED] ApplicationManagerException} message when
failed to insert loaded
+ * [EMAIL PROTECTED] com.xpn.xwiki.doc.XWikiDocument} from package into
database.
+ */
+ public static final String ERROR_IMORT_INSTALL =
+ "applicationmanager.plugin.error.import.install";
+
+ /**
+ * Used as [EMAIL PROTECTED] ApplicationManagerException} message when
failed to find application from
+ * provided application name.
+ */
+ public static final String ERROR_APPDOESNOTEXISTS =
+ "applicationmanager.plugin.error.applicationdoesnotexists";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when application creation failed.
+ */
+ public static final String LOG_CREATEAPP =
"applicationmanager.plugin.log.createapplication";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when application delete failed.
+ */
+ public static final String LOG_DELETEAPP =
"applicationmanager.plugin.log.deleteapplication";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when getting all application
+ * descriptors failed.
+ */
+ public static final String LOG_GETALLAPPS =
+ "applicationmanager.plugin.log.getallapplications";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when getting application
+ * descriptor failed.
+ */
+ public static final String LOG_GETAPP =
"applicationmanager.plugin.log.getapplication";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when exporting application failed.
+ */
+ public static final String LOG_EXPORTAPP =
"applicationmanager.plugin.log.exportapplication";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when importing application failed.
+ */
+ public static final String LOG_IMPORTAPP =
"applicationmanager.plugin.log.importapplication";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when reloading application failed.
+ */
+ public static final String LOG_RELOADAPP =
"applicationmanager.plugin.log.reloadapplication";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when reloading all applications
+ * failed.
+ */
+ public static final String LOG_REALOADALLAPPS =
+ "applicationmanager.plugin.log.realoadallapplications";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when automatically updating
+ * application translations informations failed.
+ */
+ public static final String LOG_AUTOUPDATETRANSLATIONS =
+ "applicationmanager.plugin.log.autoupdatetranslations";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when refreshing all applications
+ * translations pages.
+ */
+ public static final String LOG_REFRESHALLTRANSLATIONS =
+ "applicationmanager.plugin.log.refreshalltranslations";
+
+ /**
+ * Used as [EMAIL PROTECTED] org.apache.commons.logging.Log} log message
when getting wiki root application
+ * failed.
+ */
+ public static final String LOG_GETROOTAPP =
+ "applicationmanager.plugin.log.getrootapplication";
+
+ /**
+ * Default bundle manager where to find translated messages.
+ */
+ private static final ApplicationManagerMessageTool DEFAULTMESSAGETOOL =
+ new ApplicationManagerMessageTool();
+
+ /**
+ * Create default WikiManagerMessageTool. Only look at WikiManager
properties file with system
+ * [EMAIL PROTECTED] Locale}.
+ */
+ private ApplicationManagerMessageTool()
+ {
+ super(ResourceBundle.getBundle(ApplicationManagerPlugin.PLUGIN_NAME
+ + "/ApplicationResources"));
+ }
+
+ /**
+ * Call for [EMAIL PROTECTED]
XWikiPluginMessageTool#XWikiPluginMessageTool(ResourceBundle, XWikiContext)}.
+ * Construct ResourceBundle based on [EMAIL PROTECTED]
WikiManagerPlugin#PLUGIN_NAME} +
+ * "/ApplicationResources".
+ *
+ * @param locale the [EMAIL PROTECTED] Locale} used to load the [EMAIL
PROTECTED] ResourceBundle}.
+ * @param plugin the plugin.
+ * @param context the [EMAIL PROTECTED] com.xpn.xwiki.XWikiContext}
object, used to get access to XWiki
+ * primitives for loading documents
+ */
+ ApplicationManagerMessageTool(Locale locale, ApplicationManagerPlugin
plugin,
+ XWikiContext context)
+ {
+ super(locale, plugin, context);
+ }
+
+ /**
+ * Get Wiki Manager message tool registered in XWiki context. If not
return default.
+ *
+ * @param context the XWiki context from which to get message tool.
+ * @return the default Wiki Manager message tool.
+ */
+ public static ApplicationManagerMessageTool getDefault(XWikiContext
context)
+ {
+ Object messagetool = context.get(MESSAGETOOL_CONTEXT_KEY);
+
+ return messagetool != null && messagetool instanceof
ApplicationManagerMessageTool
+ ? (ApplicationManagerMessageTool) messagetool : DEFAULTMESSAGETOOL;
+ }
+}
Property changes on:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerMessageTool.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPlugin.java
===================================================================
---
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPlugin.java
2008-02-19 13:06:48 UTC (rev 7842)
+++
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPlugin.java
2008-02-19 13:46:35 UTC (rev 7843)
@@ -90,9 +90,11 @@
context.setURLFactory(urlf);
context.setDatabase(context.getMainXWiki());
ApplicationManager.getInstance().updateAllApplicationTranslation(
- "Referesh applications translations informations", context);
+ ApplicationManagerMessageTool.getDefault(context).get(
+
ApplicationManagerMessageTool.COMMENT_REFRESHALLTRANSLATIONS), context);
} catch (XWikiException e) {
- LOG.error("Error when updating all applications translations
informations", e);
+ LOG.error(ApplicationManagerMessageTool.getDefault(context).get(
+ ApplicationManagerMessageTool.LOG_REFRESHALLTRANSLATIONS), e);
} finally {
context.setDatabase(database);
}
Modified:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPluginApi.java
===================================================================
---
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPluginApi.java
2008-02-19 13:06:48 UTC (rev 7842)
+++
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/ApplicationManagerPluginApi.java
2008-02-19 13:46:35 UTC (rev 7843)
@@ -21,13 +21,11 @@
package com.xpn.xwiki.plugin.applicationmanager;
import java.io.IOException;
-import java.text.MessageFormat;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import com.xpn.xwiki.plugin.applicationmanager.core.api.XWikiExceptionApi;
-import
com.xpn.xwiki.plugin.applicationmanager.core.plugin.XWikiPluginMessageTool;
import com.xpn.xwiki.plugin.PluginApi;
import com.xpn.xwiki.plugin.applicationmanager.doc.XWikiApplication;
import com.xpn.xwiki.plugin.applicationmanager.doc.XWikiApplicationClass;
@@ -75,7 +73,7 @@
/**
* The plugin internationalization service.
*/
- private XWikiPluginMessageTool messageTool;
+ private ApplicationManagerMessageTool messageTool;
/**
* Create an instance of the Application Manager plugin user api.
@@ -93,8 +91,8 @@
// Message Tool
Locale locale = (Locale) context.get("locale");
- this.messageTool = new XWikiPluginMessageTool(locale, plugin, context);
- context.put(ApplicationManager.MESSAGETOOL_CONTEXT_KEY,
this.messageTool);
+ this.messageTool = new ApplicationManagerMessageTool(locale, plugin,
context);
+ context.put(ApplicationManagerMessageTool.MESSAGETOOL_CONTEXT_KEY,
this.messageTool);
}
/**
@@ -159,11 +157,11 @@
ApplicationManager.getInstance().createApplication(
appXObjectDocument,
failOnExist,
-
this.messageTool.get("applicationmanager.plugin.createapplication.comment",
+
this.messageTool.get(ApplicationManagerMessageTool.COMMENT_CREATEAPPLICATION,
appXObjectDocument.toString()), context);
} catch (ApplicationManagerException e) {
- LOG.error(MessageFormat.format("Try to create application [{0}]",
- new Object[] {appXObjectDocument}), e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_CREATEAPP,
+ appXObjectDocument.toString()), e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -201,8 +199,8 @@
try {
ApplicationManager.getInstance().deleteApplication(appName,
context);
} catch (ApplicationManagerException e) {
- LOG.error(MessageFormat.format("Try to delete application [{0}]",
- new Object[] {appName}), e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_DELETEAPP,
appName),
+ e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -226,7 +224,7 @@
try {
listDocument =
ApplicationManager.getInstance().getApplicationList(this.context);
} catch (ApplicationManagerException e) {
- LOG.error("Try to get all applications documents", e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_GETALLAPPS),
e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -255,7 +253,7 @@
try {
app = ApplicationManager.getInstance().getApplication(appName,
context, true);
} catch (ApplicationManagerException e) {
- LOG.error("Try to get application document from application name",
e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_GETAPP,
appName), e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -314,7 +312,8 @@
ApplicationManager.getInstance().exportApplicationXAR(appName,
recurse,
withDocHistory, context);
} catch (ApplicationManagerException e) {
- LOG.error("Try to export application in a XAR package", e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_EXPORTAPP,
appName),
+ e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -356,10 +355,11 @@
ApplicationManager.getInstance().importApplication(
context.getDoc(),
packageName,
-
this.messageTool.get("applicationmanager.plugin.importapplication.comment",
+
this.messageTool.get(ApplicationManagerMessageTool.COMMENT_IMPORTAPPLICATION,
packageName), context);
} catch (ApplicationManagerException e) {
- LOG.error("Try to import applications from XAR package", e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_IMPORTAPP,
+ packageName), e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -404,10 +404,11 @@
ApplicationManager.getInstance().getApplication(appName,
context, true);
ApplicationManager.getInstance().reloadApplication(
app,
-
this.messageTool.get("applicationmanager.plugin.reloadapplication.comment", app
+
this.messageTool.get(ApplicationManagerMessageTool.COMMENT_RELOADAPPLICATION,
app
.getAppName()), context);
} catch (ApplicationManagerException e) {
- LOG.error("Try to reload application", e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_RELOADAPP,
appName),
+ e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -439,11 +440,13 @@
int returncode = XWikiExceptionApi.ERROR_NOERROR;
try {
- ApplicationManager.getInstance().reloadAllApplications(
-
this.messageTool.get("applicationmanager.plugin.reloadallapplications.comment"),
- context);
+ ApplicationManager.getInstance()
+ .reloadAllApplications(
+ this.messageTool
+
.get(ApplicationManagerMessageTool.COMMENT_RELOADALLAPPLICATIONS),
+ context);
} catch (ApplicationManagerException e) {
- LOG.error("Try to reload all applications", e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_REALOADALLAPPS),
e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
@@ -467,7 +470,7 @@
try {
app = ApplicationManager.getInstance().getRootApplication(context);
} catch (ApplicationManagerException e) {
- LOG.error("Try to get root application document", e);
+
LOG.error(this.messageTool.get(ApplicationManagerMessageTool.LOG_GETROOTAPP),
e);
context.put(CONTEXT_LASTERRORCODE, new Integer(e.getCode()));
context.put(CONTEXT_LASTEXCEPTION, new XWikiExceptionApi(e,
context));
Modified:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/doc/XWikiApplicationClass.java
===================================================================
---
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/doc/XWikiApplicationClass.java
2008-02-19 13:06:48 UTC (rev 7842)
+++
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/java/com/xpn/xwiki/plugin/applicationmanager/doc/XWikiApplicationClass.java
2008-02-19 13:46:35 UTC (rev 7843)
@@ -28,6 +28,7 @@
import com.xpn.xwiki.objects.StringProperty;
import com.xpn.xwiki.objects.classes.BaseClass;
import com.xpn.xwiki.plugin.applicationmanager.ApplicationManagerException;
+import com.xpn.xwiki.plugin.applicationmanager.ApplicationManagerMessageTool;
import
com.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes.AbstractXClassManager;
import
com.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes.XObjectDocument;
@@ -358,7 +359,8 @@
if (validate) {
throw new ApplicationManagerException(
ApplicationManagerException.ERROR_AM_DOESNOTEXIST,
- appName + " application does not exist");
+ ApplicationManagerMessageTool.getDefault(context).get(
+ ApplicationManagerMessageTool.ERROR_APPDOESNOTEXISTS,
appName));
} else {
return
xwiki.getDocument(getItemDocumentDefaultFullName(appName, context),
context);
Modified:
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/resources/applicationmanager/ApplicationResources.properties
===================================================================
---
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/resources/applicationmanager/ApplicationResources.properties
2008-02-19 13:06:48 UTC (rev 7842)
+++
xwiki-platform/xwiki-plugins/trunk/application-manager/src/main/resources/applicationmanager/ApplicationResources.properties
2008-02-19 13:46:35 UTC (rev 7843)
@@ -1,4 +1,27 @@
-applicationmanager.plugin.createapplication.comment=create application \"{0}\"
-applicationmanager.plugin.importapplication.comment=import application \"{0}\"
-applicationmanager.plugin.reloadapplication.comment=reload application \"{0}\"
-applicationmanager.plugin.reloadallapplications.comment=reload all applications
\ No newline at end of file
+# comments
+applicationmanager.plugin.comment.createapplication=Create application [{0}]
+applicationmanager.plugin.comment.importapplication=Import application [{0}]
+applicationmanager.plugin.comment.reloadapplication=Reload application [{0}]
+applicationmanager.plugin.comment.reloadallapplications=Reload all applications
+applicationmanager.plugin.comment.autoupdatetranslations=Automatically update
translations informations from applications in [{0}]
+applicationmanager.plugin.comment.refreshalltranslations=Refresh all
applications translations informations
+
+# messages
+applicationmanager.plugin.error.applicationpagealreadyexists=Application [{0}]
descriptor page already exists
+applicationmanager.plugin.error.import.packagedoesnotexists=Package [{0}] does
not exists
+applicationmanager.plugin.error.import.import=Fail to import package [{0}]
+applicationmanager.plugin.error.import.install=Fail to install package [{0}]
+applicationmanager.plugin.error.applicationdoesnotexists=Application [{0}]
does not exists
+
+# log
+applicationmanager.plugin.log.createapplication=Application creation failed
[{0}]
+applicationmanager.plugin.log.deleteapplication=Application [{0}] failed
+applicationmanager.plugin.log.getallapplications=Get all applications
descriptors failed
+applicationmanager.plugin.log.getapplication=Get application descriptor failed
+applicationmanager.plugin.log.exportapplication=Application [{0}] export as a
XAR package failed
+applicationmanager.plugin.log.importapplication=Application import from XAR
package [{0}] failed
+applicationmanager.plugin.log.reloadapplication=Application [{0}] reload failed
+applicationmanager.plugin.log.realoadallapplications=All applications reload
failed
+applicationmanager.plugin.log.getrootapplication=Get wiki root application
failed
+applicationmanager.plugin.log.autoupdatetranslations=Error when automatically
updating translations informations from applications in [{0}]
+applicationmanager.plugin.log.refreshalltranslations=Refresh all applications
translations informations
\ No newline at end of file
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications