Source Code Cross Referenced for Application.java in  » Report » openi » org » openi » application » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » openi » org.openi.application 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*********************************************************************************
002:         * The contents of this file are subject to the OpenI Public License Version 1.0
003:         * ("License"); You may not use this file except in compliance with the
004:         * License. You may obtain a copy of the License at
005:         * http://www.openi.org/docs/LICENSE.txt
006:         *
007:         * Software distributed under the License is distributed on an "AS IS" basis,
008:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
009:         * the specific language governing rights and limitations under the License.
010:         *
011:         * The Original Code is: OpenI Open Source
012:         *
013:         * The Initial Developer of the Original Code is Loyalty Matrix, Inc.
014:         * Portions created by Loyalty Matrix, Inc. are
015:         * Copyright (C) 2005 Loyalty Matrix, Inc.; All Rights Reserved.
016:         *
017:         * Contributor(s):  i18n: Pedro Casals Fradera (2006/05/12)
018:         *
019:         ********************************************************************************/package org.openi.application;
020:
021:        import java.io.ObjectStreamException;
022:        import java.io.Serializable;
023:        import java.util.ArrayList;
024:        import java.util.HashMap;
025:        import java.util.Iterator;
026:        import java.util.List;
027:        import java.util.Locale;
028:        import java.util.Map;
029:
030:        import org.apache.log4j.LogManager;
031:        import org.apache.log4j.Logger;
032:        import org.openi.security.Permission;
033:
034:        /**
035:         * @author Uddhab Pant <br>
036:         *
037:         * Singleton class stores application configuration.
038:         *
039:         */
040:        public class Application implements  Serializable {
041:            private static Logger logger = LogManager
042:                    .getLogger(Application.class);
043:            private static Application instance = null;
044:
045:            //application configuration values
046:            private String applicationAdmins = null; //comma separated list of admins
047:            private String poweredByLogoName = null;
048:            private String logonImageName = null;
049:            private boolean basicAuthentication = false; //default
050:            private String applicationAdminPermissions = null; //comma separated list of app admin's permission.
051:            private String projectAdminPermissions = null; //comma separated list of project admin's permission.
052:            private String projectUserPermissions = null; //comma separated list of project user's permission.
053:            private String availableLanguages; //comma separated list of availables languages codes.
054:            private String defaultLanguage; //default language code
055:            private transient Locale defaultLocale;
056:
057:            // default application title
058:            private String applicationTitle = "OpenI Intelligence Portal";
059:
060:            // default customer support link
061:            private String customerSupport = "http://sourceforge.net/forum/?group_id=142873";
062:
063:            // default copyright message
064:            private String copyrightMessage = "\u00a9 2005 - 2007, Loyalty Matrix, Inc.";
065:            private transient String applicationPath;
066:
067:            private long maxFileUploadSize = 1000000;
068:
069:            private boolean sql2005Compatiblilty = false;
070:
071:            //initialized by InitApplicationServlet
072:            private String projectXsl = "";
073:
074:            //wild card filters to hide matched menu items
075:            private List wildCardFilters = null;
076:
077:            //list of FeatureItem
078:            private List availableFeatures = null;
079:
080:            //list of security definitions;
081:            private List securityConfig = null;
082:
083:            //comma seperated security roles
084:            private String securityRoles = null;
085:
086:            //if true JMS based queued drillthrough is used, rather than jpivot's build in drillthrough.
087:            private boolean queuedDrillthrough = false;
088:
089:            private String applicationSubtitle = "";
090:
091:            //to hide chart config, mdx, sql, show parent members, hide spans for non admin users
092:            private boolean showButtonsForAdminsOnly = false;
093:
094:            //powered by logo link
095:            private String poweredByLogoLink = "http://www.openi.org/";
096:
097:            private String poweredByLogoToolTip = "Go to the OpenI site";
098:
099:            private Application() {
100:            }
101:
102:            /**
103:             *
104:             * @return Application
105:             */
106:            public static Application getInstance() {
107:                if (instance == null) {
108:                    logger.info("Creating instance of application config");
109:                    instance = new Application();
110:                }
111:
112:                return instance;
113:            }
114:
115:            /**
116:             *
117:             * @return String LogonImageName
118:             */
119:            public String getLogonImageName() {
120:                return logonImageName;
121:            }
122:
123:            /**
124:             *
125:             * @return String PoweredByLogoName
126:             */
127:            public String getPoweredByLogoName() {
128:                return poweredByLogoName;
129:            }
130:
131:            /**
132:             *
133:             * @return String ApplicationAdmins
134:             */
135:            public String getApplicationAdmins() {
136:                return applicationAdmins;
137:            }
138:
139:            /**
140:             *
141:             * @return boolean basicAuthentication
142:             */
143:            public boolean isBasicAuthentication() {
144:                return basicAuthentication;
145:            }
146:
147:            /**
148:             *
149:             * @return String projectAdminPermissions
150:             */
151:            public String getProjectAdminPermissions() {
152:                return projectAdminPermissions;
153:            }
154:
155:            /**
156:             *
157:             * @return String projectUserPermissions
158:             */
159:            public String getProjectUserPermissions() {
160:                return projectUserPermissions;
161:            }
162:
163:            /**
164:             *
165:             * @return String applicationAdminPermissions
166:             */
167:            public String getApplicationAdminPermissions() {
168:                return applicationAdminPermissions;
169:            }
170:
171:            /**
172:             *
173:             * @param logonImageName String
174:             */
175:            public void setLogonImageName(String logonImageName) {
176:                this .logonImageName = logonImageName;
177:            }
178:
179:            /**
180:             *
181:             * @param poweredByLogoName String
182:             */
183:            public void setPoweredByLogoName(String poweredByLogoName) {
184:                this .poweredByLogoName = poweredByLogoName;
185:            }
186:
187:            /**
188:             *
189:             * @param applicationAdmins String
190:             */
191:            public void setApplicationAdmins(String applicationAdmins) {
192:                this .applicationAdmins = applicationAdmins;
193:            }
194:
195:            /**
196:             *
197:             * @param basicAuthentication boolean
198:             */
199:            public void setBasicAuthentication(boolean basicAuthentication) {
200:                this .basicAuthentication = basicAuthentication;
201:            }
202:
203:            /**
204:             *
205:             * @param projectAdminPermissions String
206:             */
207:            public void setProjectAdminPermissions(
208:                    String projectAdminPermissions) {
209:                this .projectAdminPermissions = projectAdminPermissions;
210:            }
211:
212:            /**
213:             *
214:             * @param projectUserPermissions String
215:             */
216:            public void setProjectUserPermissions(String projectUserPermissions) {
217:                this .projectUserPermissions = projectUserPermissions;
218:            }
219:
220:            /**
221:             *
222:             * @param applicationAdminPermissions String
223:             */
224:            public void setApplicationAdminPermissions(
225:                    String applicationAdminPermissions) {
226:                this .applicationAdminPermissions = applicationAdminPermissions;
227:            }
228:
229:            /**
230:             * If the singleton implements Serializable, then this
231:             * method must be supplied.
232:             */
233:            private Object readResolve() throws ObjectStreamException {
234:                return instance;
235:            }
236:
237:            /**
238:             * @return Returns the applicationTitle.
239:             */
240:            public String getApplicationTitle() {
241:                return applicationTitle;
242:            }
243:
244:            /**
245:             *
246:             * @return Returns customer support
247:             */
248:            public String getCustomerSupport() {
249:                return customerSupport;
250:            }
251:
252:            public String getCopyrightMessage() {
253:                return copyrightMessage;
254:            }
255:
256:            public long getMaxFileUploadSize() {
257:                return maxFileUploadSize;
258:            }
259:
260:            /**
261:             * @param applicationTitle The applicationTitle to set.
262:             */
263:            public void setApplicationTitle(String applicationTitle) {
264:                this .applicationTitle = applicationTitle;
265:            }
266:
267:            /**
268:             *
269:             * @param customerSupport String
270:             */
271:            public void setCustomerSupport(String customerSupport) {
272:                this .customerSupport = customerSupport;
273:            }
274:
275:            public void setCopyrightMessage(String copyrightMessage) {
276:                this .copyrightMessage = copyrightMessage;
277:            }
278:
279:            public void setMaxFileUploadSize(long maxFileUploadSize) {
280:                this .maxFileUploadSize = maxFileUploadSize;
281:            }
282:
283:            public boolean isSql2005Compatiblilty() {
284:                return this .sql2005Compatiblilty;
285:            }
286:
287:            public void setSql2005Compatiblilty(boolean sql2005Compatiblilty) {
288:                this .sql2005Compatiblilty = sql2005Compatiblilty;
289:            }
290:
291:            public String getProjectXsl() {
292:                return projectXsl;
293:            }
294:
295:            public void setProjectXsl(String projectXsl) {
296:                this .projectXsl = projectXsl;
297:            }
298:
299:            public Map getAppAdminPermissionsSelection() {
300:                Map permissionMap = new HashMap();
301:                Permission[] permissions = Permission.getAllPermission();
302:                for (int i = 0; i < permissions.length; i++) {
303:                    String permission = permissions[i].toString();
304:                    if (this .applicationAdminPermissions != null
305:                            && this .applicationAdminPermissions
306:                                    .indexOf(permission) != -1) {
307:                        permissionMap.put(permission, Boolean.TRUE);
308:                    } else {
309:                        permissionMap.put(permission, Boolean.FALSE);
310:                    }
311:                }
312:                return permissionMap;
313:            }
314:
315:            public Map getProjectAdminPermissionsSelection() {
316:                Map permissionMap = new HashMap();
317:                Permission[] permissions = Permission.getAllPermission();
318:                for (int i = 0; i < permissions.length; i++) {
319:                    String permission = permissions[i].toString();
320:                    if (this .projectAdminPermissions != null
321:                            && this .projectAdminPermissions.indexOf(permission) != -1) {
322:                        permissionMap.put(permission, Boolean.TRUE);
323:                    } else {
324:                        permissionMap.put(permission, Boolean.FALSE);
325:                    }
326:                }
327:                return permissionMap;
328:            }
329:
330:            public Map getProjectUserPermissionsSelection() {
331:                Map permissionMap = new HashMap();
332:                Permission[] permissions = Permission.getAllPermission();
333:                for (int i = 0; i < permissions.length; i++) {
334:                    String permission = permissions[i].toString();
335:                    if (this .projectUserPermissions != null
336:                            && this .projectUserPermissions.indexOf(permission) != -1) {
337:                        permissionMap.put(permission, Boolean.TRUE);
338:                    } else {
339:                        permissionMap.put(permission, Boolean.FALSE);
340:                    }
341:                }
342:                return permissionMap;
343:            }
344:
345:            public List getWildCardFilters() {
346:                return wildCardFilters;
347:            }
348:
349:            public void setWildCardFilters(List wildCardFilters) {
350:                this .wildCardFilters = wildCardFilters;
351:            }
352:
353:            public String getApplicationPath() {
354:                return applicationPath;
355:            }
356:
357:            public void setApplicationPath(String appPath) {
358:                this .applicationPath = appPath;
359:            }
360:
361:            public String getAvailableLanguages() {
362:                return availableLanguages;
363:            }
364:
365:            public void setAvailableLanguages(String availableLanguages) {
366:                this .availableLanguages = availableLanguages;
367:            }
368:
369:            public String getDefaultLanguage() {
370:                return defaultLanguage;
371:            }
372:
373:            public void setDefaultLanguage(String defaultLanguage) {
374:                if (defaultLanguage == null)
375:                    defaultLanguage = "";
376:                this .defaultLanguage = defaultLanguage;
377:                if ("".equals(this .defaultLocale))
378:                    this .defaultLocale = null;
379:                else if (!"".equals(defaultLanguage))
380:                    this .defaultLocale = new Locale(this .defaultLanguage);
381:                else
382:                    defaultLocale = null;
383:            }
384:
385:            public Locale getDefaultLocale() {
386:                Locale loc = null;
387:                if (defaultLocale == null) {
388:                    try {
389:                        if ((defaultLanguage != null)
390:                                && (!defaultLanguage.equals("")))
391:                            defaultLocale = new Locale(defaultLanguage);
392:                    } catch (Exception e) {
393:                    }
394:                } else {
395:                    loc = defaultLocale;
396:                }
397:                return loc;
398:            }
399:
400:            public List getAvailableFeatures() {
401:                return availableFeatures;
402:            }
403:
404:            public void setAvailableFeatures(List availableFeatures) {
405:                this .availableFeatures = availableFeatures;
406:            }
407:
408:            /**
409:             * returns comma seperated wild card filter string list 
410:             * @return
411:             */
412:            public String getWildCardFilterString() {
413:                String patterns = "";
414:                if (wildCardFilters == null || wildCardFilters.size() == 0)
415:                    return patterns;
416:                for (Iterator iter = wildCardFilters.iterator(); iter.hasNext();) {
417:                    String filter = (String) iter.next();
418:                    if ("".equals(patterns))
419:                        patterns = filter;
420:                    else
421:                        patterns = patterns + "," + filter;
422:                }
423:                return patterns;
424:            }
425:
426:            public List getSecurityConfig() {
427:                return securityConfig;
428:            }
429:
430:            public void setSecurityConfig(List securityConfig) {
431:                this .securityConfig = securityConfig;
432:            }
433:
434:            public String getSecurityRoles() {
435:                return securityRoles;
436:            }
437:
438:            public void setSecurityRoles(String securityRoles) {
439:                this .securityRoles = securityRoles;
440:            }
441:
442:            /**
443:             * returns all user defined roles
444:             * @return List of roles
445:             */
446:            public List getRoleList() {
447:                List roles = new ArrayList();
448:                if (this .securityRoles != null
449:                        && this .securityRoles.trim().length() != 0) {
450:                    String all[] = this .securityRoles.split(",");
451:                    for (int i = 0; i < all.length; i++) {
452:                        String arole = all[i];
453:                        if (!("APP_ADMINISTRATOR".equals(arole)
454:                                || "PROJ_ADMINISTRATOR".equals(arole)
455:                                || "PROJ_USER".equals(arole) || "READ_ONLY"
456:                                .equals(arole)))
457:                            roles.add(arole);
458:                    }
459:                }
460:                return roles;
461:            }
462:
463:            /**
464:             * returns all roles
465:             * @return List of roles
466:             */
467:            public List getAllRoles() {
468:                List roles = new ArrayList();
469:                roles.add("APP_ADMINISTRATOR");
470:                roles.add("PROJ_ADMINISTRATOR");
471:                roles.add("PROJ_USER");
472:                roles.add("READ_ONLY");
473:                roles.addAll(getRoleList());
474:                return roles;
475:            }
476:
477:            public boolean isQueuedDrillthrough() {
478:                return queuedDrillthrough;
479:            }
480:
481:            public void setQueuedDrillthrough(boolean queuedDrillthrough) {
482:                this .queuedDrillthrough = queuedDrillthrough;
483:            }
484:
485:            public String getApplicationSubtitle() {
486:                return applicationSubtitle;
487:            }
488:
489:            public void setApplicationSubtitle(String applicationSubtitle) {
490:                this .applicationSubtitle = applicationSubtitle;
491:            }
492:
493:            public String getPoweredByLogoLink() {
494:                return poweredByLogoLink;
495:            }
496:
497:            public void setPoweredByLogoLink(String poweredByLogoLink) {
498:                this .poweredByLogoLink = poweredByLogoLink;
499:            }
500:
501:            public boolean isShowButtonsForAdminsOnly() {
502:                return showButtonsForAdminsOnly;
503:            }
504:
505:            public void setShowButtonsForAdminsOnly(
506:                    boolean showButtonsForAdminsOnly) {
507:                this .showButtonsForAdminsOnly = showButtonsForAdminsOnly;
508:            }
509:
510:            public String getPoweredByLogoToolTip() {
511:                return poweredByLogoToolTip;
512:            }
513:
514:            public void setPoweredByLogoToolTip(String poweredByLogoToolTip) {
515:                this.poweredByLogoToolTip = poweredByLogoToolTip;
516:            }
517:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.