KickJava   Java API By Example, From Geeks To Geeks.

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


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 GlobalListsPublisher extends BasePublisher {
26
27     private static final long serialVersionUID = -8247487696354924652L;
28
29     private static final Log logger = LogFactory.getLog(GlobalListsPublisher.class);
30
31     public Log getLogger() {
32         return logger;
33     }
34
35     public String JavaDoc getName() {
36         return Messages.getString("GlobalListsPublisher.USER_SYSTEM_SETTINGS"); //$NON-NLS-1$
37
}
38
39     public String JavaDoc getDescription() {
40         return Messages.getString("GlobalListsPublisher.USER_DESCRIPTION"); //$NON-NLS-1$
41
}
42
43     public String JavaDoc publish(IPentahoSession localSession) {
44         try {
45             PentahoSystem.clearGlobals();
46             PentahoSystem.sessionStartup(localSession, false);
47         } catch (Throwable JavaDoc t) {
48             error(Messages.getErrorString("GlobalListsPublisher.ERROR_0001_PUBLISH_FAILED"), t); //$NON-NLS-1$
49
return Messages.getString("GlobalListsPublisher.USER_ERROR_PUBLISH_FAILED") + t.getLocalizedMessage(); //$NON-NLS-1$
50
}
51         return Messages.getString("GlobalListsPublisher.USER_SYSTEM_SETTINGS_UPDATED"); //$NON-NLS-1$
52
}
53
54 }
55
Popular Tags