KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > core > system > SettingsPublisher


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Aug 28, 2005
14  * @author James Dixon
15  */

16
17 package org.pentaho.core.system;
18
19 import org.apache.commons.logging.Log;
20 import org.apache.commons.logging.LogFactory;
21 import org.pentaho.core.publisher.BasePublisher;
22 import org.pentaho.core.session.IPentahoSession;
23 import org.pentaho.messages.Messages;
24
25 public class SettingsPublisher extends BasePublisher {
26
27     private static final long serialVersionUID = -4584778481507215709L;
28
29     private static final Log logger = LogFactory.getLog(SettingsPublisher.class);
30
31     public Log getLogger() {
32         return logger;
33     }
34
35     public String JavaDoc getName() {
36         return Messages.getString("SettingsPublisher.USER_SYSTEM_SETTINGS"); //$NON-NLS-1$
37
}
38
39     public String JavaDoc getDescription() {
40         return Messages.getString("SettingsPublisher.USER_DESCRIPTION", PentahoSystem.getApplicationContext().getSolutionPath("system").replace('\\', '/')); //$NON-NLS-1$ //$NON-NLS-2$
41
}
42
43     public String JavaDoc publish(IPentahoSession localSession) {
44         try {
45             PentahoSystem.refreshSettings();
46         } catch (Throwable JavaDoc t) {
47             error(Messages.getErrorString("SettingsPublisher.ERROR_0001_PUBLISH_FAILED"), t); //$NON-NLS-1$
48
return Messages.getString("SettingsPublisher.USER_ERROR_PUBLISH_FAILED") + t.getLocalizedMessage(); //$NON-NLS-1$
49
}
50         return Messages.getString("SettingsPublisher.USER_SYSTEM_SETTINGS_UPDATED"); //$NON-NLS-1$
51
}
52
53 }
54
Popular Tags