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


001:        /*
002:         * Created on 21.03.2004
003:         *
004:         * date: 21.03.2004
005:         * project: JmcFrame_all
006:         * 
007:         * comment:
008:         */
009:        package de.ug2t.channel.runtime.swing;
010:
011:        import java.util.*;
012:
013:        import de.ug2t.channel.ho.service.*;
014:        import de.ug2t.channel.ho.session.*;
015:        import de.ug2t.kernel.*;
016:        import de.ug2t.kernel.id.*;
017:        import de.ug2t.unifiedGui.*;
018:        import de.ug2t.unifiedGui.exceptions.*;
019:        import de.ug2t.unifiedGui.interfaces.*;
020:        import de.ug2t.xmlScript.*;
021:
022:        /**
023:         * @author Dirk
024:         * 
025:         * date: 21.03.2004 project: JmcFrame_all
026:         * 
027:         * <p>
028:         * ...
029:         * </p>
030:         */
031:        public class RtSwingStandalone implements  IHoServerContainer {
032:            private static String pem_file = "environment.xml";
033:
034:            private String pem_initScript = null;
035:            private String pem_initProc = null;
036:            private String pem_initClass = null;
037:            private Object pem_staticInitObj = null;
038:
039:            public static void start() throws Exception {
040:                int l_port = Integer.parseInt((String) KeEnvironment
041:                        .pcmf_getParameter(pem_file, "RtSwingClient", "PORT"));
042:                String l_host = (String) KeEnvironment.pcmf_getParameter(
043:                        pem_file, "RtSwingClient", "HOST");
044:
045:                String l_comp_str = (String) KeEnvironment.pcmf_getParameter(
046:                        pem_file, "RtSwingClient", "COMPRESS");
047:                String l_ssl_str = (String) KeEnvironment.pcmf_getParameter(
048:                        pem_file, "RtSwingClient", "SSL");
049:
050:                boolean l_comp = l_comp_str != null
051:                        && l_comp_str.toUpperCase().equals("TRUE") ? true
052:                        : false;
053:                boolean l_ssl = l_ssl_str != null
054:                        && l_ssl_str.toUpperCase().equals("TRUE") ? true
055:                        : false;
056:
057:                de.ug2t.channel.ho.service.HoClientService client = new de.ug2t.channel.ho.service.HoClientService(
058:                        l_port, l_host, l_ssl, l_comp, true);
059:
060:                String l_service = (String) KeEnvironment.pcmf_getParameter(
061:                        pem_file, "RtSwingClient", "SERVICE_CLASS");
062:                String l_init = (String) KeEnvironment.pcmf_getParameter(
063:                        pem_file, "RtSwingClient", "SERVICE_INIT");
064:                String l_alias = (String) KeEnvironment.pcmf_getParameter(
065:                        pem_file, "RtSwingClient", "SERVICE_ALIAS");
066:                String l_cr = (String) KeEnvironment.pcmf_getParameter(
067:                        pem_file, "RtSwingClient", "CREATE");
068:
069:                KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
070:                        "");
071:                ScXmlScript.pcmf_createxScriptString(l_remCall, null);
072:                ScXmlScript.pcmf_addProc(l_remCall, null);
073:
074:                if (l_cr != null && l_cr.equals("true"))
075:                    ScXmlScript.pcmf_addDecl(l_remCall, l_alias, l_service,
076:                            "forever");
077:
078:                ScXmlScript.pcmf_addCall(l_remCall, null, l_alias, l_init);
079:
080:                String l_lang = (String) KeEnvironment.pcmf_getParameter(
081:                        pem_file, "RtSwingClient", IUnApplication.MY_LANGUAGE);
082:                if (l_lang == null)
083:                    l_lang = Locale.getDefault().getLanguage();
084:
085:                ScXmlScript.pcmf_addCallPar(l_remCall, l_lang, "false",
086:                        "java.lang.String");
087:
088:                ScXmlScript.pcmf_endAll(l_remCall);
089:
090:                IHoSession l_session = client.pcmf_getSession();
091:
092:                l_session.pcmf_call(l_remCall.toString(), null);
093:            };
094:
095:            public void pcmf_crswapp(String xLang) throws Exception {
096:                String l_factpar = (String) KeEnvironment.pcmf_getParameter(
097:                        pem_file, "RtSwingServer", "FACTORY");
098:                String l_main = (String) KeEnvironment.pcmf_getParameter(
099:                        pem_file, "RtSwingServer", "XML_MAIN");
100:
101:                de.ug2t.unifiedGui.UnApplicationFactory
102:                        .pcmf_setStandAloneMode(true);
103:
104:                UnComponentFactory l_fact = new UnComponentFactory(l_factpar);
105:                de.ug2t.unifiedGui.UnApplicationFactory l_prod = new de.ug2t.unifiedGui.UnApplicationFactory(
106:                        l_main, l_fact);
107:
108:                try {
109:                    String l_lang = xLang.toUpperCase();
110:                    if (l_lang != null) {
111:                        Object l_langMap = KeEnvironment.pcmf_getParameter(
112:                                "environment.xml", IUnApplication.MY_LANGUAGE,
113:                                l_lang);
114:                        if (l_langMap == null)
115:                            l_langMap = KeEnvironment.pcmf_getParameter(
116:                                    "environment.xml",
117:                                    IUnApplication.MY_LANGUAGE, "DEFAULT");
118:
119:                        KeRegisteredObject.pcmf_register(
120:                                IUnApplication.MY_LANGUAGE_CODE, l_lang
121:                                        .equals("") ? new KeStringWrapper(
122:                                        "DEFAULT")
123:                                        : new KeStringWrapper(l_lang));
124:
125:                        if (l_langMap == null)
126:                            throw (new Exception());
127:
128:                        KeRegisteredObject.pcmf_register(
129:                                IUnApplication.MY_LANGUAGE,
130:                                new KeStringWrapper(l_langMap.toString()));
131:                        KeLog.pcmf_log("ug2t", "set language to: " + l_lang
132:                                + "=>" + l_langMap, this , KeLog.MESSAGE);
133:                    }
134:                } catch (Exception e) {
135:                    KeLog.pcmf_log("ug2t",
136:                            "no valid language definition found", this ,
137:                            KeLog.MESSAGE);
138:                }
139:
140:                IUnApplication l_swapp = (IUnApplication) l_prod
141:                        .pcmf_produce(new Integer(UnComponentFactory.HALFOBJECT));
142:                l_swapp.pcmf_execView();
143:            };
144:
145:            public RtSwingStandalone() {
146:                try {
147:                    KeRegisteredObject.pcmf_registerGlobal(
148:                            IHoServerContainer.SERVER_CONTAINER, this );
149:
150:                    pem_initScript = (String) KeEnvironment.pcmf_getParameter(
151:                            pem_file, "RtSwingServer", "initScript", null);
152:                    pem_initProc = (String) KeEnvironment.pcmf_getParameter(
153:                            pem_file, "RtSwingServer", "initProc", null);
154:                    pem_initClass = (String) KeEnvironment.pcmf_getParameter(
155:                            pem_file, "RtSwingServer", "initClass", null);
156:
157:                    if (pem_initScript != null && pem_initProc != null)
158:                        KeEnvironment.pcmf_initScript(pem_initScript,
159:                                pem_initProc);
160:
161:                    try {
162:                        if (pem_initClass != null)
163:                            pem_staticInitObj = ((IKeExecutable) Class.forName(
164:                                    pem_initClass).newInstance())
165:                                    .pcmf_execObj(null);
166:                    } catch (Exception e) {
167:                        KeLog.pcmf_log("ug2t",
168:                                "error creating and calling initClass: "
169:                                        + pem_initClass, this , KeLog.ERROR);
170:                    }
171:
172:                    // external call
173:                    String l_call = (String) KeEnvironment.pcmf_getParameter(
174:                            pem_file, "RtSwingServer", "initCall", null);
175:                    ;
176:                    try {
177:                        if (l_call != null)
178:                            Runtime.getRuntime().exec(l_call);
179:                    } catch (Exception e) {
180:                        KeLog.pcmf_log("ug2t",
181:                                "error executing external call: " + l_call,
182:                                this , KeLog.ERROR);
183:                    }
184:                } catch (Exception e) {
185:                    KeLog.pcmf_log("ug2t",
186:                            "error initialising standalone application", this ,
187:                            KeLog.ERROR);
188:                }
189:            }
190:
191:            public static void main(String[] args) throws Exception {
192:                try {
193:                    if (args.length > 0)
194:                        pem_file = args[0];
195:
196:                    if (args.length > 1)
197:                        KeEnvironment.pcmf_setRootDir(args[1]);
198:                    else
199:                        KeEnvironment.pcmf_setRootDir("./");
200:
201:                    if (args.length > 2)
202:                        KeEnvironment.pcmf_setTmpDir(KeEnvironment
203:                                .pcmf_getRootDir()
204:                                + args[2]);
205:                    else
206:                        KeEnvironment.pcmf_setTmpDir(KeEnvironment
207:                                .pcmf_getRootDir()
208:                                + "tmp");
209:                } catch (Exception e) {
210:                    KeLog
211:                            .pcmf_log(
212:                                    "N.A.",
213:                                    "error reading command line parameters, assign standard values",
214:                                    null, KeLog.ERROR);
215:                    pem_file = "environment.xml";
216:                    KeEnvironment.pcmf_setRootDir("./");
217:                    KeEnvironment.pcmf_setTmpDir(KeEnvironment
218:                            .pcmf_getRootDir()
219:                            + "tmp");
220:                }
221:
222:                String l_idGen = (String) KeEnvironment.pcmf_getParameter(
223:                        pem_file, "runtime", "IDGEN", null);
224:                if (l_idGen != null) {
225:                    try {
226:                        IKeIDGenerator l_gen = (IKeIDGenerator) Class.forName(
227:                                l_idGen).newInstance();
228:                        KeRegisteredObject.pcmf_setIDGenerator(l_gen);
229:                        KeLog.pcmf_log("ug2t", "Setting ID Generator class: "
230:                                + l_gen, null, KeLog.MESSAGE);
231:                    } catch (Exception e) {
232:                        KeLog.pcmf_logException("ug2t", null, e);
233:                    }
234:                }
235:
236:                String l_derror = (String) KeEnvironment.pcmf_getParameter(
237:                        pem_file, "runtime", "DISPATCH_ERROR_HANDLER", null);
238:                if (l_derror != null) {
239:                    try {
240:                        IUnDispatchExceptionHandler l_dsp = (IUnDispatchExceptionHandler) Class
241:                                .forName(l_derror).newInstance();
242:                        UnComponent.pcmf_setDispatcher(new UnEventDispatcher(
243:                                l_dsp));
244:                        KeLog.pcmf_log("ug2t",
245:                                "Setting dispatch error handler class: "
246:                                        + l_dsp, null, KeLog.MESSAGE);
247:                    } catch (Exception e) {
248:                        KeLog.pcmf_logException("ug2t", null, e);
249:                    }
250:                } else
251:                    UnComponent.pcmf_setDispatcher(new UnEventDispatcher(null));
252:
253:                String log_level_s = (String) KeEnvironment.pcmf_getParameter(
254:                        pem_file, "RtSwingClient", "LOG_LEVEL");
255:                if (log_level_s == null)
256:                    log_level_s = "MESSAGE";
257:
258:                String l_logWriter = (String) KeEnvironment.pcmf_getParameter(
259:                        pem_file, "RtSwingClient", "LOG_WRITER");
260:                try {
261:                    if (l_logWriter != null)
262:                        KeLog.pcmf_setLogWriter((IKeLogWriter) Class.forName(
263:                                l_logWriter).newInstance());
264:                } catch (Exception e) {
265:                    KeLog.pcmf_log("ug2t", "error setting log writer: "
266:                            + l_logWriter, null, KeLog.ERROR);
267:                }
268:
269:                if (log_level_s.equals("FATAL"))
270:                    KeLog.pcmf_setPrio(KeLog.FATAL);
271:                else if (log_level_s.equals("ERROR"))
272:                    KeLog.pcmf_setPrio(KeLog.ERROR);
273:                else if (log_level_s.equals("MESSAGE"))
274:                    KeLog.pcmf_setPrio(KeLog.MESSAGE);
275:                else if (log_level_s.equals("DEBUG"))
276:                    KeLog.pcmf_setPrio(KeLog.DEBUG);
277:                else if (log_level_s.equals("STATISTICS"))
278:                    KeLog.pcmf_setPrio(KeLog.STATISTICS);
279:                else if (log_level_s.equals("TRACE"))
280:                    KeLog.pcmf_setPrio(KeLog.TRACE);
281:                else if (log_level_s.equals("APPL"))
282:                    KeLog.pcmf_setPrio(KeLog.APPL);
283:                else if (log_level_s.equals("SILENT"))
284:                    KeLog.pcmf_setPrio(KeLog.SILENT);
285:
286:                // @@
287:
288:                int l_port = Integer.parseInt((String) KeEnvironment
289:                        .pcmf_getParameter(pem_file, "RtSwingServer", "PORT"));
290:
291:                String l_comp_str = (String) KeEnvironment.pcmf_getParameter(
292:                        pem_file, "RtSwingClient", "COMPRESS");
293:                String l_ssl_str = (String) KeEnvironment.pcmf_getParameter(
294:                        pem_file, "RtSwingClient", "SSL");
295:                String l_coll_str = (String) KeEnvironment.pcmf_getParameter(
296:                        pem_file, "RtSwingServer", "COLLECT_REPLIES");
297:                String l_rec_str = (String) KeEnvironment.pcmf_getParameter(
298:                        pem_file, "RtSwingServer", "RECORD");
299:                String l_recClass_str = (String) KeEnvironment
300:                        .pcmf_getParameter(pem_file, "RtSwingServer",
301:                                "RECORDER_CLASS");
302:
303:                boolean l_comp = l_comp_str != null
304:                        && l_comp_str.toUpperCase().equals("TRUE") ? true
305:                        : false;
306:                boolean l_ssl = l_ssl_str != null
307:                        && l_ssl_str.toUpperCase().equals("TRUE") ? true
308:                        : false;
309:                boolean l_coll = l_coll_str != null
310:                        && l_coll_str.toUpperCase().equals("FALSE") ? false
311:                        : true;
312:                boolean l_rec = l_rec_str != null
313:                        && l_rec_str.toUpperCase().equals("TRUE") ? true
314:                        : false;
315:
316:                new de.ug2t.channel.ho.service.HoServerService(l_port, l_ssl,
317:                        l_comp, l_coll, l_recClass_str, l_rec);
318:
319:                String l_cr = (String) KeEnvironment.pcmf_getParameter(
320:                        pem_file, "RtSwingServer", "CREATE");
321:                if (l_cr == null || l_cr.equals("false"))
322:                    new RtSwingStandalone();
323:
324:                start();
325:
326:                return;
327:            };
328:
329:            public Object pcmf_getStaticInitObj() {
330:                return (this.pem_staticInitObj);
331:            }
332:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.