KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openi > application > Application


1 /*********************************************************************************
2  * The contents of this file are subject to the OpenI Public License Version 1.0
3  * ("License"); You may not use this file except in compliance with the
4  * License. You may obtain a copy of the License at
5  * http://www.openi.org/docs/LICENSE.txt
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is: OpenI Open Source
12  *
13  * The Initial Developer of the Original Code is Loyalty Matrix, Inc.
14  * Portions created by Loyalty Matrix, Inc. are
15  * Copyright (C) 2005 Loyalty Matrix, Inc.; All Rights Reserved.
16  *
17  * Contributor(s): ______________________________________.
18  *
19  ********************************************************************************/

20 package org.openi.application;
21
22 import java.io.*;
23
24 import org.apache.log4j.*;
25
26
27 /**
28  * @author Uddhab Pant <br>
29  *
30  * Singleton class stores application configuration.
31  *
32  */

33 public class Application implements Serializable {
34     private static Logger logger = LogManager.getLogger(Application.class);
35     private static Application application = null;
36
37     //application configuration values
38
private String JavaDoc applicationAdmins = null; //comma separated list of admins
39
private String JavaDoc poweredByLogoName = null;
40     private String JavaDoc logonImageName = null;
41     private boolean basicAuthentication = false; //default
42
private String JavaDoc applicationAdminPermissions = null; //comma separated list of app admin's permission.
43
private String JavaDoc projectAdminPermissions = null; //comma separated list of project admin's permission.
44
private String JavaDoc projectUserPermissions = null; //comma separated list of project user's permission.
45

46     // default application title
47
private String JavaDoc applicationTitle = "OpenI Open Intelligence Portal";
48
49     // default customer support link
50
private String JavaDoc customerSupport = "http://sourceforge.net/forum/?group_id=142873";
51
52     // default copyright message
53
private String JavaDoc copyrightMessage = "\u00a9 2005 - 2006, Loyalty Matrix, Inc.";
54
55     private long maxFileUploadSize = 1000000;
56     
57     private boolean sql2005Compatiblilty = false;
58     
59     //initialized by InitApplicationServlet
60
private String JavaDoc projectXsl = "";
61
62     
63     private Application() {
64     }
65
66     /**
67      *
68      * @return Application
69      */

70     public static Application getInstance() {
71         if (application == null) {
72             logger.info("Creating instance of application config");
73             application = new Application();
74         }
75
76         return application;
77     }
78
79     /**
80      *
81      * @return String LogonImageName
82      */

83     public String JavaDoc getLogonImageName() {
84         return logonImageName;
85     }
86
87     /**
88      *
89      * @return String PoweredByLogoName
90      */

91     public String JavaDoc getPoweredByLogoName() {
92         return poweredByLogoName;
93     }
94
95     /**
96      *
97      * @return String ApplicationAdmins
98      */

99     public String JavaDoc getApplicationAdmins() {
100         return applicationAdmins;
101     }
102
103     /**
104      *
105      * @return boolean basicAuthentication
106      */

107     public boolean isBasicAuthentication() {
108         return basicAuthentication;
109     }
110
111     /**
112      *
113      * @return String projectAdminPermissions
114      */

115     public String JavaDoc getProjectAdminPermissions() {
116         return projectAdminPermissions;
117     }
118
119     /**
120      *
121      * @return String projectUserPermissions
122      */

123     public String JavaDoc getProjectUserPermissions() {
124         return projectUserPermissions;
125     }
126
127     /**
128      *
129      * @return String applicationAdminPermissions
130      */

131     public String JavaDoc getApplicationAdminPermissions() {
132         return applicationAdminPermissions;
133     }
134
135     /**
136      *
137      * @param logonImageName String
138      */

139     public void setLogonImageName(String JavaDoc logonImageName) {
140         this.logonImageName = logonImageName;
141     }
142
143     /**
144      *
145      * @param poweredByLogoName String
146      */

147     public void setPoweredByLogoName(String JavaDoc poweredByLogoName) {
148         this.poweredByLogoName = poweredByLogoName;
149     }
150
151     /**
152      *
153      * @param applicationAdmins String
154      */

155     public void setApplicationAdmins(String JavaDoc applicationAdmins) {
156         this.applicationAdmins = applicationAdmins;
157     }
158
159     /**
160      *
161      * @param basicAuthentication boolean
162      */

163     public void setBasicAuthentication(boolean basicAuthentication) {
164         this.basicAuthentication = basicAuthentication;
165     }
166
167     /**
168      *
169      * @param projectAdminPermissions String
170      */

171     public void setProjectAdminPermissions(String JavaDoc projectAdminPermissions) {
172         this.projectAdminPermissions = projectAdminPermissions;
173     }
174
175     /**
176      *
177      * @param projectUserPermissions String
178      */

179     public void setProjectUserPermissions(String JavaDoc projectUserPermissions) {
180         this.projectUserPermissions = projectUserPermissions;
181     }
182
183     /**
184      *
185      * @param applicationAdminPermissions String
186      */

187     public void setApplicationAdminPermissions(
188         String JavaDoc applicationAdminPermissions) {
189         this.applicationAdminPermissions = applicationAdminPermissions;
190     }
191
192     /**
193      * If the singleton implements Serializable, then this
194      * method must be supplied.
195      */

196     private Object JavaDoc readResolve() throws ObjectStreamException {
197         return application;
198     }
199
200     /**
201      * @return Returns the applicationTitle.
202      */

203     public String JavaDoc getApplicationTitle() {
204         return applicationTitle;
205     }
206
207     /**
208      *
209      * @return Returns customer support
210      */

211     public String JavaDoc getCustomerSupport() {
212         return customerSupport;
213     }
214
215     public String JavaDoc getCopyrightMessage() {
216         return copyrightMessage;
217     }
218
219     public long getMaxFileUploadSize() {
220         return maxFileUploadSize;
221     }
222
223     /**
224      * @param applicationTitle The applicationTitle to set.
225      */

226     public void setApplicationTitle(String JavaDoc applicationTitle) {
227         this.applicationTitle = applicationTitle;
228     }
229
230     /**
231      *
232      * @param customerSupport String
233      */

234     public void setCustomerSupport(String JavaDoc customerSupport) {
235         this.customerSupport = customerSupport;
236     }
237
238     public void setCopyrightMessage(String JavaDoc copyrightMessage) {
239         this.copyrightMessage = copyrightMessage;
240     }
241
242     public void setMaxFileUploadSize(long maxFileUploadSize) {
243         this.maxFileUploadSize = maxFileUploadSize;
244     }
245     
246
247     public boolean isSql2005Compatiblilty() {
248         return this.sql2005Compatiblilty;
249     }
250
251     public void setSql2005Compatiblilty(boolean sql2005Compatiblilty) {
252         this.sql2005Compatiblilty = sql2005Compatiblilty;
253     }
254     
255     public String JavaDoc getProjectXsl() {
256         return projectXsl;
257     }
258
259     public void setProjectXsl(String JavaDoc projectXsl) {
260         this.projectXsl = projectXsl;
261     }
262
263 }
264
Popular Tags