Source Code Cross Referenced for JaWEManager.java in  » Workflow-Engines » JaWE » org » enhydra » jawe » 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 » Workflow Engines » JaWE » org.enhydra.jawe 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /**
0002:         * Miroslav Popov, Dec 20, 2005 miroslav.popov@gmail.com
0003:         */package org.enhydra.jawe;
0004:
0005:        import java.awt.Font;
0006:        import java.io.File;
0007:        import java.io.FileInputStream;
0008:        import java.io.InputStream;
0009:        import java.lang.reflect.Constructor;
0010:        import java.net.URL;
0011:        import java.net.URLConnection;
0012:        import java.util.Calendar;
0013:        import java.util.Properties;
0014:        import java.util.ResourceBundle;
0015:
0016:        import javax.swing.UIManager;
0017:
0018:        import org.enhydra.jawe.base.componentmanager.ComponentManager;
0019:        import org.enhydra.jawe.base.controller.ControllerSettings;
0020:        import org.enhydra.jawe.base.controller.JaWEController;
0021:        import org.enhydra.jawe.base.display.DisplayNameGenerator;
0022:        import org.enhydra.jawe.base.display.DisplayNameGeneratorSettings;
0023:        import org.enhydra.jawe.base.display.StandardDisplayNameGenerator;
0024:        import org.enhydra.jawe.base.editor.NewStandardXPDLEditorSettings;
0025:        import org.enhydra.jawe.base.editor.NewStandardXPDLElementEditor;
0026:        import org.enhydra.jawe.base.editor.TableEditor;
0027:        import org.enhydra.jawe.base.editor.TableEditorSettings;
0028:        import org.enhydra.jawe.base.editor.ValidationOrSearchResultEditor;
0029:        import org.enhydra.jawe.base.editor.XPDLElementEditor;
0030:        import org.enhydra.jawe.base.idfactory.IdFactory;
0031:        import org.enhydra.jawe.base.idfactory.IdFactorySettings;
0032:        import org.enhydra.jawe.base.label.LabelGenerator;
0033:        import org.enhydra.jawe.base.label.LabelGeneratorSettings;
0034:        import org.enhydra.jawe.base.label.StandardLabelGenerator;
0035:        import org.enhydra.jawe.base.logger.LoggingManager;
0036:        import org.enhydra.jawe.base.panel.InlinePanel;
0037:        import org.enhydra.jawe.base.panel.PanelSettings;
0038:        import org.enhydra.jawe.base.panel.PanelValidator;
0039:        import org.enhydra.jawe.base.panel.StandardPanelGenerator;
0040:        import org.enhydra.jawe.base.panel.StandardPanelValidator;
0041:        import org.enhydra.jawe.base.tooltip.StandardTooltipGenerator;
0042:        import org.enhydra.jawe.base.tooltip.TooltipGenerator;
0043:        import org.enhydra.jawe.base.tooltip.TooltipGeneratorSettings;
0044:        import org.enhydra.jawe.base.transitionhandler.TransitionHandler;
0045:        import org.enhydra.jawe.base.transitionhandler.TransitionHandlerSettings;
0046:        import org.enhydra.jawe.base.xpdlhandler.XPDLHandler;
0047:        import org.enhydra.jawe.base.xpdlhandler.XPDLHandlerSettings;
0048:        import org.enhydra.jawe.base.xpdlhandler.XPDLRepHandler;
0049:        import org.enhydra.jawe.base.xpdlobjectfactory.XPDLObjectFactory;
0050:        import org.enhydra.jawe.base.xpdlobjectfactory.XPDLObjectFactorySettings;
0051:        import org.enhydra.jawe.base.xpdlvalidator.XPDLValidatorSettings;
0052:        import org.enhydra.shark.xpdl.StandardPackageValidator;
0053:        import org.enhydra.shark.xpdl.XPDLRepositoryHandler;
0054:
0055:        /**
0056:         * This class is used to get all jawe's managers.
0057:         * 
0058:         * @author Sasa Bojanic
0059:         * @author Miroslav Popov
0060:         */
0061:        public class JaWEManager {
0062:
0063:            public static final String TOGWE_BASIC_PROPERTYFILE_PATH = "org/enhydra/jawe/properties/";
0064:
0065:            public static final String TOGWE_BASIC_PROPERTYFILE_NAME = "togwebasic.properties";
0066:
0067:            protected PropertyMgr propertyMgr;
0068:
0069:            protected static boolean isConfigured = false;
0070:
0071:            protected static Properties properties;
0072:
0073:            protected static String version;
0074:
0075:            protected static String release;
0076:
0077:            protected static String buildNo;
0078:
0079:            protected static String buildEd;
0080:
0081:            protected static String buildEdSuff;
0082:
0083:            protected ComponentManager componentManager;
0084:
0085:            protected LabelGenerator labelGenerator;
0086:
0087:            protected LoggingManager loggingManager;
0088:
0089:            protected IdFactory idFactory;
0090:
0091:            protected XPDLObjectFactory xpdlObjectFactory;
0092:
0093:            protected TransitionHandler transitionHandler;
0094:
0095:            protected PanelValidator panelValidator;
0096:
0097:            protected StandardPackageValidator xpdlValidator;
0098:
0099:            protected XPDLHandler xpdlHandler;
0100:
0101:            protected JaWEController jaweController;
0102:
0103:            protected DisplayNameGenerator displayNameGenerator;
0104:
0105:            protected XPDLElementEditor xpdlElementEditor;
0106:
0107:            protected TableEditor tableEditor;
0108:
0109:            protected TooltipGenerator tooltipGenerator;
0110:
0111:            protected String panelGeneratorClassName;
0112:
0113:            protected String inlinePanelClassName;
0114:
0115:            protected XPDLUtils xpdlUtils;
0116:
0117:            protected ValidationOrSearchResultEditor validationOrSearchResultEditor;
0118:
0119:            protected static String splash;
0120:
0121:            protected boolean showSplash = false;
0122:
0123:            protected static String aboutMsg;
0124:
0125:            protected static boolean showLicenseInfo = true;
0126:
0127:            protected static String additionalLicenseText;
0128:
0129:            // the one and only instance of this class
0130:            protected static JaWEManager jaweManager;
0131:
0132:            protected JaWEManager() {
0133:                version = BuildInfo.getVersion();
0134:                release = BuildInfo.getRelease();
0135:                long bn = BuildInfo.getBuildNo();
0136:                Calendar cal = Calendar.getInstance();
0137:                cal.setTimeInMillis(bn);
0138:                String y = String.valueOf(cal.get(Calendar.YEAR));
0139:                String m = String.valueOf(cal.get(Calendar.MONTH) + 1);
0140:                if (m.length() == 1) {
0141:                    m = "0" + m;
0142:                }
0143:                String d = String.valueOf(cal.get(Calendar.DATE));
0144:                if (d.length() == 1) {
0145:                    d = "0" + d;
0146:                }
0147:                String h = String.valueOf(cal.get(Calendar.HOUR_OF_DAY));
0148:                if (h.length() == 1) {
0149:                    h = "0" + h;
0150:                }
0151:                String min = String.valueOf(cal.get(Calendar.MINUTE));
0152:                if (min.length() == 1) {
0153:                    min = "0" + min;
0154:                }
0155:                buildNo = y + m + d + "-" + h + min;
0156:                buildEdSuff = BuildInfo.getJRESuffix();
0157:
0158:                buildEd = "C";
0159:                splash = "org/enhydra/jawe/images/JaWESplash-community.jpg";
0160:                aboutMsg = " Visit <a href=\"http://www.together.at/together/prod/twe/index.html\">Together Workflow Editor Homepage</a>"
0161:                        + " for more <br>information about the product."
0162:                        + "<br><br>For support please contact: <a href=\"mailto:jawe@enhydra.org\">jawe@enhydra.org</a>"
0163:                        + "<br><br>© <a href=\"http://www.together.at\">Together Teamlösungen EDV Dienstleistungen GmbH</a></p>";
0164:                additionalLicenseText = "<html><p align center>"
0165:                        + "<br>LGPL Sources are available at "
0166:                        + "<a href=\"http://jawe.enhydra.org\">http://jawe.enhydra.org</a>"
0167:                        + "<br><br>This product includes software developed by the "
0168:                        + "<br>Apache Software Foundation (http://www.apache.org/).</html>";
0169:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0170:                    if (JaWE.getJaWEVersion() == JaWE.DEMO_VERSION) {
0171:                        splash = "org/enhydra/jawe/images/JaWESplash-demo.jpg";
0172:                        aboutMsg = " Visit <a href=\"http://www.together.at/together/prod/twe/index.html\">Together Workflow Editor Homepage</a>"
0173:                                + " for more <br>information about the product."
0174:                                + "<br><br>For support please contact: <a href=\"mailto:twe@together.at\">twe@together.at</a>"
0175:                                + "<br><br>© <a href=\"http://www.together.at\">Together Teamlösungen EDV Dienstleistungen GmbH</a></p>";
0176:                        buildEd = "D";
0177:                    } else {
0178:                        buildEd = "P";
0179:                        splash = properties
0180:                                .getProperty("JaWESplash.Image",
0181:                                        "org/enhydra/jawe/images/JaWESplash-commercial.jpg");
0182:                        try {
0183:                            ResourceBundle rb = ResourceBundle
0184:                                    .getBundle("org.enhydra.jawe.aboutbox");
0185:                            aboutMsg = rb.getString("aboutMsg");
0186:                            showLicenseInfo = new Boolean(rb
0187:                                    .getString("showLicenseInfo"))
0188:                                    .booleanValue();
0189:                            additionalLicenseText = rb
0190:                                    .getString("additionalLicenseText");
0191:                        } catch (Exception e) {
0192:                        }
0193:                    }
0194:
0195:                    showSplash = true;
0196:                    propertyMgr = new JaWEPropertyMgr();
0197:                }
0198:            }
0199:
0200:            public static JaWEManager getInstance() {
0201:                if (jaweManager == null) {
0202:                    jaweManager = new JaWEManager();
0203:                }
0204:
0205:                return jaweManager;
0206:            }
0207:
0208:            public static void configure(Properties props) {
0209:                if (isConfigured) {
0210:                    JaWEManager
0211:                            .getInstance()
0212:                            .getLoggingManager()
0213:                            .info(
0214:                                    "Trying to configure "
0215:                                            + jaweManager.getName()
0216:                                            + " instance that is already configured !!!");
0217:                    return;
0218:                }
0219:
0220:                if (props == null) {
0221:                    throw new Error(
0222:                            jaweManager.getName()
0223:                                    + " needs to be configured properly - given Properties have null value!!!");
0224:                }
0225:
0226:                configureFromJar();
0227:                Utils.adjustProperties(properties, props);
0228:                isConfigured = true;
0229:            }
0230:
0231:            public static void configure(String filePath) {
0232:                if (isConfigured) {
0233:                    JaWEManager
0234:                            .getInstance()
0235:                            .getLoggingManager()
0236:                            .info(
0237:                                    "Trying to configure "
0238:                                            + jaweManager.getName()
0239:                                            + " instance that is already configured !!!");
0240:                    return;
0241:                }
0242:
0243:                if (filePath == null) {
0244:                    throw new Error(
0245:                            jaweManager.getName()
0246:                                    + " need to be configured properly - given path to configuration file is null!!!");
0247:                }
0248:
0249:                File config = new File(filePath);
0250:                JaWEManager.configure(config);
0251:            }
0252:
0253:            public static void configure(File configFile) {
0254:                if (isConfigured) {
0255:                    JaWEManager
0256:                            .getInstance()
0257:                            .getLoggingManager()
0258:                            .info(
0259:                                    "Trying to configure "
0260:                                            + jaweManager.getName()
0261:                                            + " instance that is already configured !!!");
0262:                    return;
0263:                }
0264:
0265:                if (configFile == null) {
0266:                    throw new Error(
0267:                            jaweManager.getName()
0268:                                    + " need to be configured properly - given configuration file is null!!!");
0269:                }
0270:
0271:                if (!configFile.isAbsolute()) {
0272:                    configFile = configFile.getAbsoluteFile();
0273:                }
0274:
0275:                if (configFile.exists()) {
0276:                    configureFromJar();
0277:                    FileInputStream fis = null;
0278:                    try {
0279:                        fis = new FileInputStream(configFile);
0280:                        Properties props = new Properties();
0281:                        props.load(fis);
0282:                        fis.close();
0283:                        Utils.adjustProperties(properties, props);
0284:                    } catch (Exception ex) {
0285:                        throw new Error(
0286:                                "Something went wrong while reading of configuration from the file!!!",
0287:                                ex);
0288:                    }
0289:                } else {
0290:                    throw new Error(
0291:                            jaweManager.getName()
0292:                                    + " needs to be configured properly - configuration file "
0293:                                    + configFile + " does not exist!!!");
0294:                }
0295:
0296:                isConfigured = true;
0297:            }
0298:
0299:            public static void configure() {
0300:                if (isConfigured) {
0301:                    JaWEManager
0302:                            .getInstance()
0303:                            .getLoggingManager()
0304:                            .info(
0305:                                    "Trying to configure "
0306:                                            + jaweManager.getName()
0307:                                            + " instance that is already configured !!!");
0308:                    return;
0309:                }
0310:
0311:                configureFromJar();
0312:                isConfigured = true;
0313:            }
0314:
0315:            protected static void configureFromJar() {
0316:                try {
0317:                    // creating USER_HOME/.JaWE directory if it doesn't exist
0318:                    File ujdir = new File(JaWEConstants.JAWE_USER_HOME);
0319:                    if (!ujdir.exists()) {
0320:                        try {
0321:                            ujdir.mkdir();
0322:                        } catch (Exception exc) {
0323:                        }
0324:                    }
0325:
0326:                    URL u = JaWEManager.class
0327:                            .getClassLoader()
0328:                            .getResource(
0329:                                    JaWEConstants.JAWE_BASIC_PROPERTYFILE_PATH
0330:                                            + JaWEConstants.JAWE_BASIC_PROPERTYFILE_NAME);
0331:                    URLConnection urlConnection = u.openConnection();
0332:                    InputStream is = urlConnection.getInputStream();
0333:
0334:                    properties = new Properties();
0335:                    properties.load(is);
0336:                    Utils.copyPropertyFile(
0337:                            JaWEConstants.JAWE_BASIC_PROPERTYFILE_PATH,
0338:                            JaWEConstants.JAWE_BASIC_PROPERTYFILE_NAME, false);
0339:
0340:                    u = JaWEManager.class
0341:                            .getClassLoader()
0342:                            .getResource(
0343:                                    JaWEConstants.JAWE_LANGUAGE_MISC_PROPERTYFILE_PATH
0344:                                            + JaWEConstants.JAWE_LANGUAGE_MISC_PROPERTYFILE_NAME);
0345:                    urlConnection = u.openConnection();
0346:                    is = urlConnection.getInputStream();
0347:
0348:                    Utils.copyPropertyFile(
0349:                            JaWEConstants.JAWE_LANGUAGE_MISC_PROPERTYFILE_PATH,
0350:                            JaWEConstants.JAWE_LANGUAGE_MISC_PROPERTYFILE_NAME,
0351:                            false);
0352:
0353:                } catch (Exception ex) {
0354:                    ex.printStackTrace();
0355:                    throw new Error(jaweManager.getName()
0356:                            + " need to be configured properly - Can't read "
0357:                            + jaweManager.getName()
0358:                            + "'s default configuration from JAR!!!", ex);
0359:                }
0360:            }
0361:
0362:            public void init() {
0363:                if (!isConfigured)
0364:                    return;
0365:
0366:                String cmClass = ComponentManager.class.getName();
0367:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0368:                        || JaWE.addOnsAvailable()) {
0369:                    cmClass = properties
0370:                            .getProperty("ComponentManager.Class",
0371:                                    "org.enhydra.jawe.base.componentmanager.ComponentManager");
0372:                }
0373:
0374:                String dngClass = StandardDisplayNameGenerator.class.getName();
0375:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0376:                        || JaWE.addOnsAvailable()) {
0377:                    dngClass = properties
0378:                            .getProperty("DisplayNameGenerator.Class",
0379:                                    "org.enhydra.jawe.base.display.StandardDisplayNameGenerator");
0380:                }
0381:                String dnSettings = DisplayNameGeneratorSettings.class
0382:                        .getName();
0383:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0384:                        || JaWE.addOnsAvailable()) {
0385:                    dnSettings = properties
0386:                            .getProperty("DisplayNameGenerator.Settings",
0387:                                    "org.enhydra.jawe.base.display.DisplayNameGeneratorSettings");
0388:                }
0389:                String jcClass = JaWEController.class.getName();
0390:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0391:                        || JaWE.addOnsAvailable()) {
0392:                    jcClass = properties.getProperty("JaWEController.Class",
0393:                            "org.enhydra.jawe.base.controller.JaWEController");
0394:                }
0395:                try {
0396:                    Class
0397:                            .forName("org.enhydra.jawe.base.controller.TogWEDemoController");
0398:                    jcClass = "org.enhydra.jawe.base.controller.TogWEDemoController";
0399:                } catch (Exception ex) {
0400:                }
0401:                String jcSettings = ControllerSettings.class.getName();
0402:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0403:                        || JaWE.addOnsAvailable()) {
0404:                    jcSettings = properties
0405:                            .getProperty("JaWEController.Settings",
0406:                                    "org.enhydra.jawe.base.controller.ControllerSettings");
0407:                }
0408:                String lgClass = StandardLabelGenerator.class.getName();
0409:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0410:                        || JaWE.addOnsAvailable()) {
0411:                    lgClass = properties
0412:                            .getProperty("LabelGenerator.Class",
0413:                                    "org.enhydra.jawe.base.label.StandardLabelGenerator");
0414:                }
0415:                String lgSettings = LabelGeneratorSettings.class.getName();
0416:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0417:                        || JaWE.addOnsAvailable()) {
0418:                    lgSettings = properties
0419:                            .getProperty("LabelGenerator.Settings",
0420:                                    "org.enhydra.jawe.base.label.LabelGeneratorSettings");
0421:                }
0422:                String lmClass = LoggingManager.class.getName();
0423:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0424:                        || JaWE.addOnsAvailable()) {
0425:                    lmClass = properties.getProperty("LoggingManager.Class",
0426:                            "org.enhydra.jawe.base.logger.LoggingManager");
0427:                }
0428:                String thClass = TransitionHandler.class.getName();
0429:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0430:                        || JaWE.addOnsAvailable()) {
0431:                    thClass = properties
0432:                            .getProperty("TransitionHandler.Class",
0433:                                    "org.enhydra.jawe.base.transitionhandler.TransitionHandler");
0434:                }
0435:                String thSettings = TransitionHandlerSettings.class.getName();
0436:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0437:                        || JaWE.addOnsAvailable()) {
0438:                    thSettings = properties
0439:                            .getProperty("TransitionHandler.Settings",
0440:                                    "org.enhydra.jawe.base.transitionhandler.TransitionHandlerSettings");
0441:                }
0442:                String idfClass = IdFactory.class.getName();
0443:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0444:                        || JaWE.addOnsAvailable()) {
0445:                    idfClass = properties.getProperty("IdFactory.Class",
0446:                            "org.enhydra.jawe.base.idfactory.IdFactory");
0447:                }
0448:                String idfSettings = IdFactorySettings.class.getName();
0449:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0450:                        || JaWE.addOnsAvailable()) {
0451:                    idfSettings = properties
0452:                            .getProperty("IdFactory.Settings",
0453:                                    "org.enhydra.jawe.base.idfactory.IdFactorySettings");
0454:                }
0455:                String xpdlofClass = XPDLObjectFactory.class.getName();
0456:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0457:                        || JaWE.addOnsAvailable()) {
0458:                    xpdlofClass = properties
0459:                            .getProperty("XPDLObjectFactory.Class",
0460:                                    "org.enhydra.jawe.base.xpdlobjectfactory.XPDLObjectFactory");
0461:                }
0462:                String xpdlofSettings = XPDLObjectFactorySettings.class
0463:                        .getName();
0464:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0465:                        || JaWE.addOnsAvailable()) {
0466:                    xpdlofSettings = properties
0467:                            .getProperty("XPDLObjectFactory.Settings",
0468:                                    "org.enhydra.jawe.base.xpdlobjectfactory.XPDLObjectFactorySettings");
0469:                }
0470:                String pnlvClass = StandardPanelValidator.class.getName();
0471:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0472:                        || JaWE.addOnsAvailable()) {
0473:                    pnlvClass = properties
0474:                            .getProperty("PanelValidator.Class",
0475:                                    "org.enhydra.jawe.base.panel.StandardPanelValidator");
0476:                }
0477:                String xpdlvClass = StandardPackageValidator.class.getName();
0478:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0479:                        || JaWE.addOnsAvailable()) {
0480:                    xpdlvClass = properties
0481:                            .getProperty("XPDLValidator.Class",
0482:                                    "org.enhydra.jawe.base.xpdlvalidator.TogWEXPDLValidator");
0483:                }
0484:                String xpdlvSettings = XPDLValidatorSettings.class.getName();
0485:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0486:                        || JaWE.addOnsAvailable()) {
0487:                    xpdlvSettings = properties
0488:                            .getProperty("XPDLValidator.Settings",
0489:                                    "org.enhydra.jawe.base.xpdlvalidator.XPDLValidatorSettings");
0490:                }
0491:                String xpdlrhClass = XPDLRepHandler.class.getName();
0492:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0493:                        || JaWE.addOnsAvailable()) {
0494:                    xpdlrhClass = properties.getProperty(
0495:                            "XPDLRepositoryHandler.Class",
0496:                            "org.enhydra.shark.xpdl.XPDLRepositoryHandler");
0497:                }
0498:
0499:                String xpdleeClass = NewStandardXPDLElementEditor.class
0500:                        .getName();
0501:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0502:                        || JaWE.addOnsAvailable()) {
0503:                    xpdleeClass = properties
0504:                            .getProperty("XPDLElementEditor.Class",
0505:                                    "org.enhydra.jawe.base.editor.TogWEStandardXPDLElementEditor");
0506:                }
0507:                String xpdlEditorSettings = NewStandardXPDLEditorSettings.class
0508:                        .getName();
0509:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0510:                        || JaWE.addOnsAvailable()) {
0511:                    xpdlEditorSettings = properties
0512:                            .getProperty("XPDLElementEditor.Settings",
0513:                                    "org.enhydra.jawe.base.editor.TogWEStandardXPDLEditorSettings");
0514:                }
0515:
0516:                String teClass = TableEditor.class.getName();
0517:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0518:                        || JaWE.addOnsAvailable()) {
0519:                    teClass = properties.getProperty("TableEditor.Class",
0520:                            "org.enhydra.jawe.base.editor.TogWETableEditor");
0521:                }
0522:                String teSettings = TableEditorSettings.class.getName();
0523:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0524:                        || JaWE.addOnsAvailable()) {
0525:                    teSettings = properties.getProperty("TableEditor.Settings",
0526:                            "org.enhydra.jawe.base.editor.TableEditorSettings");
0527:                }
0528:                String ttgClass = StandardTooltipGenerator.class.getName();
0529:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0530:                        || JaWE.addOnsAvailable()) {
0531:                    ttgClass = properties
0532:                            .getProperty("TooltipGenerator.Class",
0533:                                    "org.enhydra.jawe.base.tooltip.StandardTooltipGenerator");
0534:                }
0535:                String ttgSettings = TooltipGeneratorSettings.class.getName();
0536:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0537:                        || JaWE.addOnsAvailable()) {
0538:                    ttgSettings = properties
0539:                            .getProperty("TooltipGenerator.Settings",
0540:                                    "org.enhydra.jawe.base.tooltip.TooltipGeneratorSettings");
0541:                }
0542:                panelGeneratorClassName = StandardPanelGenerator.class
0543:                        .getName();
0544:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0545:                        || JaWE.addOnsAvailable()) {
0546:                    panelGeneratorClassName = properties.getProperty(
0547:                            "PanelGenerator.Class",
0548:                            "org.enhydra.jawe.base.panel.TogWEPanelGenerator");
0549:                }
0550:                inlinePanelClassName = InlinePanel.class.getName();
0551:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0552:                        || JaWE.addOnsAvailable()) {
0553:                    inlinePanelClassName = properties.getProperty(
0554:                            "InlinePanel.Class",
0555:                            "org.enhydra.jawe.base.panel.InlinePanel");
0556:                }
0557:
0558:                String xpdlutClass = XPDLUtils.class.getName();
0559:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0560:                        || JaWE.addOnsAvailable()) {
0561:                    xpdlutClass = properties.getProperty("XPDLUtils.Class",
0562:                            "org.enhydra.jawe.XPDLUtils");
0563:                }
0564:
0565:                ClassLoader cl = getClass().getClassLoader();
0566:
0567:                try {
0568:                    Constructor c = Class.forName(lmClass).getConstructor(
0569:                            new Class[] {});
0570:                    loggingManager = (LoggingManager) c
0571:                            .newInstance(new Object[] {});
0572:                    loggingManager.info("JaWEManager -> Working with '"
0573:                            + lmClass + "' implementation of Logging Manager");
0574:                } catch (Throwable ex) {
0575:                    String msg = "JaweManager -> Problems while instantiating Logging Manager '"
0576:                            + lmClass + "' !";
0577:                    System.err.println(msg);
0578:                    throw new Error(msg, ex);
0579:                }
0580:
0581:                try {
0582:                    Constructor c = Class.forName(xpdlutClass).getConstructor(
0583:                            new Class[] {});
0584:                    xpdlUtils = (XPDLUtils) c.newInstance(new Object[] {});
0585:                    loggingManager.info("JaWEManager -> Working with '"
0586:                            + xpdlutClass + "' implementation of XPDLUtils");
0587:                } catch (Throwable ex) {
0588:                    xpdlUtils = new XPDLUtils();
0589:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0590:                        String msg = "JaweManager -> Problems while instantiating XPDL Utils '"
0591:                                + xpdlutClass
0592:                                + "' - using default implementation!";
0593:                        loggingManager.error(msg, ex);
0594:                    } else {
0595:                        loggingManager.info("JaWEManager -> Working with '"
0596:                                + XPDLUtils.class.getName()
0597:                                + "' implementation of XPDLUtils");
0598:                    }
0599:                }
0600:
0601:                XPDLRepositoryHandler xpdlRHandler = null;
0602:                try {
0603:                    Constructor c = Class.forName(xpdlrhClass).getConstructor(
0604:                            new Class[] {});
0605:                    xpdlRHandler = (XPDLRepositoryHandler) c
0606:                            .newInstance(new Object[] {});
0607:                    loggingManager.info("JaWEManager -> Working with '"
0608:                            + xpdlrhClass
0609:                            + "' implementation of XPDL Repository Handler");
0610:                } catch (Throwable ex) {
0611:                    xpdlRHandler = new XPDLRepHandler();
0612:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0613:                        String msg = "JaweManager -> Problems while instantiating XPDL Repository Handler class '"
0614:                                + xpdlrhClass
0615:                                + "' - using default implementation!";
0616:                        loggingManager.error(msg, ex);
0617:                    } else {
0618:                        loggingManager
0619:                                .info("JaWEManager -> Working with '"
0620:                                        + XPDLRepHandler.class.getName()
0621:                                        + "' implementation of XPDL Repository Handler");
0622:
0623:                    }
0624:                }
0625:
0626:                xpdlHandler = createXPDLHandler(xpdlRHandler);
0627:                loggingManager.info("JaWEManager -> Working with '"
0628:                        + xpdlHandler.getClass().getName()
0629:                        + "' implementation of XPDL Handler");
0630:
0631:                try {
0632:                    ControllerSettings cs = (ControllerSettings) cl.loadClass(
0633:                            jcSettings).newInstance();
0634:                    cs.setPropertyMgr(propertyMgr);
0635:
0636:                    Constructor c = Class.forName(jcClass).getConstructor(
0637:                            new Class[] { ControllerSettings.class });
0638:                    jaweController = (JaWEController) c
0639:                            .newInstance(new Object[] { cs });
0640:                    jaweController.init();
0641:                    loggingManager.info("JaWEManager -> Working with '"
0642:                            + jcClass + "' implementation of JaWE Controller");
0643:                } catch (Throwable ex) {
0644:                    jaweController = new JaWEController(
0645:                            new ControllerSettings());
0646:                    jaweController.init();
0647:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0648:                        String msg = "JaweManager -> Problems while instantiating JaWE Controller '"
0649:                                + jcClass + "' - using default implementation!";
0650:                        loggingManager.error(msg, ex);
0651:                    } else {
0652:                        loggingManager.info("JaWEManager -> Working with '"
0653:                                + JaWEController.class.getName()
0654:                                + "' implementation of JaWE Controller");
0655:                    }
0656:                }
0657:
0658:                try {
0659:                    LabelGeneratorSettings ls = (LabelGeneratorSettings) cl
0660:                            .loadClass(lgSettings).newInstance();
0661:                    ls.setPropertyMgr(propertyMgr);
0662:
0663:                    Constructor c = Class.forName(lgClass).getConstructor(
0664:                            new Class[] { LabelGeneratorSettings.class });
0665:                    labelGenerator = (StandardLabelGenerator) c
0666:                            .newInstance(new Object[] { ls });
0667:                    loggingManager.info("JaWEManager -> Working with '"
0668:                            + lgClass + "' implementation of Label Generator");
0669:                } catch (Exception ex) {
0670:                    labelGenerator = new StandardLabelGenerator();
0671:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0672:                        String msg = "JaweManager -> Problems while instantiating Label Generator '"
0673:                                + lgClass + "' - using default implementation!";
0674:                        loggingManager.error(msg, ex);
0675:                    } else {
0676:                        loggingManager.info("JaWEManager -> Working with '"
0677:                                + StandardLabelGenerator.class.getName()
0678:                                + "' implementation of Label Generator");
0679:                    }
0680:                }
0681:
0682:                try {
0683:                    TransitionHandlerSettings ts = (TransitionHandlerSettings) cl
0684:                            .loadClass(thSettings).newInstance();
0685:                    ts.setPropertyMgr(propertyMgr);
0686:
0687:                    Constructor c = Class.forName(thClass).getConstructor(
0688:                            new Class[] { TransitionHandlerSettings.class });
0689:                    transitionHandler = (TransitionHandler) c
0690:                            .newInstance(new Object[] { ts });
0691:                    loggingManager.info("JaWEManager -> Working with '"
0692:                            + thClass
0693:                            + "' implementation of Transition Handler");
0694:                } catch (Throwable ex) {
0695:                    transitionHandler = new TransitionHandler();
0696:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0697:                        String msg = "JaweManager -> Problems while instantiating Transition Handler class '"
0698:                                + thClass + "' - using default implementation!";
0699:                        loggingManager.error(msg, ex);
0700:                    } else {
0701:                        loggingManager.info("JaWEManager -> Working with '"
0702:                                + TransitionHandler.class.getName()
0703:                                + "' implementation of Transition Handler");
0704:                    }
0705:                }
0706:
0707:                try {
0708:                    IdFactorySettings is = (IdFactorySettings) cl.loadClass(
0709:                            idfSettings).newInstance();
0710:                    is.setPropertyMgr(propertyMgr);
0711:
0712:                    Constructor c = Class.forName(idfClass).getConstructor(
0713:                            new Class[] { IdFactorySettings.class });
0714:                    idFactory = (IdFactory) c.newInstance(new Object[] { is });
0715:                    loggingManager.info("JaWEManager -> Working with '"
0716:                            + idfClass + "' implementation of Id Factory");
0717:                } catch (Throwable ex) {
0718:                    idFactory = new IdFactory();
0719:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0720:                        String msg = "JaweManager -> Problems while instantiating Id Factory class '"
0721:                                + idfClass
0722:                                + "' - using default implementation!";
0723:                        loggingManager.error(msg, ex);
0724:                    } else {
0725:                        loggingManager.info("JaWEManager -> Working with '"
0726:                                + IdFactory.class.getName()
0727:                                + "' implementation of Id Factory");
0728:                    }
0729:                }
0730:
0731:                try {
0732:                    XPDLObjectFactorySettings os = (XPDLObjectFactorySettings) cl
0733:                            .loadClass(xpdlofSettings).newInstance();
0734:                    os.setPropertyMgr(propertyMgr);
0735:
0736:                    Constructor c = Class.forName(xpdlofClass).getConstructor(
0737:                            new Class[] { XPDLObjectFactorySettings.class });
0738:                    xpdlObjectFactory = (XPDLObjectFactory) c
0739:                            .newInstance(new Object[] { os });
0740:                    loggingManager.info("JaWEManager -> Working with '"
0741:                            + xpdlofClass
0742:                            + "' implementation of XPDL Object Factory");
0743:                } catch (Throwable ex) {
0744:                    xpdlObjectFactory = new XPDLObjectFactory();
0745:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0746:                        String msg = "JaweManager -> Problems while instantiating XPDL Object Factory class '"
0747:                                + xpdlofClass
0748:                                + "' - using default implementation!";
0749:                        loggingManager.error(msg, ex);
0750:                    } else {
0751:                        loggingManager.info("JaWEManager -> Working with '"
0752:                                + XPDLObjectFactory.class.getName()
0753:                                + "' implementation of XPDL Object Factory");
0754:                    }
0755:                }
0756:
0757:                try {
0758:                    panelValidator = (StandardPanelValidator) cl.loadClass(
0759:                            pnlvClass).newInstance();
0760:                    loggingManager
0761:                            .info("JaWEManager -> Working with '" + pnlvClass
0762:                                    + "' implementation of Panel Validator");
0763:                } catch (Throwable ex) {
0764:                    panelValidator = new StandardPanelValidator();
0765:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0766:                        String msg = "JaweManager -> Problems while instantiating Panel Validator class '"
0767:                                + pnlvClass
0768:                                + "' - using default implementation!";
0769:                        loggingManager.error(msg, ex);
0770:                    } else {
0771:                        loggingManager.info("JaWEManager -> Working with '"
0772:                                + StandardPanelValidator.class.getName()
0773:                                + "' implementation of Panel Validator");
0774:                    }
0775:                }
0776:
0777:                try {
0778:                    XPDLValidatorSettings xvs = (XPDLValidatorSettings) cl
0779:                            .loadClass(xpdlvSettings).newInstance();
0780:                    xvs.setPropertyMgr(propertyMgr);
0781:                    xvs.init(null);
0782:
0783:                    Constructor c = Class.forName(xpdlvClass).getConstructor(
0784:                            new Class[] { Properties.class });
0785:                    xpdlValidator = (StandardPackageValidator) c
0786:                            .newInstance(new Object[] { xvs.getProperties() });
0787:                    loggingManager
0788:                            .info("JaWEManager -> Working with '" + xpdlvClass
0789:                                    + "' implementation of XPDL Validator");
0790:                } catch (Throwable ex) {
0791:                    XPDLValidatorSettings vs = new XPDLValidatorSettings();
0792:                    vs.init(null);
0793:                    xpdlValidator = new StandardPackageValidator(vs
0794:                            .getProperties());
0795:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0796:                        String msg = "JaweManager -> Problems while instantiating XPDL Validator class '"
0797:                                + xpdlvClass
0798:                                + "' - using default implementation!";
0799:                        loggingManager.error(msg, ex);
0800:                    } else {
0801:                        loggingManager.info("JaWEManager -> Working with '"
0802:                                + StandardPackageValidator.class.getName()
0803:                                + "' implementation of XPDL Validator");
0804:                    }
0805:                }
0806:                validationOrSearchResultEditor = new ValidationOrSearchResultEditor();
0807:
0808:                try {
0809:                    DisplayNameGeneratorSettings ds = (DisplayNameGeneratorSettings) cl
0810:                            .loadClass(dnSettings).newInstance();
0811:                    ds.setPropertyMgr(propertyMgr);
0812:
0813:                    Constructor c = Class.forName(dngClass).getConstructor(
0814:                            new Class[] { DisplayNameGeneratorSettings.class });
0815:                    displayNameGenerator = (StandardDisplayNameGenerator) c
0816:                            .newInstance(new Object[] { ds });
0817:                    loggingManager.info("JaWEManager -> Working with '"
0818:                            + dngClass
0819:                            + "' implementation of Display Name Generator");
0820:                } catch (Exception ex) {
0821:                    displayNameGenerator = new StandardDisplayNameGenerator();
0822:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0823:                        String msg = "JaweManager -> Problems while instantiating Display Name Generator class '"
0824:                                + dngClass
0825:                                + "' - using default implementation!";
0826:                        loggingManager.error(msg, ex);
0827:                    } else {
0828:                        loggingManager.info("JaWEManager -> Working with '"
0829:                                + StandardDisplayNameGenerator.class.getName()
0830:                                + "' implementation of Display Name Generator");
0831:                    }
0832:                }
0833:
0834:                try {
0835:                    cl.loadClass(panelGeneratorClassName).newInstance();
0836:                    loggingManager.info("JaWEManager -> Using '"
0837:                            + panelGeneratorClassName
0838:                            + "' implementation of Panel Generator");
0839:                } catch (Exception ex) {
0840:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0841:                        String msg = "JaWEManager -> Problems while instantiating Panel Generator class '"
0842:                                + JaWEManager.getInstance()
0843:                                        .getPanelGeneratorClassName()
0844:                                + "' - using default implementation!";
0845:
0846:                        JaWEManager.getInstance().getLoggingManager().error(
0847:                                msg, ex);
0848:                    }
0849:                    panelGeneratorClassName = StandardPanelGenerator.class
0850:                            .getName();
0851:                }
0852:                try {
0853:                    cl.loadClass(inlinePanelClassName).newInstance();
0854:                    loggingManager.info("JaWEManager -> Using '"
0855:                            + inlinePanelClassName
0856:                            + "' implementation of Inline Panel");
0857:                } catch (Exception ex) {
0858:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0859:                        String msg = "JaWEManager --> Problems while instantiating InlinePanel class '"
0860:                                + JaWEManager.getInstance()
0861:                                        .getInlinePanelClassName()
0862:                                + "' - using default implementation!";
0863:                        JaWEManager.getInstance().getLoggingManager().error(
0864:                                msg, ex);
0865:                    }
0866:                    inlinePanelClassName = InlinePanel.class.getName();
0867:                }
0868:
0869:                try {
0870:                    PanelSettings ps = (PanelSettings) cl.loadClass(
0871:                            xpdlEditorSettings).newInstance();
0872:                    ps.setPropertyMgr(propertyMgr);
0873:
0874:                    Constructor c = Class.forName(xpdleeClass).getConstructor(
0875:                            new Class[] { PanelSettings.class });
0876:                    xpdlElementEditor = (XPDLElementEditor) c
0877:                            .newInstance(new Object[] { ps });
0878:                    loggingManager.info("JaWEManager -> Working with '"
0879:                            + xpdleeClass
0880:                            + "' implementation of XPDL Element Editor ");
0881:                } catch (Throwable ex) {
0882:                    xpdlElementEditor = new NewStandardXPDLElementEditor(
0883:                            new NewStandardXPDLEditorSettings());
0884:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0885:                        String msg = "JaweManager -> Problems while instantiating XPDL Element Editor class '"
0886:                                + xpdleeClass
0887:                                + "' - using default implementation!";
0888:                        loggingManager.error(msg, ex);
0889:                    } else {
0890:                        loggingManager.info("JaWEManager -> Working with '"
0891:                                + NewStandardXPDLElementEditor.class.getName()
0892:                                + "' implementation of XPDL Element Editor ");
0893:                    }
0894:                }
0895:
0896:                try {
0897:                    TableEditorSettings ts = (TableEditorSettings) cl
0898:                            .loadClass(teSettings).newInstance();
0899:                    ts.setPropertyMgr(propertyMgr);
0900:
0901:                    Constructor c = Class.forName(teClass).getConstructor(
0902:                            new Class[] { TableEditorSettings.class });
0903:                    tableEditor = (TableEditor) c
0904:                            .newInstance(new Object[] { ts });
0905:                    loggingManager.info("JaWEManager -> Working with '"
0906:                            + teClass + "' implementation of Table Editor ");
0907:                } catch (Throwable ex) {
0908:                    tableEditor = new TableEditor(new TableEditorSettings());
0909:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0910:                        String msg = "JaweManager -> Problems while instantiating table editor class '"
0911:                                + teClass + "' - using default implementation!";
0912:                        loggingManager.error(msg, ex);
0913:                    } else {
0914:                        loggingManager.info("JaWEManager -> Working with '"
0915:                                + TableEditor.class.getName()
0916:                                + "' implementation of Table Editor ");
0917:                    }
0918:                }
0919:
0920:                try {
0921:                    TooltipGeneratorSettings ts = (TooltipGeneratorSettings) cl
0922:                            .loadClass(ttgSettings).newInstance();
0923:                    ts.setPropertyMgr(propertyMgr);
0924:
0925:                    Constructor c = Class.forName(ttgClass).getConstructor(
0926:                            new Class[] { TooltipGeneratorSettings.class });
0927:                    tooltipGenerator = (StandardTooltipGenerator) c
0928:                            .newInstance(new Object[] { ts });
0929:                    loggingManager.info("JaWEManager -> Working with '"
0930:                            + ttgClass
0931:                            + "' implementation of Tooltip Generator");
0932:                } catch (Exception ex) {
0933:                    tooltipGenerator = new StandardTooltipGenerator();
0934:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0935:                        String msg = "JaweManager -> Problems while instantiating Tooltip Generator class '"
0936:                                + ttgClass
0937:                                + "' - using default implementation!";
0938:                        loggingManager.error(msg, ex);
0939:                    } else {
0940:                        loggingManager.info("JaWEManager -> Working with '"
0941:                                + StandardTooltipGenerator.class.getName()
0942:                                + "' implementation of Tooltip Generator");
0943:                    }
0944:                }
0945:
0946:                try {
0947:                    componentManager = (ComponentManager) cl.loadClass(cmClass)
0948:                            .newInstance();
0949:                    componentManager.setPropertyMgr(propertyMgr);
0950:                    componentManager.init();
0951:                    loggingManager
0952:                            .info("JaWEManager -> Working with '" + cmClass
0953:                                    + "' implementation of Component Manager");
0954:                } catch (Throwable ex) {
0955:                    componentManager = new ComponentManager();
0956:                    componentManager.init();
0957:                    if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION) {
0958:                        String msg = "JaWEManger -> Problems while instantiating Component Manager class '"
0959:                                + cmClass + "' - using default implementation!";
0960:                        loggingManager.error(msg, ex);
0961:                    } else {
0962:                        loggingManager.info("JaWEManager -> Working with '"
0963:                                + ComponentManager.class.getName()
0964:                                + "' implementation of Component Manager");
0965:                    }
0966:                }
0967:
0968:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
0969:                        || JaWE.addOnsAvailable()) {
0970:                    getXPDLHandler().getXPDLRepositoryHandler()
0971:                            .setXPDLPrefixEnabled(
0972:                                    Boolean.valueOf(
0973:                                            properties.getProperty(
0974:                                                    "UseXPDLPrefix", "true"))
0975:                                            .booleanValue());
0976:                    // caching resources
0977:                    Utils.getActivityIconsMap();
0978:
0979:                    // loading transient packages
0980:                    loadTransientPackages();
0981:                }
0982:            }
0983:
0984:            public void restart(String filename) throws Throwable {
0985:                clearComponents();
0986:                String confHome = System
0987:                        .getProperty(JaWEConstants.JAWE_CURRENT_CONFIG_HOME);
0988:                String cfn = confHome + "/"
0989:                        + JaWEManager.TOGWE_BASIC_PROPERTYFILE_NAME;
0990:                File cf = new File(cfn);
0991:
0992:                if (!cf.exists()) {
0993:                    cfn = confHome + "/"
0994:                            + JaWEConstants.JAWE_BASIC_PROPERTYFILE_NAME;
0995:                    cf = new File(cfn);
0996:                }
0997:                if (cf.exists()) {
0998:                    JaWEManager.configure(cf);
0999:                } else {
1000:                    JaWEManager.configure();
1001:                }
1002:                ResourceManager.reconfigure();
1003:                JaWEManager.getInstance().start(filename);
1004:            }
1005:
1006:            public void loadTransientPackages() {
1007:                String ltpstr = properties.getProperty(
1008:                        "DefaultTransientPackages", "");
1009:                String[] tps = Utils.tokenize(ltpstr, ",");
1010:                if (tps != null) {
1011:                    for (int i = 0; i < tps.length; i++) {
1012:                        String tp = tps[i].trim();
1013:                        getJaWEController().addTransientPackage(tp);
1014:                    }
1015:                }
1016:            }
1017:
1018:            public String getName() {
1019:                if (JaWE.getJaWEVersion() == JaWE.COMMUNITY_VERSION) {
1020:                    return "Together Workflow Editor Community Edition";
1021:                }
1022:                if (JaWE.getJaWEVersion() == JaWE.DEMO_VERSION) {
1023:                    return "Together Workflow Editor Demo Version";
1024:                }
1025:                return ResourceManager.getLanguageDependentString("Title");
1026:            }
1027:
1028:            public XPDLHandler createXPDLHandler(
1029:                    XPDLRepositoryHandler xpdlRHandler) {
1030:                ClassLoader cl = getClass().getClassLoader();
1031:
1032:                String xpdlhClass = XPDLHandler.class.getName();
1033:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
1034:                        || JaWE.addOnsAvailable()) {
1035:                    xpdlhClass = properties.getProperty("XPDLHandler.Class",
1036:                            "org.enhydra.jawe.base.xpdlhandler.XPDLHandler");
1037:                }
1038:                String xpdlhSettings = XPDLHandlerSettings.class.getName();
1039:                if (JaWE.getJaWEVersion() != JaWE.COMMUNITY_VERSION
1040:                        || JaWE.addOnsAvailable()) {
1041:                    xpdlhSettings = properties
1042:                            .getProperty("XPDLHandler.Settings",
1043:                                    "org.enhydra.jawe.base.xpdlhandler.XPDLHandlerSettings");
1044:                }
1045:
1046:                XPDLHandler xpdlh = null;
1047:                try {
1048:                    XPDLHandlerSettings hs = (XPDLHandlerSettings) cl
1049:                            .loadClass(xpdlhSettings).newInstance();
1050:                    hs.setPropertyMgr(propertyMgr);
1051:
1052:                    Constructor c = Class.forName(xpdlhClass).getConstructor(
1053:                            new Class[] { XPDLHandlerSettings.class });
1054:                    xpdlh = (XPDLHandler) c.newInstance(new Object[] { hs });
1055:                } catch (Throwable ex) {
1056:                    String msg = "JaweManager -> Problems while instantiating XPDL Handler class '"
1057:                            + xpdlhClass + "' - using default!";
1058:                    xpdlh = new XPDLHandler();
1059:                    xpdlh.setXPDLRepositoryHandler(xpdlRHandler);
1060:                    loggingManager.error(msg, ex);
1061:                }
1062:                xpdlh.setXPDLRepositoryHandler(xpdlRHandler);
1063:                xpdlh.setLocale(ResourceManager.getChoosenLocale());
1064:                return xpdlh;
1065:            }
1066:
1067:            protected void clearComponents() {
1068:                getJaWEController().getJaWEFrame().dispose();
1069:                isConfigured = false;
1070:                showSplash = false;
1071:                componentManager = null;
1072:                labelGenerator = null;
1073:                loggingManager = null;
1074:                idFactory = null;
1075:                xpdlObjectFactory = null;
1076:                transitionHandler = null;
1077:                panelValidator = null;
1078:                xpdlValidator = null;
1079:                xpdlHandler = null;
1080:                jaweController = null;
1081:                displayNameGenerator = null;
1082:                xpdlElementEditor = null;
1083:                tableEditor = null;
1084:                tooltipGenerator = null;
1085:                panelGeneratorClassName = null;
1086:                inlinePanelClassName = null;
1087:                xpdlUtils = null;
1088:            }
1089:
1090:            public void start(String fileName) throws Throwable {
1091:                if (!isConfigured)
1092:                    return;
1093:
1094:                long tStart = System.currentTimeMillis();
1095:
1096:                String lookAndFeelClassName = JaWEManager
1097:                        .getLookAndFeelClassName();
1098:                if (lookAndFeelClassName == null
1099:                        || !lookAndFeelClassName.equals(""))
1100:                    try {
1101:                        UIManager.setLookAndFeel(lookAndFeelClassName);
1102:                    } catch (Exception ex) {
1103:                        UIManager.setLookAndFeel(UIManager
1104:                                .getSystemLookAndFeelClassName());
1105:                    }
1106:                else
1107:                    UIManager.setLookAndFeel(UIManager
1108:                            .getSystemLookAndFeelClassName());
1109:
1110:                javax.swing.plaf.FontUIResource f;
1111:                try {
1112:                    try {
1113:                        f = new javax.swing.plaf.FontUIResource(JaWEManager
1114:                                .getFontName(), Font.PLAIN, JaWEManager
1115:                                .getFontSize());
1116:                    } catch (Exception ex) {
1117:                        ex.printStackTrace();
1118:                        f = new javax.swing.plaf.FontUIResource("Label.font",
1119:                                Font.PLAIN, JaWEManager.getFontSize());
1120:                    }
1121:                    java.util.Enumeration keys = UIManager.getDefaults().keys();
1122:                    while (keys.hasMoreElements()) {
1123:                        Object key = keys.nextElement();
1124:                        Object value = UIManager.get(key);
1125:                        if (value instanceof  javax.swing.plaf.FontUIResource) {
1126:                            UIManager.put(key, f);
1127:                        }
1128:                    }
1129:                } catch (Exception ex) {
1130:                }
1131:
1132:                JaWESplash splashScr = null;
1133:                if (showSplash)
1134:                    splashScr = new JaWESplash();
1135:
1136:                JaWEManager.getInstance().init();
1137:
1138:                long tEnd = System.currentTimeMillis();
1139:                if (loggingManager != null) {
1140:                    loggingManager.info("JaWEManager -> " + getName()
1141:                            + " editor initialization is finished, it lasted "
1142:                            + (tEnd - tStart) + " ms");
1143:                    loggingManager.info(getName() + " ready and waiting ...");
1144:                }
1145:
1146:                if (fileName != null) {
1147:                    jaweController.openPackageFromFile(fileName);
1148:                }
1149:
1150:                if (splashScr != null) {
1151:                    splashScr.dispose();
1152:                    splashScr = null;
1153:                }
1154:
1155:                jaweController.showJaWEFrame();
1156:            }
1157:
1158:            public static String getBuildNo() {
1159:                return buildNo;
1160:            }
1161:
1162:            public static String getBuildEdition() {
1163:                return buildEd;
1164:            }
1165:
1166:            public static String getBuildEditionSuffix() {
1167:                return buildEdSuff;
1168:            }
1169:
1170:            public static String getVersion() {
1171:                return version;
1172:            }
1173:
1174:            public static String getRelease() {
1175:                return release;
1176:            }
1177:
1178:            public static String getFontName() {
1179:                if (isConfigured)
1180:                    return properties.getProperty("Font.Name", "Sans Serif");
1181:
1182:                return "System";
1183:            }
1184:
1185:            public static int getFontSize() {
1186:                int fontSize = 12;
1187:
1188:                if (isConfigured) {
1189:                    String fnts = properties.getProperty("Font.Size", "12");
1190:                    try {
1191:                        fontSize = Integer.parseInt(fnts);
1192:                    } catch (Exception ex) {
1193:                    }
1194:                }
1195:
1196:                return fontSize;
1197:            }
1198:
1199:            public String getStartingLocale() {
1200:                if (isConfigured)
1201:                    return properties.getProperty("StartingLocale", "default");
1202:
1203:                return "default";
1204:            }
1205:
1206:            public static String getLookAndFeelClassName() {
1207:                if (isConfigured)
1208:                    return properties.getProperty("LookAndFeelClassName", "");
1209:
1210:                return null;
1211:            }
1212:
1213:            public static String getSplashScreenImage() {
1214:                return splash;
1215:            }
1216:
1217:            public static String getAboutMsg() {
1218:                return aboutMsg;
1219:            }
1220:
1221:            public static boolean showLicenseInfo() {
1222:                return showLicenseInfo;
1223:            }
1224:
1225:            public static String getAdditionalLicenseText() {
1226:                return additionalLicenseText;
1227:            }
1228:
1229:            public ComponentManager getComponentManager() {
1230:                return componentManager;
1231:            }
1232:
1233:            public LabelGenerator getLabelGenerator() {
1234:                return labelGenerator;
1235:            }
1236:
1237:            public LoggingManager getLoggingManager() {
1238:                return loggingManager;
1239:            }
1240:
1241:            public TransitionHandler getTransitionHandler() {
1242:                return transitionHandler;
1243:            }
1244:
1245:            public IdFactory getIdFactory() {
1246:                return idFactory;
1247:            }
1248:
1249:            public XPDLObjectFactory getXPDLObjectFactory() {
1250:                return xpdlObjectFactory;
1251:            }
1252:
1253:            public PanelValidator getPanelValidator() {
1254:                return panelValidator;
1255:            }
1256:
1257:            public StandardPackageValidator getXPDLValidator() {
1258:                return xpdlValidator;
1259:            }
1260:
1261:            public XPDLHandler getXPDLHandler() {
1262:                return xpdlHandler;
1263:            }
1264:
1265:            public JaWEController getJaWEController() {
1266:                return jaweController;
1267:            }
1268:
1269:            public DisplayNameGenerator getDisplayNameGenerator() {
1270:                return displayNameGenerator;
1271:            }
1272:
1273:            public XPDLElementEditor getXPDLElementEditor() {
1274:                return xpdlElementEditor;
1275:            }
1276:
1277:            public TableEditor getTableEditor() {
1278:                return tableEditor;
1279:            }
1280:
1281:            public TooltipGenerator getTooltipGenerator() {
1282:                return tooltipGenerator;
1283:            }
1284:
1285:            public String getPanelGeneratorClassName() {
1286:                return panelGeneratorClassName;
1287:            }
1288:
1289:            public String getInlinePanelClassName() {
1290:                return inlinePanelClassName;
1291:            }
1292:
1293:            public XPDLUtils getXPDLUtils() {
1294:                return xpdlUtils;
1295:            }
1296:
1297:            public ValidationOrSearchResultEditor getValidationOrSearchResultEditor() {
1298:                return validationOrSearchResultEditor;
1299:            }
1300:
1301:            class JaWEPropertyMgr implements  PropertyMgr {
1302:
1303:                public Properties loadProperties(String path, String name) {
1304:                    Properties prop = new Properties();
1305:
1306:                    try {
1307:                        Utils.manageProperties(prop, path, name);
1308:                    } catch (Exception e) {
1309:                    }
1310:
1311:                    return prop;
1312:                }
1313:
1314:                public void manageProperties(JaWEComponent comp,
1315:                        JaWEComponentSettings settings, String path, String name) {
1316:                    try {
1317:                        settings.loadDefault(comp, loadProperties(path, name));
1318:                    } catch (Exception e) {
1319:                        System.err
1320:                                .println("Something's wrong with "
1321:                                        + name
1322:                                        + ", it has been overwritten by the default one!");
1323:                        try {
1324:                            settings.clear();
1325:                            Utils.copyPropertyFile(path, name, true);
1326:                            settings.loadDefault(comp, new Properties());
1327:                        } catch (Exception ex) {
1328:                        }
1329:                    }
1330:                }
1331:            }
1332:
1333:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.