Source Code Cross Referenced for RifeConfig.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » config » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
0003:         * Distributed under the terms of either:
0004:         * - the common development and distribution license (CDDL), v1.0; or
0005:         * - the GNU Lesser General Public License, v2.1 or later
0006:         * $Id: RifeConfig.java 3806 2007-06-24 21:12:50Z gbevin $
0007:         */
0008:        package com.uwyn.rife.config;
0009:
0010:        import java.util.*;
0011:
0012:        import com.uwyn.rife.config.exceptions.DateFormatInitializationException;
0013:        import com.uwyn.rife.continuations.ContinuationConfigRuntime;
0014:        import com.uwyn.rife.template.TemplateFactory;
0015:        import com.uwyn.rife.tools.Convert;
0016:        import com.uwyn.rife.tools.Localization;
0017:        import com.uwyn.rife.tools.StringUtils;
0018:        import com.uwyn.rife.tools.exceptions.LightweightError;
0019:        import java.io.File;
0020:        import java.text.DateFormat;
0021:        import java.text.SimpleDateFormat;
0022:
0023:        public abstract class RifeConfig {
0024:            public static abstract class Global {
0025:                public static final String PARAM_TEMP_PATH = "TEMP_PATH";
0026:                public static final String PARAM_APPLICATION_CLASSPATH = "APPLICATION_CLASSPATH";
0027:                public static final String PARAM_JAVA_COMPILER_PATH = "JAVA_COMPILER_PATH";
0028:                public static final String PARAM_JAVA_COMPILER_ARGS = "JAVA_COMPILER_ARGS";
0029:                public static final String PARAM_JAVA_COMPILER_INTERNAL = "JAVA_COMPILER_INTERNAL";
0030:                public static final String PARAM_AUTO_RELOAD_DELAY = "AUTO_RELOAD_DELAY";
0031:                public static final String PARAM_USE_FAST_EXCEPTIONS = "USE_FAST_EXCEPTIONS";
0032:
0033:                private static final String DEFAULT_JAVA_COMPILER_PATH;
0034:                static {
0035:                    if (System.getProperty("os.name").toLowerCase().indexOf(
0036:                            "windows") != -1) {
0037:                        DEFAULT_JAVA_COMPILER_PATH = "javac.exe";
0038:                    } else {
0039:                        DEFAULT_JAVA_COMPILER_PATH = "javac";
0040:                    }
0041:                }
0042:
0043:                private static final boolean DEFAULT_JAVA_COMPILER_INTERNAL = false;
0044:                private static final int DEFAULT_AUTO_RELOAD_DELAY = 10 * 1000;
0045:
0046:                private static String sFallbackTempPath;
0047:                static {
0048:                    String tmpdir = System.getProperty("java.io.tmpdir");
0049:                    sFallbackTempPath = StringUtils.stripFromEnd(tmpdir,
0050:                            File.separator);
0051:                }
0052:
0053:                private static String sFallbackApplicationClassPath = "";
0054:                private static int sAutoReloadDelay = DEFAULT_AUTO_RELOAD_DELAY;
0055:
0056:                public static String getTempPath() {
0057:                    if (Config.hasRepInstance()) {
0058:                        return Config.getRepInstance().getString(
0059:                                PARAM_TEMP_PATH, sFallbackTempPath);
0060:                    }
0061:
0062:                    return sFallbackTempPath;
0063:                }
0064:
0065:                public static synchronized void setTempPath(String path) {
0066:                    if (null == path)
0067:                        throw new IllegalArgumentException(
0068:                                "path can't be null.");
0069:                    if (0 == path.length())
0070:                        throw new IllegalArgumentException(
0071:                                "path can't be empty.");
0072:
0073:                    if (Config.hasRepInstance()) {
0074:                        Config.getRepInstance().setParameter(PARAM_TEMP_PATH,
0075:                                path);
0076:                    } else {
0077:                        sFallbackTempPath = path;
0078:                    }
0079:                }
0080:
0081:                public static String getApplicationClassPath() {
0082:                    if (Config.hasRepInstance()) {
0083:                        return Config.getRepInstance().getString(
0084:                                PARAM_APPLICATION_CLASSPATH,
0085:                                sFallbackApplicationClassPath);
0086:                    }
0087:
0088:                    return sFallbackApplicationClassPath;
0089:                }
0090:
0091:                public static synchronized void setApplicationClassPath(
0092:                        String path) {
0093:                    if (null == path)
0094:                        throw new IllegalArgumentException(
0095:                                "path can't be null.");
0096:                    if (0 == path.length())
0097:                        throw new IllegalArgumentException(
0098:                                "path can't be empty.");
0099:
0100:                    if (Config.hasRepInstance()) {
0101:                        Config.getRepInstance().setParameter(
0102:                                PARAM_APPLICATION_CLASSPATH, path);
0103:                    } else {
0104:                        sFallbackApplicationClassPath = path;
0105:                    }
0106:                }
0107:
0108:                public static String getJavaCompilerPath() {
0109:                    if (Config.hasRepInstance()) {
0110:                        return Config.getRepInstance().getString(
0111:                                PARAM_JAVA_COMPILER_PATH,
0112:                                DEFAULT_JAVA_COMPILER_PATH);
0113:                    }
0114:
0115:                    return DEFAULT_JAVA_COMPILER_PATH;
0116:                }
0117:
0118:                public static boolean isJavaCompilerPathSet() {
0119:                    if (Config.hasRepInstance()) {
0120:                        return Config.getRepInstance().hasParameter(
0121:                                PARAM_JAVA_COMPILER_PATH);
0122:                    }
0123:
0124:                    return false;
0125:                }
0126:
0127:                public static boolean getJavaCompilerInternal() {
0128:                    if (Config.hasRepInstance()) {
0129:                        return Config.getRepInstance().getBool(
0130:                                PARAM_JAVA_COMPILER_INTERNAL,
0131:                                DEFAULT_JAVA_COMPILER_INTERNAL);
0132:                    }
0133:
0134:                    return DEFAULT_JAVA_COMPILER_INTERNAL;
0135:                }
0136:
0137:                public static boolean areJavaCompilerArgsSet() {
0138:                    if (Config.hasRepInstance()) {
0139:                        return Config.getRepInstance().hasList(
0140:                                PARAM_JAVA_COMPILER_ARGS);
0141:                    }
0142:
0143:                    return false;
0144:                }
0145:
0146:                public static Collection<String> getJavaCompilerArgs() {
0147:                    if (Config.hasRepInstance()) {
0148:                        return Config.getRepInstance().getStringItems(
0149:                                PARAM_JAVA_COMPILER_ARGS);
0150:                    }
0151:
0152:                    return null;
0153:                }
0154:
0155:                public static boolean isInternalJavaCompilerAvailable() {
0156:                    try {
0157:                        Class klass = Class.forName("com.sun.tools.javac.Main");
0158:                        if (null == klass) {
0159:                            return false;
0160:                        }
0161:                    } catch (ClassNotFoundException e) {
0162:                        return false;
0163:                    }
0164:
0165:                    return true;
0166:                }
0167:
0168:                public static int getAutoReloadDelay() {
0169:                    if (Config.hasRepInstance()) {
0170:                        return Config.getRepInstance().getInt(
0171:                                PARAM_AUTO_RELOAD_DELAY, sAutoReloadDelay);
0172:                    }
0173:
0174:                    return sAutoReloadDelay;
0175:                }
0176:
0177:                public static synchronized void setAutoReloadDelay(int delay) {
0178:                    if (Config.hasRepInstance()) {
0179:                        Config.getRepInstance().setParameter(
0180:                                PARAM_AUTO_RELOAD_DELAY, delay);
0181:                    } else {
0182:                        sAutoReloadDelay = delay;
0183:                    }
0184:                }
0185:
0186:                public static boolean getUseFastExceptions() {
0187:                    if (Config.hasRepInstance()) {
0188:                        return Config.getRepInstance().getBool(
0189:                                PARAM_USE_FAST_EXCEPTIONS,
0190:                                LightweightError.getUseFastExceptions());
0191:                    }
0192:
0193:                    return LightweightError.getUseFastExceptions();
0194:                }
0195:
0196:                public static synchronized void setUseFastExceptions(
0197:                        boolean toggle) {
0198:                    if (Config.hasRepInstance()) {
0199:                        Config.getRepInstance().setParameter(
0200:                                PARAM_USE_FAST_EXCEPTIONS, toggle);
0201:                    } else {
0202:                        LightweightError.setUseFastExceptions(toggle);
0203:                    }
0204:                }
0205:            }
0206:
0207:            public static abstract class Authentication {
0208:                public static final String PARAM_SESSION_DURATION = "SESSION_DURATION";
0209:                public static final String PARAM_SESSION_PURGE_FREQUENCY = "SESSION_PURGE_FREQUENCY";
0210:                public static final String PARAM_SESSION_PURGE_SCALE = "SESSION_PURGE_SCALE";
0211:                public static final String PARAM_SESSION_RESTRICT_HOSTIP = "SESSION_RESTRICT_HOSTIP";
0212:                public static final String PARAM_REMEMBER_DURATION = "REMEMBER_DURATION";
0213:                public static final String PARAM_REMEMBER_PURGE_FREQUENCY = "REMEMBER_PURGE_FREQUENCY";
0214:                public static final String PARAM_REMEMBER_PURGE_SCALE = "REMEMBER_PURGE_SCALE";
0215:                public static final String PARAM_TABLE_ROLE = "TABLE_ROLE";
0216:                public static final String PARAM_SEQUENCE_ROLE = "SEQUENCE_ROLE";
0217:                public static final String PARAM_TABLE_USER = "TABLE_USER";
0218:                public static final String PARAM_TABLE_ROLELINK = "TABLE_ROLELINK";
0219:                public static final String PARAM_TABLE_AUTHENTICATION = "TABLE_AUTHENTICATION";
0220:                public static final String PARAM_TABLE_REMEMBER = "TABLE_REMEMBER";
0221:                public static final String PARAM_ROLE_NAME_MAXIMUM_LENGTH = "ROLE_NAME_MAXIMUM_LENGTH";
0222:                public static final String PARAM_LOGIN_MAXIMUM_LENGTH = "LOGIN_NAME_MAXIMUM_LENGTH";
0223:                public static final String PARAM_LOGIN_MINIMUM_LENGTH = "LOGIN_NAME_MINIMUM_LENGTH";
0224:                public static final String PARAM_PASSWORD_MAXIMUM_LENGTH = "PASSWORD_MAXIMUM_LENGTH";
0225:                public static final String PARAM_PASSWORD_MINIMUM_LENGTH = "PASSWORD_MINIMUM_LENGTH";
0226:
0227:                private static final long DEFAULT_SESSION_DURATION = 1000 * 60 * 20; // 20 minutes
0228:                private static final int DEFAULT_SESSION_PURGE_FREQUENCY = 20; // 20 out of 1000 times, means 1/50th of the time
0229:                private static final int DEFAULT_SESSION_PURGE_SCALE = 1000;
0230:                private static final boolean DEFAULT_SESSION_RESTRICT_HOSTIP = false;
0231:                private static final long DEFAULT_REMEMBER_DURATION = 1000L
0232:                        * 60L * 60L * 24L * 30L * 3L; // 3 months
0233:                private static final int DEFAULT_REMEMBER_PURGE_FREQUENCY = 20; // 20 out of 1000 times, means 1/50th of the time
0234:                private static final int DEFAULT_REMEMBER_PURGE_SCALE = 1000;
0235:                private static final int DEFAULT_ROLE_NAME_MAXIMUM_LENGTH = 20;
0236:                private static final int DEFAULT_LOGIN_MAXIMUM_LENGTH = 20;
0237:                private static final int DEFAULT_LOGIN_MINIMUM_LENGTH = 5;
0238:                private static final int DEFAULT_PASSWORD_MAXIMUM_LENGTH = 100;
0239:                private static final int DEFAULT_PASSWORD_MINIMUM_LENGTH = 5;
0240:                private static final String DEFAULT_TABLE_ROLE = "AuthRole";
0241:                private static final String DEFAULT_SEQUENCE_ROLE = "SEQ_AUTHROLE";
0242:                private static final String DEFAULT_TABLE_USER = "AuthUser";
0243:                private static final String DEFAULT_TABLE_ROLELINK = "AuthRoleLink";
0244:                private static final String DEFAULT_TABLE_AUTHENTICATION = "Authentication";
0245:                private static final String DEFAULT_TABLE_REMEMBER = "AuthRemember";
0246:
0247:                public static int getPasswordMinimumLength() {
0248:                    if (Config.hasRepInstance()) {
0249:                        return Config.getRepInstance().getInt(
0250:                                PARAM_PASSWORD_MINIMUM_LENGTH,
0251:                                DEFAULT_PASSWORD_MINIMUM_LENGTH);
0252:                    }
0253:
0254:                    return DEFAULT_PASSWORD_MINIMUM_LENGTH;
0255:                }
0256:
0257:                public static int getPasswordMaximumLength() {
0258:                    if (Config.hasRepInstance()) {
0259:                        return Config.getRepInstance().getInt(
0260:                                PARAM_PASSWORD_MAXIMUM_LENGTH,
0261:                                DEFAULT_PASSWORD_MAXIMUM_LENGTH);
0262:                    }
0263:
0264:                    return DEFAULT_PASSWORD_MAXIMUM_LENGTH;
0265:                }
0266:
0267:                public static int getLoginMinimumLength() {
0268:                    if (Config.hasRepInstance()) {
0269:                        return Config.getRepInstance().getInt(
0270:                                PARAM_LOGIN_MINIMUM_LENGTH,
0271:                                DEFAULT_LOGIN_MINIMUM_LENGTH);
0272:                    }
0273:
0274:                    return DEFAULT_LOGIN_MINIMUM_LENGTH;
0275:                }
0276:
0277:                public static int getLoginMaximumLength() {
0278:                    if (Config.hasRepInstance()) {
0279:                        return Config.getRepInstance().getInt(
0280:                                PARAM_LOGIN_MAXIMUM_LENGTH,
0281:                                DEFAULT_LOGIN_MAXIMUM_LENGTH);
0282:                    }
0283:
0284:                    return DEFAULT_LOGIN_MAXIMUM_LENGTH;
0285:                }
0286:
0287:                public static int getRoleNameMaximumLength() {
0288:                    if (Config.hasRepInstance()) {
0289:                        return Config.getRepInstance().getInt(
0290:                                PARAM_ROLE_NAME_MAXIMUM_LENGTH,
0291:                                DEFAULT_ROLE_NAME_MAXIMUM_LENGTH);
0292:                    }
0293:
0294:                    return DEFAULT_ROLE_NAME_MAXIMUM_LENGTH;
0295:                }
0296:
0297:                public static long getSessionDuration() {
0298:                    if (Config.hasRepInstance()) {
0299:                        return Config.getRepInstance().getLong(
0300:                                PARAM_SESSION_DURATION,
0301:                                DEFAULT_SESSION_DURATION);
0302:                    }
0303:
0304:                    return DEFAULT_SESSION_DURATION;
0305:                }
0306:
0307:                public static int getSessionPurgeFrequency() {
0308:                    if (Config.hasRepInstance()) {
0309:                        return Config.getRepInstance().getInt(
0310:                                PARAM_SESSION_PURGE_FREQUENCY,
0311:                                DEFAULT_SESSION_PURGE_FREQUENCY);
0312:                    }
0313:
0314:                    return DEFAULT_SESSION_PURGE_FREQUENCY;
0315:                }
0316:
0317:                public static int getSessionPurgeScale() {
0318:                    if (Config.hasRepInstance()) {
0319:                        return Config.getRepInstance().getInt(
0320:                                PARAM_SESSION_PURGE_SCALE,
0321:                                DEFAULT_SESSION_PURGE_SCALE);
0322:                    }
0323:
0324:                    return DEFAULT_SESSION_PURGE_SCALE;
0325:                }
0326:
0327:                public static boolean getSessionRestrictHostIp() {
0328:                    if (Config.hasRepInstance()) {
0329:                        return Config.getRepInstance().getBool(
0330:                                PARAM_SESSION_RESTRICT_HOSTIP,
0331:                                DEFAULT_SESSION_RESTRICT_HOSTIP);
0332:                    }
0333:
0334:                    return DEFAULT_SESSION_RESTRICT_HOSTIP;
0335:                }
0336:
0337:                public static long getRememberDuration() {
0338:                    if (Config.hasRepInstance()) {
0339:                        return Config.getRepInstance().getLong(
0340:                                PARAM_REMEMBER_DURATION,
0341:                                DEFAULT_REMEMBER_DURATION);
0342:                    }
0343:
0344:                    return DEFAULT_REMEMBER_DURATION;
0345:                }
0346:
0347:                public static int getRememberPurgeFrequency() {
0348:                    if (Config.hasRepInstance()) {
0349:                        return Config.getRepInstance().getInt(
0350:                                PARAM_REMEMBER_PURGE_FREQUENCY,
0351:                                DEFAULT_REMEMBER_PURGE_FREQUENCY);
0352:                    }
0353:
0354:                    return DEFAULT_REMEMBER_PURGE_FREQUENCY;
0355:                }
0356:
0357:                public static int getRememberPurgeScale() {
0358:                    if (Config.hasRepInstance()) {
0359:                        return Config.getRepInstance().getInt(
0360:                                PARAM_REMEMBER_PURGE_SCALE,
0361:                                DEFAULT_REMEMBER_PURGE_SCALE);
0362:                    }
0363:
0364:                    return DEFAULT_REMEMBER_PURGE_SCALE;
0365:                }
0366:
0367:                public static String getTableRole() {
0368:                    if (Config.hasRepInstance()) {
0369:                        return Config.getRepInstance().getString(
0370:                                PARAM_TABLE_ROLE, DEFAULT_TABLE_ROLE);
0371:                    }
0372:
0373:                    return DEFAULT_TABLE_ROLE;
0374:                }
0375:
0376:                public static String getSequenceRole() {
0377:                    if (Config.hasRepInstance()) {
0378:                        return Config.getRepInstance().getString(
0379:                                PARAM_SEQUENCE_ROLE, DEFAULT_SEQUENCE_ROLE);
0380:                    }
0381:
0382:                    return DEFAULT_SEQUENCE_ROLE;
0383:                }
0384:
0385:                public static String getTableUser() {
0386:                    if (Config.hasRepInstance()) {
0387:                        return Config.getRepInstance().getString(
0388:                                PARAM_TABLE_USER, DEFAULT_TABLE_USER);
0389:                    }
0390:
0391:                    return DEFAULT_TABLE_USER;
0392:                }
0393:
0394:                public static String getTableRoleLink() {
0395:                    if (Config.hasRepInstance()) {
0396:                        return Config.getRepInstance().getString(
0397:                                PARAM_TABLE_ROLELINK, DEFAULT_TABLE_ROLELINK);
0398:                    }
0399:
0400:                    return DEFAULT_TABLE_ROLELINK;
0401:                }
0402:
0403:                public static String getTableAuthentication() {
0404:                    if (Config.hasRepInstance()) {
0405:                        return Config.getRepInstance().getString(
0406:                                PARAM_TABLE_AUTHENTICATION,
0407:                                DEFAULT_TABLE_AUTHENTICATION);
0408:                    }
0409:
0410:                    return DEFAULT_TABLE_AUTHENTICATION;
0411:                }
0412:
0413:                public static String getTableRemember() {
0414:                    if (Config.hasRepInstance()) {
0415:                        return Config.getRepInstance().getString(
0416:                                PARAM_TABLE_REMEMBER, DEFAULT_TABLE_REMEMBER);
0417:                    }
0418:
0419:                    return DEFAULT_TABLE_REMEMBER;
0420:                }
0421:            }
0422:
0423:            public static abstract class Cmf {
0424:                public static final String PARAM_SEQUENCE_CONTENTREPOSITORY = "SEQUENCE_CONTENTREPOSITORY";
0425:                public static final String PARAM_SEQUENCE_CONTENTINFO = "SEQUENCE_CONTENTINFO";
0426:                public static final String PARAM_TABLE_CONTENTREPOSITORY = "TABLE_CONTENTREPOSITORY";
0427:                public static final String PARAM_TABLE_CONTENTINFO = "TABLE_CONTENTINFO";
0428:                public static final String PARAM_TABLE_CONTENTATTRIBUTE = "TABLE_CONTENTATTRIBUTE";
0429:                public static final String PARAM_TABLE_CONTENTPROPERTY = "TABLE_CONTENTPROPERTY";
0430:                public static final String PARAM_TABLE_CONTENTSTOREIMAGE = "TABLE_CONTENTSTOREIMAGE";
0431:                public static final String PARAM_TABLE_CONTENTSTORETEXT = "TABLE_CONTENTSTORETEXT";
0432:                public static final String PARAM_TABLE_CONTENTSTORERAWINFO = "TABLE_CONTENTSTORERAWINFO";
0433:                public static final String PARAM_TABLE_CONTENTSTORERAWCHUNK = "TABLE_CONTENTSTORERAWCHUNK";
0434:
0435:                private static final String DEFAULT_SEQUENCE_CONTENTREPOSITORY = "SEQ_CONTENTREPOSITORY";
0436:                private static final String DEFAULT_SEQUENCE_CONTENTINFO = "SEQ_CONTENTINFO";
0437:                private static final String DEFAULT_TABLE_CONTENTREPOSITORY = "ContentRepository";
0438:                private static final String DEFAULT_TABLE_CONTENTINFO = "ContentInfo";
0439:                private static final String DEFAULT_TABLE_CONTENTATTRIBUTE = "ContentAttribute";
0440:                private static final String DEFAULT_TABLE_CONTENTPROPERTY = "ContentProperty";
0441:                private static final String DEFAULT_TABLE_CONTENTSTOREIMAGE = "ContentStoreImage";
0442:                private static final String DEFAULT_TABLE_CONTENTSTORETEXT = "ContentStoreText";
0443:                private static final String DEFAULT_TABLE_CONTENTSTORERAWINFO = "ContentStoreRawInfo";
0444:                private static final String DEFAULT_TABLE_CONTENTSTORERAWCHUNK = "ContentStoreRawChunk";
0445:
0446:                public static String getSequenceContentRepository() {
0447:                    if (Config.hasRepInstance()) {
0448:                        return Config.getRepInstance().getString(
0449:                                PARAM_SEQUENCE_CONTENTREPOSITORY,
0450:                                DEFAULT_SEQUENCE_CONTENTREPOSITORY);
0451:                    }
0452:
0453:                    return DEFAULT_SEQUENCE_CONTENTREPOSITORY;
0454:                }
0455:
0456:                public static String getSequenceContentInfo() {
0457:                    if (Config.hasRepInstance()) {
0458:                        return Config.getRepInstance().getString(
0459:                                PARAM_SEQUENCE_CONTENTINFO,
0460:                                DEFAULT_SEQUENCE_CONTENTINFO);
0461:                    }
0462:
0463:                    return DEFAULT_SEQUENCE_CONTENTINFO;
0464:                }
0465:
0466:                public static String getTableContentRepository() {
0467:                    if (Config.hasRepInstance()) {
0468:                        return Config.getRepInstance().getString(
0469:                                PARAM_TABLE_CONTENTREPOSITORY,
0470:                                DEFAULT_TABLE_CONTENTREPOSITORY);
0471:                    }
0472:
0473:                    return DEFAULT_TABLE_CONTENTREPOSITORY;
0474:                }
0475:
0476:                public static String getTableContentInfo() {
0477:                    if (Config.hasRepInstance()) {
0478:                        return Config.getRepInstance().getString(
0479:                                PARAM_TABLE_CONTENTINFO,
0480:                                DEFAULT_TABLE_CONTENTINFO);
0481:                    }
0482:
0483:                    return DEFAULT_TABLE_CONTENTINFO;
0484:                }
0485:
0486:                public static String getTableContentAttribute() {
0487:                    if (Config.hasRepInstance()) {
0488:                        return Config.getRepInstance().getString(
0489:                                PARAM_TABLE_CONTENTATTRIBUTE,
0490:                                DEFAULT_TABLE_CONTENTATTRIBUTE);
0491:                    }
0492:
0493:                    return DEFAULT_TABLE_CONTENTATTRIBUTE;
0494:                }
0495:
0496:                public static String getTableContentProperty() {
0497:                    if (Config.hasRepInstance()) {
0498:                        return Config.getRepInstance().getString(
0499:                                PARAM_TABLE_CONTENTPROPERTY,
0500:                                DEFAULT_TABLE_CONTENTPROPERTY);
0501:                    }
0502:
0503:                    return DEFAULT_TABLE_CONTENTPROPERTY;
0504:                }
0505:
0506:                public static String getTableContentStoreImage() {
0507:                    if (Config.hasRepInstance()) {
0508:                        return Config.getRepInstance().getString(
0509:                                PARAM_TABLE_CONTENTSTOREIMAGE,
0510:                                DEFAULT_TABLE_CONTENTSTOREIMAGE);
0511:                    }
0512:
0513:                    return DEFAULT_TABLE_CONTENTSTOREIMAGE;
0514:                }
0515:
0516:                public static String getTableContentStoreText() {
0517:                    if (Config.hasRepInstance()) {
0518:                        return Config.getRepInstance().getString(
0519:                                PARAM_TABLE_CONTENTSTORETEXT,
0520:                                DEFAULT_TABLE_CONTENTSTORETEXT);
0521:                    }
0522:
0523:                    return DEFAULT_TABLE_CONTENTSTORETEXT;
0524:                }
0525:
0526:                public static String getTableContentStoreRawInfo() {
0527:                    if (Config.hasRepInstance()) {
0528:                        return Config.getRepInstance().getString(
0529:                                PARAM_TABLE_CONTENTSTORERAWINFO,
0530:                                DEFAULT_TABLE_CONTENTSTORERAWINFO);
0531:                    }
0532:
0533:                    return DEFAULT_TABLE_CONTENTSTORERAWINFO;
0534:                }
0535:
0536:                public static String getTableContentStoreRawChunk() {
0537:                    if (Config.hasRepInstance()) {
0538:                        return Config.getRepInstance().getString(
0539:                                PARAM_TABLE_CONTENTSTORERAWCHUNK,
0540:                                DEFAULT_TABLE_CONTENTSTORERAWCHUNK);
0541:                    }
0542:
0543:                    return DEFAULT_TABLE_CONTENTSTORERAWCHUNK;
0544:                }
0545:            }
0546:
0547:            public static abstract class Database {
0548:                public static final String PARAM_TRANSACTION_TIMEOUT = "TRANSACTION_TIMEOUT";
0549:                public static final String PARAM_SQL_DEBUG_TRACE = "SQL_DEBUG_TRACE";
0550:
0551:                private static final int DEFAULT_TRANSACTION_TIMEOUT = 0; // 0 seconds : turned off
0552:                private static final boolean DEFAULT_SQL_DEBUG_TRACE = false;
0553:
0554:                public static int getTransactionTimeout() {
0555:                    if (Config.hasRepInstance()) {
0556:                        return Config.getRepInstance().getInt(
0557:                                PARAM_TRANSACTION_TIMEOUT,
0558:                                DEFAULT_TRANSACTION_TIMEOUT);
0559:                    }
0560:
0561:                    return DEFAULT_TRANSACTION_TIMEOUT;
0562:                }
0563:
0564:                public static boolean getSqlDebugTrace() {
0565:                    if (Config.hasRepInstance()) {
0566:                        return Config.getRepInstance().getBool(
0567:                                PARAM_SQL_DEBUG_TRACE, DEFAULT_SQL_DEBUG_TRACE);
0568:                    }
0569:
0570:                    return DEFAULT_SQL_DEBUG_TRACE;
0571:                }
0572:            }
0573:
0574:            public static abstract class Engine {
0575:                public static final String PARAM_DEFAULT_CONTENT_TYPE = "DEFAULT_CONTENT_TYPE";
0576:                public static final String PARAM_ELEMENT_AUTO_RELOAD = "ELEMENT_AUTO_RELOAD";
0577:                public static final String PARAM_ELEMENT_GENERATION_PATH = "ELEMENT_GENERATION_PATH";
0578:                public static final String PARAM_ELEMENT_DEBUG_TRACE = "ELEMENT_DEBUG_TRACE";
0579:                public static final String PARAM_ELEMENT_DEBUG_MEMORY = "ELEMENT_DEBUG_MEMORY";
0580:                public static final String PARAM_LOG_ENGINE_EXCEPTIONS = "PRETTY_LOG_EXCEPTIONS";
0581:                public static final String PARAM_PRETTY_ENGINE_EXCEPTIONS = "PRETTY_ENGINE_EXCEPTIONS";
0582:                public static final String PARAM_FILEUPLOAD_PATH = "FILEUPLOAD_PATH";
0583:                public static final String PARAM_FILEUPLOAD_SIZE_LIMIT = "FILEUPLOAD_SIZE_LIMIT";
0584:                public static final String PARAM_FILEUPLOAD_SIZE_CHECK = "FILEUPLOAD_SIZE_CHECK";
0585:                public static final String PARAM_FILEUPLOAD_SIZE_EXCEPTION = "FILEUPLOAD_SIZE_EXCEPTION";
0586:                public static final String PARAM_SITE_AUTO_RELOAD = "SITE_AUTO_RELOAD";
0587:                public static final String PARAM_CONTINUATION_DURATION = "CONTINUATION_DURATION";
0588:                public static final String PARAM_CONTINUATION_PURGE_FREQUENCY = "CONTINUATION_PURGE_FREQUENCY";
0589:                public static final String PARAM_CONTINUATION_PURGE_SCALE = "CONTINUATION_PURGE_SCALE";
0590:                public static final String PARAM_GZIP_COMPRESSION = "GZIP_COMPRESSION";
0591:                public static final String PARAM_GZIP_COMPRESSION_TYPES = "GZIP_COMPRESSION_TYPES";
0592:                public static final String PARAM_LOCAL_FORWARD_PORT = "LOCAL_FORWARD_PORT";
0593:                public static final String PARAM_PROXY_ROOTURL = "PROXY_ROOTURL";
0594:                public static final String PARAM_WEBAPP_CONTEXT_PATH = "WEBAPP_CONTEXT_PATH";
0595:                public static final String PARAM_RESPONSE_REQUIRES_SITE = "RESPONSE_REQUIRES_SITE";
0596:                public static final String PARAM_SITE_INITIALIZING_REDIRECT_URL = "SITE_INITIALIZING_REDIRECT_URL";
0597:                public static final String PARAM_SITE_INITIALIZING_PASSTHROUGH_SUFFIXES = "SITE_INITIALIZING_PASSTHROUGH_SUFFIXES";
0598:                public static final String PARAM_REQUEST_ENCODING = "REQUEST_ENCODING";
0599:                public static final String PARAM_RESPONSE_ENCODING = "RESPONSE_ENCODING";
0600:                public static final String PARAM_SESSION_STATE_STORE_CLONING = "SESSION_STATE_STORE_CLONING";
0601:
0602:                private static final String DEFAULT_DEFAULT_CONTENT_TYPE = "text/html";
0603:                private static final boolean DEFAULT_ELEMENT_AUTO_RELOAD = true;
0604:                private static final boolean DEFAULT_ELEMENT_DEBUG_TRACE = false;
0605:                private static final boolean DEFAULT_ELEMENT_DEBUG_MEMORY = false;
0606:                private static final boolean DEFAULT_LOG_ENGINE_EXCEPTIONS = true;
0607:                private static final boolean DEFAULT_PRETTY_ENGINE_EXCEPTIONS = true;
0608:                private static final long DEFAULT_FILEUPLOAD_SIZE_LIMIT = 1024 * 1024 * 2; // 2MB
0609:                private static final boolean DEFAULT_FILEUPLOAD_SIZE_CHECK = true;
0610:                private static final boolean DEFAULT_FILEUPLOAD_SIZE_EXCEPTION = false;
0611:                private static final boolean DEFAULT_SITE_AUTO_RELOAD = true;
0612:                private static final boolean DEFAULT_GZIP_COMPRESSION = false;
0613:                private static final Collection<String> DEFAULT_GZIP_COMPRESSION_TYPES = new ArrayList<String>() {
0614:                    {
0615:                        add("text/html");
0616:                        add("text/xml");
0617:                        add("text/plain");
0618:                        add("text/css");
0619:                        add("text/javascript");
0620:                        add("application/xml");
0621:                        add("application/xhtml+xml");
0622:                    }
0623:                };
0624:                private static final int DEFAULT_LOCAL_FORWARD_PORT = -1;
0625:                private static final String DEFAULT_PROXY_ROOTURL = null;
0626:                private static final String DEFAULT_WEBAPP_CONTEXT_PATH = null;
0627:                private static final boolean DEFAULT_RESPONSE_REQUIRES_SITE = true;
0628:                private static final String DEFAULT_SITE_INITIALIZING_REDIRECT_URL = null;
0629:                private static final Collection<String> DEFAULT_SITE_INITIALIZING_PASSTHROUGH_SUFFIXES = new ArrayList<String>() {
0630:                    {
0631:                        add(".gif");
0632:                        add(".png");
0633:                        add(".jpg");
0634:                        add(".jpeg");
0635:                        add(".bmp");
0636:                        add(".ico");
0637:                        add(".css");
0638:                        add(".js");
0639:                        add(".swf");
0640:                        add(".html");
0641:                        add(".htm");
0642:                        add(".htc");
0643:                        add(".class");
0644:                        add(".jar");
0645:                        add(".zip");
0646:                        add(".arj");
0647:                        add(".gz");
0648:                        add(".z");
0649:                        add(".wav");
0650:                        add(".mp3");
0651:                        add(".wma");
0652:                        add(".mpg");
0653:                        add(".avi");
0654:                        add(".ogg");
0655:                        add(".txt");
0656:                    }
0657:                };
0658:                private static final String DEFAULT_REQUEST_ENCODING = StringUtils.ENCODING_UTF_8;
0659:                private static final String DEFAULT_RESPONSE_ENCODING = StringUtils.ENCODING_UTF_8;
0660:                private static final boolean DEFAULT_SESSION_STATE_STORE_CLONING = true;
0661:
0662:                private static boolean sLogEngineExceptions = DEFAULT_LOG_ENGINE_EXCEPTIONS;
0663:
0664:                public static String getDefaultContentType() {
0665:                    if (Config.hasRepInstance()) {
0666:                        return Config.getRepInstance().getString(
0667:                                PARAM_DEFAULT_CONTENT_TYPE,
0668:                                DEFAULT_DEFAULT_CONTENT_TYPE);
0669:                    }
0670:
0671:                    return DEFAULT_DEFAULT_CONTENT_TYPE;
0672:                }
0673:
0674:                public static boolean getElementAutoReload() {
0675:                    Object value = System.getProperties().get(
0676:                            PARAM_ELEMENT_AUTO_RELOAD);
0677:                    return Convert
0678:                            .toBoolean(value, DEFAULT_ELEMENT_AUTO_RELOAD);
0679:                }
0680:
0681:                public static String getElementGenerationPath() {
0682:                    String generation_path = null;
0683:
0684:                    Object value = System.getProperties().get(
0685:                            PARAM_ELEMENT_GENERATION_PATH);
0686:                    if (value != null) {
0687:                        generation_path = value.toString();
0688:                    }
0689:
0690:                    if (null == generation_path) {
0691:                        return RifeConfig.Global.getTempPath() + File.separator
0692:                                + "rife_elements";
0693:                    }
0694:
0695:                    generation_path += File.separator;
0696:
0697:                    return generation_path;
0698:                }
0699:
0700:                public static boolean getElementDebugTrace() {
0701:                    if (Config.hasRepInstance()) {
0702:                        return Config.getRepInstance().getBool(
0703:                                PARAM_ELEMENT_DEBUG_TRACE,
0704:                                DEFAULT_ELEMENT_DEBUG_TRACE);
0705:                    }
0706:
0707:                    return DEFAULT_ELEMENT_DEBUG_TRACE;
0708:                }
0709:
0710:                public static boolean getElementDebugMemory() {
0711:                    if (Config.hasRepInstance()) {
0712:                        return Config.getRepInstance().getBool(
0713:                                PARAM_ELEMENT_DEBUG_MEMORY,
0714:                                DEFAULT_ELEMENT_DEBUG_MEMORY);
0715:                    }
0716:
0717:                    return DEFAULT_ELEMENT_DEBUG_MEMORY;
0718:                }
0719:
0720:                public static boolean getPrettyEngineExceptions() {
0721:                    if (Config.hasRepInstance()) {
0722:                        return Config.getRepInstance().getBool(
0723:                                PARAM_PRETTY_ENGINE_EXCEPTIONS,
0724:                                DEFAULT_PRETTY_ENGINE_EXCEPTIONS);
0725:                    }
0726:
0727:                    return DEFAULT_PRETTY_ENGINE_EXCEPTIONS;
0728:                }
0729:
0730:                public static boolean getLogEngineExceptions() {
0731:                    if (Config.hasRepInstance()
0732:                            && Config.getRepInstance().hasParameter(
0733:                                    PARAM_LOG_ENGINE_EXCEPTIONS)) {
0734:                        return Config.getRepInstance().getBool(
0735:                                PARAM_LOG_ENGINE_EXCEPTIONS,
0736:                                DEFAULT_LOG_ENGINE_EXCEPTIONS);
0737:                    }
0738:
0739:                    return sLogEngineExceptions;
0740:                }
0741:
0742:                public static synchronized void setLogEngineExceptions(
0743:                        boolean generate) {
0744:                    if (Config.hasRepInstance()) {
0745:                        Config.getRepInstance().setParameter(
0746:                                PARAM_LOG_ENGINE_EXCEPTIONS, generate);
0747:                    } else {
0748:                        sLogEngineExceptions = generate;
0749:                    }
0750:                }
0751:
0752:                public static String getFileUploadPath() {
0753:                    String fileupload_path = null;
0754:
0755:                    if (Config.hasRepInstance()) {
0756:                        fileupload_path = Config.getRepInstance().getString(
0757:                                PARAM_FILEUPLOAD_PATH);
0758:                    }
0759:                    if (null == fileupload_path) {
0760:                        return RifeConfig.Global.getTempPath() + File.separator
0761:                                + "rife_uploads";
0762:                    }
0763:
0764:                    fileupload_path += File.separator;
0765:
0766:                    return fileupload_path;
0767:                }
0768:
0769:                public static long getFileuploadSizeLimit() {
0770:                    if (Config.hasRepInstance()) {
0771:                        return Config.getRepInstance().getLong(
0772:                                PARAM_FILEUPLOAD_SIZE_LIMIT,
0773:                                DEFAULT_FILEUPLOAD_SIZE_LIMIT);
0774:                    }
0775:
0776:                    return DEFAULT_FILEUPLOAD_SIZE_LIMIT;
0777:                }
0778:
0779:                public static boolean getFileUploadSizeCheck() {
0780:                    if (Config.hasRepInstance()) {
0781:                        return Config.getRepInstance().getBool(
0782:                                PARAM_FILEUPLOAD_SIZE_CHECK,
0783:                                DEFAULT_FILEUPLOAD_SIZE_CHECK);
0784:                    }
0785:
0786:                    return DEFAULT_FILEUPLOAD_SIZE_CHECK;
0787:                }
0788:
0789:                public static boolean getFileUploadSizeException() {
0790:                    if (Config.hasRepInstance()) {
0791:                        return Config.getRepInstance().getBool(
0792:                                PARAM_FILEUPLOAD_SIZE_EXCEPTION,
0793:                                DEFAULT_FILEUPLOAD_SIZE_EXCEPTION);
0794:                    }
0795:
0796:                    return DEFAULT_FILEUPLOAD_SIZE_EXCEPTION;
0797:                }
0798:
0799:                public static boolean getSiteAutoReload() {
0800:                    if (Config.hasRepInstance()) {
0801:                        return Config.getRepInstance().getBool(
0802:                                PARAM_SITE_AUTO_RELOAD,
0803:                                DEFAULT_SITE_AUTO_RELOAD);
0804:                    }
0805:
0806:                    return DEFAULT_SITE_AUTO_RELOAD;
0807:                }
0808:
0809:                public static long getContinuationDuration() {
0810:                    if (Config.hasRepInstance()) {
0811:                        return Config
0812:                                .getRepInstance()
0813:                                .getLong(
0814:                                        PARAM_CONTINUATION_DURATION,
0815:                                        ContinuationConfigRuntime.DEFAULT_CONTINUATION_DURATION);
0816:                    }
0817:
0818:                    return ContinuationConfigRuntime.DEFAULT_CONTINUATION_DURATION;
0819:                }
0820:
0821:                public static int getContinuationPurgeFrequency() {
0822:                    if (Config.hasRepInstance()) {
0823:                        return Config
0824:                                .getRepInstance()
0825:                                .getInt(
0826:                                        PARAM_CONTINUATION_PURGE_FREQUENCY,
0827:                                        ContinuationConfigRuntime.DEFAULT_CONTINUATION_PURGE_FREQUENCY);
0828:                    }
0829:
0830:                    return ContinuationConfigRuntime.DEFAULT_CONTINUATION_PURGE_FREQUENCY;
0831:                }
0832:
0833:                public static int getContinuationPurgeScale() {
0834:                    if (Config.hasRepInstance()) {
0835:                        return Config
0836:                                .getRepInstance()
0837:                                .getInt(
0838:                                        PARAM_CONTINUATION_PURGE_SCALE,
0839:                                        ContinuationConfigRuntime.DEFAULT_CONTINUATION_PURGE_SCALE);
0840:                    }
0841:
0842:                    return ContinuationConfigRuntime.DEFAULT_CONTINUATION_PURGE_SCALE;
0843:                }
0844:
0845:                public static boolean getGzipCompression() {
0846:                    if (Config.hasRepInstance()) {
0847:                        return Config.getRepInstance().getBool(
0848:                                PARAM_GZIP_COMPRESSION,
0849:                                DEFAULT_GZIP_COMPRESSION);
0850:                    }
0851:
0852:                    return DEFAULT_GZIP_COMPRESSION;
0853:                }
0854:
0855:                public static Collection<String> getGzipCompressionTypes() {
0856:                    if (Config.hasRepInstance()) {
0857:                        Collection<String> types = Config.getRepInstance()
0858:                                .getStringItems(PARAM_GZIP_COMPRESSION_TYPES);
0859:                        if (null == types) {
0860:                            return DEFAULT_GZIP_COMPRESSION_TYPES;
0861:                        }
0862:
0863:                        return types;
0864:                    }
0865:
0866:                    return DEFAULT_GZIP_COMPRESSION_TYPES;
0867:                }
0868:
0869:                public static int getLocalForwardPort() {
0870:                    if (Config.hasRepInstance()) {
0871:                        return Config.getRepInstance().getInt(
0872:                                PARAM_LOCAL_FORWARD_PORT,
0873:                                DEFAULT_LOCAL_FORWARD_PORT);
0874:                    }
0875:
0876:                    return DEFAULT_LOCAL_FORWARD_PORT;
0877:                }
0878:
0879:                public static String getProxyRootUrl() {
0880:                    if (Config.hasRepInstance()) {
0881:                        return Config.getRepInstance().getString(
0882:                                PARAM_PROXY_ROOTURL, DEFAULT_PROXY_ROOTURL);
0883:                    }
0884:
0885:                    return DEFAULT_PROXY_ROOTURL;
0886:                }
0887:
0888:                public static String getWebappContextPath() {
0889:                    if (Config.hasRepInstance()) {
0890:                        return Config.getRepInstance().getString(
0891:                                PARAM_WEBAPP_CONTEXT_PATH,
0892:                                DEFAULT_WEBAPP_CONTEXT_PATH);
0893:                    }
0894:
0895:                    return DEFAULT_WEBAPP_CONTEXT_PATH;
0896:                }
0897:
0898:                public static boolean getResponseRequiresSite() {
0899:                    if (Config.hasRepInstance()) {
0900:                        return Config.getRepInstance().getBool(
0901:                                PARAM_RESPONSE_REQUIRES_SITE,
0902:                                DEFAULT_RESPONSE_REQUIRES_SITE);
0903:                    }
0904:
0905:                    return DEFAULT_RESPONSE_REQUIRES_SITE;
0906:                }
0907:
0908:                public static String getSiteInitializingRedirectUrl() {
0909:                    if (Config.hasRepInstance()) {
0910:                        return Config.getRepInstance().getString(
0911:                                PARAM_SITE_INITIALIZING_REDIRECT_URL,
0912:                                DEFAULT_SITE_INITIALIZING_REDIRECT_URL);
0913:                    }
0914:
0915:                    return DEFAULT_SITE_INITIALIZING_REDIRECT_URL;
0916:                }
0917:
0918:                public static Collection<String> getSiteInitializingPassthroughSuffixes() {
0919:                    if (Config.hasRepInstance()) {
0920:                        Collection<String> types = Config
0921:                                .getRepInstance()
0922:                                .getStringItems(
0923:                                        PARAM_SITE_INITIALIZING_PASSTHROUGH_SUFFIXES);
0924:                        if (null == types) {
0925:                            return DEFAULT_SITE_INITIALIZING_PASSTHROUGH_SUFFIXES;
0926:                        }
0927:
0928:                        return types;
0929:                    }
0930:
0931:                    return DEFAULT_SITE_INITIALIZING_PASSTHROUGH_SUFFIXES;
0932:                }
0933:
0934:                public static String getRequestEncoding() {
0935:                    if (Config.hasRepInstance()) {
0936:                        return Config.getRepInstance().getString(
0937:                                PARAM_REQUEST_ENCODING,
0938:                                DEFAULT_REQUEST_ENCODING);
0939:                    }
0940:
0941:                    return DEFAULT_REQUEST_ENCODING;
0942:                }
0943:
0944:                public static String getResponseEncoding() {
0945:                    if (Config.hasRepInstance()) {
0946:                        return Config.getRepInstance().getString(
0947:                                PARAM_RESPONSE_ENCODING,
0948:                                DEFAULT_RESPONSE_ENCODING);
0949:                    }
0950:
0951:                    return DEFAULT_RESPONSE_ENCODING;
0952:                }
0953:
0954:                public static boolean getSessionStateStoreCloning() {
0955:                    if (Config.hasRepInstance()) {
0956:                        return Config.getRepInstance().getBool(
0957:                                PARAM_SESSION_STATE_STORE_CLONING,
0958:                                DEFAULT_SESSION_STATE_STORE_CLONING);
0959:                    }
0960:
0961:                    return DEFAULT_SESSION_STATE_STORE_CLONING;
0962:                }
0963:            }
0964:
0965:            public static abstract class Mime {
0966:                public static final String PARAM_MIME_MAPPING = "MIME_MAPPING";
0967:
0968:                private static Map<String, String> DEFAULT_MIME_MAPPING = new HashMap<String, String>() {
0969:                    {
0970:                        put("ez", "application/andrew-inset");
0971:                        put("jnlp", "application/jnlp");
0972:                        put("hqx", "application/mac-binhex40");
0973:                        put("cpt", "application/mac-compactpro");
0974:                        put("mathml", "application/mathml+xml");
0975:                        put("bin", "application/octet-stream");
0976:                        put("dms", "application/octet-stream");
0977:                        put("lha", "application/octet-stream");
0978:                        put("lzh", "application/octet-stream");
0979:                        put("exe", "application/octet-stream");
0980:                        put("class", "application/octet-stream");
0981:                        put("so", "application/octet-stream");
0982:                        put("dll", "application/octet-stream");
0983:                        put("dmg", "application/octet-stream");
0984:                        put("oda", "application/oda");
0985:                        put("ogg", "application/ogg");
0986:                        put("pdf", "application/pdf");
0987:                        put("ai", "application/postscript");
0988:                        put("eps", "application/postscript");
0989:                        put("ps", "application/postscript");
0990:                        put("rdf", "application/rdf+xml");
0991:                        put("smi", "application/smil");
0992:                        put("smil", "application/smil");
0993:                        put("gram", "application/srgs");
0994:                        put("grxml", "application/srgs+xml");
0995:                        put("mif", "application/vnd.mif");
0996:                        put("xls", "application/vnd.ms-excel");
0997:                        put("ppt", "application/vnd.ms-powerpoint");
0998:                        put("rm", "application/vnd.rn-realmedia");
0999:                        put("bcpio", "application/x-bcpio");
1000:                        put("vcd", "application/x-cdlink");
1001:                        put("pgn", "application/x-chess-pgn");
1002:                        put("cpio", "application/x-cpio");
1003:                        put("csh", "application/x-csh");
1004:                        put("dcr", "application/x-director");
1005:                        put("dir", "application/x-director");
1006:                        put("dxr", "application/x-director");
1007:                        put("dvi", "application/x-dvi");
1008:                        put("spl", "application/x-futuresplash");
1009:                        put("gtar", "application/x-gtar");
1010:                        put("hdf", "application/x-hdf");
1011:                        put("js", "application/x-javascript");
1012:                        put("skp", "application/x-koan");
1013:                        put("skd", "application/x-koan");
1014:                        put("skt", "application/x-koan");
1015:                        put("skm", "application/x-koan");
1016:                        put("latex", "application/x-latex");
1017:                        put("nc", "application/x-netcdf");
1018:                        put("cdf", "application/x-netcdf");
1019:                        put("ogg", "application/x-ogg");
1020:                        put("sh", "application/x-sh");
1021:                        put("shar", "application/x-shar");
1022:                        put("swf", "application/x-shockwave-flash");
1023:                        put("sit", "application/x-stuffit");
1024:                        put("sv4cpio", "application/x-sv4cpio");
1025:                        put("sv4crc", "application/x-sv4crc");
1026:                        put("tar", "application/x-tar");
1027:                        put("tcl", "application/x-tcl");
1028:                        put("tex", "application/x-tex");
1029:                        put("texinfo", "application/x-texinfo");
1030:                        put("texi", "application/x-texinfo");
1031:                        put("t", "application/x-troff");
1032:                        put("tr", "application/x-troff");
1033:                        put("roff", "application/x-troff");
1034:                        put("man", "application/x-troff-man");
1035:                        put("me", "application/x-troff-me");
1036:                        put("ms", "application/x-troff-ms");
1037:                        put("ustar", "application/x-ustar");
1038:                        put("src", "application/x-wais-source");
1039:                        put("xhtml", "application/xhtml+xml");
1040:                        put("xht", "application/xhtml+xml");
1041:                        put("xslt", "application/xslt+xml");
1042:                        put("xml", "application/xml");
1043:                        put("xsl", "application/xml");
1044:                        put("dtd", "application/xml-dtd");
1045:                        put("zip", "application/zip");
1046:                        put("au", "audio/basic");
1047:                        put("snd", "audio/basic");
1048:                        put("mid", "audio/midi");
1049:                        put("midi", "audio/midi");
1050:                        put("kar", "audio/midi");
1051:                        put("mpga", "audio/mpeg");
1052:                        put("mp2", "audio/mpeg");
1053:                        put("mp3", "audio/mpeg");
1054:                        put("aif", "audio/x-aiff");
1055:                        put("aiff", "audio/x-aiff");
1056:                        put("aifc", "audio/x-aiff");
1057:                        put("m3u", "audio/x-mpegurl");
1058:                        put("ram", "audio/x-pn-realaudio");
1059:                        put("ra", "audio/x-pn-realaudio");
1060:                        put("wav", "audio/x-wav");
1061:                        put("pdb", "chemical/x-pdb");
1062:                        put("xyz", "chemical/x-xyz");
1063:                        put("bmp", "image/bmp");
1064:                        put("cgm", "image/cgm");
1065:                        put("gif", "image/gif");
1066:                        put("ief", "image/ief");
1067:                        put("jpeg", "image/jpeg");
1068:                        put("jpg", "image/jpeg");
1069:                        put("jpe", "image/jpeg");
1070:                        put("png", "image/png");
1071:                        put("svg", "image/svg+xml");
1072:                        put("tiff", "image/tiff");
1073:                        put("tif", "image/tiff");
1074:                        put("djvu", "image/vnd.djvu");
1075:                        put("djv", "image/vnd.djvu");
1076:                        put("wbmp", "image/vnd.wap.wbmp");
1077:                        put("ras", "image/x-cmu-raster");
1078:                        put("ico", "image/x-icon");
1079:                        put("pnm", "image/x-portable-anymap");
1080:                        put("pbm", "image/x-portable-bitmap");
1081:                        put("pgm", "image/x-portable-graymap");
1082:                        put("ppm", "image/x-portable-pixmap");
1083:                        put("rgb", "image/x-rgb");
1084:                        put("xbm", "image/x-xbitmap");
1085:                        put("xpm", "image/x-xpixmap");
1086:                        put("xwd", "image/x-xwindowdump");
1087:                        put("igs", "model/iges");
1088:                        put("iges", "model/iges");
1089:                        put("msh", "model/mesh");
1090:                        put("mesh", "model/mesh");
1091:                        put("silo", "model/mesh");
1092:                        put("wrl", "model/vrml");
1093:                        put("vrml", "model/vrml");
1094:                        put("ics", "text/calendar");
1095:                        put("ifb", "text/calendar");
1096:                        put("css", "text/css");
1097:                        put("html", "text/html");
1098:                        put("htm", "text/html");
1099:                        put("asc", "text/plain");
1100:                        put("txt", "text/plain");
1101:                        put("rtx", "text/richtext");
1102:                        put("rtf", "text/rtf");
1103:                        put("sgml", "text/sgml");
1104:                        put("sgm", "text/sgml");
1105:                        put("tsv", "text/tab-separated-values");
1106:                        put("wml", "text/vnd.wap.wml");
1107:                        put("wmls", "text/vnd.wap.wmlscript");
1108:                        put("etx", "text/x-setext");
1109:                        put("htc", "text/x-component");
1110:                        put("mpeg", "video/mpeg");
1111:                        put("mpg", "video/mpeg");
1112:                        put("mpe", "video/mpeg");
1113:                        put("qt", "video/quicktime");
1114:                        put("mov", "video/quicktime");
1115:                        put("mxu", "video/vnd.mpegurl");
1116:                        put("m4u", "video/vnd.mpegurl");
1117:                        put("avi", "video/x-msvideo");
1118:                        put("movie", "video/x-sgi-movie");
1119:                        put("ice", "x-conference/x-cooltalk");
1120:                    }
1121:                };
1122:
1123:                public static String getMimeType(String extension) {
1124:                    return DEFAULT_MIME_MAPPING.get(extension);
1125:                }
1126:            }
1127:
1128:            public static abstract class Resources {
1129:                public static final String PARAM_TABLE_RESOURCES = "TABLE_RESOURCES";
1130:
1131:                private static final String DEFAULT_TABLE_TASK = "Resources";
1132:
1133:                public static String getTableResources() {
1134:                    if (Config.hasRepInstance()) {
1135:                        return Config.getRepInstance().getString(
1136:                                PARAM_TABLE_RESOURCES, DEFAULT_TABLE_TASK);
1137:                    }
1138:
1139:                    return DEFAULT_TABLE_TASK;
1140:                }
1141:            }
1142:
1143:            public static abstract class Scheduler {
1144:                public static final String PARAM_TABLE_TASK = "TABLE_TASK";
1145:                public static final String PARAM_SEQUENCE_TASK = "SEQUENCE_TASK";
1146:                public static final String PARAM_TABLE_TASKOPTION = "TABLE_TASKOPTION";
1147:                public static final String PARAM_TASKOPTION_NAME_MAXIMUM_LENGTH = "TASKOPTION_NAME_MAXIMUM_LENGTH";
1148:                public static final String PARAM_TASKOPTION_VALUE_MAXIMUM_LENGTH = "TASKOPTION_VALUE_MAXIMUM_LENGTH";
1149:                public static final String PARAM_TASK_TYPE_MAXIMUM_LENGTH = "TASK_TYPE_MAXIMUM_LENGTH";
1150:                public static final String PARAM_TASK_FREQUENCY_MAXIMUM_LENGTH = "TASK_FREQUENCY_MAXIMUM_LENGTH";
1151:
1152:                private static final String DEFAULT_TABLE_TASK = "SchedTask";
1153:                private static final String DEFAULT_SEQUENCE_TASK = "SEQ_SCHEDTASK";
1154:                private static final String DEFAULT_TABLE_TASKOPTION = "SchedTaskoption";
1155:                private static final int DEFAULT_TASKOPTION_NAME_MAXIMUM_LENGTH = 255;
1156:                private static final int DEFAULT_TASKOPTION_VALUE_MAXIMUM_LENGTH = 255;
1157:                private static final int DEFAULT_TASK_TYPE_MAXIMUM_LENGTH = 255;
1158:                private static final int DEFAULT_TASK_FREQUENCY_MAXIMUM_LENGTH = 255;
1159:
1160:                public static int getTaskTypeMaximumLength() {
1161:                    if (Config.hasRepInstance()) {
1162:                        return Config.getRepInstance().getInt(
1163:                                PARAM_TASK_TYPE_MAXIMUM_LENGTH,
1164:                                DEFAULT_TASK_TYPE_MAXIMUM_LENGTH);
1165:                    }
1166:
1167:                    return DEFAULT_TASK_TYPE_MAXIMUM_LENGTH;
1168:                }
1169:
1170:                public static int getTaskFrequencyMaximumLength() {
1171:                    if (Config.hasRepInstance()) {
1172:                        return Config.getRepInstance().getInt(
1173:                                PARAM_TASK_FREQUENCY_MAXIMUM_LENGTH,
1174:                                DEFAULT_TASK_FREQUENCY_MAXIMUM_LENGTH);
1175:                    }
1176:
1177:                    return DEFAULT_TASK_FREQUENCY_MAXIMUM_LENGTH;
1178:                }
1179:
1180:                public static int getTaskoptionValueMaximumLength() {
1181:                    if (Config.hasRepInstance()) {
1182:                        return Config.getRepInstance().getInt(
1183:                                PARAM_TASKOPTION_VALUE_MAXIMUM_LENGTH,
1184:                                DEFAULT_TASKOPTION_VALUE_MAXIMUM_LENGTH);
1185:                    }
1186:
1187:                    return DEFAULT_TASKOPTION_VALUE_MAXIMUM_LENGTH;
1188:                }
1189:
1190:                public static int getTaskoptionNameMaximumLength() {
1191:                    if (Config.hasRepInstance()) {
1192:                        return Config.getRepInstance().getInt(
1193:                                PARAM_TASKOPTION_NAME_MAXIMUM_LENGTH,
1194:                                DEFAULT_TASKOPTION_NAME_MAXIMUM_LENGTH);
1195:                    }
1196:
1197:                    return DEFAULT_TASKOPTION_NAME_MAXIMUM_LENGTH;
1198:                }
1199:
1200:                public static String getTableTask() {
1201:                    if (Config.hasRepInstance()) {
1202:                        return Config.getRepInstance().getString(
1203:                                PARAM_TABLE_TASK, DEFAULT_TABLE_TASK);
1204:                    }
1205:
1206:                    return DEFAULT_TABLE_TASK;
1207:                }
1208:
1209:                public static String getSequenceTask() {
1210:                    if (Config.hasRepInstance()) {
1211:                        return Config.getRepInstance().getString(
1212:                                PARAM_SEQUENCE_TASK, DEFAULT_SEQUENCE_TASK);
1213:                    }
1214:
1215:                    return DEFAULT_SEQUENCE_TASK;
1216:                }
1217:
1218:                public static String getTableTaskoption() {
1219:                    if (Config.hasRepInstance()) {
1220:                        return Config.getRepInstance().getString(
1221:                                PARAM_TABLE_TASKOPTION,
1222:                                DEFAULT_TABLE_TASKOPTION);
1223:                    }
1224:
1225:                    return DEFAULT_TABLE_TASKOPTION;
1226:                }
1227:            }
1228:
1229:            public static abstract class Swing {
1230:                public static final String PARAM_ICON_CONFIRM_PATH = "ICON_CONFIRM_PATH";
1231:                public static final String PARAM_ICON_ERROR_PATH = "ICON_ERROR_PATH";
1232:                public static final String PARAM_ICON_INFO_PATH = "ICON_INFO_PATH";
1233:
1234:                private static final String DEFAULT_ICON_CONFIRM_PATH = "icons/confirm.gif";
1235:                private static final String DEFAULT_ICON_ERROR_PATH = "icons/error.gif";
1236:                private static final String DEFAULT_ICON_INFO_PATH = "icons/info.gif";
1237:
1238:                public static String getIconConfirmPath() {
1239:                    if (Config.hasRepInstance()) {
1240:                        return Config.getRepInstance().getString(
1241:                                PARAM_ICON_CONFIRM_PATH,
1242:                                DEFAULT_ICON_CONFIRM_PATH);
1243:                    }
1244:
1245:                    return DEFAULT_ICON_CONFIRM_PATH;
1246:                }
1247:
1248:                public static String getIconErrorPath() {
1249:                    if (Config.hasRepInstance()) {
1250:                        return Config.getRepInstance().getString(
1251:                                PARAM_ICON_ERROR_PATH, DEFAULT_ICON_ERROR_PATH);
1252:                    }
1253:
1254:                    return DEFAULT_ICON_ERROR_PATH;
1255:                }
1256:
1257:                public static String getIconInfoPath() {
1258:                    if (Config.hasRepInstance()) {
1259:                        return Config.getRepInstance().getString(
1260:                                PARAM_ICON_INFO_PATH, DEFAULT_ICON_INFO_PATH);
1261:                    }
1262:
1263:                    return DEFAULT_ICON_INFO_PATH;
1264:                }
1265:            }
1266:
1267:            public static abstract class Template {
1268:                public static final String PARAM_TEMPLATE_AUTO_RELOAD = "TEMPLATE_AUTO_RELOAD";
1269:                public static final String PARAM_TEMPLATE_GENERATION_PATH = "TEMPLATE_GENERATION_PATH";
1270:                public static final String PARAM_TEMPLATE_GENERATE_CLASSES = "TEMPLATE_GENERATE_CLASSES";
1271:                public static final String PARAM_TEMPLATE_DEFAULT_ENCODING = "TEMPLATE_DEFAULT_ENCODING";
1272:
1273:                public static final String PREFIX_TEMPLATE_DEFAULT_RESOURCEBUNDLES = "TEMPLATE_DEFAULT_RESOURCEBUNDLES_";
1274:
1275:                private static String sGenerationPath = null;
1276:                private static String sDefaultEncoding = null;
1277:                private static HashMap<String, Collection<String>> sDefaultResourcebundles = null;
1278:                private static boolean sGenerateClasses = false;
1279:
1280:                private static final boolean DEFAULT_TEMPLATE_AUTO_RELOAD = true;
1281:
1282:                public static boolean getAutoReload() {
1283:                    if (Config.hasRepInstance()) {
1284:                        return Config.getRepInstance().getBool(
1285:                                PARAM_TEMPLATE_AUTO_RELOAD,
1286:                                DEFAULT_TEMPLATE_AUTO_RELOAD);
1287:                    }
1288:
1289:                    return DEFAULT_TEMPLATE_AUTO_RELOAD;
1290:                }
1291:
1292:                public static String getGenerationPath() {
1293:                    String generation_path = null;
1294:
1295:                    if (Config.hasRepInstance()) {
1296:                        generation_path = Config.getRepInstance()
1297:                                .getString(PARAM_TEMPLATE_GENERATION_PATH,
1298:                                        sGenerationPath);
1299:                    }
1300:                    if (null == generation_path) {
1301:                        generation_path = sGenerationPath;
1302:                    }
1303:                    if (null == generation_path) {
1304:                        return RifeConfig.Global.getTempPath() + File.separator
1305:                                + "rife_templates";
1306:                    }
1307:
1308:                    generation_path += File.separator;
1309:
1310:                    return generation_path;
1311:                }
1312:
1313:                public static synchronized void setGenerationPath(String path) {
1314:                    if (null == path)
1315:                        throw new IllegalArgumentException(
1316:                                "path can't be null.");
1317:                    if (0 == path.length())
1318:                        throw new IllegalArgumentException(
1319:                                "path can't be empty.");
1320:
1321:                    if (Config.hasRepInstance()) {
1322:                        Config.getRepInstance().setParameter(
1323:                                PARAM_TEMPLATE_GENERATION_PATH, path);
1324:                    } else {
1325:                        sGenerationPath = path;
1326:                    }
1327:                }
1328:
1329:                public static boolean getGenerateClasses() {
1330:                    if (Config.hasRepInstance()
1331:                            && Config.getRepInstance().hasParameter(
1332:                                    PARAM_TEMPLATE_GENERATE_CLASSES)) {
1333:                        return Config.getRepInstance().getBool(
1334:                                PARAM_TEMPLATE_GENERATE_CLASSES,
1335:                                sGenerateClasses);
1336:                    }
1337:
1338:                    return sGenerateClasses;
1339:                }
1340:
1341:                public static synchronized void setGenerateClasses(
1342:                        boolean generate) {
1343:                    if (Config.hasRepInstance()) {
1344:                        Config.getRepInstance().setParameter(
1345:                                PARAM_TEMPLATE_GENERATE_CLASSES, generate);
1346:                    } else {
1347:                        sGenerateClasses = generate;
1348:                    }
1349:                }
1350:
1351:                public static String getDefaultEncoding() {
1352:                    if (Config.hasRepInstance()) {
1353:                        return Config.getRepInstance().getString(
1354:                                PARAM_TEMPLATE_DEFAULT_ENCODING,
1355:                                sDefaultEncoding);
1356:                    }
1357:
1358:                    return sDefaultEncoding;
1359:                }
1360:
1361:                public static synchronized void setDefaultEncoding(
1362:                        String encoding) {
1363:                    if (null == encoding)
1364:                        throw new IllegalArgumentException(
1365:                                "encoding can't be null.");
1366:                    if (0 == encoding.length())
1367:                        throw new IllegalArgumentException(
1368:                                "encoding can't be empty.");
1369:
1370:                    if (Config.hasRepInstance()) {
1371:                        Config.getRepInstance().setParameter(
1372:                                PARAM_TEMPLATE_DEFAULT_ENCODING, encoding);
1373:                    } else {
1374:                        sDefaultEncoding = encoding;
1375:                    }
1376:                }
1377:
1378:                public static Collection<String> getDefaultResourcebundles(
1379:                        TemplateFactory factory) {
1380:                    Collection<String> result = null;
1381:
1382:                    if (Config.hasRepInstance()) {
1383:                        result = Config.getRepInstance().getStringItems(
1384:                                PREFIX_TEMPLATE_DEFAULT_RESOURCEBUNDLES
1385:                                        + factory.getIdentifierUppercase());
1386:                    }
1387:
1388:                    if (null == result && sDefaultResourcebundles != null) {
1389:                        result = sDefaultResourcebundles.get(factory
1390:                                .getIdentifierUppercase());
1391:                    }
1392:
1393:                    return result;
1394:                }
1395:
1396:                public static synchronized void setDefaultResourcebundles(
1397:                        TemplateFactory factory, Collection<String> bundles) {
1398:                    if (Config.hasRepInstance()) {
1399:                        String param = PREFIX_TEMPLATE_DEFAULT_RESOURCEBUNDLES
1400:                                + factory.getIdentifierUppercase();
1401:
1402:                        Config.getRepInstance().removeList(param);
1403:                        if (bundles != null) {
1404:                            for (String bundle : bundles) {
1405:                                Config.getRepInstance().addListItem(param,
1406:                                        bundle);
1407:                            }
1408:                        }
1409:                    } else {
1410:                        if (null == sDefaultResourcebundles) {
1411:                            sDefaultResourcebundles = new HashMap<String, Collection<String>>();
1412:                        }
1413:
1414:                        sDefaultResourcebundles.put(factory
1415:                                .getIdentifierUppercase(), bundles);
1416:                    }
1417:                }
1418:            }
1419:
1420:            public static abstract class Tools {
1421:                public static final String PARAM_L10N_RESOURCEBUNDLE_AUTO_RELOAD = "L10N_RESOURCEBUNDLE_AUTO_RELOAD";
1422:                public static final String PARAM_L10N_DEFAULT_RESOURCEBUNDLE = "L10N_DEFAULT_RESOURCEBUNDLE";
1423:                public static final String PARAM_L10N_DEFAULT_LANGUAGE = "L10N_DEFAULT_LANGUAGE";
1424:                public static final String PARAM_L10N_DEFAULT_COUNTRY = "L10N_DEFAULT_COUNTRY";
1425:                public static final String PARAM_L10N_DEFAULT_TIMEZONE = "L10N_DEFAULT_TIMEZONE";
1426:                public static final String PARAM_L10N_DEFAULT_SHORT_DATEFORMAT = "L10N_DEFAULT_SHORT_DATEFORMAT";
1427:                public static final String PARAM_L10N_DEFAULT_LONG_DATEFORMAT = "L10N_DEFAULT_LONG_DATEFORMAT";
1428:                public static final String PARAM_L10N_DEFAULT_INPUT_DATEFORMAT = "L10N_DEFAULT_INPUT_DATEFORMAT";
1429:                public static final String PARAM_MAX_VISUAL_URL_LENGTH = "MAX_VISUAL_URL_LENGTH";
1430:
1431:                private static final String DEFAULT_LANGUAGE = "en";
1432:                private static final int DEFAULT_MAX_VISUAL_URL_LENGTH = 70;
1433:                private static final boolean DEFAULT_RESOURCEBUNDLE_AUTO_RELOAD = true;
1434:
1435:                private static String sDefaultResourcebundle = null;
1436:                private static String sDefaultLanguage = DEFAULT_LANGUAGE;
1437:                private static String sDefaultCountry = null;
1438:                private static TimeZone sDefaultTimeZone = null;
1439:
1440:                public static boolean getResourcebundleAutoReload() {
1441:                    if (Config.hasRepInstance()) {
1442:                        return Config.getRepInstance().getBool(
1443:                                PARAM_L10N_RESOURCEBUNDLE_AUTO_RELOAD,
1444:                                DEFAULT_RESOURCEBUNDLE_AUTO_RELOAD);
1445:                    }
1446:
1447:                    return DEFAULT_RESOURCEBUNDLE_AUTO_RELOAD;
1448:                }
1449:
1450:                public static String getDefaultResourceBundle() {
1451:                    if (Config.hasRepInstance()) {
1452:                        return Config.getRepInstance().getString(
1453:                                PARAM_L10N_DEFAULT_RESOURCEBUNDLE,
1454:                                sDefaultResourcebundle);
1455:                    }
1456:
1457:                    return sDefaultResourcebundle;
1458:                }
1459:
1460:                public static synchronized void setDefaultResourceBundle(
1461:                        String name) {
1462:                    if (name != null && 0 == name.length())
1463:                        throw new IllegalArgumentException(
1464:                                "name can't be empty.");
1465:
1466:                    if (Config.hasRepInstance()) {
1467:                        if (null == name) {
1468:                            Config.getRepInstance().removeParameter(
1469:                                    PARAM_L10N_DEFAULT_RESOURCEBUNDLE);
1470:                        } else {
1471:                            Config.getRepInstance().setParameter(
1472:                                    PARAM_L10N_DEFAULT_RESOURCEBUNDLE, name);
1473:                        }
1474:                    } else {
1475:                        sDefaultResourcebundle = name;
1476:                    }
1477:                }
1478:
1479:                public static String getDefaultLanguage() {
1480:                    if (Config.hasRepInstance()) {
1481:                        return Config.getRepInstance().getString(
1482:                                PARAM_L10N_DEFAULT_LANGUAGE, sDefaultLanguage);
1483:                    }
1484:
1485:                    return sDefaultLanguage;
1486:                }
1487:
1488:                public static synchronized void setDefaultLanguage(
1489:                        String abbreviation) {
1490:                    if (abbreviation != null && 0 == abbreviation.length())
1491:                        throw new IllegalArgumentException(
1492:                                "abbreviation can't be empty.");
1493:
1494:                    if (Config.hasRepInstance()) {
1495:                        if (null == abbreviation) {
1496:                            Config.getRepInstance().removeParameter(
1497:                                    PARAM_L10N_DEFAULT_LANGUAGE);
1498:                        } else {
1499:                            Config.getRepInstance().setParameter(
1500:                                    PARAM_L10N_DEFAULT_LANGUAGE, abbreviation);
1501:                        }
1502:                    } else {
1503:                        if (null == abbreviation) {
1504:                            sDefaultLanguage = DEFAULT_LANGUAGE;
1505:                        } else {
1506:                            sDefaultLanguage = abbreviation;
1507:                        }
1508:                    }
1509:                }
1510:
1511:                public static String getDefaultCountry() {
1512:                    if (Config.hasRepInstance()) {
1513:                        return Config.getRepInstance().getString(
1514:                                PARAM_L10N_DEFAULT_COUNTRY, sDefaultCountry);
1515:                    }
1516:
1517:                    return sDefaultCountry;
1518:                }
1519:
1520:                public static synchronized void setDefaultCountry(
1521:                        String countryCode) {
1522:                    if (null == countryCode)
1523:                        throw new IllegalArgumentException(
1524:                                "countryCode can't be null.");
1525:                    if (0 == countryCode.length())
1526:                        throw new IllegalArgumentException(
1527:                                "countryCode can't be empty.");
1528:
1529:                    if (Config.hasRepInstance()) {
1530:                        Config.getRepInstance().setParameter(
1531:                                PARAM_L10N_DEFAULT_COUNTRY, countryCode);
1532:                    } else {
1533:                        sDefaultCountry = countryCode;
1534:                    }
1535:                }
1536:
1537:                public static TimeZone getDefaultTimeZone() {
1538:                    TimeZone result = sDefaultTimeZone;
1539:
1540:                    if (null == result && Config.hasRepInstance()) {
1541:                        String timezoneid = Config.getRepInstance().getString(
1542:                                PARAM_L10N_DEFAULT_TIMEZONE);
1543:                        if (timezoneid != null) {
1544:                            result = TimeZone.getTimeZone(timezoneid);
1545:                        }
1546:                    }
1547:
1548:                    if (null == result) {
1549:                        result = TimeZone.getDefault();
1550:                    }
1551:
1552:                    return result;
1553:                }
1554:
1555:                public static synchronized void setDefaultTimeZone(
1556:                        TimeZone timeZone) {
1557:                    if (Config.hasRepInstance()) {
1558:                        Config.getRepInstance().setParameter(
1559:                                PARAM_L10N_DEFAULT_TIMEZONE, timeZone.getID());
1560:                    } else {
1561:                        sDefaultTimeZone = timeZone;
1562:                    }
1563:                }
1564:
1565:                public static DateFormat getDefaultShortDateFormat() {
1566:                    if (Config.hasRepInstance()) {
1567:                        Config config = Config.getRepInstance();
1568:                        if (config
1569:                                .hasParameter(PARAM_L10N_DEFAULT_SHORT_DATEFORMAT)) {
1570:                            SimpleDateFormat sf = null;
1571:                            try {
1572:                                sf = new SimpleDateFormat(
1573:                                        config
1574:                                                .getString(PARAM_L10N_DEFAULT_SHORT_DATEFORMAT),
1575:                                        Localization.getLocale());
1576:                                sf.setTimeZone(RifeConfig.Tools
1577:                                        .getDefaultTimeZone());
1578:                            } catch (IllegalArgumentException e) {
1579:                                throw new DateFormatInitializationException(e
1580:                                        .getMessage());
1581:                            }
1582:
1583:                            return sf;
1584:                        }
1585:                    }
1586:
1587:                    if (0 != getDefaultLanguage().compareToIgnoreCase(
1588:                            DEFAULT_LANGUAGE)) {
1589:                        return DateFormat.getDateInstance(DateFormat.SHORT,
1590:                                Localization.getLocale());
1591:                    }
1592:
1593:                    return DateFormat.getDateInstance(DateFormat.SHORT,
1594:                            Locale.ENGLISH);
1595:                }
1596:
1597:                public static DateFormat getDefaultLongDateFormat() {
1598:                    if (Config.hasRepInstance()) {
1599:                        Config config = Config.getRepInstance();
1600:                        if (config
1601:                                .hasParameter(PARAM_L10N_DEFAULT_LONG_DATEFORMAT)) {
1602:                            SimpleDateFormat sf = null;
1603:                            try {
1604:                                sf = new SimpleDateFormat(
1605:                                        config
1606:                                                .getString(PARAM_L10N_DEFAULT_LONG_DATEFORMAT),
1607:                                        Localization.getLocale());
1608:                                sf.setTimeZone(RifeConfig.Tools
1609:                                        .getDefaultTimeZone());
1610:                            } catch (IllegalArgumentException e) {
1611:                                throw new DateFormatInitializationException(e
1612:                                        .getMessage());
1613:                            }
1614:
1615:                            return sf;
1616:                        }
1617:                    }
1618:
1619:                    if (0 != getDefaultLanguage().compareToIgnoreCase(
1620:                            DEFAULT_LANGUAGE)) {
1621:                        return DateFormat.getDateTimeInstance(
1622:                                DateFormat.MEDIUM, DateFormat.SHORT,
1623:                                Localization.getLocale());
1624:                    }
1625:
1626:                    return DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
1627:                            DateFormat.SHORT, Locale.ENGLISH);
1628:                }
1629:
1630:                public static DateFormat getDefaultInputDateFormat() {
1631:                    if (Config.hasRepInstance()) {
1632:                        Config config = Config.getRepInstance();
1633:                        if (config
1634:                                .hasParameter(PARAM_L10N_DEFAULT_INPUT_DATEFORMAT)) {
1635:                            SimpleDateFormat sf = null;
1636:                            try {
1637:                                sf = new SimpleDateFormat(
1638:                                        config
1639:                                                .getString(PARAM_L10N_DEFAULT_INPUT_DATEFORMAT),
1640:                                        Localization.getLocale());
1641:                                sf.setTimeZone(RifeConfig.Tools
1642:                                        .getDefaultTimeZone());
1643:                            } catch (IllegalArgumentException e) {
1644:                                throw new DateFormatInitializationException(e
1645:                                        .getMessage());
1646:                            }
1647:
1648:                            return sf;
1649:                        }
1650:                    }
1651:
1652:                    SimpleDateFormat sf = new SimpleDateFormat(
1653:                            "yyyy-MM-dd HH:mm");
1654:                    sf.setTimeZone(RifeConfig.Tools.getDefaultTimeZone());
1655:                    return sf;
1656:                }
1657:
1658:                public static int getMaxVisualUrlLength() {
1659:                    if (Config.hasRepInstance()) {
1660:                        return Config.getRepInstance().getInt(
1661:                                PARAM_MAX_VISUAL_URL_LENGTH,
1662:                                DEFAULT_MAX_VISUAL_URL_LENGTH);
1663:                    }
1664:
1665:                    return DEFAULT_MAX_VISUAL_URL_LENGTH;
1666:                }
1667:            }
1668:
1669:            public static abstract class Xml {
1670:                public static final String PARAM_XML_VALIDATION = "XML_VALIDATION";
1671:
1672:                private static final boolean DEFAULT_XML_VALIDATION = true;
1673:
1674:                public static boolean getXmlValidation() {
1675:                    if (Config.hasRepInstance()) {
1676:                        return Config.getRepInstance().getBool(
1677:                                PARAM_XML_VALIDATION, DEFAULT_XML_VALIDATION);
1678:                    }
1679:
1680:                    return DEFAULT_XML_VALIDATION;
1681:                }
1682:            }
1683:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.