Source Code Cross Referenced for UnBasicServlet.java in  » J2EE » WiSerFramework » de » ug2t » unifiedGui » service » 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 » J2EE » WiSerFramework » de.ug2t.unifiedGui.service 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @@
002:        // @@
003:        /*
004:         * Wi.Ser Framework
005:         *
006:         * Version: 1.8.1, 20-September-2007  
007:         * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library located in LGPL.txt in the 
021:         * license directory; if not, write to the 
022:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023:         * Boston, MA  02111-1307, USA.
024:         * 
025:         * If this agreement does not cover your requirements, please contact us
026:         * via email to get detailed information about the commercial license 
027:         * or our service offerings!
028:         *
029:         */
030:        // @@
031:        package de.ug2t.unifiedGui.service;
032:
033:        import java.io.*;
034:        import java.net.*;
035:        import java.util.*;
036:
037:        import javax.servlet.*;
038:        import javax.servlet.http.*;
039:
040:        import de.ug2t.channel.ho.service.*;
041:        import de.ug2t.channel.ho.session.*;
042:        import de.ug2t.channel.markup.generic.*;
043:        import de.ug2t.channel.markup.service.*;
044:        import de.ug2t.kernel.*;
045:        import de.ug2t.kernel.id.*;
046:        import de.ug2t.unifiedGui.*;
047:        import de.ug2t.unifiedGui.exceptions.*;
048:        import de.ug2t.unifiedGui.interfaces.*;
049:        import de.ug2t.unifiedGui.session.*;
050:        import de.ug2t.xmlScript.*;
051:
052:        public final class UnBasicServlet extends HttpServlet implements 
053:                IHoServerContainer {
054:            private MuApplInstanceDispatcher pem_appDisp = null;
055:            private String pem_appName = null;
056:            private String pem_errorAppName = null;
057:            private UnApplicationFactory pem_prodWeb = null;
058:            private UnApplicationFactory pem_prodSwing = null;
059:            private UnComponentFactory pem_fact = null;
060:            private String pem_applDesc = null;
061:            private String pem_factDesc = null;
062:            private HoServerService pem_swingServ = null;
063:            private String pem_rootDir = null;
064:            private String pem_initScript = null;
065:            private String pem_initProc = null;
066:            private String pem_initClass = null;
067:            private Object pem_staticInitObj = null;
068:            private int pem_swingPort = 11000;
069:            private MuGenericTemplateKitSelector pem_tplKitSel = null;
070:            private boolean pem_disableWeb = false;
071:            private ServletConfig pem_config = null;
072:            private boolean pem_swingHttp = false;
073:            private String pem_cache = null;
074:            private int pem_httpSCnt = 1000;
075:
076:            public UnBasicServlet() throws Exception {
077:                return;
078:            };
079:
080:            public void pcmf_resumeHoSession(String xSession) {
081:                // @@
082:            }
083:
084:            public void pcmf_startHoSession(String xLang) {
085:                KeLog
086:                        .pcmf_log(
087:                                "ug2t",
088:                                "application channel type is HALFOBJECT, client type is default SWING",
089:                                this , KeLog.MESSAGE);
090:
091:                try {
092:                    try {
093:                        if (xLang == null)
094:                            xLang = "";
095:
096:                        String l_lang = xLang.toUpperCase();
097:                        Object l_langMap = KeEnvironment.pcmf_getParameter(
098:                                "environment.xml", IUnApplication.MY_LANGUAGE,
099:                                l_lang);
100:                        if (l_langMap == null)
101:                            l_langMap = KeEnvironment.pcmf_getParameter(
102:                                    "environment.xml",
103:                                    IUnApplication.MY_LANGUAGE, "DEFAULT");
104:
105:                        KeRegisteredObject.pcmf_register(
106:                                IUnApplication.MY_LANGUAGE_CODE, l_lang
107:                                        .equals("") ? new KeStringWrapper(
108:                                        "DEFAULT")
109:                                        : new KeStringWrapper(l_lang));
110:
111:                        if (l_langMap == null)
112:                            throw (new Exception());
113:
114:                        KeRegisteredObject.pcmf_register(
115:                                IUnApplication.MY_LANGUAGE,
116:                                new KeStringWrapper(l_langMap.toString()));
117:                        KeLog.pcmf_log("ug2t", "set language to: " + l_lang
118:                                + "=>" + l_langMap, this , KeLog.MESSAGE);
119:                    } catch (Exception e) {
120:                        KeLog.pcmf_log("ug2t",
121:                                "no valid language definition found", this ,
122:                                KeLog.MESSAGE);
123:                    }
124:
125:                    KeRegisteredObject.pcmf_register(
126:                            IUnApplication.MY_CLIENT_TYPE, "SWING");
127:
128:                    IUnApplication l_appl = (IUnApplication) this .pem_prodSwing
129:                            .pcmf_produce(new Integer(UnComponentFactory.MIXED));
130:
131:                    KeLog.pcmf_log("ug2t", "set http protocol to to: "
132:                            + l_appl.pcmf_getProtocol(), this , KeLog.MESSAGE);
133:                    KeLog.pcmf_log("ug2t", "set domain to: "
134:                            + l_appl.pcmf_getHostName(), this , KeLog.MESSAGE);
135:                    KeLog.pcmf_log("ug2t", "set port to: "
136:                            + l_appl.pcmf_getPort(), this , KeLog.MESSAGE);
137:                    KeLog.pcmf_log("ug2t", "set rootURL to: "
138:                            + l_appl.pcmf_getRootUrl(), this , KeLog.MESSAGE);
139:
140:                    l_appl.pcmf_execView();
141:                } catch (Exception e) {
142:                    KeLog.pcmf_logException("ug2t", this , e);
143:                }
144:                ;
145:
146:                return;
147:            };
148:
149:            public void pcmf_startHoSession(String xLang, String xClient) {
150:                if (xClient == null) {
151:                    this .pcmf_startHoSession(xLang);
152:                    return;
153:                }
154:
155:                try {
156:                    String l_config = (String) KeEnvironment.pcmf_getParameter(
157:                            "environment.xml", "HoClientMap", xClient);
158:                    KeLog.pcmf_log("ug2t",
159:                            "application channel type is HALFOBJECT, client type is: "
160:                                    + xClient, this , KeLog.MESSAGE);
161:                    KeLog.pcmf_log("ug2t", "configuration for " + xClient
162:                            + " client is: " + l_config, this , KeLog.MESSAGE);
163:
164:                    try {
165:                        if (xLang == null)
166:                            xLang = "";
167:
168:                        String l_lang = xLang.toUpperCase();
169:                        Object l_langMap = KeEnvironment.pcmf_getParameter(
170:                                "environment.xml", IUnApplication.MY_LANGUAGE,
171:                                l_lang);
172:                        if (l_langMap == null)
173:                            l_langMap = KeEnvironment.pcmf_getParameter(
174:                                    "environment.xml",
175:                                    IUnApplication.MY_LANGUAGE, "DEFAULT");
176:
177:                        if (l_langMap == null)
178:                            throw (new Exception());
179:
180:                        KeRegisteredObject.pcmf_register(
181:                                IUnApplication.MY_LANGUAGE, l_langMap);
182:                        KeLog.pcmf_log("ug2t", "set language to: " + l_lang
183:                                + "=>" + l_langMap, this , KeLog.MESSAGE);
184:                    } catch (Exception e) {
185:                        KeLog.pcmf_log("ug2t",
186:                                "no valid language definition found", this ,
187:                                KeLog.MESSAGE);
188:                    }
189:
190:                    boolean l_bcache = true;
191:
192:                    if (pem_cache != null && pem_cache.equals("false")) {
193:                        KeLog.pcmf_log("ug2t",
194:                                "producer cache has been disabled", this ,
195:                                KeLog.MESSAGE);
196:                        l_bcache = false;
197:                    }
198:
199:                    UnComponentFactory l_fact = new UnComponentFactory(l_config);
200:                    de.ug2t.unifiedGui.UnApplicationFactory
201:                            .pcmf_setStandAloneMode(false);
202:                    UnApplicationFactory l_prod = new de.ug2t.unifiedGui.UnApplicationFactory(
203:                            this .pem_applDesc, l_fact, l_bcache);
204:
205:                    KeRegisteredObject.pcmf_register(
206:                            IUnApplication.MY_CLIENT_TYPE, xClient);
207:
208:                    IUnApplication l_appl = (IUnApplication) l_prod
209:                            .pcmf_produce(new Integer(UnComponentFactory.MIXED));
210:
211:                    KeLog.pcmf_log("ug2t", "set http protocol to to: "
212:                            + l_appl.pcmf_getProtocol(), this , KeLog.MESSAGE);
213:                    KeLog.pcmf_log("ug2t", "set domain to: "
214:                            + l_appl.pcmf_getHostName(), this , KeLog.MESSAGE);
215:                    KeLog.pcmf_log("ug2t", "set port to: "
216:                            + l_appl.pcmf_getPort(), this , KeLog.MESSAGE);
217:                    KeLog.pcmf_log("ug2t", "set rootURL to: "
218:                            + l_appl.pcmf_getRootUrl(), this , KeLog.MESSAGE);
219:
220:                    l_appl.pcmf_execView();
221:                } catch (Exception e) {
222:                    KeLog.pcmf_logException("ug2t", this , e);
223:                }
224:                ;
225:
226:                return;
227:            };
228:
229:            public static final String SERVLET_CONFIG = "SERVLET_CONFIG";
230:            public static final String SERVLET_IDISP = "SERVLET_INSTANCE_DISPATCHER";
231:
232:            // @@
233:
234:            public void init(ServletConfig xConfig) {
235:                KeLog.pcmf_logEnter("Init(" + xConfig + ")", this );
236:
237:                KeRegisteredObject.pcmf_registerGlobal(SERVLET_CONFIG, xConfig);
238:                KeRegisteredObject.pcmf_registerGlobal(
239:                        IHoServerContainer.SERVER_CONTAINER, this );
240:
241:                this .pem_config = xConfig;
242:
243:                // rootDir
244:                pem_rootDir = xConfig.getInitParameter("rootDir");
245:                if (pem_rootDir == null) {
246:                    pem_rootDir = xConfig.getServletContext().getRealPath(
247:                            File.separator);
248:                    KeLog.pcmf_log("ug2t",
249:                            "webContext rootDir not set use default: "
250:                                    + pem_rootDir, this , KeLog.MESSAGE);
251:                } else {
252:                    pem_rootDir = pem_rootDir.replace('\\', File.separator
253:                            .charAt(0));
254:                    pem_rootDir = KeTools.pcmf_stringSingleSubst(pem_rootDir,
255:                            "{$SERVLETCTX}", xConfig.getServletContext()
256:                                    .getRealPath(File.separator));
257:                    KeLog.pcmf_log("ug2t",
258:                            "webContext rootDir: " + pem_rootDir, this ,
259:                            KeLog.MESSAGE);
260:                }
261:
262:                KeEnvironment.pcmf_setRootDir(pem_rootDir);
263:
264:                String l_idGen = (String) KeEnvironment.pcmf_getParameter(
265:                        "environment.xml", "runtime", "IDGEN", null);
266:                if (l_idGen != null) {
267:                    try {
268:                        IKeIDGenerator l_gen = (IKeIDGenerator) Class.forName(
269:                                l_idGen).newInstance();
270:                        KeRegisteredObject.pcmf_setIDGenerator(l_gen);
271:                        KeLog.pcmf_log("ug2t", "Setting ID Generator class: "
272:                                + l_gen, this , KeLog.MESSAGE);
273:                    } catch (Exception e) {
274:                        KeLog.pcmf_logException("ug2t", this , e);
275:                    }
276:                }
277:
278:                String l_derror = (String) KeEnvironment.pcmf_getParameter(
279:                        "environment.xml", "runtime", "DISPATCH_ERROR_HANDLER",
280:                        null);
281:                if (l_derror != null) {
282:                    try {
283:                        IUnDispatchExceptionHandler l_dsp = (IUnDispatchExceptionHandler) Class
284:                                .forName(l_derror).newInstance();
285:                        UnComponent.pcmf_setDispatcher(new UnEventDispatcher(
286:                                l_dsp));
287:                        KeLog.pcmf_log("ug2t",
288:                                "Setting dispatch error handler class: "
289:                                        + l_dsp, null, KeLog.MESSAGE);
290:                    } catch (Exception e) {
291:                        KeLog.pcmf_logException("ug2t", null, e);
292:                    }
293:                } else
294:                    UnComponent.pcmf_setDispatcher(new UnEventDispatcher(null));
295:
296:                // tmpDir
297:                String l_tmpDir = xConfig.getInitParameter("tmpDir");
298:                if (l_tmpDir == null) {
299:                    l_tmpDir = KeEnvironment.pcmf_getRootDir() + "tmp";
300:                    KeLog.pcmf_log("ug2t",
301:                            "webContext tmpDir not set use default: "
302:                                    + l_tmpDir, this , KeLog.MESSAGE);
303:                } else {
304:                    l_tmpDir = l_tmpDir.replace('\\', File.separator.charAt(0));
305:                    l_tmpDir = KeEnvironment.pcmf_getRootDir() + l_tmpDir;
306:                    KeLog.pcmf_log("ug2t", "webContext tmpDir: " + l_tmpDir,
307:                            this , KeLog.MESSAGE);
308:                }
309:
310:                KeEnvironment.pcmf_setTmpDir(l_tmpDir);
311:
312:                // Logging
313:                String l_logPrio = xConfig.getInitParameter("logPrio");
314:                String l_logWriter = xConfig.getInitParameter("logWriter");
315:
316:                try {
317:                    if (l_logWriter != null)
318:                        KeLog.pcmf_setLogWriter((IKeLogWriter) Class.forName(
319:                                l_logWriter).newInstance());
320:                } catch (Exception e) {
321:                    KeLog.pcmf_log("ug2t", "error setting log writer: "
322:                            + l_logWriter, this , KeLog.ERROR);
323:                }
324:
325:                if (l_logPrio == null)
326:                    l_logPrio = "MESSAGE";
327:
328:                if (l_logPrio.equals("FATAL"))
329:                    KeLog.pcmf_setPrio(KeLog.FATAL);
330:                else if (l_logPrio.equals("ERROR"))
331:                    KeLog.pcmf_setPrio(KeLog.ERROR);
332:                else if (l_logPrio.equals("MESSAGE"))
333:                    KeLog.pcmf_setPrio(KeLog.MESSAGE);
334:                else if (l_logPrio.equals("APPL"))
335:                    KeLog.pcmf_setPrio(KeLog.APPL);
336:                else if (l_logPrio.equals("DEBUG"))
337:                    KeLog.pcmf_setPrio(KeLog.DEBUG);
338:                else if (l_logPrio.equals("STATISTICS"))
339:                    KeLog.pcmf_setPrio(KeLog.STATISTICS);
340:                else if (l_logPrio.equals("TRACE"))
341:                    KeLog.pcmf_setPrio(KeLog.TRACE);
342:                else if (l_logPrio.equals("SILENT"))
343:                    KeLog.pcmf_setPrio(KeLog.SILENT);
344:                else {
345:                    KeLog.pcmf_setPrio(KeLog.MESSAGE);
346:                    KeLog.pcmf_log("ug2t", "unknown log priority set MESSAGE",
347:                            this , KeLog.ERROR);
348:                }
349:
350:                String l_logClass = xConfig.getInitParameter("logClass");
351:                if (l_logClass != null)
352:                    KeLog.pcmf_addClass(l_logClass);
353:
354:                // SSL
355:                String l_keyStore = null;
356:                String l_trustStore = null;
357:                String l_trustPwd = null;
358:                String l_keyPwd = null;
359:
360:                l_keyStore = xConfig.getInitParameter("SSL_KEYSTORE");
361:                l_keyPwd = xConfig.getInitParameter("SSL_KEYPWD");
362:                l_trustStore = xConfig.getInitParameter("SSL_TRUSTSTORE");
363:                l_trustPwd = xConfig.getInitParameter("SSL_TRUSTPWD");
364:
365:                if (l_keyStore != null)
366:                    System.setProperty("javax.net.ssl.keyStore", KeEnvironment
367:                            .pcmf_buildPath(l_keyStore));
368:
369:                if (l_keyPwd != null)
370:                    System.setProperty("javax.net.ssl.keyStorePassword",
371:                            l_keyPwd);
372:
373:                if (l_trustStore != null)
374:                    System.setProperty("javax.net.ssl.trustStore",
375:                            KeEnvironment.pcmf_buildPath(l_trustStore));
376:
377:                if (l_trustPwd != null)
378:                    System.setProperty("javax.net.ssl.trustStorePassword",
379:                            l_trustPwd);
380:
381:                // Appnames
382:                pem_appName = xConfig.getInitParameter("mainAppName");
383:                if (pem_appName == null)
384:                    pem_appName = "stdMainWebApp";
385:
386:                pem_errorAppName = xConfig.getInitParameter("errorAppName");
387:                if (pem_errorAppName == null)
388:                    pem_errorAppName = "stdErrorHandler";
389:
390:                // Init-Script
391:                pem_initScript = xConfig.getInitParameter("initScript");
392:                pem_initProc = xConfig.getInitParameter("initProc");
393:                pem_initClass = xConfig.getInitParameter("initClass");
394:
395:                if (pem_initScript != null && pem_initProc != null)
396:                    KeEnvironment.pcmf_initScript(pem_initScript, pem_initProc);
397:
398:                try {
399:                    if (pem_initClass != null)
400:                        pem_staticInitObj = ((IKeExecutable) Class.forName(
401:                                pem_initClass).newInstance())
402:                                .pcmf_execObj(this );
403:                } catch (Exception e) {
404:                    KeLog.pcmf_log("ug2t",
405:                            "error creating and calling initClass: "
406:                                    + pem_initClass, this , KeLog.ERROR);
407:                }
408:
409:                // external call
410:                String l_call = xConfig.getInitParameter("initCall");
411:                try {
412:                    if (l_call != null)
413:                        Runtime.getRuntime().exec(l_call);
414:                } catch (Exception e) {
415:                    KeLog.pcmf_log("ug2t", "error executing external call: "
416:                            + l_call, this , KeLog.ERROR);
417:                }
418:
419:                // XML-Konfig
420:                pem_applDesc = xConfig.getInitParameter("guiApplDescFile");
421:                pem_factDesc = xConfig.getInitParameter("guiFactDescFile");
422:                pem_cache = xConfig.getInitParameter("cacheApplDesc");
423:                boolean l_bcache = true;
424:
425:                if (pem_cache != null && pem_cache.equals("false")) {
426:                    KeLog.pcmf_log("ug2t", "producer cache has been disabled",
427:                            this , KeLog.MESSAGE);
428:                    l_bcache = false;
429:                }
430:
431:                if (pem_applDesc != null && pem_factDesc != null) {
432:                    pem_fact = new UnComponentFactory(this .pem_factDesc);
433:
434:                    de.ug2t.unifiedGui.UnApplicationFactory
435:                            .pcmf_setStandAloneMode(false);
436:
437:                    pem_prodWeb = new de.ug2t.unifiedGui.UnApplicationFactory(
438:                            this .pem_applDesc, pem_fact, l_bcache);
439:                    pem_prodSwing = new de.ug2t.unifiedGui.UnApplicationFactory(
440:                            this .pem_applDesc, pem_fact, l_bcache);
441:                }
442:                ;
443:
444:                MuGenericTemplateKit l_stdKit = new MuGenericTemplateKit(
445:                        pem_fact, "STD");
446:                KeRegisteredObject.pcmf_registerGlobal(
447:                        MuGenericTemplateKit.TEMPLATE_KIT_NAME, l_stdKit);
448:
449:                this .pem_tplKitSel = new MuGenericTemplateKitSelector(l_stdKit);
450:                try {
451:                    String l_tplKitDef = xConfig
452:                            .getInitParameter("guiTemplateDescFile");
453:                    if (l_tplKitDef != null) {
454:                        // Paramter lesen und kits erzeugen
455:                        Iterator l_kit = KeEnvironment.pcmf_getParameterKeys(
456:                                l_tplKitDef, "MuClientMap");
457:                        String l_parfile = null;
458:                        String l_key = null;
459:                        MuGenericTemplateKit l_tplkit = null;
460:                        while (l_kit.hasNext()) {
461:                            l_key = (String) l_kit.next();
462:                            if (l_key
463:                                    .startsWith(MuGenericTemplateKitSelector.TPLSEL_REGEXP_MARKER)) {
464:                                // [RegExp]:blabla@[Alias]:
465:                                String l_regexp = l_key;
466:                                String l_alias = (String) KeEnvironment
467:                                        .pcmf_getParameter(l_tplKitDef,
468:                                                "MuClientMap", l_key);
469:
470:                                l_parfile = (String) KeEnvironment
471:                                        .pcmf_getParameter(l_tplKitDef,
472:                                                "MuClientMap", l_alias);
473:                                l_tplkit = new MuGenericTemplateKit(l_parfile,
474:                                        l_alias, this .pem_fact, l_alias);
475:                                this .pem_tplKitSel.pcmf_addTplKit(l_regexp,
476:                                        l_tplkit);
477:                            } else {
478:                                l_parfile = (String) KeEnvironment
479:                                        .pcmf_getParameter(l_tplKitDef,
480:                                                "MuClientMap", l_key);
481:                                l_tplkit = new MuGenericTemplateKit(l_parfile,
482:                                        l_key, this .pem_fact, l_key);
483:                                this .pem_tplKitSel.pcmf_addTplKit(l_key,
484:                                        l_tplkit);
485:                            }
486:                        }
487:                        ;
488:                    }
489:                } catch (Exception e) {
490:                    KeLog.pcmf_logException("ug2t", this , e);
491:                    KeLog.pcmf_log("ug2t", "error reading template-kits", this ,
492:                            KeLog.ERROR);
493:                }
494:
495:                // Swing Server Starten
496:                String l_swingport = xConfig.getInitParameter("swingPort");
497:                if (l_swingport != null)
498:                    pem_swingPort = Integer.parseInt(l_swingport);
499:
500:                try {
501:                    String l_disabSwing = xConfig
502:                            .getInitParameter("DISABLE_SWING");
503:                    if (l_disabSwing == null || l_disabSwing.equals("false")) {
504:                        KeLog.pcmf_log("ug2t", "swing server has been enabled",
505:                                this , KeLog.MESSAGE);
506:
507:                        String l_coll_str = xConfig
508:                                .getInitParameter("COLLECT_REPLIES");
509:                        String l_comp_str = xConfig
510:                                .getInitParameter("COMPRESS");
511:                        String l_ssl_str = xConfig.getInitParameter("SSL");
512:                        String l_rec_str = xConfig.getInitParameter("RECORD");
513:                        String l_recClass_str = xConfig
514:                                .getInitParameter("RECORDER_CLASS");
515:
516:                        boolean l_comp = l_comp_str != null
517:                                && l_comp_str.toUpperCase().equals("TRUE") ? true
518:                                : false;
519:                        boolean l_ssl = l_ssl_str != null
520:                                && l_ssl_str.toUpperCase().equals("TRUE") ? true
521:                                : false;
522:                        boolean l_coll = l_coll_str != null
523:                                && l_coll_str.toUpperCase().equals("FALSE") ? false
524:                                : true;
525:                        boolean l_rec = l_rec_str != null
526:                                && l_rec_str.toUpperCase().equals("TRUE") ? true
527:                                : false;
528:
529:                        String l_serv_alias = xConfig
530:                                .getInitParameter("SERVICE_ALIAS");
531:                        if (l_serv_alias != null)
532:                            KeRegisteredObject.pcmf_registerGlobal(
533:                                    l_serv_alias, this );
534:
535:                        pem_swingServ = new de.ug2t.channel.ho.service.HoServerService(
536:                                pem_swingPort, l_ssl, l_comp, l_coll,
537:                                l_recClass_str, l_rec);
538:                    } else
539:                        KeLog.pcmf_log("ug2t",
540:                                "swing server has been disabled", this ,
541:                                KeLog.MESSAGE);
542:                } catch (Exception e) {
543:                    KeLog.pcmf_logException("ug2t", this , e);
544:                    KeLog.pcmf_log("ug2t", "error configuring swing server",
545:                            this , KeLog.ERROR);
546:                }
547:                ;
548:
549:                // Producer erzeugen
550:                try {
551:                    String l_stimeout = xConfig.getInitParameter("TIMEOUT");
552:                    String l_smaxInst = xConfig
553:                            .getInitParameter("MAX_SESSIONS");
554:                    String l_sprotocol = xConfig.getInitParameter("PROTOCOL");
555:                    String l_sresdel = xConfig
556:                            .getInitParameter("RESPONSE_DELAY");
557:                    String l_sdeadlock = xConfig
558:                            .getInitParameter("DEADLOCK_DELAY");
559:                    String l_disabWeb = xConfig.getInitParameter("DISABLE_WEB");
560:                    String l_disabSwingHttp = xConfig
561:                            .getInitParameter("DISABLE_SWINGHTTP");
562:
563:                    if (l_disabSwingHttp != null
564:                            && l_disabSwingHttp.equals("true")) {
565:                        this .pem_swingHttp = false;
566:                        KeLog.pcmf_log("ug2t",
567:                                "swing http server has been disabled", this ,
568:                                KeLog.MESSAGE);
569:                    } else {
570:                        KeLog.pcmf_log("ug2t",
571:                                "swing http server has been enabled", this ,
572:                                KeLog.MESSAGE);
573:                        this .pem_swingHttp = true;
574:                    }
575:
576:                    if (l_disabWeb != null && l_disabWeb.equals("true")) {
577:                        this .pem_disableWeb = true;
578:                        KeLog.pcmf_log("ug2t", "web server has been disabled",
579:                                this , KeLog.MESSAGE);
580:                    } else
581:                        KeLog.pcmf_log("ug2t", "web server has been enabled",
582:                                this , KeLog.MESSAGE);
583:
584:                    int l_timeout = 1800;
585:                    int l_maxInst = 50;
586:                    int l_resdel = -1;
587:                    int l_deadLock = 600;
588:
589:                    String l_protocol = "http";
590:
591:                    if (l_stimeout != null)
592:                        l_timeout = Integer.parseInt(l_stimeout);
593:                    if (l_smaxInst != null)
594:                        l_maxInst = Integer.parseInt(l_smaxInst);
595:                    if (l_sprotocol != null)
596:                        l_protocol = l_sprotocol;
597:                    if (l_sresdel != null)
598:                        l_resdel = Integer.parseInt(l_sresdel);
599:                    if (l_sdeadlock != null)
600:                        l_deadLock = Integer.parseInt(l_sdeadlock);
601:
602:                    KeLog.pcmf_log("ug2t", "servlet settings: TIMEOUT: "
603:                            + l_timeout
604:                            + ", RESPONSE_DELAY: "
605:                            + (l_resdel == -1 ? "DISABLED" : (l_resdel
606:                                    + ", DEADLOCK_DELAY: " + l_deadLock))
607:                            + ", PROTOCOL: " + l_protocol, this , KeLog.MESSAGE);
608:
609:                    KeObjectFactory.pcmf_addProducer(pem_appName,
610:                            new MuBasicApplProducer(xConfig, pem_prodWeb));
611:                    KeObjectFactory.pcmf_addProducer(pem_errorAppName,
612:                            new MuBasicErrorApplProducer(xConfig, pem_prodWeb));
613:                    pem_appDisp = new MuApplInstanceDispatcher(l_maxInst,
614:                            pem_errorAppName, l_timeout, this .pem_tplKitSel,
615:                            l_protocol, l_resdel, l_deadLock);
616:                    KeRegisteredObject.pcmf_registerGlobal(
617:                            UnBasicServlet.SERVLET_IDISP, this .pem_appDisp);
618:                } catch (Exception e) {
619:                    KeLog.pcmf_logException("ug2t", this , e);
620:                    KeLog.pcmf_log("ug2t", "error configuring web server",
621:                            this , KeLog.ERROR);
622:                }
623:                ;
624:
625:                KeLog.pcmf_logLeave("Init(" + xConfig + ")", this );
626:
627:                return;
628:            };
629:
630:            // @@
631:
632:            public void service(HttpServletRequest req, HttpServletResponse res)
633:                    throws IOException {
634:                try {
635:                    req.setCharacterEncoding(KeEnvironment
636:                            .pcmf_getCharacterSet());
637:
638:                    if (this .pem_disableWeb) {
639:                        res.sendError(HttpServletResponse.SC_FORBIDDEN);
640:                        return;
641:                    }
642:
643:                    // @@
644:
645:                    // KeLog.pcmf_log(pem_appName, "servlet-service called: " +
646:                    // req.getSession().getId(), this, KeLog.DEBUG);
647:                    pem_appDisp.pcmf_work(pem_appName, req, res,
648:                            this .pem_config);
649:                } catch (Exception e) {
650:                    e.printStackTrace(System.out);
651:                }
652:                ;
653:            }
654:
655:            public void pcmf_setApplication(HttpServletRequest req,
656:                    HttpServletResponse res) throws IOException {
657:                try {
658:                    req.setCharacterEncoding(KeEnvironment
659:                            .pcmf_getCharacterSet());
660:
661:                    pem_appDisp.pcmf_create(pem_appName, req, res,
662:                            this .pem_config);
663:                } catch (Exception e) {
664:                    e.printStackTrace(System.out);
665:                }
666:                ;
667:            }
668:
669:            public Object pcmf_getStaticInitObj() {
670:                return (this .pem_staticInitObj);
671:            }
672:        } // /:~
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.